From 7b6c88473c02d97485970390086395b515be653e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Jan 2008 15:13:42 +0000 Subject: find_group would only return the first group, this let to the assumption that an object was only in 1 group, made it easy to loop through all groups an object is in. group = NULL; while( (group = find_group(base->object, group)) ) { ... } --- source/blender/blenkernel/intern/depsgraph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index a963b877912..e1cecaa7a61 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2064,8 +2064,8 @@ void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay) /* object not in scene? then handle group exception. needs to be dagged once too */ if(node==NULL) { - Group *group= find_group(ob); - if(group) { + Group *group= NULL; + while( (group = find_group(ob, group)) ) { GroupObject *go; /* primitive; tag all... this call helps building groups for particles */ for(go= group->gobject.first; go; go= go->next) -- cgit v1.2.3 From 31ecc5cba00ebcd7eb02fec76c5fbf34825c8995 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 29 Jan 2008 18:29:14 +0000 Subject: Fix for bug #8124: dupli particles were not rendering in some cases, now added dependencies so they are passed to the render engine in the right order to detect the duplis. --- source/blender/blenkernel/intern/depsgraph.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index e1cecaa7a61..5133381ba9f 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -593,6 +593,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int psys= ob->particlesystem.first; if(psys) { ParticleEffectorCache *nec; + GroupObject *go; for(; psys; psys=psys->next) { ParticleSettings *part= psys->part; @@ -605,6 +606,18 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA); } + if(part->draw_as == PART_DRAW_OB && part->dup_ob) { + node2 = dag_get_node(dag, part->dup_ob); + dag_add_relation(dag, node, node2, DAG_RL_OB_OB); + } + + if(part->draw_as == PART_DRAW_GR && part->dup_group) { + for(go=part->dup_group->gobject.first; go; go=go->next) { + node2 = dag_get_node(dag, go->ob); + dag_add_relation(dag, node, node2, DAG_RL_OB_OB); + } + } + if(psys->effectors.first) psys_end_effectors(psys); psys_init_effectors(ob,psys->part->eff_group,psys); -- cgit v1.2.3 From 5b4376a137839534bfd012314c9246dd74d161cf Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 14 Feb 2008 19:08:24 +0000 Subject: Bugfix for depsgraph error leading to lagging, caused by local constraint ipo drivers and proxies. --- source/blender/blenkernel/intern/depsgraph.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 5133381ba9f..e582cd7c9d9 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2196,7 +2196,10 @@ void DAG_pose_sort(Object *ob) if(con->ipo) { IpoCurve *icu; for(icu= con->ipo->curve.first; icu; icu= icu->next) { - if(icu->driver && icu->driver->ob==ob) { + /* icu->driver->ob should actually point to ob->proxy if it + * is a proxy, but since it wasn't set correct it older + * files comparing with ob->proxy makes it work for those */ + if(icu->driver && (icu->driver->ob==ob || icu->driver->ob==ob->proxy)) { bPoseChannel *target= get_pose_channel(ob->pose, icu->driver->name); if(target) { node2 = dag_get_node(dag, target); -- cgit v1.2.3 From cd3d63a628aa98b1769687a9c039c7fa4c6e4db1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 14 Feb 2008 21:34:27 +0000 Subject: Bugfix: depsgraph cycle checking for armatures sometimes gave incorrect cycle warnings. --- source/blender/blenkernel/intern/depsgraph.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index e582cd7c9d9..32927b6058c 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2114,16 +2114,21 @@ void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay) static int node_recurs_level(DagNode *node, int level) { DagAdjList *itA; - + int newlevel; + node->color= DAG_BLACK; /* done */ - level++; + newlevel= ++level; for(itA= node->parent; itA; itA= itA->next) { - if(itA->node->color==DAG_WHITE) + 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 level; + return newlevel; } static void pose_check_cycle(DagForest *dag) -- cgit v1.2.3 From 88c2358f4f0829b95ad2f9d94c3e077e9dc7fcb5 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 25 Mar 2008 05:32:04 +0000 Subject: Bugfix #8736: Follow Path constraints does not work for Bones This appears to be a long-standing bug, and it only affected the Follow-Path constraint as it was the only one which was dependant on time-based changes. An oversight in the depsgraph code meant that Follow-Path constraints on armature bones were not evaluated, unless there was an Action or some NLA-Strips for that armature. I've added a new flag to pose->flag (POSE_CONSTRAINTS_TIMEDEPEND) which only gets set/cleared by update_pose_constraint_flags. This flag indicates that the depsgraph needs to do an update for such cases, and will require going in/out of EditMode to set this for old files. It's been implemented as such to avoid having costly searches when trying to run animations realtime (as is done for modifiers). --- source/blender/blenkernel/intern/depsgraph.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 32927b6058c..5f95ce61aca 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1848,6 +1848,7 @@ static void dag_object_time_update_flags(Object *ob) } 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 { Mesh *me; Curve *cu; -- cgit v1.2.3 From 1fe5302cce8de1bad875ad29a3fcff06d0c59654 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 10 Apr 2008 11:39:20 +0000 Subject: Point Cache Refactoring ======================= Caching and Baking: - The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates. - There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles. - The cloth autoprotect feature was removed. - The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries. - The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions. - PointCache struct was added to DNA and is automatically allocated for each physics type. - Soft body now supports Bake Editing just like cloth. - Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now. Library Linking: - Added some more warnings to prevent editing settings on library linked objects. - Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked. - Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh). Physics UI: - Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth. - Tweaked field panel buttons to not jump around when changing options. - Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable. - I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers. - Fixed modifier error drawing glitch. Particles: - Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() .. - Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading. - Make particle threads work with autothreads. Continue Physics: - The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache. - This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics. Todo: - Point cache can get out of sync with and undo and changing a file without saving it. - Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion. - Menu item and/or buttons for Ctrl+B. - A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested. - The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway. --- source/blender/blenkernel/intern/depsgraph.c | 76 +++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 14 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 5f95ce61aca..ab6cf070a80 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -74,6 +74,7 @@ #include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_particle.h" +#include "BKE_pointcache.h" #include "BKE_utildefines.h" #include "BKE_scene.h" @@ -1647,6 +1648,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) ob= node->ob; if(ob && (ob->recalc & OB_RECALC)) { all_layer= ob->lay; + /* got an object node that changes, now check relations */ for(itA = node->child; itA; itA= itA->next) { all_layer |= itA->lay; @@ -1720,18 +1722,24 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) } /* node was checked to have lasttime != curtime , and is of type ID_OB */ -static unsigned int flush_layer_node(DagNode *node, int curtime) +static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime) { + Base *base; DagAdjList *itA; node->lasttime= curtime; - node->lay= ((Object *)node->ob)->lay; + node->lay= 0; + for(base= sce->base.first; base; base= base->next) { + if(node->ob == base->object) { + node->lay= ((Object *)node->ob)->lay; + break; + } + } for(itA = node->child; itA; itA= itA->next) { if(itA->node->type==ID_OB) { if(itA->node->lasttime!=curtime) { - itA->lay= flush_layer_node(itA->node, curtime); // lay is only set once for each relation - //printf("layer %d for relation %s to %s\n", itA->lay, ((Object *)node->ob)->id.name, ((Object *)itA->node->ob)->id.name); + itA->lay= flush_layer_node(sce, itA->node, curtime); // lay is only set once for each relation } else itA->lay= itA->node->lay; @@ -1742,11 +1750,32 @@ static unsigned int flush_layer_node(DagNode *node, int curtime) return node->lay; } +/* node was checked to have lasttime != curtime , and is of type ID_OB */ +static void flush_pointcache_reset(DagNode *node, int curtime) +{ + DagAdjList *itA; + Object *ob; + + node->lasttime= curtime; + + for(itA = node->child; itA; itA= itA->next) { + if(itA->node->type==ID_OB) { + if(itA->node->lasttime!=curtime) { + ob= (Object*)(node->ob); + if(BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH)) + ob->recalc |= OB_RECALC_DATA; + flush_pointcache_reset(itA->node, curtime); + } + } + } +} + /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(Scene *sce, unsigned int lay) +void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) { DagNode *firstnode; DagAdjList *itA; + Object *ob; int lasttime; if(sce->theDag==NULL) { @@ -1755,21 +1784,37 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay) } firstnode= sce->theDag->DagNode.first; // always scene node + + for(itA = firstnode->child; itA; itA= itA->next) + itA->lay= 0; /* first we flush the layer flags */ sce->theDag->time++; // so we know which nodes were accessed lasttime= sce->theDag->time; - for(itA = firstnode->child; itA; itA= itA->next) { + + for(itA = firstnode->child; itA; itA= itA->next) if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) - flush_layer_node(itA->node, lasttime); - } + flush_layer_node(sce, itA->node, lasttime); /* then we use the relationships + layer info to flush update events */ sce->theDag->time++; // so we know which nodes were accessed lasttime= sce->theDag->time; - for(itA = firstnode->child; itA; itA= itA->next) { - if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) + for(itA = firstnode->child; itA; itA= itA->next) + if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) flush_update_node(itA->node, lay, lasttime); + + /* if update is not due to time change, do pointcache clears */ + if(!time) { + sce->theDag->time++; // so we know which nodes were accessed + lasttime= sce->theDag->time; + for(itA = firstnode->child; itA; itA= itA->next) { + if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) { + ob= (Object*)(itA->node->ob); + if(BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH)) + ob->recalc |= OB_RECALC_DATA; + flush_pointcache_reset(itA->node, lasttime); + } + } } } @@ -1955,7 +2000,7 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay) } for(sce= scene; sce; sce= sce->set) - DAG_scene_flush_update(sce, lay); + DAG_scene_flush_update(sce, lay, 1); /* test: set time flag, to disable baked systems to update */ for(SETLOOPER(scene, base)) { @@ -2005,7 +2050,9 @@ void DAG_object_flush_update(Scene *sce, Object *ob, short flag) { if(ob==NULL || sce->theDag==NULL) return; + ob->recalc |= flag; + BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH); /* all users of this ob->data should be checked */ /* BUT! displists for curves are still only on cu */ @@ -2018,8 +2065,9 @@ void DAG_object_flush_update(Scene *sce, Object *ob, short flag) else { Object *obt; for (obt=G.main->object.first; obt; obt= obt->id.next) { - if (obt->data==ob->data) { + if (obt != ob && obt->data==ob->data) { obt->recalc |= OB_RECALC_DATA; + BKE_ptcache_object_reset(obt, PTCACHE_RESET_DEPSGRAPH); } } } @@ -2028,9 +2076,9 @@ void DAG_object_flush_update(Scene *sce, Object *ob, short flag) } if(G.curscreen) - DAG_scene_flush_update(sce, dag_screen_view3d_layers()); + DAG_scene_flush_update(sce, dag_screen_view3d_layers(), 0); else - DAG_scene_flush_update(sce, sce->lay); + DAG_scene_flush_update(sce, sce->lay, 0); } /* recursively descends tree, each node only checked once */ -- cgit v1.2.3 From 0b60ff01b4cf3f6cfad294c2cefe9028f6b6f5d3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 12 Apr 2008 14:30:17 +0000 Subject: Fix for bug #6753: metaballs instanced by a particle system did not refresh properly, also fixed a memory leak. --- source/blender/blenkernel/intern/depsgraph.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index ab6cf070a80..f9687880d16 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -610,6 +610,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int if(part->draw_as == PART_DRAW_OB && part->dup_ob) { node2 = dag_get_node(dag, part->dup_ob); dag_add_relation(dag, node, node2, DAG_RL_OB_OB); + if(part->dup_ob->type == OB_MBALL) + dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA); } if(part->draw_as == PART_DRAW_GR && part->dup_group) { -- cgit v1.2.3 From 13ec85aeb5340a02b932875a6ee01d8e3fd679e5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Apr 2008 13:07:56 +0000 Subject: Bug #8950: dependency cycles weren't always printed correct. For debugging, also added a name for each dependency relation, and when a cycle is detected it now prints the full cycle to the console. --- source/blender/blenkernel/intern/depsgraph.c | 175 ++++++++++++++++++--------- 1 file changed, 117 insertions(+), 58 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index f9687880d16..caf5c9e64b4 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -327,9 +327,9 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int 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); + 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); + dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Python Ipo Driver"); oba++; } @@ -340,9 +340,9 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int 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); + 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); + dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver"); } } } @@ -363,7 +363,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int if ((ob->data) && (mask&DAG_RL_DATA)) { node2 = dag_get_node(dag,ob->data); - dag_add_relation(dag,node,node2,DAG_RL_DATA); + dag_add_relation(dag,node,node2,DAG_RL_DATA, "Object-Data Relation"); node2->first_ancestor = ob; node2->ancestor_count += 1; } @@ -388,11 +388,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int node3 = dag_get_node(dag, ct->tar); if (ct->subtarget[0]) - dag_add_relation(dag,node3,node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA); + dag_add_relation(dag,node3,node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, cti->name); else if(ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO)) - dag_add_relation(dag,node3,node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA); + dag_add_relation(dag,node3,node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, cti->name); else - dag_add_relation(dag,node3,node, DAG_RL_OB_DATA); + dag_add_relation(dag,node3,node, DAG_RL_OB_DATA, cti->name); } } @@ -440,7 +440,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int for(amod= strip->modifiers.first; amod; amod= amod->next) { if(amod->ob) { node2 = dag_get_node(dag, amod->ob); - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "NLA Strip Modifier"); } } } @@ -460,46 +460,46 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int switch(ob->partype) { case PARSKEL: - dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Parent"); break; case PARVERT1: case PARVERT3: case PARBONE: - dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Vertex Parent"); break; default: if(ob->parent->type==OB_LATTICE) - dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Lattice Parent"); else if(ob->parent->type==OB_CURVE) { Curve *cu= ob->parent->data; if(cu->flag & CU_PATH) - dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Curve Parent"); else - dag_add_relation(dag,node2,node,DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent"); } else - dag_add_relation(dag,node2,node,DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent"); } /* exception case: parent is duplivert */ if(ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) { - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_OB); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Duplivert"); } addtoroot = 0; } if (ob->track) { node2 = dag_get_node(dag,ob->track); - dag_add_relation(dag,node2,node,DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Track To"); addtoroot = 0; } if (ob->proxy) { node2 = dag_get_node(dag, ob->proxy); - dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB); + 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->dof_ob) { node2 = dag_get_node(dag, cam->dof_ob); - dag_add_relation(dag,node2,node,DAG_RL_OB_OB); + dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Camera DoF"); } } if (ob->transflag & OB_DUPLI) { @@ -509,7 +509,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int if(go->ob) { node2 = dag_get_node(dag, go->ob); /* node2 changes node1, this keeps animations updated in groups?? not logical? */ - dag_add_relation(dag, node2, node, DAG_RL_OB_OB); + dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Dupligroup"); } } } @@ -526,7 +526,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int 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); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Softbody Collision"); } } } @@ -537,18 +537,18 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int Object *mom= find_basis_mball(ob); if(mom!=ob) { node2 = dag_get_node(dag, mom); - dag_add_relation(dag,node,node2,DAG_RL_DATA_DATA|DAG_RL_OB_DATA); // mom depends on children! + dag_add_relation(dag,node,node2,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Metaball"); // mom depends on children! } } else if (ob->type==OB_CURVE) { Curve *cu= ob->data; if(cu->bevobj) { node2 = dag_get_node(dag, cu->bevobj); - dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA); + dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Bevel"); } if(cu->taperobj) { node2 = dag_get_node(dag, cu->taperobj); - dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA); + 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); @@ -558,7 +558,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int Curve *cu= ob->data; if(cu->textoncurve) { node2 = dag_get_node(dag, cu->textoncurve); - dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_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) { @@ -569,7 +569,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int /* ob location depends on itself */ if((paf->flag & PAF_STATIC)==0) - dag_add_relation(dag, node, node, DAG_RL_OB_DATA); + dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation"); listb= pdInitEffectors(ob, paf->group); /* note, makes copy... */ if(listb) { @@ -580,9 +580,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int 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); + 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); + dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Particle Field"); } } @@ -599,25 +599,25 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int for(; psys; psys=psys->next) { ParticleSettings *part= psys->part; - dag_add_relation(dag, node, node, DAG_RL_OB_DATA); + dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation"); 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); - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Keyed Physics"); } if(part->draw_as == PART_DRAW_OB && part->dup_ob) { node2 = dag_get_node(dag, part->dup_ob); - dag_add_relation(dag, node, node2, DAG_RL_OB_OB); + dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation"); if(part->dup_ob->type == OB_MBALL) - dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA); + dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Object Visualisation"); } if(part->draw_as == PART_DRAW_GR && part->dup_group) { for(go=part->dup_group->gobject.first; go; go=go->next) { node2 = dag_get_node(dag, go->ob); - dag_add_relation(dag, node, node2, DAG_RL_OB_OB); + dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Group Visualisation"); } } @@ -632,22 +632,22 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int 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); + 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); + 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); + 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); + 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); + dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Reactor"); } } } @@ -672,12 +672,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int node2 = dag_get_node(dag, obt); if (ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO)) - dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB); + dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name); else { if (ELEM3(obt->type, OB_ARMATURE, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) - dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB); + dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name); else - dag_add_relation(dag, node2, node, DAG_RL_OB_OB); + dag_add_relation(dag, node2, node, DAG_RL_OB_OB, cti->name); } addtoroot = 0; } @@ -688,7 +688,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int } if (addtoroot == 1 ) - dag_add_relation(dag,scenenode,node,DAG_RL_SCENE); + dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene Relation"); } struct DagForest *build_dag(struct Scene *sce, short mask) @@ -879,7 +879,7 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel) +void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) { DagAdjList *itA = fob1->child; @@ -897,10 +897,11 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel itA->type = rel; itA->count = 1; itA->next = fob1->child; + itA->name = name; fob1->child = itA; } -static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel) +static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) { DagAdjList *itA = fob2->parent; @@ -918,9 +919,66 @@ static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *f itA->type = rel; itA->count = 1; itA->next = fob2->parent; + itA->name = name; fob2->parent = itA; } +static char *dag_node_name(DagNode *node) +{ + if(node->ob == NULL) + return "null"; + else if(ugly_hack_sorry) + return ((ID*)(node->ob))->name+2; + else + return ((bPoseChannel*)(node->ob))->name; +} + +#if 0 +static void dag_node_print_dependencies(DagNode *node) +{ + DagAdjList *itA; + + printf("%s depends on:\n", dag_node_name(node)); + + for(itA= node->parent; itA; itA= itA->next) + printf(" %s through %s\n", dag_node_name(itA->node), itA->name); + printf("\n"); +} +#endif + +static int dag_node_print_dependency_recurs(DagNode *node, DagNode *endnode) +{ + DagAdjList *itA; + + if(node->color == DAG_BLACK) + return 0; + + node->color= DAG_BLACK; + + if(node == endnode) + return 1; + + for(itA= node->parent; itA; itA= itA->next) { + if(dag_node_print_dependency_recurs(itA->node, endnode)) { + printf(" %s depends on %s through %s.\n", dag_node_name(node), dag_node_name(itA->node), itA->name); + return 1; + } + } + + return 0; +} + +static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, DagNode *endnode, char *name) +{ + DagNode *node; + + for(node = dag->DagNode.first; node; node= node->next) + node->color= DAG_WHITE; + + printf(" %s depends on %s through %s.\n", dag_node_name(endnode), dag_node_name(startnode), name); + dag_node_print_dependency_recurs(startnode, endnode); + printf("\n"); +} /* * MainDAG is the DAG of all objects in current scene @@ -2204,9 +2262,10 @@ static void pose_check_cycle(DagForest *dag) bPoseChannel *pchan= (bPoseChannel *)node->ob; bPoseChannel *parchan= (bPoseChannel *)itA->node->ob; - if(pchan && parchan) - if(pchan->parent!=parchan) - printf("Cycle in %s to %s\n", pchan->name, parchan->name); + if(pchan && parchan) { + printf("Cycle detected:\n"); + dag_node_print_dependency_cycle(dag, itA->node, node, itA->name); + } } } } @@ -2240,8 +2299,8 @@ void DAG_pose_sort(Object *ob) if(pchan->parent) { node2 = dag_get_node(dag, pchan->parent); - dag_add_relation(dag, node2, node, 0); - dag_add_parent_relation(dag, node2, node, 0); + 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) { @@ -2259,8 +2318,8 @@ void DAG_pose_sort(Object *ob) bPoseChannel *target= get_pose_channel(ob->pose, icu->driver->name); if(target) { node2 = dag_get_node(dag, target); - dag_add_relation(dag, node2, node, 0); - dag_add_parent_relation(dag, node2, node, 0); + 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, @@ -2279,9 +2338,9 @@ void DAG_pose_sort(Object *ob) bPoseChannel *target= get_pose_channel(ob->pose, ct->subtarget); if (target) { node2= dag_get_node(dag, target); - dag_add_relation(dag, node2, node, 0); - dag_add_parent_relation(dag, node2, node, 0); - + 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; bPoseChannel *parchan; @@ -2296,8 +2355,8 @@ void DAG_pose_sort(Object *ob) /* Walk to the chain's root */ while (parchan) { node3= dag_get_node(dag, parchan); - dag_add_relation(dag, node2, node3, 0); - dag_add_parent_relation(dag, node2, node3, 0); + 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 @@ -2313,8 +2372,8 @@ void DAG_pose_sort(Object *ob) } } if (addtoroot == 1 ) { - dag_add_relation(dag, rootnode, node, 0); - dag_add_parent_relation(dag, rootnode, node, 0); + dag_add_relation(dag, rootnode, node, 0, "Root Bone Relation"); + dag_add_parent_relation(dag, rootnode, node, 0, "Root Bone Relation"); } } -- cgit v1.2.3 From 5d0a207ecb843c4c73be897cfccbf3a0d2db574b Mon Sep 17 00:00:00 2001 From: Chris Want Date: Wed, 16 Apr 2008 22:40:48 +0000 Subject: Patch from GSR that a) fixes a whole bunch of GPL/BL license blocks that were previously missed; and b) greatly increase my ohloh stats! --- source/blender/blenkernel/intern/depsgraph.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index caf5c9e64b4..eb59ed885a9 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1,15 +1,12 @@ /** * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +22,7 @@ * * Contributor(s): none yet. * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ #include -- cgit v1.2.3 From d00a0e56f69c00748c635bb06860041a8726d9fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Apr 2008 02:19:46 +0000 Subject: fix for [#8236] Lens Change by driver won't update in 3d View Lamps would not update either. --- source/blender/blenkernel/intern/depsgraph.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index eb59ed885a9..5b84617f8d5 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -46,6 +46,7 @@ #include "DNA_effect_types.h" #include "DNA_group_types.h" #include "DNA_lattice_types.h" +#include "DNA_lamp_types.h" #include "DNA_key_types.h" #include "DNA_mesh_types.h" #include "DNA_modifier_types.h" @@ -494,11 +495,20 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int } if (ob->type==OB_CAMERA) { Camera *cam = (Camera *)ob->data; + if (cam->ipo) { + dag_add_driver_relation(cam->ipo, 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 (ob->transflag & OB_DUPLI) { if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { GroupObject *go; -- cgit v1.2.3 From c3d36b0a4bec7b51e328fec1fa4f9ae9b34ce47d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 22 Apr 2008 21:53:30 +0000 Subject: Fix for bug #9654: point cache was being reset too often, made transforming unrelated objects slow. --- source/blender/blenkernel/intern/depsgraph.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 5b84617f8d5..9d8007e8184 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1818,7 +1818,7 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime) } /* node was checked to have lasttime != curtime , and is of type ID_OB */ -static void flush_pointcache_reset(DagNode *node, int curtime) +static void flush_pointcache_reset(DagNode *node, int curtime, int reset) { DagAdjList *itA; Object *ob; @@ -1829,9 +1829,15 @@ static void flush_pointcache_reset(DagNode *node, int curtime) if(itA->node->type==ID_OB) { if(itA->node->lasttime!=curtime) { ob= (Object*)(node->ob); - if(BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH)) - ob->recalc |= OB_RECALC_DATA; - flush_pointcache_reset(itA->node, curtime); + + if(reset || (ob->recalc & OB_RECALC)) { + if(BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH)) + ob->recalc |= OB_RECALC_DATA; + + flush_pointcache_reset(itA->node, curtime, 1); + } + else + flush_pointcache_reset(itA->node, curtime, 0); } } } @@ -1877,9 +1883,15 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) for(itA = firstnode->child; itA; itA= itA->next) { if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) { ob= (Object*)(itA->node->ob); - if(BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH)) - ob->recalc |= OB_RECALC_DATA; - flush_pointcache_reset(itA->node, lasttime); + + if(ob->recalc & OB_RECALC) { + if(BKE_ptcache_object_reset(ob, PTCACHE_RESET_DEPSGRAPH)) + ob->recalc |= OB_RECALC_DATA; + + flush_pointcache_reset(itA->node, lasttime, 1); + } + else + flush_pointcache_reset(itA->node, lasttime, 0); } } } -- cgit v1.2.3 From 57c1fbe5579b786ee24e58ad1d67ca5ad0625f76 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 Apr 2008 18:26:20 +0000 Subject: remove old particle system. also removed quat, dquat, and sumohandle from the Object struct since they aren't used anywhere. --- source/blender/blenkernel/intern/depsgraph.c | 40 +--------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 9d8007e8184..1331c9a7d12 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -568,36 +568,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int 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; @@ -1987,15 +1958,6 @@ static void dag_object_time_update_flags(Object *ob) 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)) { -- cgit v1.2.3 From 6a97a2ab33b84a7f95616b1923227eb6c61ae156 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 9 May 2008 12:39:56 +0000 Subject: Fix for bug #8919: uv shadow mesh doesn't update without 3d view open. Made it so that the dependency graph besides the visible layers, also updates the edited object. --- source/blender/blenkernel/intern/depsgraph.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 1331c9a7d12..f7b1f7930f9 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1691,7 +1691,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) for(itA = node->child; itA; itA= itA->next) { all_layer |= itA->lay; /* the relationship is visible */ - if(itA->lay & layer) { + if((itA->lay & layer) || (itA->node->ob == G.obedit)) { if(itA->node->type==ID_OB) { obc= itA->node->ob; oldflag= obc->recalc; @@ -1722,7 +1722,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) } } /* even nicer, we can clear recalc flags... */ - if((all_layer & layer)==0) { + if((all_layer & layer)==0 && (ob != G.obedit)) { /* but existing displaylists or derivedmesh should be freed */ if(ob->recalc & OB_RECALC_DATA) object_free_display(ob); @@ -1736,7 +1736,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) /* 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) || (itA->node->ob == G.obedit)) { if(itA->node->type==ID_OB) { obc= itA->node->ob; /* child moves */ -- cgit v1.2.3 From 7e93f5569db733a0d7a7bb30b1075266a0247cec Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 9 May 2008 13:04:36 +0000 Subject: Fix for bug #10475: added more dependencies for physics systems with deflectors and fields for proper dependency graph updates. --- source/blender/blenkernel/intern/depsgraph.c | 37 ++++++++++++++++------------ 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index f7b1f7930f9..80f450000bb 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -346,6 +346,24 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int } } +static void dag_add_collision_field_relation(DagForest *dag, 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 = 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->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) { bConstraint *con; @@ -523,22 +541,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int } /* 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, ob, node); if (ob->type==OB_MBALL) { Object *mom= find_basis_mball(ob); -- cgit v1.2.3 From d7fecc9e963d8823d3e6a045c96d3a166ac031a6 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Fri, 25 Jul 2008 18:57:16 +0000 Subject: Fluid control: WIP commit before weekend, not working is crashing on the first 3 frames --- source/blender/blenkernel/intern/depsgraph.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 80f450000bb..9dc89a49196 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1963,12 +1963,6 @@ static void dag_object_time_update_flags(Object *ob) ob->shapeflag &= ~OB_SHAPE_TEMPLOCK; } } - 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; -- cgit v1.2.3 From 1c44562d64b5031d0b0a86553fa563a1d9434f3d Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Wed, 10 Sep 2008 11:40:30 +0000 Subject: Bugfix [#12033] Cloth and Softbody don't work with Object Actions (fix pointed out by Aligorith. Ton: You might like to look over this) --- source/blender/blenkernel/intern/depsgraph.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 80f450000bb..1be0a2aafdb 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1924,8 +1924,10 @@ static void dag_object_time_update_flags(Object *ob) } } } - 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; } @@ -1946,10 +1948,11 @@ static void dag_object_time_update_flags(Object *ob) } } } - 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 { + + 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; -- cgit v1.2.3 From 0922ecee93e09e0d608710a0e82258ecaba949d1 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Tue, 16 Sep 2008 18:40:54 +0000 Subject: "Fix" for #17636 Crashing bug - won't open a file - The cause was indeed corrupted particle settings which should have caused a deletion of the whole particle system. However the particle modifier was still left and that led to the crash. - A "fix" because there's really no way of knowing what caused the corruption of the particle settings. If anyone else gets this and can recreate I'd love to get a .blend. Now that there shouldn't be a crash anymore the symptom will be a missing particle system after file load in an object that had a particle system before. --- source/blender/blenkernel/intern/depsgraph.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 1be0a2aafdb..d958c43aa40 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -581,9 +581,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int 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); -- cgit v1.2.3 From a15296eff6ea2820694a5b1aedd7c17f9268ac71 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 19 Sep 2008 22:03:16 +0000 Subject: Small dependency debugging aid: now it also prints cycles for the object depsgrah instead of only armatures. --- source/blender/blenkernel/intern/depsgraph.c | 144 ++++++++++++++------------- 1 file changed, 75 insertions(+), 69 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index d958c43aa40..11e61989dfa 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -865,12 +865,12 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) 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; @@ -879,20 +879,23 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel } /* 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; @@ -901,12 +904,12 @@ static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *f } /* 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) @@ -966,6 +969,63 @@ static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, 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 @@ -1603,6 +1663,8 @@ void DAG_scene_sort(struct Scene *sce) 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) { @@ -2212,57 +2274,6 @@ void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay) /* ******************* 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) { @@ -2292,7 +2303,6 @@ 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) { @@ -2311,7 +2321,6 @@ void DAG_pose_sort(Object *ob) 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, @@ -2331,7 +2340,6 @@ void DAG_pose_sort(Object *ob) 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; @@ -2348,7 +2356,6 @@ void DAG_pose_sort(Object *ob) 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 @@ -2365,11 +2372,10 @@ void DAG_pose_sort(Object *ob) } 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; -- cgit v1.2.3 From ac4ff83ca6b5795f4451a7e743d3975aeb17ae3b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 28 Oct 2008 18:47:13 +0000 Subject: added scons option BF_WITH_PYTHON (defined as DISABLE_PYTHON) --- source/blender/blenkernel/intern/depsgraph.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 7f4910a9765..6914de29d43 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -79,7 +79,9 @@ #include "MEM_guardedalloc.h" #include "blendef.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "depsgraph_private.h" @@ -313,6 +315,7 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int if ((icu->driver->flag & IPO_DRIVER_FLAG_INVALID) || (icu->driver->name[0] == '\0')) continue; /* empty or invalid expression */ +#ifndef DISABLE_PYTHON else { /* now we need refs to all objects mentioned in this * pydriver expression, to call 'dag_add_relation' @@ -334,6 +337,7 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int MEM_freeN(obarray); } } +#endif /* DISABLE_PYTHON */ } else if (icu->driver->ob) { node1 = dag_get_node(dag, icu->driver->ob); -- cgit v1.2.3 From baf98b098ca7ff03850fb4b2ce245081a55a76e9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 30 Oct 2008 16:03:38 +0000 Subject: Fix for dependency graph cycle print, regular "Parent" relation was incorrectly printed as "Curve Parent". --- source/blender/blenkernel/intern/depsgraph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/depsgraph.c') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 6914de29d43..59619b25f8b 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -495,8 +495,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int 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)) { -- cgit v1.2.3