forked from Mirrors/openclonk
Qt Editor: Always duplicate contents with objects
Even if they are not selected, this is probably what the user expects.qteditor
parent
302fa5e362
commit
b6526d2f65
|
@ -665,10 +665,14 @@ void C4EditCursor::PerformDuplication(int32_t *object_numbers, int32_t object_co
|
|||
// Get serialized objects
|
||||
C4RefCntPointer<C4ValueArray> object_numbers_c4v = new C4ValueArray();
|
||||
object_numbers_c4v->SetSize(object_count);
|
||||
int32_t total_object_count = 0;
|
||||
for (int32_t i = 0; i < object_count; ++i)
|
||||
{
|
||||
object_numbers_c4v->SetItem(i, C4VObj(::Objects.SafeObjectPointer(object_numbers[i])));
|
||||
C4Object *obj = ::Objects.SafeObjectPointer(object_numbers[i]);
|
||||
if (!obj) continue;
|
||||
total_object_count = obj->AddObjectAndContentsToArray(object_numbers_c4v, total_object_count);
|
||||
}
|
||||
object_numbers_c4v->SetSize(total_object_count);
|
||||
int32_t objects_file_handle = ::ScriptEngine.CreateUserFile();
|
||||
C4AulParSet pars(C4VInt(objects_file_handle), C4VArray(object_numbers_c4v.Get()));
|
||||
C4Value result_c4v(::ScriptEngine.GetPropList()->Call(PSF_SaveScenarioObjects, &pars));
|
||||
|
|
|
@ -4461,6 +4461,17 @@ bool C4Object::GetDragImage(C4Object **drag_object, C4Def **drag_def) const
|
|||
return true;
|
||||
}
|
||||
|
||||
int32_t C4Object::AddObjectAndContentsToArray(C4ValueArray *target_array, int32_t index)
|
||||
{
|
||||
// add self, contents and child contents count recursively to value array. Return index after last added item.
|
||||
target_array->SetItem(index++, C4VObj(this));
|
||||
for (C4Object *cobj : Contents)
|
||||
{
|
||||
index = cobj->AddObjectAndContentsToArray(target_array, index);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
bool C4Object::DoSelect()
|
||||
{
|
||||
// selection allowed?
|
||||
|
|
|
@ -344,6 +344,7 @@ public:
|
|||
void UpdateInLiquid(); // makes splash when a liquid is entered
|
||||
void GrabContents(C4Object *pFrom); // grab all contents that don't reject it
|
||||
bool GetDragImage(C4Object **drag_object, C4Def **drag_id) const; // return true if object is draggable; assign drag_object/drag_id to gfx to be used for dragging
|
||||
int32_t AddObjectAndContentsToArray(C4ValueArray *target_array, int32_t index=0); // add self, contents and child contents count recursively to value array. Return index after last added item.
|
||||
|
||||
protected:
|
||||
void SideBounds(C4Real &ctcox); // apply bounds at side; regarding bourder bound and pLayer
|
||||
|
|
Loading…
Reference in New Issue