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
This commit is contained in:
Mai Lavelle 2018-02-06 05:17:19 -05:00
parent 5b01e428a9
commit 17f5d7f3c5
4 changed files with 18 additions and 1 deletions

View File

@ -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) {

View File

@ -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)

View File

@ -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. */

View File

@ -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,