diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-20 18:43:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-20 19:12:48 +0300 |
commit | e1dff01e2945918a59e52fee38402292b7fa58cf (patch) | |
tree | 9e36242924bee0d3cd347259dccabb2f2a5b8c40 /source/blender/editors/space_outliner | |
parent | 0d0d8935a53974c2c4603f97e41189daf4e4d47b (diff) |
Depsgraph: add some missing depsgraph tags when relations change.
Diffstat (limited to 'source/blender/editors/space_outliner')
3 files changed, 20 insertions, 14 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index a700f8e20e0..b97cc13d713 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -164,8 +164,10 @@ static int collection_new_exec(bContext *C, wmOperator *op) data.collection, NULL); - outliner_cleanup_tree(soops); + DEG_id_tag_update(&data.collection->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); + + outliner_cleanup_tree(soops); WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); return OPERATOR_FINISHED; } @@ -236,18 +238,19 @@ static int collection_delete_exec(bContext *C, wmOperator *op) /* Effectively delete the collections. */ GSetIterator collections_to_edit_iter; GSET_ITER(collections_to_edit_iter, data.collections_to_edit) { - /* TODO: what if collection was child and got deleted in the meantime? */ Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter); - BKE_collection_delete(bmain, collection, hierarchy); + + /* Test in case collection got deleted as part of another one. */ + if (BLI_findindex(&bmain->collection, collection) != -1) { + BKE_collection_delete(bmain, collection, hierarchy); + } } BLI_gset_free(data.collections_to_edit, NULL); + DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); return OPERATOR_FINISHED; @@ -462,11 +465,9 @@ static int collection_link_exec(bContext *C, wmOperator *UNUSED(op)) BLI_gset_free(data.collections_to_edit, NULL); + DEG_id_tag_update(&active_collection->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); return OPERATOR_FINISHED; @@ -527,9 +528,6 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op)) DEG_relations_tag_update(bmain); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); - WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index a455f8c076a..a0d0529086f 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -2366,6 +2366,7 @@ static int collection_drop_invoke(bContext *C, wmOperator *op, const wmEvent *ev Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, childname); BKE_collection_object_add(bmain, collection, ob); + DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 32918806765..eec0f083543 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -229,18 +229,22 @@ static void unlink_collection_cb( if (GS(tsep->id->name) == ID_OB) { Object *ob = (Object *)tsep->id; ob->dup_group = NULL; + DEG_id_tag_update(&ob->id, OB_RECALC_OB); DEG_relations_tag_update(bmain); } else if (GS(tsep->id->name) == ID_GR) { Collection *parent = (Collection *)tsep->id; id_fake_user_set(&collection->id); BKE_collection_child_remove(bmain, parent, collection); + DEG_id_tag_update(&parent->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); } else if (GS(tsep->id->name) == ID_SCE) { - Collection *parent = BKE_collection_master((Scene *)tsep->id); + Scene *scene = (Scene *)tsep->id; + Collection *parent = BKE_collection_master(scene); id_fake_user_set(&collection->id); BKE_collection_child_remove(bmain, parent, collection); + DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); } } @@ -257,11 +261,14 @@ static void unlink_object_cb( if (GS(tsep->id->name) == ID_GR) { Collection *parent = (Collection *)tsep->id; BKE_collection_object_remove(bmain, parent, ob, true); + DEG_id_tag_update(&parent->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); } else if (GS(tsep->id->name) == ID_SCE) { - Collection *parent = BKE_collection_master((Scene *)tsep->id); + Scene *scene = (Scene *)tsep->id; + Collection *parent = BKE_collection_master(scene); BKE_collection_object_remove(bmain, parent, ob, true); + DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); DEG_relations_tag_update(bmain); } } |