Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-07-05 07:55:28 +0400
committerJoshua Leung <aligorith@gmail.com>2010-07-05 07:55:28 +0400
commitfaf1c9a4bb27dfdd843cc745707d15ab47ce8683 (patch)
treef57e5bdca9359ff2b80c02f3cf0053b9842b55ca /source/blender/blenkernel/intern/depsgraph.c
parent02b0188c163343cf1e21123b33cf98d3beb606c2 (diff)
Bugfix #22685: Screen update slow, animation player ALT-A, files created with 2.4x
Modifiers were being mistakenly recalculated at every frame as long as the object had animation, slowing things down due to incorrect depsgraph recalc tags. Renamed OB_RECALC -> OB_RECALC_ALL to reduce future confusion. During this process, I noticed a few dubious usages of OB_RECALC, so it's best to use this commit as a guide of places to check on. Apart from the place responsible for this bug, I haven't changed any OB_RECALC -> OB_RECALC_OB/DATA in case that introduces more unforseen bugs now, making it more difficult to track the problems later (rename + value change can be confusing to identify the genuine typos).
Diffstat (limited to 'source/blender/blenkernel/intern/depsgraph.c')
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 4be5cce38a8..c1223a5c37f 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1754,7 +1754,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
node->lasttime= curtime;
ob= node->ob;
- if(ob && (ob->recalc & OB_RECALC)) {
+ if(ob && (ob->recalc & OB_RECALC_ALL)) {
all_layer= node->scelay;
/* got an object node that changes, now check relations */
@@ -1797,7 +1797,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
if(ob->recalc & OB_RECALC_DATA)
object_free_display(ob);
- ob->recalc &= ~OB_RECALC;
+ ob->recalc &= ~OB_RECALC_ALL;
}
}
@@ -1810,7 +1810,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
if(itA->node->type==ID_OB) {
obc= itA->node->ob;
/* child moves */
- if((obc->recalc & OB_RECALC)==OB_RECALC_OB) {
+ if((obc->recalc & OB_RECALC_ALL)==OB_RECALC_OB) {
/* parent has deforming info */
if(itA->type & (DAG_RL_OB_DATA|DAG_RL_DATA_DATA)) {
// printf("parent %s changes ob %s\n", ob->id.name, obc->id.name);
@@ -1864,7 +1864,7 @@ static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int
if(itA->node->lasttime!=curtime) {
ob= (Object*)(node->ob);
- if(reset || (ob->recalc & OB_RECALC)) {
+ if(reset || (ob->recalc & OB_RECALC_ALL)) {
if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH))
ob->recalc |= OB_RECALC_DATA;
@@ -1946,7 +1946,7 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time)
if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) {
ob= (Object*)(itA->node->ob);
- if(ob->recalc & OB_RECALC) {
+ if(ob->recalc & OB_RECALC_ALL) {
if(BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH))
ob->recalc |= OB_RECALC_DATA;
@@ -1962,11 +1962,30 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time)
static int object_modifiers_use_time(Object *ob)
{
ModifierData *md;
-
+
+ /* check if a modifier in modifier stack needs time input */
for (md=ob->modifiers.first; md; md=md->next)
if (modifier_dependsOnTime(md))
return 1;
-
+
+ /* check whether any modifiers are animated */
+ if (ob->adt) {
+ AnimData *adt = ob->adt;
+
+ /* action - check for F-Curves with paths containing 'modifiers[' */
+ if (adt->action) {
+ FCurve *fcu;
+
+ for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
+ if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
+ return 1;
+ }
+ }
+
+ // XXX: also, should check NLA strips, though for now assume that nobody uses
+ // that and we can omit that for performance reasons...
+ }
+
return 0;
}
@@ -2026,14 +2045,14 @@ static void dag_object_time_update_flags(Object *ob)
/* this case is for groups with nla, whilst nla target has no action or nla */
for(strip= ob->nlastrips.first; strip; strip= strip->next) {
if(strip->object)
- strip->object->recalc |= OB_RECALC;
+ strip->object->recalc |= OB_RECALC_ALL;
}
}
}
#endif // XXX old animation system
if(animdata_use_time(ob->adt)) {
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_OB;
ob->adt->recalc |= ADT_RECALC_ANIM;
}
@@ -2276,7 +2295,7 @@ void DAG_id_flush_update(ID *id, short flag)
/* set flags & pointcache for object */
if(GS(id->name) == ID_OB) {
ob= (Object*)id;
- ob->recalc |= (flag & OB_RECALC);
+ ob->recalc |= (flag & OB_RECALC_ALL);
BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH);
if(flag & OB_RECALC_DATA) {
@@ -2331,7 +2350,7 @@ void DAG_id_flush_update(ID *id, short flag)
for(obt=bmain->object.first; obt; obt= obt->id.next) {
Key *key= ob_get_key(obt);
if(!(ob && obt == ob) && ((ID *)key == id)) {
- obt->flag |= (OB_RECALC|OB_RECALC_DATA);
+ obt->flag |= (OB_RECALC_OB|OB_RECALC_DATA);
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
}
}
@@ -2344,7 +2363,7 @@ void DAG_id_flush_update(ID *id, short flag)
for(psys=obt->particlesystem.first; psys; psys=psys->next) {
if(&psys->part->id == id) {
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
- obt->recalc |= (flag & OB_RECALC);
+ obt->recalc |= (flag & OB_RECALC_ALL);
psys->recalc |= (flag & PSYS_RECALC);
}
}
@@ -2424,7 +2443,7 @@ void DAG_id_update_flags(ID *id)
GroupObject *go;
/* primitive; tag all... this call helps building groups for particles */
for(go= group->gobject.first; go; go= go->next)
- go->ob->recalc= OB_RECALC;
+ go->ob->recalc= OB_RECALC_ALL;
}
}
else {