[Bf-blender-cvs] [17f5d7f3c53] blender2.8: Depsgraph: Add missing relationship between object transform and point cache reset

Mai Lavelle noreply at git.blender.org
Wed Feb 7 07:18:24 CET 2018


Commit: 17f5d7f3c53da2cd90470efe13c54dc708297f4b
Author: Mai Lavelle
Date:   Tue Feb 6 05:17:19 2018 -0500
Branches: blender2.8
https://developer.blender.org/rB17f5d7f3c53da2cd90470efe13c54dc708297f4b

Depsgraph: Add missing relationship between object transform and point cache reset

This fixes an issue where old cache data was used after an object has been moved.
Particles were coming from very wrong positions. Reproduction case is to move an
object while animation is running and then let the animation loop back and
play again.

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

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

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

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 7de3c169737..db1e8aeb9bd 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -90,6 +90,7 @@ extern "C" {
 #include "BKE_node.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
+#include "BKE_pointcache.h"
 #include "BKE_rigidbody.h"
 #include "BKE_sound.h"
 #include "BKE_tracking.h"
@@ -905,6 +906,13 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
 	}
 
 	/* TODO(sergey): Do we need a point cache operations here? */
+	add_operation_node(&object->id,
+	                   DEG_NODE_TYPE_CACHE,
+	                   function_bind(BKE_ptcache_object_reset,
+	                                 scene_cow,
+	                                 ob_cow,
+	                                 PTCACHE_RESET_DEPSGRAPH),
+	                   DEG_OPCODE_POINT_CACHE_RESET);
 }
 
 void DepsgraphNodeBuilder::build_particle_settings(ParticleSettings *part) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 9733fbcb123..31c85a40f0e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1532,7 +1532,11 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
 	ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
 	add_relation(transform_key, obdata_ubereval_key, "Partcile Eval");
 
-	/* TODO(sergey): Do we need a point cache operations here? */
+	OperationKey point_cache_reset_key(&object->id,
+	                                   DEG_NODE_TYPE_CACHE,
+	                                   DEG_OPCODE_POINT_CACHE_RESET);
+	add_relation(transform_key, point_cache_reset_key, "Object Transform -> Point Cache Reset");
+	add_relation(point_cache_reset_key, obdata_ubereval_key, "Point Cache Reset -> UberEval");
 }
 
 void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 22df3161428..886601225c7 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -119,6 +119,8 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
 		STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL);
 		STRINGIFY_OPCODE(PARTICLE_SETTINGS_EVAL);
 		STRINGIFY_OPCODE(PARTICLE_SETTINGS_RECALC_CLEAR);
+		/* Point Cache. */
+		STRINGIFY_OPCODE(POINT_CACHE_RESET);
 		/* Batch cache. */
 		STRINGIFY_OPCODE(GEOMETRY_SELECT_UPDATE);
 		/* Masks. */
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index d091f42bf80..3f4df21b8d6 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -240,6 +240,9 @@ typedef enum eDepsOperation_Code {
 	DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
 	DEG_OPCODE_PARTICLE_SETTINGS_RECALC_CLEAR,
 
+	/* Point Cache. ------------------------------------- */
+	DEG_OPCODE_POINT_CACHE_RESET,
+
 	/* Collections. ------------------------------------- */
 	DEG_OPCODE_VIEW_LAYER_INIT,
 	DEG_OPCODE_VIEW_LAYER_EVAL,



More information about the Bf-blender-cvs mailing list