Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-02-22 11:56:15 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-02-22 11:56:15 +0400
commite5d4e0f69bab7ff7fd7df23a1790bba9c8adcf8d (patch)
tree6fdbfa516a784081091523b784c51d32e9ac631e /source/blender/editors/space_outliner
parent9ca3084d4dc8efabc72e1970725c396b59f78cdf (diff)
Fix #30231: Drag and Droping Parenting from Outliner giving unnecessary Loop Error
In fact, error was much deeper and DND parenting in outliner used to parent all selected objects to drop target, not just currently dragging object. This was caused by code sharing between Parent Set operator and this DND operator which was iterating all selected objects in scene and was setting parent to it. Solved issue by separating actual parenting code which makes specified object be parented to specified parent and moved iterating to Parent Set exec callback. Now both of discovered issues (unneeded loop error and parenting all selected objects) are solved, but more extensive testing of this changes are welcome.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 80bd8291757..32c5683607d 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1433,15 +1433,24 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
static int parent_drop_exec(bContext *C, wmOperator *op)
{
- Object *par = NULL;
+ Object *par = NULL, *ob = NULL;
+ Main *bmain= CTX_data_main(C);
+ Scene *scene= CTX_data_scene(C);
int partype = -1;
- char parname[32];
+ char parname[MAX_ID_NAME], childname[MAX_ID_NAME];
partype= RNA_enum_get(op->ptr, "type");
RNA_string_get(op->ptr, "parent", parname);
par= (Object *)find_id("OB", parname);
+ RNA_string_get(op->ptr, "child", childname);
+ ob= (Object *)find_id("OB", childname);
+
+ ED_object_parent_set(op->reports, bmain, scene, ob, par, partype);
- ED_object_parent_set(C, op, par, partype);
+ DAG_scene_sort(bmain, scene);
+ DAG_ids_flush_update(bmain, 0);
+ WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
return OPERATOR_FINISHED;
}
@@ -1482,6 +1491,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
Object *ob= NULL;
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
+ Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
TreeElement *te= NULL;
TreeElement *te_found= NULL;
@@ -1519,7 +1529,12 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
ED_base_object_select(object_in_scene(ob, scene), BA_SELECT);
if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) {
- ED_object_parent_set(C, op, par, partype);
+ if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
+ DAG_scene_sort(bmain, scene);
+ DAG_ids_flush_update(bmain, 0);
+ WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+ }
}
else {
/* Menu creation */