Fix T52134: New depsgraph crashes when evaluating several psys on from object

This commit is contained in:
Sergey Sharybin
2017-07-21 11:12:34 +02:00
parent 2200e5a280
commit 4d67034076
6 changed files with 25 additions and 18 deletions
+3 -4
View File
@@ -473,9 +473,8 @@ typedef struct ParticleRenderData {
struct EvaluationContext;
void BKE_particle_system_eval(struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct ParticleSystem *psys);
void BKE_particle_system_eval_init(struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob);
#endif
@@ -4350,13 +4350,12 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func,
/* **** Depsgraph evaluation **** */
void BKE_particle_system_eval(EvaluationContext *UNUSED(eval_ctx),
Scene *scene,
Object *ob,
ParticleSystem *psys)
void BKE_particle_system_eval_init(EvaluationContext *UNUSED(eval_ctx),
Scene *scene,
Object *ob)
{
if (G.debug & G_DEBUG_DEPSGRAPH) {
printf("%s on %s:%s\n", __func__, ob->id.name, psys->name);
printf("%s on %s\n", __func__, ob->id.name);
}
BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
}
@@ -671,6 +671,13 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob)
ComponentDepsNode *psys_comp =
add_component_node(&ob->id, DEG_NODE_TYPE_EVAL_PARTICLES);
add_operation_node(psys_comp,
function_bind(BKE_particle_system_eval_init,
_1,
scene,
ob),
DEG_OPCODE_PSYS_EVAL_INIT);
/* particle systems */
LINKLIST_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
ParticleSettings *part = psys->part;
@@ -682,11 +689,7 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob)
/* this particle system */
// TODO: for now, this will just be a placeholder "ubereval" node
add_operation_node(psys_comp,
function_bind(BKE_particle_system_eval,
_1,
scene,
ob,
psys),
NULL,
DEG_OPCODE_PSYS_EVAL,
psys->name);
}
@@ -1239,6 +1239,13 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob)
OperationKey obdata_ubereval_key(&ob->id,
DEG_NODE_TYPE_GEOMETRY,
DEG_OPCODE_GEOMETRY_UBEREVAL);
OperationKey eval_init_key(&ob->id,
DEG_NODE_TYPE_EVAL_PARTICLES,
DEG_OPCODE_PSYS_EVAL_INIT);
/* TODO(sergey): Are all particle systems depends on time?
* Hair without dynamics i.e.
*/
add_relation(time_src_key, eval_init_key, "TimeSrc -> PSys");
/* particle systems */
LINKLIST_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
@@ -1254,10 +1261,7 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob)
if (!psys_check_enabled(ob, psys, G.is_rendering))
continue;
/* TODO(sergey): Are all particle systems depends on time?
* Hair without dynamics i.e.
*/
add_relation(time_src_key, psys_key, "TimeSrc -> PSys");
add_relation(eval_init_key, psys_key, "Init -> PSys");
/* TODO(sergey): Currently particle update is just a placeholder,
* hook it to the ubereval node so particle system is getting updated
@@ -119,6 +119,7 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
STRINGIFY_OPCODE(BONE_READY);
STRINGIFY_OPCODE(BONE_DONE);
STRINGIFY_OPCODE(PSYS_EVAL);
STRINGIFY_OPCODE(PSYS_EVAL_INIT);
case DEG_NUM_OPCODES: return "SpecialCase";
#undef STRINGIFY_OPCODE
@@ -219,6 +219,7 @@ typedef enum eDepsOperation_Code {
/* Particles --------------------------------------- */
/* XXX: placeholder - Particle System eval */
DEG_OPCODE_PSYS_EVAL_INIT,
DEG_OPCODE_PSYS_EVAL,
DEG_NUM_OPCODES,