#include "BLI_winstuff.h"
#endif
-//#include "BMF_Api.h"
-
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
+#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force.h"
#include "DNA_object_fluidsim.h"
-#include "DNA_oops_types.h"
+#include "DNA_outliner_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BKE_scene.h"
#include "MEM_guardedalloc.h"
-#include "blendef.h"
+#ifndef DISABLE_PYTHON
#include "BPY_extern.h"
+#endif
#include "depsgraph_private.h"
return forest;
}
-static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int isdata)
+/* isdata = object data... */
+// XXX this needs to be extended to be more flexible (so that not only objects are evaluated via depsgraph)...
+static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node, int isdata)
{
- IpoCurve *icu;
+ FCurve *fcu;
DagNode *node1;
- for(icu= ipo->curve.first; icu; icu= icu->next) {
- if(icu->driver) {
-
- if (icu->driver->type == IPO_DRIVER_TYPE_PYTHON) {
-
- if ((icu->driver->flag & IPO_DRIVER_FLAG_INVALID) || (icu->driver->name[0] == '\0'))
- continue; /* empty or invalid expression */
- else {
- /* now we need refs to all objects mentioned in this
- * pydriver expression, to call 'dag_add_relation'
- * for each of them */
- Object **obarray = BPY_pydriver_get_objects(icu->driver);
- if (obarray) {
- Object *ob, **oba = obarray;
-
- while (*oba) {
- ob = *oba;
- node1 = dag_get_node(dag, ob);
- if (ob->type == OB_ARMATURE)
- dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Python Ipo Driver");
- else
- dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Python Ipo Driver");
- oba++;
- }
-
- MEM_freeN(obarray);
- }
+ for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
+ ChannelDriver *driver= fcu->driver;
+ DriverTarget *dtar;
+
+ /* loop over targets, adding relationships as appropriate */
+ for (dtar= driver->targets.first; dtar; dtar= dtar->next) {
+ if (dtar->id) {
+ if (GS(dtar->id->name)==ID_OB) {
+ Object *ob= (Object *)dtar->id;
+
+ /* normal channel-drives-channel */
+ node1 = dag_get_node(dag, dtar->id);
+
+ /* check if bone... */
+ if ((ob->type==OB_ARMATURE) && dtar->rna_path && strstr(dtar->rna_path, "pose.pose_channels["))
+ dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
+ /* check if ob data */
+ else if (dtar->rna_path && strstr(dtar->rna_path, "data."))
+ dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
+ /* normal */
+ else
+ dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
}
}
- else if (icu->driver->ob) {
- node1 = dag_get_node(dag, icu->driver->ob);
- if(icu->driver->blocktype==ID_AR)
- dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Ipo Driver");
- else
- dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver");
+ }
+ }
+}
+
+static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node)
+{
+ Base *base;
+ DagNode *node2;
+
+ // would be nice to have a list of colliders here
+ // so for now walk all objects in scene check 'same layer rule'
+ for(base = scene->base.first; base; base= base->next) {
+ if((base->lay & ob->lay) && base->object->pd) {
+ Object *ob1= base->object;
+ if((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
+ node2 = dag_get_node(dag, ob1);
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Field Collision");
}
}
}
}
-static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int mask)
+static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, Object *ob, int mask)
{
bConstraint *con;
- bConstraintChannel *conchan;
DagNode * node;
DagNode * node2;
DagNode * node3;
}
/* driver dependencies, nla modifiers */
- if(ob->ipo)
- dag_add_driver_relation(ob->ipo, dag, node, 0);
-
- key= ob_get_key(ob);
- if(key && key->ipo)
- dag_add_driver_relation(key->ipo, dag, node, 1);
-
- for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next)
- if(conchan->ipo)
- dag_add_driver_relation(conchan->ipo, dag, node, 0);
-
- if(ob->action) {
- bActionChannel *chan;
- for (chan = ob->action->chanbase.first; chan; chan=chan->next){
- if(chan->ipo)
- dag_add_driver_relation(chan->ipo, dag, node, 1);
- for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
- if(conchan->ipo)
- dag_add_driver_relation(conchan->ipo, dag, node, 1);
- }
- }
+#if 0 // XXX old animation system
if(ob->nlastrips.first) {
bActionStrip *strip;
bActionChannel *chan;
for(strip= ob->nlastrips.first; strip; strip= strip->next) {
- if(strip->act && strip->act!=ob->action)
- for (chan = strip->act->chanbase.first; chan; chan=chan->next)
- if(chan->ipo)
- dag_add_driver_relation(chan->ipo, dag, node, 1);
if(strip->modifiers.first) {
bActionModifier *amod;
for(amod= strip->modifiers.first; amod; amod= amod->next) {
}
}
}
+#endif // XXX old animation system
+ if (ob->adt)
+ dag_add_driver_relation(ob->adt, dag, node, (ob->type == OB_ARMATURE)); // XXX isdata arg here doesn't give an accurate picture of situation
+
+ key= ob_get_key(ob);
+ if (key && key->adt)
+ dag_add_driver_relation(key->adt, dag, node, 1);
+
if (ob->modifiers.first) {
ModifierData *md;
for(md=ob->modifiers.first; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if (mti->updateDepgraph) mti->updateDepgraph(md, dag, ob, node);
+ if (mti->updateDepgraph) mti->updateDepgraph(md, dag, scene, ob, node);
}
}
if (ob->parent) {
else
dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent");
}
- else
- dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent");
+ else
+ dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Parent");
}
/* exception case: parent is duplivert */
if(ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Proxy");
/* inverted relation, so addtoroot shouldn't be set to zero */
}
+
+
if (ob->type==OB_CAMERA) {
Camera *cam = (Camera *)ob->data;
- if (cam->ipo) {
- dag_add_driver_relation(cam->ipo, dag, node, 1);
- }
+ if (cam->adt)
+ dag_add_driver_relation(cam->adt, dag, node, 1);
if (cam->dof_ob) {
node2 = dag_get_node(dag, cam->dof_ob);
dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Camera DoF");
}
if (ob->type==OB_LAMP) {
Lamp *la = (Lamp *)ob->data;
- if (la->ipo) {
- dag_add_driver_relation(la->ipo, dag, node, 1);
- }
+ if (la->adt)
+ dag_add_driver_relation(la->adt, dag, node, 1);
}
+
if (ob->transflag & OB_DUPLI) {
if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
GroupObject *go;
}
/* softbody collision */
- if((ob->type==OB_MESH) || (ob->type==OB_CURVE) || (ob->type==OB_LATTICE)) {
- Base *base;
- if(modifiers_isSoftbodyEnabled(ob)){
- // would be nice to have a list of colliders here
- // so for now walk all objects in scene check 'same layer rule'
- for(base = G.scene->base.first; base; base= base->next) {
- if( (base->lay & ob->lay) && base->object->pd) {
- Object *ob1= base->object;
- if((ob1->pd->deflect) && (ob1 != ob)) {
- node2 = dag_get_node(dag, ob1);
- dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Softbody Collision");
- }
- }
- }
- }
- }
+ if((ob->type==OB_MESH) || (ob->type==OB_CURVE) || (ob->type==OB_LATTICE))
+ if(modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob))
+ dag_add_collision_field_relation(dag, scene, ob, node);
if (ob->type==OB_MBALL) {
- Object *mom= find_basis_mball(ob);
+ Object *mom= find_basis_mball(scene, ob);
if(mom!=ob) {
node2 = dag_get_node(dag, mom);
dag_add_relation(dag,node,node2,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Metaball"); // mom depends on children!
node2 = dag_get_node(dag, cu->taperobj);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
}
- if(cu->ipo)
- dag_add_driver_relation(cu->ipo, dag, node, 1);
-
+ if (cu->adt)
+ dag_add_driver_relation(cu->adt, dag, node, 1);
}
else if(ob->type==OB_FONT) {
Curve *cu= ob->data;
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
}
}
- else if(ob->type==OB_MESH) {
- PartEff *paf= give_parteff(ob);
- if(paf) {
- ListBase *listb;
- pEffectorCache *ec;
-
- /* ob location depends on itself */
- if((paf->flag & PAF_STATIC)==0)
- dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
-
- listb= pdInitEffectors(ob, paf->group); /* note, makes copy... */
- if(listb) {
- for(ec= listb->first; ec; ec= ec->next) {
- Object *ob1= ec->ob;
- PartDeflect *pd= ob1->pd;
-
- if(pd->forcefield) {
- node2 = dag_get_node(dag, ob1);
- if(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");
- }
- }
-
- pdEndEffectors(listb); /* restores copy... */
- }
- }
- }
-
+
psys= ob->particlesystem.first;
if(psys) {
ParticleEffectorCache *nec;
for(; psys; psys=psys->next) {
ParticleSettings *part= psys->part;
-
+
dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
+ if(psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE)
+ continue;
+
if(part->phystype==PART_PHYS_KEYED && psys->keyed_ob &&
BLI_findlink(&psys->keyed_ob->particlesystem,psys->keyed_psys-1)) {
node2 = dag_get_node(dag, psys->keyed_ob);
if(psys->effectors.first)
psys_end_effectors(psys);
- psys_init_effectors(ob,psys->part->eff_group,psys);
+ psys_init_effectors(scene, ob, psys->part->eff_group, psys);
if(psys->effectors.first) {
for(nec= psys->effectors.first; nec; nec= nec->next) {
for(base = sce->base.first; base; base= base->next) {
ob= base->object;
- build_dag_object(dag, scenenode, ob, mask);
+ build_dag_object(dag, scenenode, sce, ob, mask);
if(ob->proxy)
- build_dag_object(dag, scenenode, ob->proxy, mask);
+ build_dag_object(dag, scenenode, sce, ob->proxy, mask);
/* handled in next loop */
if(ob->dup_group)
for(group= G.main->group.first; group; group= group->id.next) {
if(group->id.flag & LIB_DOIT) {
for(go= group->gobject.first; go; go= go->next) {
- build_dag_object(dag, scenenode, go->ob, mask);
+ build_dag_object(dag, scenenode, sce, go->ob, mask);
}
group->id.flag &= ~LIB_DOIT;
}
return node;
}
-void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
+static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
{
- DagAdjList *itA = fob1->child;
+ DagAdjList *itA = fob2->parent;
while (itA) { /* search if relation exist already */
- if (itA->node == fob2) {
+ if (itA->node == fob1) {
itA->type |= rel;
itA->count += 1;
return;
}
/* create new relation and insert at head. MALLOC alert! */
itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list");
- itA->node = fob2;
+ itA->node = fob1;
itA->type = rel;
itA->count = 1;
- itA->next = fob1->child;
+ itA->next = fob2->parent;
itA->name = name;
- fob1->child = itA;
+ fob2->parent = itA;
}
-static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
+void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
{
- DagAdjList *itA = fob2->parent;
+ DagAdjList *itA = fob1->child;
+ /* parent relation is for cycle checking */
+ dag_add_parent_relation(forest, fob1, fob2, rel, name);
+
while (itA) { /* search if relation exist already */
- if (itA->node == fob1) {
+ if (itA->node == fob2) {
itA->type |= rel;
itA->count += 1;
return;
}
/* create new relation and insert at head. MALLOC alert! */
itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list");
- itA->node = fob1;
+ itA->node = fob2;
itA->type = rel;
itA->count = 1;
- itA->next = fob2->parent;
+ itA->next = fob1->child;
itA->name = name;
- fob2->parent = itA;
+ fob1->child = itA;
}
static char *dag_node_name(DagNode *node)
printf("\n");
}
+static int dag_node_recurs_level(DagNode *node, int level)
+{
+ DagAdjList *itA;
+ int newlevel;
+
+ node->color= DAG_BLACK; /* done */
+ newlevel= ++level;
+
+ for(itA= node->parent; itA; itA= itA->next) {
+ if(itA->node->color==DAG_WHITE) {
+ itA->node->ancestor_count= dag_node_recurs_level(itA->node, level);
+ newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
+ }
+ else
+ newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
+ }
+
+ return newlevel;
+}
+
+static void dag_check_cycle(DagForest *dag)
+{
+ DagNode *node;
+ DagAdjList *itA;
+
+ /* tag nodes unchecked */
+ for(node = dag->DagNode.first; node; node= node->next)
+ node->color= DAG_WHITE;
+
+ for(node = dag->DagNode.first; node; node= node->next) {
+ if(node->color==DAG_WHITE) {
+ node->ancestor_count= dag_node_recurs_level(node, 0);
+ }
+ }
+
+ /* check relations, and print errors */
+ for(node = dag->DagNode.first; node; node= node->next) {
+ for(itA= node->parent; itA; itA= itA->next) {
+ if(itA->node->ancestor_count > node->ancestor_count) {
+ if(node->ob && itA->node->ob) {
+ printf("Dependency cycle detected:\n");
+ dag_node_print_dependency_cycle(dag, itA->node, node, itA->name);
+ }
+ }
+ }
+ }
+
+ /* parent relations are only needed for cycle checking, so free now */
+ for(node = dag->DagNode.first; node; node= node->next) {
+ while (node->parent) {
+ itA = node->parent->next;
+ MEM_freeN(node->parent);
+ node->parent = itA;
+ }
+ }
+}
+
/*
* MainDAG is the DAG of all objects in current scene
* used only for drawing there is one also in each scene
build_dag(sce, DAG_RL_ALL_BUT_DATA);
+ dag_check_cycle(sce->theDag);
+
nqueue = queue_create(DAGQUEUEALLOC);
for(node = sce->theDag->DagNode.first; node; node= node->next) {
for(itA = node->child; itA; itA= itA->next) {
all_layer |= itA->lay;
/* the relationship is visible */
- if(itA->lay & layer) {
+ if((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
if(itA->node->type==ID_OB) {
obc= itA->node->ob;
oldflag= obc->recalc;
}
}
/* even nicer, we can clear recalc flags... */
- if((all_layer & layer)==0) {
+ if((all_layer & layer)==0) { // XXX && (ob != obedit)) {
/* but existing displaylists or derivedmesh should be freed */
if(ob->recalc & OB_RECALC_DATA)
object_free_display(ob);
/* could merge this in with loop above...? (ton) */
for(itA = node->child; itA; itA= itA->next) {
/* the relationship is visible */
- if(itA->lay & layer) {
+ if((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
if(itA->node->type==ID_OB) {
obc= itA->node->ob;
/* child moves */
return 0;
}
-static int exists_channel(Object *ob, char *name)
+static short animdata_use_time(AnimData *adt)
{
- bActionStrip *strip;
+ NlaTrack *nlt;
- if(ob->action)
- if(get_action_channel(ob->action, name))
- return 1;
+ if(adt==NULL) return 0;
- for (strip=ob->nlastrips.first; strip; strip=strip->next)
- if(get_action_channel(strip->act, name))
+ /* check action - only if assigned, and it has anim curves */
+ if (adt->action && adt->action->curves.first)
+ return 1;
+
+ /* check NLA tracks + strips */
+ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+ if (nlt->strips.first)
return 1;
+ }
+
return 0;
}
static void dag_object_time_update_flags(Object *ob)
{
-
- if(ob->ipo) ob->recalc |= OB_RECALC_OB;
- else if(ob->constraints.first) {
+ if(ob->constraints.first) {
bConstraint *con;
for (con = ob->constraints.first; con; con=con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
}
}
}
- else if(ob->scriptlink.totscript) ob->recalc |= OB_RECALC_OB;
- else if(ob->parent) {
+
+ if(ob->scriptlink.totscript) ob->recalc |= OB_RECALC_OB;
+
+ if(ob->parent) {
/* motion path or bone child */
if(ob->parent->type==OB_CURVE || ob->parent->type==OB_ARMATURE) ob->recalc |= OB_RECALC_OB;
}
- if(ob->action || ob->nlastrips.first) {
- /* since actions now are mixed, we set the recalcs on the safe side */
- ob->recalc |= OB_RECALC_OB;
- if(ob->type==OB_ARMATURE)
- ob->recalc |= OB_RECALC_DATA;
- else if(exists_channel(ob, "Shape"))
- ob->recalc |= OB_RECALC_DATA;
- else if(ob->dup_group) {
+#if 0 // XXX old animation system
+ if(ob->nlastrips.first) {
+ if(ob->dup_group) {
bActionStrip *strip;
/* this case is for groups with nla, whilst nla target has no action or nla */
for(strip= ob->nlastrips.first; strip; strip= strip->next) {
}
}
}
- else if(modifiers_isSoftbodyEnabled(ob)) ob->recalc |= OB_RECALC_DATA;
- else if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
- else if((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
- else {
+#endif // XXX old animation system
+
+ if(animdata_use_time(ob->adt)) {
+ ob->recalc |= OB_RECALC;
+ ob->adt->recalc |= ADT_RECALC_ANIM;
+ }
+
+ if((ob->adt) && (ob->type==OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
+
+ if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
+ if((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
+
+ {
Mesh *me;
Curve *cu;
Lattice *lt;
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
}
}
- else if(ob->effect.first) {
- Effect *eff= ob->effect.first;
- PartEff *paf= give_parteff(ob);
-
- if(eff->type==EFF_WAVE)
- ob->recalc |= OB_RECALC_DATA;
- else if(paf && paf->keys==NULL)
- ob->recalc |= OB_RECALC_DATA;
- }
- if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings)) {
- // fluidsimSettings might not be initialized during load...
- if(ob->fluidsimSettings->type & (OB_FLUIDSIM_DOMAIN|OB_FLUIDSIM_PARTICLE)) {
- ob->recalc |= OB_RECALC_DATA; // NT FSPARTICLE
- }
- }
if(ob->particlesystem.first)
ob->recalc |= OB_RECALC_DATA;
break;
}
-/* for depgraph updating, all layers visible in a screen */
-/* this is a copy from editscreen.c... I need to think over a more proper solution for this */
-/* probably the DAG_object_flush_update() should give layer too? */
-/* or some kind of dag context... (DAG_set_layer) */
-static unsigned int dag_screen_view3d_layers(void)
-{
- ScrArea *sa;
- int layer= 0;
-
- for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_VIEW3D)
- layer |= ((View3D *)sa->spacedata.first)->lay;
- }
- return layer;
-}
-
/* flag this object and all its relations to recalc */
/* if you need to do more objects, tag object yourself and
}
}
- if(G.curscreen)
- DAG_scene_flush_update(sce, dag_screen_view3d_layers(), 0);
- else
+// XXX if(G.curscreen)
+// DAG_scene_flush_update(sce, dag_screen_view3d_layers(), 0);
+// else
DAG_scene_flush_update(sce, sce->lay, 0);
}
/* ******************* DAG FOR ARMATURE POSE ***************** */
-static int node_recurs_level(DagNode *node, int level)
-{
- DagAdjList *itA;
- int newlevel;
-
- node->color= DAG_BLACK; /* done */
- newlevel= ++level;
-
- for(itA= node->parent; itA; itA= itA->next) {
- if(itA->node->color==DAG_WHITE) {
- itA->node->ancestor_count= node_recurs_level(itA->node, level);
- newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
- }
- else
- newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
- }
-
- return newlevel;
-}
-
-static void pose_check_cycle(DagForest *dag)
-{
- DagNode *node;
- DagAdjList *itA;
-
- /* tag nodes unchecked */
- for(node = dag->DagNode.first; node; node= node->next)
- node->color= DAG_WHITE;
-
- for(node = dag->DagNode.first; node; node= node->next) {
- if(node->color==DAG_WHITE) {
- node->ancestor_count= node_recurs_level(node, 0);
- }
- }
-
- /* check relations, and print errors */
- for(node = dag->DagNode.first; node; node= node->next) {
- for(itA= node->parent; itA; itA= itA->next) {
- if(itA->node->ancestor_count > node->ancestor_count) {
- bPoseChannel *pchan= (bPoseChannel *)node->ob;
- bPoseChannel *parchan= (bPoseChannel *)itA->node->ob;
-
- if(pchan && parchan) {
- printf("Cycle detected:\n");
- dag_node_print_dependency_cycle(dag, itA->node, node, itA->name);
- }
- }
- }
- }
-}
-
/* we assume its an armature with pose */
void DAG_pose_sort(Object *ob)
{
if(pchan->parent) {
node2 = dag_get_node(dag, pchan->parent);
dag_add_relation(dag, node2, node, 0, "Parent Relation");
- dag_add_parent_relation(dag, node2, node, 0, "Parent Relation");
addtoroot = 0;
}
for (con = pchan->constraints.first; con; con=con->next) {
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
+#if 0 // XXX old animation system... driver stuff to watch out for
if(con->ipo) {
IpoCurve *icu;
for(icu= con->ipo->curve.first; icu; icu= icu->next) {
if(target) {
node2 = dag_get_node(dag, target);
dag_add_relation(dag, node2, node, 0, "Ipo Driver");
- dag_add_parent_relation(dag, node2, node, 0, "Ipo Driver");
-
+
/* uncommented this line, results in dependencies
* not being added properly for this constraint,
* what is the purpose of this? - brecht */
}
}
}
+#endif // XXX old animation system... driver stuff to watch out for
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
if (target) {
node2= dag_get_node(dag, target);
dag_add_relation(dag, node2, node, 0, "IK Constraint");
- dag_add_parent_relation(dag, node2, node, 0, "IK Constraint");
if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = (bKinematicConstraint *)con->data;
while (parchan) {
node3= dag_get_node(dag, parchan);
dag_add_relation(dag, node2, node3, 0, "IK Constraint");
- dag_add_parent_relation(dag, node2, node3, 0, "IK Constraint");
segcount++;
if (segcount==data->rootbone || segcount>255) break; // 255 is weak
}
if (addtoroot == 1 ) {
dag_add_relation(dag, rootnode, node, 0, "Root Bone Relation");
- dag_add_parent_relation(dag, rootnode, node, 0, "Root Bone Relation");
}
}
- pose_check_cycle(dag);
+ dag_check_cycle(dag);
/* now we try to sort... */
tempbase.first= tempbase.last= NULL;