[Bf-blender-cvs] [b18122451f8] master: Fix T88433: no greaspencil depsgraph evaluation with certain drivers

Philipp Oeser noreply at git.blender.org
Tue Aug 31 15:26:22 CEST 2021


Commit: b18122451f8185ade9fc1e9aff5cc2f03d4fa040
Author: Philipp Oeser
Date:   Thu Aug 26 15:45:00 2021 +0200
Branches: master
https://developer.blender.org/rBb18122451f8185ade9fc1e9aff5cc2f03d4fa040

Fix T88433: no greaspencil depsgraph evaluation with certain drivers

When the same stroke was used as a driver variable, this could make this
stroke already tagged as built in the course of building driver
variables (via `build_gpencil`), but then important stuff from
`build_object_data_geometry_datablock` could be missed later on (because
both of these funtions use `checkIsBuiltAndTag`). Most importantly,
setting up operations such as GEOMETRY_EVAL would be skipped entirely.

`build_object_data_geometry_datablock` seems to cover greasepencil just
fine (does the same as `build_gpencil` and more). Proposed solution is to
remove `build_gpencil` entirely. In `build_id` it would then also call
`build_object_data_geometry_datablock` for `ID_GD` IDs. Now the covered
types that _call_ `build_object_data_geometry_datablock` match exactly
to what is covered _inside_ `build_object_data_geometry_datablock`.

Think this "duplication" of functionality was just overseen in
rB66da2f537ae8 [`build_gpencil` existed long before and said commit made
greasepencil a real object with geometry and such].

thx @JacquesLucke for additional input!

Maniphest Tasks: T88433

Differential Revision: https://developer.blender.org/D12324

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

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.h

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index a739a0fe337..36c6b56caae 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -571,9 +571,10 @@ void DepsgraphNodeBuilder::build_id(ID *id)
       build_movieclip((MovieClip *)id);
       break;
     case ID_ME:
-    case ID_CU:
     case ID_MB:
+    case ID_CU:
     case ID_LT:
+    case ID_GD:
     case ID_HA:
     case ID_PT:
     case ID_VO:
@@ -604,9 +605,6 @@ void DepsgraphNodeBuilder::build_id(ID *id)
     case ID_PA:
       build_particle_settings((ParticleSettings *)id);
       break;
-    case ID_GD:
-      build_gpencil((bGPdata *)id);
-      break;
 
     case ID_LI:
     case ID_IP:
@@ -1852,22 +1850,6 @@ void DepsgraphNodeBuilder::build_image(Image *image)
       &image->id, NodeType::GENERIC_DATABLOCK, OperationCode::GENERIC_DATABLOCK_UPDATE);
 }
 
-void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd)
-{
-  if (built_map_.checkIsBuiltAndTag(gpd)) {
-    return;
-  }
-  ID *gpd_id = &gpd->id;
-
-  /* TODO(sergey): what about multiple users of same datablock? This should
-   * only get added once. */
-
-  /* The main reason Grease Pencil is included here is because the animation
-   * (and drivers) need to be hosted somewhere. */
-  build_animdata(gpd_id);
-  build_parameters(gpd_id);
-}
-
 void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file)
 {
   if (built_map_.checkIsBuiltAndTag(cache_file)) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 3b2dd44af0d..2378f3fc100 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -225,7 +225,6 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
   virtual void build_texture(Tex *tex);
   virtual void build_image(Image *image);
   virtual void build_world(World *world);
-  virtual void build_gpencil(bGPdata *gpd);
   virtual void build_cachefile(CacheFile *cache_file);
   virtual void build_mask(Mask *mask);
   virtual void build_movieclip(MovieClip *clip);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index ab3081cb1ae..ef1db8be933 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -544,12 +544,13 @@ void DepsgraphRelationBuilder::build_id(ID *id)
       build_movieclip((MovieClip *)id);
       break;
     case ID_ME:
-    case ID_CU:
     case ID_MB:
+    case ID_CU:
     case ID_LT:
     case ID_HA:
     case ID_PT:
     case ID_VO:
+    case ID_GD:
       build_object_data_geometry_datablock(id);
       break;
     case ID_SPK:
@@ -573,9 +574,6 @@ void DepsgraphRelationBuilder::build_id(ID *id)
     case ID_PA:
       build_particle_settings((ParticleSettings *)id);
       break;
-    case ID_GD:
-      build_gpencil((bGPdata *)id);
-      break;
 
     case ID_LI:
     case ID_IP:
@@ -2609,18 +2607,6 @@ void DepsgraphRelationBuilder::build_image(Image *image)
   build_parameters(&image->id);
 }
 
-void DepsgraphRelationBuilder::build_gpencil(bGPdata *gpd)
-{
-  if (built_map_.checkIsBuiltAndTag(gpd)) {
-    return;
-  }
-  /* animation */
-  build_animdata(&gpd->id);
-  build_parameters(&gpd->id);
-
-  // TODO: parent object (when that feature is implemented)
-}
-
 void DepsgraphRelationBuilder::build_cachefile(CacheFile *cache_file)
 {
   if (built_map_.checkIsBuiltAndTag(cache_file)) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 21d1d4b6268..1ad61c25305 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -286,7 +286,6 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
   virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle);
   virtual void build_texture(Tex *tex);
   virtual void build_image(Image *image);
-  virtual void build_gpencil(bGPdata *gpd);
   virtual void build_cachefile(CacheFile *cache_file);
   virtual void build_mask(Mask *mask);
   virtual void build_movieclip(MovieClip *clip);



More information about the Bf-blender-cvs mailing list