[Bf-blender-cvs] [ba4e6e59b2e] master: Depsgraph: Don't tag original IDs for recalc

Sergey Sharybin noreply at git.blender.org
Thu May 23 16:56:51 CEST 2019


Commit: ba4e6e59b2e487c54d97863a8176f3c9cac51f20
Author: Sergey Sharybin
Date:   Wed May 22 11:40:25 2019 +0200
Branches: master
https://developer.blender.org/rBba4e6e59b2e487c54d97863a8176f3c9cac51f20

Depsgraph: Don't tag original IDs for recalc

Tagging original ID introduces a conflict of interest when a separate
graph is created and is tagging objects to be re-evaluated with its
context.

This is part of the problem in T63111: tags within a temporary dependency
graph affects viewport and vice versa, which makes logic to wrongly
consider that something did change in the scene and that baking is to
be redone.

This effectively reverts db3bfd0, but this time everything seems to
be updating fine in the viewport.

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

M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 88f1130b7fb..fc1c6be19af 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -249,7 +249,6 @@ void depsgraph_id_tag_copy_on_write(Depsgraph *graph, IDNode *id_node, eUpdateSo
 {
   ComponentNode *cow_comp = id_node->find_component(NodeType::COPY_ON_WRITE);
   cow_comp->tag_update(graph, update_source);
-  id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE;
 }
 
 void depsgraph_tag_component(Depsgraph *graph,
@@ -357,16 +356,16 @@ static void graph_id_tag_update_single_flag(Main *bmain,
     /* TODO(sergey): Shall we raise some panic here? */
     return;
   }
-  /* Tag ID recalc flag. */
-  DepsNodeFactory *factory = type_get_factory(component_type);
-  BLI_assert(factory != NULL);
-  id->recalc |= factory->id_recalc_tag();
   /* Some sanity checks before moving forward. */
   if (id_node == NULL) {
     /* Happens when object is tagged for update and not yet in the
      * dependency graph (but will be after relations update). */
     return;
   }
+  /* Tag ID recalc flag. */
+  DepsNodeFactory *factory = type_get_factory(component_type);
+  BLI_assert(factory != NULL);
+  id_node->id_cow->recalc |= factory->id_recalc_tag();
   /* Tag corresponding dependency graph operation for update. */
   if (component_type == NodeType::ID_REF) {
     id_node->tag_update(graph, update_source);
@@ -440,7 +439,7 @@ void deg_graph_node_tag_zero(Main *bmain,
   }
   ID *id = id_node->id_orig;
   /* TODO(sergey): Which recalc flags to set here? */
-  id->recalc |= ID_RECALC_ALL & ~(ID_RECALC_PSYS_ALL | ID_RECALC_ANIMATION);
+  id_node->id_cow->recalc |= ID_RECALC_ALL & ~(ID_RECALC_PSYS_ALL | ID_RECALC_ANIMATION);
   GHASH_FOREACH_BEGIN (ComponentNode *, comp_node, id_node->components) {
     if (comp_node->type == NodeType::ANIMATION) {
       continue;
@@ -579,7 +578,6 @@ void graph_id_tag_update(
   if (flag == 0) {
     deg_graph_node_tag_zero(bmain, graph, id_node, update_source);
   }
-  id->recalc |= flag;
   int current_flag = flag;
   while (current_flag != 0) {
     IDRecalcFlag tag = (IDRecalcFlag)(1 << bitscan_forward_clear_i(&current_flag));
@@ -744,17 +742,12 @@ static void deg_graph_clear_id_node_func(void *__restrict data_v,
   DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(data_v);
   DEG::IDNode *id_node = deg_graph->id_nodes[i];
   id_node->id_cow->recalc &= ~ID_RECALC_ALL;
-  id_node->id_orig->recalc &= ~ID_RECALC_ALL;
 
   /* Clear embedded node trees too. */
   bNodeTree *ntree_cow = ntreeFromID(id_node->id_cow);
   if (ntree_cow) {
     ntree_cow->id.recalc &= ~ID_RECALC_ALL;
   }
-  bNodeTree *ntree_orig = ntreeFromID(id_node->id_orig);
-  if (ntree_orig) {
-    ntree_orig->id.recalc &= ~ID_RECALC_ALL;
-  }
 }
 
 void DEG_ids_clear_recalc(Main *UNUSED(bmain), Depsgraph *depsgraph)
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index d714a913b96..4b0d6d43f4f 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -855,7 +855,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
   /* Correct or tweak some pointers which are not taken care by foreach
    * from above. */
   update_id_after_copy(depsgraph, id_node, id_orig, id_cow);
-  id_cow->recalc = id_orig->recalc | id_cow_recalc;
+  id_cow->recalc = id_cow_recalc;
   return id_cow;
 }
 
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 0bd5b3b4f82..6d8dcf2778f 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -234,10 +234,6 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd
     /* TODO(sergey): Do we need to pass original or evaluated ID here? */
     ID *id_orig = id_node->id_orig;
     ID *id_cow = id_node->id_cow;
-    /* Copy tag from original data to CoW storage.
-     * This is because DEG_id_tag_update() sets tags on original
-     * data. */
-    id_cow->recalc |= (id_orig->recalc & ID_RECALC_ALL);
     /* Gather recalc flags from all changed components. */
     GHASH_FOREACH_BEGIN (ComponentNode *, comp_node, id_node->components) {
       if (comp_node->custom_flags != COMPONENT_STATE_DONE) {



More information about the Bf-blender-cvs mailing list