Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_physics.cc
| Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | void DEG_add_collision_relations(DepsNodeHandle *handle, | ||||
| ListBase *relations = build_collision_relations(deg_graph, collection, modifier_type); | ListBase *relations = build_collision_relations(deg_graph, collection, modifier_type); | ||||
| LISTBASE_FOREACH (CollisionRelation *, relation, relations) { | LISTBASE_FOREACH (CollisionRelation *, relation, relations) { | ||||
| Object *ob1 = relation->ob; | Object *ob1 = relation->ob; | ||||
| if (ob1 == object) { | if (ob1 == object) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (filter_function == NULL || | if (filter_function == NULL || | ||||
| filter_function(ob1, modifiers_findByType(ob1, (ModifierType)modifier_type))) { | filter_function(ob1, modifiers_findByType(ob1, (ModifierType)modifier_type))) { | ||||
| DEG_add_object_pointcache_relation(handle, ob1, DEG_OB_COMP_TRANSFORM, name); | DEG_add_object_pointcache_relation(handle, ob1, DEG_OB_COMP_TRANSFORM, name, false); | ||||
| DEG_add_object_pointcache_relation(handle, ob1, DEG_OB_COMP_GEOMETRY, name); | DEG_add_object_pointcache_relation(handle, ob1, DEG_OB_COMP_GEOMETRY, name, true); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void DEG_add_forcefield_relations(DepsNodeHandle *handle, | void DEG_add_forcefield_relations(DepsNodeHandle *handle, | ||||
| Object *object, | Object *object, | ||||
| EffectorWeights *effector_weights, | EffectorWeights *effector_weights, | ||||
| bool add_absorption, | bool add_absorption, | ||||
| int skip_forcefield, | int skip_forcefield, | ||||
| const char *name) | const char *name) | ||||
| { | { | ||||
| Depsgraph *depsgraph = DEG_get_graph_from_handle(handle); | Depsgraph *depsgraph = DEG_get_graph_from_handle(handle); | ||||
| DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph; | DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph; | ||||
| ListBase *relations = build_effector_relations(deg_graph, effector_weights->group); | ListBase *relations = build_effector_relations(deg_graph, effector_weights->group); | ||||
| LISTBASE_FOREACH (EffectorRelation *, relation, relations) { | LISTBASE_FOREACH (EffectorRelation *, relation, relations) { | ||||
| if (relation->ob == object) { | if (relation->ob == object) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (relation->pd->forcefield == skip_forcefield) { | if (relation->pd->forcefield == skip_forcefield) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Relation to forcefield object, optionally including geometry. | /* Relation to forcefield object, optionally including geometry. | ||||
| * Use special point cache relations for automatic cache clearing. */ | * Use special point cache relations for automatic cache clearing. */ | ||||
| DEG_add_object_pointcache_relation(handle, relation->ob, DEG_OB_COMP_TRANSFORM, name); | DEG_add_object_pointcache_relation(handle, relation->ob, DEG_OB_COMP_TRANSFORM, name, false); | ||||
| if (relation->psys || ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS) || | if (relation->psys || ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS) || | ||||
| relation->pd->forcefield == PFIELD_GUIDE) { | relation->pd->forcefield == PFIELD_GUIDE) { | ||||
| /* TODO(sergey): Consider going more granular with more dedicated | /* TODO(sergey): Consider going more granular with more dedicated | ||||
| * particle system operation. */ | * particle system operation. */ | ||||
| DEG_add_object_pointcache_relation(handle, relation->ob, DEG_OB_COMP_GEOMETRY, name); | DEG_add_object_pointcache_relation(handle, relation->ob, DEG_OB_COMP_GEOMETRY, name, false); | ||||
sergey: Why in the case above `DEG_OB_COMP_GEOMETRY` relation allows to break cycle but not here? What… | |||||
angavrilovAuthorUnsubmitted Done Inline ActionsMainly, because the collision modifier has cached state, so it's safe to kill dependencies on it, provided there is a reverse dependency to prevent simultaneously reading and updating it. I didn't check how forces work, so it might not be safe. angavrilov: Mainly, because the collision modifier has cached state, so it's safe to kill dependencies on… | |||||
| } | } | ||||
| /* Smoke flow relations. */ | /* Smoke flow relations. */ | ||||
| if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source != NULL) { | if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source != NULL) { | ||||
| DEG_add_object_pointcache_relation( | DEG_add_object_pointcache_relation( | ||||
| handle, relation->pd->f_source, DEG_OB_COMP_TRANSFORM, "Smoke Force Domain"); | handle, relation->pd->f_source, DEG_OB_COMP_TRANSFORM, "Smoke Force Domain", false); | ||||
| DEG_add_object_pointcache_relation( | DEG_add_object_pointcache_relation( | ||||
| handle, relation->pd->f_source, DEG_OB_COMP_GEOMETRY, "Smoke Force Domain"); | handle, relation->pd->f_source, DEG_OB_COMP_GEOMETRY, "Smoke Force Domain", false); | ||||
| } | } | ||||
| /* Absorption forces need collision relation. */ | /* Absorption forces need collision relation. */ | ||||
| if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) { | if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) { | ||||
| DEG_add_collision_relations( | DEG_add_collision_relations( | ||||
| handle, object, NULL, eModifierType_Collision, NULL, "Force Absorption"); | handle, object, NULL, eModifierType_Collision, NULL, "Force Absorption"); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||
Why in the case above DEG_OB_COMP_GEOMETRY relation allows to break cycle but not here? What are the rules?