diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-04 02:34:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-04 02:36:15 +0400 |
commit | a1ba57a008286e0ff213016be5173d30178107fa (patch) | |
tree | 3c8295cb2371d45d44682dd18d623ea3c8ebc849 | |
parent | ea6671a6309b6d9363758a945f681c1adb2a4c6b (diff) |
Fix T40010: Single user looses parent relationship (temporarily)
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 21 |
2 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 10b25420ab7..72669d65f71 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -307,6 +307,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) Scene *scene = CTX_data_scene(C); ED_object_single_user(bmain, scene, (struct Object *)id); WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); + DAG_relations_tag_update(bmain); } else { if (id) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index c06592c4c9d..f7da53f3e79 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2284,24 +2284,32 @@ static int make_single_user_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); /* ok if this is NULL */ int flag = RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */ bool copy_groups = false; + bool update_deps = false; BKE_main_id_clear_newpoins(bmain); - if (RNA_boolean_get(op->ptr, "object")) + if (RNA_boolean_get(op->ptr, "object")) { single_object_users(bmain, scene, v3d, flag, copy_groups); - if (RNA_boolean_get(op->ptr, "obdata")) + /* needed since object relationships may have changed */ + update_deps = true; + } + + if (RNA_boolean_get(op->ptr, "obdata")) { single_obdata_users(bmain, scene, flag); + } - if (RNA_boolean_get(op->ptr, "material")) + if (RNA_boolean_get(op->ptr, "material")) { single_mat_users(scene, flag, RNA_boolean_get(op->ptr, "texture")); + } #if 0 /* can't do this separate from materials */ if (RNA_boolean_get(op->ptr, "texture")) single_mat_users(scene, flag, true); #endif - if (RNA_boolean_get(op->ptr, "animation")) + if (RNA_boolean_get(op->ptr, "animation")) { single_object_action_users(scene, flag); + } /* TODO(sergey): This should not be needed, however some tool still could rely * on the fact, that id->newid is kept NULL by default. @@ -2311,6 +2319,11 @@ static int make_single_user_exec(bContext *C, wmOperator *op) BKE_main_id_clear_newpoins(bmain); WM_event_add_notifier(C, NC_WINDOW, NULL); + + if (update_deps) { + DAG_relations_tag_update(bmain); + } + return OPERATOR_FINISHED; } |