Commit: e1dff01e2945918a59e52fee38402292b7fa58cf
Author: Brecht Van Lommel
Date:   Wed Jun 20 17:43:56 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe1dff01e2945918a59e52fee38402292b7fa58cf

Depsgraph: add some missing depsgraph tags when relations change.

===================================================================

M       source/blender/alembic/intern/alembic_capi.cc
M       source/blender/blenkernel/intern/material.c
M       source/blender/blenkernel/intern/object.c
M       source/blender/collada/DocumentImporter.cpp
M       source/blender/collada/SkinInfo.cpp
M       source/blender/collada/collada_utils.cpp
M       source/blender/editors/object/object_add.c
M       source/blender/editors/object/object_edit.c
M       source/blender/editors/object/object_group.c
M       source/blender/editors/object/object_modifier.c
M       source/blender/editors/physics/rigidbody_constraint.c
M       source/blender/editors/physics/rigidbody_object.c
M       source/blender/editors/space_outliner/outliner_collections.c
M       source/blender/editors/space_outliner/outliner_edit.c
M       source/blender/editors/space_outliner/outliner_tools.c
M       source/blender/makesrna/intern/rna_group.c
M       source/blender/makesrna/intern/rna_layer.c
M       source/blender/makesrna/intern/rna_material.c
M       source/blender/makesrna/intern/rna_object.c

===================================================================

diff --git a/source/blender/alembic/intern/alembic_capi.cc 
b/source/blender/alembic/intern/alembic_capi.cc
index cc9923189c7..79dfb8c2b58 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -852,6 +852,7 @@ static void import_endjob(void *user_data)
                        base = BKE_view_layer_base_find(view_layer, ob);
                        BKE_view_layer_base_select(view_layer, base);
 
+                       DEG_id_tag_update(&lc->collection->id, 
DEG_TAG_COPY_ON_WRITE);
                        DEG_id_tag_update_ex(data->bmain, &ob->id,
                                             OB_RECALC_OB | OB_RECALC_DATA | 
OB_RECALC_TIME | DEG_TAG_BASE_FLAGS_UPDATE);
                }
diff --git a/source/blender/blenkernel/intern/material.c 
b/source/blender/blenkernel/intern/material.c
index 21b2ab6b454..0d41385a39c 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -359,6 +359,7 @@ void BKE_material_resize_id(Main *bmain, ID *id, short 
totcol, bool do_id_user)
        }
        *totcolp = totcol;
 
+       DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
        DEG_relations_tag_update(bmain);
 }
 
@@ -376,6 +377,8 @@ void BKE_material_append_id(Main *bmain, ID *id, Material 
*ma)
 
                id_us_plus((ID *)ma);
                test_all_objects_materials(bmain, id);
+
+               DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
                DEG_relations_tag_update(bmain);
        }
 }
@@ -410,6 +413,7 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int 
index_i, bool update_data
                                material_data_index_remove_id(id, index);
                        }
 
+                       DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
                        DEG_relations_tag_update(bmain);
                }
        }
@@ -437,6 +441,7 @@ void BKE_material_clear_id(Main *bmain, ID *id, bool 
update_data)
                        material_data_index_clear_id(id);
                }
 
+               DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
                DEG_relations_tag_update(bmain);
        }
 }
@@ -532,6 +537,7 @@ void BKE_material_resize_object(Main *bmain, Object *ob, 
const short totcol, boo
        if (ob->totcol && ob->actcol == 0) ob->actcol = 1;
        if (ob->actcol > ob->totcol) ob->actcol = ob->totcol;
 
+       DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
        DEG_relations_tag_update(bmain);
 }
 
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 5ca9b9d2203..c80c679ab73 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3528,6 +3528,7 @@ void BKE_object_groups_clear(Main *bmain, Object *ob)
        Collection *collection = NULL;
        while ((collection = BKE_collection_object_find(bmain, collection, 
ob))) {
                BKE_collection_object_remove(bmain, collection, ob, false);
+               DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
        }
 }
 
diff --git a/source/blender/collada/DocumentImporter.cpp 
b/source/blender/collada/DocumentImporter.cpp
index c6ba3b8f4ac..a382b7cca9c 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -232,11 +232,6 @@ void DocumentImporter::finish()
                        objects_to_scale->insert(objects_to_scale->end(), 
objects_done->begin(), objects_done->end());
                        delete objects_done;
                }
-
-               // update scene
-               DEG_relations_tag_update(bmain);
-               WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
-
        }
 
 
@@ -245,7 +240,6 @@ void DocumentImporter::finish()
        armature_importer.set_tags_map(this->uid_tags_map);
        armature_importer.make_armatures(mContext, *objects_to_scale);
        armature_importer.make_shape_keys(mContext);
-       DEG_relations_tag_update(bmain);
 
 #if 0
        armature_importer.fix_animation();
@@ -269,13 +263,16 @@ void DocumentImporter::finish()
                        BKE_scene_collections_object_remove(bmain, sce, ob, 
true);
                }
                libnode_ob.clear();
-
-               DEG_relations_tag_update(bmain);
        }
 
        bc_match_scale(objects_to_scale, unit_converter, 
!this->import_settings->import_units);
 
        delete objects_to_scale;
+
+       // update scene
+       DEG_id_tag_update(&sce->id, DEG_TAG_COPY_ON_WRITE);
+       DEG_relations_tag_update(bmain);
+       WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
 }
 
 
diff --git a/source/blender/collada/SkinInfo.cpp 
b/source/blender/collada/SkinInfo.cpp
index b07c6518050..8046efd2335 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -242,9 +242,6 @@ void SkinInfo::link_armature(bContext *C, Object *ob, 
std::map<COLLADAFW::Unique
        invert_m4_m4(ob->parentinv, workob.obmat);
 
        DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA);
-
-       DEG_relations_tag_update(bmain);
-       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 #endif
        copy_m4_m4(ob->obmat, bind_shape_matrix);
        BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
diff --git a/source/blender/collada/collada_utils.cpp 
b/source/blender/collada/collada_utils.cpp
index 4ded9bd2d86..22ddeb4edb7 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -128,12 +128,6 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, 
bool is_parent_space)
        DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
        DEG_id_tag_update(&par->id, OB_RECALC_OB);
 
-       /** done once after import */
-#if 0
-       DEG_relations_tag_update(bmain);
-       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-#endif
-
        return true;
 }
 
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_PARTICL

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to