Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_build.cc
| Show All 30 Lines | |||||
| */ | */ | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| extern "C" { | extern "C" { | ||||
| #include "DNA_cachefile_types.h" | #include "DNA_cachefile_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_object_force.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_collision.h" | |||||
| #include "BKE_effect.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_debug.h" | #include "DEG_depsgraph_debug.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| } /* extern "C" */ | } /* extern "C" */ | ||||
| #include "builder/deg_builder.h" | #include "builder/deg_builder.h" | ||||
| ▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | |||||
| void DEG_scene_graph_free(Scene *scene) | void DEG_scene_graph_free(Scene *scene) | ||||
| { | { | ||||
| if (scene->depsgraph) { | if (scene->depsgraph) { | ||||
| DEG_graph_free(scene->depsgraph); | DEG_graph_free(scene->depsgraph); | ||||
| scene->depsgraph = NULL; | scene->depsgraph = NULL; | ||||
| } | } | ||||
| } | } | ||||
| void DEG_add_collision_relations(DepsNodeHandle *handle, Scene *scene, Object *ob, Group *group, int layer, unsigned int modifier_type, DEG_CollobjFilterFunction fn, bool dupli, const char *name) | |||||
| { | |||||
| unsigned int numcollobj; | |||||
| Object **collobjs = get_filtered_collisionobjects(scene, ob, group, layer, &numcollobj, modifier_type, fn, dupli); | |||||
| for (unsigned int i = 0; i < numcollobj; i++) | |||||
| { | |||||
| DEG_add_object_relation(handle, collobjs[i], DEG_OB_COMP_TRANSFORM, name); | |||||
| DEG_add_object_relation(handle, collobjs[i], DEG_OB_COMP_GEOMETRY, name); | |||||
| } | |||||
| if (collobjs) | |||||
| MEM_freeN(collobjs); | |||||
| } | |||||
| void DEG_add_forcefield_relations(DepsNodeHandle *handle, Scene *scene, Object *ob, EffectorWeights *effector_weights, bool add_absorption, int skip_forcefield, const char *name) | |||||
| { | |||||
| ListBase *effectors = pdInitEffectors(scene, ob, NULL, effector_weights, false); | |||||
| if (effectors) { | |||||
| for (EffectorCache *eff = (EffectorCache*)effectors->first; eff; eff = eff->next) { | |||||
| if (eff->ob != ob && eff->pd->forcefield != skip_forcefield) { | |||||
| DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_TRANSFORM, name); | |||||
| if (eff->psys) { | |||||
| DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_EVAL_PARTICLES, name); | |||||
| } | |||||
| if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) { | |||||
| DEG_add_object_relation(handle, eff->pd->f_source, DEG_OB_COMP_TRANSFORM, "Smoke Force Domain"); | |||||
| DEG_add_object_relation(handle, eff->pd->f_source, DEG_OB_COMP_GEOMETRY, "Smoke Force Domain"); | |||||
| } | |||||
| if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) { | |||||
| DEG_add_collision_relations(handle, scene, ob, NULL, eff->ob->lay, eModifierType_Collision, NULL, true, "Force Absorption"); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| pdEndEffectors(&effectors); | |||||
| } | |||||