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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-20 18:43:56 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-20 19:12:48 +0300
commite1dff01e2945918a59e52fee38402292b7fa58cf (patch)
tree9e36242924bee0d3cd347259dccabb2f2a5b8c40 /source/blender/editors
parent0d0d8935a53974c2c4603f97e41189daf4e4d47b (diff)
Depsgraph: add some missing depsgraph tags when relations change.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_add.c5
-rw-r--r--source/blender/editors/object/object_edit.c13
-rw-r--r--source/blender/editors/object/object_group.c5
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c6
-rw-r--r--source/blender/editors/physics/rigidbody_object.c1
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c22
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c1
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c11
9 files changed, 37 insertions, 29 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index dd358b95722..21ace255a4c 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1097,8 +1097,6 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
/* works without this except if you try render right after, see: 22027 */
DEG_relations_tag_update(bmain);
- DEG_id_tag_update(&collection->id, 0);
-
DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
@@ -2002,9 +2000,6 @@ static int convert_exec(bContext *C, wmOperator *op)
}
FOREACH_SCENE_OBJECT_END;
}
-
- /* delete object should renew depsgraph */
- DEG_relations_tag_update(bmain);
}
// XXX ED_object_editmode_enter(C, 0);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index ebbc0689e76..3139eb911e9 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -885,7 +885,6 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
Base *base;
Curve *cu, *cu1;
Nurb *nu;
- bool do_depgraph_update = false;
if (ID_IS_LINKED(scene)) return;
@@ -1042,8 +1041,8 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
else if (event == 22) {
/* Copy the constraint channels over */
BKE_constraints_copy(&base->object->constraints, &ob->constraints, true);
-
- do_depgraph_update = true;
+ DEG_id_tag_update(&base->object->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
}
else if (event == 23) {
base->object->softflag = ob->softflag;
@@ -1054,6 +1053,9 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
}
+
+ DEG_id_tag_update(&base->object->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
}
else if (event == 26) {
#if 0 // XXX old animation system
@@ -1094,9 +1096,6 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
}
}
}
-
- if (do_depgraph_update)
- DEG_relations_tag_update(bmain);
}
static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, Object *obedit)
@@ -1859,7 +1858,7 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
is_link ? "linked" : "moved",
collection->id.name + 2);
- DEG_relations_tag_update(CTX_data_main(C));
+ DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 8a52b6c5ef5..cd237f2e784 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -47,6 +47,7 @@
#include "BKE_report.h"
#include "BKE_object.h"
+#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "ED_screen.h"
@@ -153,6 +154,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
if (!BKE_collection_object_cyclic_check(bmain, base->object, collection)) {
BKE_collection_object_add(bmain, collection, base->object);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
updated = true;
}
else {
@@ -223,6 +225,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
BKE_collection_object_remove(bmain, collection, base->object, false);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
ok = 1;
}
CTX_DATA_END;
@@ -315,6 +318,7 @@ static int collection_objects_remove_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
BKE_collection_object_remove(bmain, collection, base->object, false);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
updated = true;
}
CTX_DATA_END;
@@ -366,6 +370,7 @@ static int collection_create_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_bases)
{
BKE_collection_object_add(bmain, collection, base->object);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 425a0acff17..d81958a0815 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -324,8 +324,6 @@ static bool object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}
- DEG_relations_tag_update(bmain);
-
BLI_remlink(&ob->modifiers, md);
modifier_free(md);
BKE_object_free_derived_caches(ob);
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index f62b72679d0..1b6325e31bf 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -94,6 +94,8 @@ bool ED_rigidbody_constraint_add(Main *bmain, Scene *scene, Object *ob, int type
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
+ DEG_id_tag_update(&rbw->constraints->id, DEG_TAG_COPY_ON_WRITE);
+
return true;
}
@@ -102,8 +104,10 @@ void ED_rigidbody_constraint_remove(Main *bmain, Scene *scene, Object *ob)
RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
BKE_rigidbody_remove_constraint(scene, ob);
- if (rbw)
+ if (rbw) {
BKE_collection_object_remove(bmain, rbw->constraints, ob, false);
+ DEG_id_tag_update(&rbw->constraints->id, DEG_TAG_COPY_ON_WRITE);
+ }
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index bdfbc47b22f..6ea0212199e 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -125,6 +125,7 @@ bool ED_rigidbody_object_add(Main *bmain, Scene *scene, Object *ob, int type, Re
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
+ DEG_id_tag_update(&rbw->group->id, DEG_TAG_COPY_ON_WRITE);
return true;
}
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);
}
}