[Bf-blender-cvs] [7b9595d366d] greasepencil-object: Fix: Added some more tags/relations in depsgraph to fix crashes when Onion Skinning is enabled

Joshua Leung noreply at git.blender.org
Wed Nov 8 01:24:18 CET 2017


Commit: 7b9595d366d0477431763ec0dc6f0f7d38cdcf99
Author: Joshua Leung
Date:   Wed Nov 8 13:22:25 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB7b9595d366d0477431763ec0dc6f0f7d38cdcf99

Fix: Added some more tags/relations in depsgraph to fix crashes when Onion Skinning is enabled

* id_tag_update_object_data() - Added a case for the GP datablock type
  so that depsgraph tagging via the GPencil datablock's RNA properties
  works. Previously, only the object.data case (i.e. modifiers) was handled.
  This fixes a crash when enabling onion skinning, and a ghost can be shown
  on the neighbouring frames.

* DepsgraphRelationBuilder::build_obdata_geom() - Added a relation between
  timesource and GP geometry (i.e. where cache rebuild occurs). This fixes
  a crash after scrubbing the timeline when onion skinning is enabled
  (I'm guessing due to onion skinning suddenly getting re-shown, but the cache
  not doesn't contain this info due to the previously being updated for animation)

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

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index e13b73ab566..bc02c0f69c1 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1722,6 +1722,14 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
 		
 		case OB_GPENCIL: /* Grease Pencil */
 		{
+			/* Geometry cache needs to be recalculated on frame change
+			 * (e.g. to fix crashes after scrubbing the timeline when
+			 *  onion skinning is enabled, since the ghosts need to be
+			 *  re-added to the cache once scrubbing ends)
+			 */
+			TimeSourceKey time_key;
+			ComponentKey geometry_key(obdata, DEG_NODE_TYPE_GEOMETRY);
+			add_relation(time_key, geometry_key, "GP Frame Change");
 			break;
 		}
 	}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index df618bd75bc..478f21966e0 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -184,6 +184,9 @@ void id_tag_update_object_data(Depsgraph *graph, IDDepsNode *id_node)
 		case ID_LP:
 			data_comp = id_node->find_component(DEG_NODE_TYPE_PARAMETERS);
 			break;
+		case ID_GD:
+			data_comp = id_node->find_component(DEG_NODE_TYPE_GEOMETRY);
+			break;
 		default:
 			break;
 	}



More information about the Bf-blender-cvs mailing list