diff options
Diffstat (limited to 'source/blender/blenkernel/intern/depsgraph.c')
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 80 |
1 files changed, 47 insertions, 33 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index f52eec34cc7..7e6a652da6b 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -39,6 +39,7 @@ #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_armature_types.h" +#include "DNA_boid_types.h" #include "DNA_curve_types.h" #include "DNA_camera_types.h" #include "DNA_ID.h" @@ -555,6 +556,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O GroupObject *go; for(; psys; psys=psys->next) { + BoidRule *rule = NULL; + BoidState *state = NULL; ParticleSettings *part= psys->part; dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation"); @@ -562,16 +565,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O if(!psys_check_enabled(ob, psys)) continue; - if(part->phystype==PART_PHYS_KEYED) { - KeyedParticleTarget *kpt = psys->keyed_targets.first; + if(ELEM(part->phystype,PART_PHYS_KEYED,PART_PHYS_BOIDS)) { + ParticleTarget *pt = psys->targets.first; - for(; kpt; kpt=kpt->next) { - if(kpt->ob && BLI_findlink(&kpt->ob->particlesystem, kpt->psys-1)) { - node2 = dag_get_node(dag, kpt->ob); - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Keyed Physics"); + for(; pt; pt=pt->next) { + if(pt->ob && BLI_findlink(&pt->ob->particlesystem, pt->psys-1)) { + node2 = dag_get_node(dag, pt->ob); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Targets"); } - else - break; } } @@ -589,33 +590,47 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O } } - if(psys->effectors.first) - psys_end_effectors(psys); + psys_end_effectors(psys); psys_init_effectors(scene, ob, psys->part->eff_group, psys); - if(psys->effectors.first) { - for(nec= psys->effectors.first; nec; nec= nec->next) { - Object *ob1= nec->ob; + for(nec= psys->effectors.first; nec; nec= nec->next) { + Object *ob1= nec->ob; - if(nec->type & PSYS_EC_EFFECTOR) { - node2 = dag_get_node(dag, ob1); - if(ob1->pd->forcefield==PFIELD_GUIDE) - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field"); - else - dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Particle Field"); - } - else if(nec->type & PSYS_EC_DEFLECT) { - node2 = dag_get_node(dag, ob1); - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Collision"); - } - else if(nec->type & PSYS_EC_PARTICLE) { - node2 = dag_get_node(dag, ob1); - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Field"); - } - - if(nec->type & PSYS_EC_REACTOR) { - node2 = dag_get_node(dag, ob1); - dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Reactor"); + if(nec->type & PSYS_EC_EFFECTOR) { + node2 = dag_get_node(dag, ob1); + if(ob1->pd->forcefield==PFIELD_GUIDE) + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field"); + else + dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Particle Field"); + } + else if(nec->type & PSYS_EC_DEFLECT) { + node2 = dag_get_node(dag, ob1); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Collision"); + } + else if(nec->type & PSYS_EC_PARTICLE) { + node2 = dag_get_node(dag, ob1); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Field"); + } + + if(nec->type & PSYS_EC_REACTOR) { + node2 = dag_get_node(dag, ob1); + dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Reactor"); + } + } + + if(part->boids) { + for(state = part->boids->states.first; state; state=state->next) { + for(rule = state->rules.first; rule; rule=rule->next) { + Object *ruleob = NULL; + if(rule->type==eBoidRuleType_Avoid) + ruleob = ((BoidRuleGoalAvoid*)rule)->ob; + else if(rule->type==eBoidRuleType_FollowLeader) + ruleob = ((BoidRuleFollowLeader*)rule)->ob; + + if(ruleob) { + node2 = dag_get_node(dag, ruleob); + dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Boid Rule"); + } } } } @@ -2070,7 +2085,6 @@ static void dag_object_time_update_flags(Object *ob) } } } - /* flag all objects that need recalc, for changes in time for example */ void DAG_scene_update_flags(Scene *scene, unsigned int lay) { |