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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-22 17:17:34 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-22 17:24:06 +0300
commit8d4bad39c1490cd1defdc4956cf445173c64b9b6 (patch)
tree4e2a18618462dfa13c0d943c3c38ab56838f2b86 /source/blender/depsgraph
parent102631486b480d98c2d9b921a95472688bba8416 (diff)
Fix T60742, T55974: crash using mesh/curve surface force fields.
Missing dependency graph relations caused race conditions.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc50
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h18
-rw-r--r--source/blender/depsgraph/intern/depsgraph_physics.cc12
3 files changed, 50 insertions, 30 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c8822df28e6..838905ac977 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -359,7 +359,7 @@ DepsRelation *DepsgraphRelationBuilder::add_operation_relation(
return NULL;
}
-void DepsgraphRelationBuilder::add_collision_relations(
+void DepsgraphRelationBuilder::add_particle_collision_relations(
const OperationKey &key,
Object *object,
Collection *collection,
@@ -378,7 +378,7 @@ void DepsgraphRelationBuilder::add_collision_relations(
}
}
-void DepsgraphRelationBuilder::add_forcefield_relations(
+void DepsgraphRelationBuilder::add_particle_forcefield_relations(
const OperationKey &key,
Object *object,
ParticleSystem *psys,
@@ -390,9 +390,16 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
if (relation->ob != object) {
+ /* Relation to forcefield object, optionally including geometry. */
ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM);
add_relation(eff_key, key, name);
+ if (ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS)) {
+ ComponentKey mod_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY);
+ add_relation(mod_key, key, name);
+ }
+
+ /* Smoke flow relations. */
if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source) {
ComponentKey trf_key(&relation->pd->f_source->id,
DEG_NODE_TYPE_TRANSFORM);
@@ -401,13 +408,16 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
DEG_NODE_TYPE_GEOMETRY);
add_relation(eff_key, key, "Smoke Force Domain");
}
+
+ /* Absorption forces need collision relation. */
if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) {
- add_collision_relations(key,
- object,
- NULL,
- "Force Absorption");
+ add_particle_collision_relations(key,
+ object,
+ NULL,
+ "Force Absorption");
}
}
+
if (relation->psys) {
if (relation->ob != object) {
ComponentKey eff_key(&relation->ob->id,
@@ -1748,27 +1758,27 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
add_relation(psys_key, obdata_ubereval_key, "PSys -> UberEval");
/* Collisions */
if (part->type != PART_HAIR) {
- add_collision_relations(psys_key,
- object,
- part->collision_group,
- "Particle Collision");
+ add_particle_collision_relations(psys_key,
+ object,
+ part->collision_group,
+ "Particle Collision");
}
else if ((psys->flag & PSYS_HAIR_DYNAMICS) &&
psys->clmd != NULL &&
psys->clmd->coll_parms != NULL)
{
- add_collision_relations(psys_key,
- object,
- psys->clmd->coll_parms->group,
- "Hair Collision");
+ add_particle_collision_relations(psys_key,
+ object,
+ psys->clmd->coll_parms->group,
+ "Hair Collision");
}
/* Effectors. */
- add_forcefield_relations(psys_key,
- object,
- psys,
- part->effector_weights,
- part->type == PART_HAIR,
- "Particle Field");
+ add_particle_forcefield_relations(psys_key,
+ object,
+ psys,
+ part->effector_weights,
+ part->type == PART_HAIR,
+ "Particle Field");
/* Boids .*/
if (part->boids) {
LISTBASE_FOREACH (BoidState *, state, &part->boids->states) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 928834cbef7..c8e01476b66 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -286,15 +286,15 @@ struct DepsgraphRelationBuilder
void build_nested_nodetree(ID *owner, bNodeTree *ntree);
void build_nested_shapekey(ID *owner, Key *key);
- void add_collision_relations(const OperationKey &key,
- Object *object,
- Collection *collection,
- const char *name);
- void add_forcefield_relations(const OperationKey &key,
- Object *object,
- ParticleSystem *psys,
- EffectorWeights *eff,
- bool add_absorption, const char *name);
+ void add_particle_collision_relations(const OperationKey &key,
+ Object *object,
+ Collection *collection,
+ const char *name);
+ void add_particle_forcefield_relations(const OperationKey &key,
+ Object *object,
+ ParticleSystem *psys,
+ EffectorWeights *eff,
+ bool add_absorption, const char *name);
void build_copy_on_write_relations();
void build_copy_on_write_relations(IDDepsNode *id_node);
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc
index 88d4c25f726..8d1b923f834 100644
--- a/source/blender/depsgraph/intern/depsgraph_physics.cc
+++ b/source/blender/depsgraph/intern/depsgraph_physics.cc
@@ -148,14 +148,22 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
if (relation->pd->forcefield == skip_forcefield) {
continue;
}
+
+ /* Relation to forcefield object, optionally including geometry.
+ * Use special point cache relations for automatic cache clearing. */
DEG_add_object_pointcache_relation(
handle, relation->ob, DEG_OB_COMP_TRANSFORM, name);
- if (relation->psys) {
+
+ if (relation->psys ||
+ ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS))
+ {
/* TODO(sergey): Consider going more granular with more dedicated
* particle system operation. */
DEG_add_object_pointcache_relation(
handle, relation->ob, DEG_OB_COMP_GEOMETRY, name);
}
+
+ /* Smoke flow relations. */
if (relation->pd->forcefield == PFIELD_SMOKEFLOW &&
relation->pd->f_source != NULL)
{
@@ -168,6 +176,8 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
DEG_OB_COMP_GEOMETRY,
"Smoke Force Domain");
}
+
+ /* Absorption forces need collision relation. */
if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) {
DEG_add_collision_relations(handle,
object,