Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMai Lavelle <mai.lavelle@gmail.com>2018-02-06 13:17:19 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2018-02-07 09:18:04 +0300
commit17f5d7f3c53da2cd90470efe13c54dc708297f4b (patch)
treeae3d3bb74df9804537841197079ad40072a63698
parent5b01e428a9443254b30cff015c42cee10d1ab142 (diff)
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
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc8
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc6
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h3
4 files changed, 18 insertions, 1 deletions
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,