[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29962] trunk/blender/source/blender: Bugfix #22685: Screen update slow, animation player ALT-A, files created with 2.4x
Joshua Leung
aligorith at gmail.com
Mon Jul 5 05:55:30 CEST 2010
Revision: 29962
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29962
Author: aligorith
Date: 2010-07-05 05:55:28 +0200 (Mon, 05 Jul 2010)
Log Message:
-----------
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).
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/depsgraph.c
trunk/blender/source/blender/blenkernel/intern/exotic.c
trunk/blender/source/blender/blenkernel/intern/library.c
trunk/blender/source/blender/blenkernel/intern/object.c
trunk/blender/source/blender/blenkernel/intern/particle_system.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/editors/animation/anim_channels_defines.c
trunk/blender/source/blender/editors/animation/anim_deps.c
trunk/blender/source/blender/editors/animation/anim_filter.c
trunk/blender/source/blender/editors/animation/keyingsets.c
trunk/blender/source/blender/editors/include/ED_anim_api.h
trunk/blender/source/blender/editors/object/object_add.c
trunk/blender/source/blender/editors/object/object_edit.c
trunk/blender/source/blender/editors/object/object_relations.c
trunk/blender/source/blender/editors/transform/transform_conversions.c
trunk/blender/source/blender/editors/transform/transform_generics.c
trunk/blender/source/blender/makesdna/DNA_object_types.h
trunk/blender/source/blender/makesrna/intern/rna_access.c
trunk/blender/source/blender/makesrna/intern/rna_curve.c
trunk/blender/source/blender/makesrna/intern/rna_object_force.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
Modified: trunk/blender/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/depsgraph.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/blenkernel/intern/depsgraph.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -1754,7 +1754,7 @@
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 @@
if(ob->recalc & OB_RECALC_DATA)
object_free_display(ob);
- ob->recalc &= ~OB_RECALC;
+ ob->recalc &= ~OB_RECALC_ALL;
}
}
@@ -1810,7 +1810,7 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
/* 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 @@
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 @@
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 @@
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 {
Modified: trunk/blender/source/blender/blenkernel/intern/exotic.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/exotic.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/blenkernel/intern/exotic.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -4071,7 +4071,7 @@
ob->dupon= 1; ob->dupoff= 0;
ob->dupsta= 1; ob->dupend= 100;
- ob->recalc= OB_RECALC; /* needed because of weird way of adding libdata directly */
+ ob->recalc= OB_RECALC_ALL; /* needed because of weird way of adding libdata directly */
ob->data= obdata;
((ID*)ob->data)->us++;
Modified: trunk/blender/source/blender/blenkernel/intern/library.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/library.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/blenkernel/intern/library.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -445,7 +445,7 @@
/* flag for full recalc */
for(ob=main->object.first; ob; ob=ob->id.next)
if(ob->id.lib)
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
}
/* note: MAX_LIBARRAY define should match this code */
Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/blenkernel/intern/object.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -317,7 +317,7 @@
if (*obpoin==unlinkOb) {
*obpoin = NULL;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL; // XXX: should this just be OB_RECALC_DATA?
}
}
@@ -357,7 +357,7 @@
if(obt->parent==ob) {
obt->parent= NULL;
- obt->recalc |= OB_RECALC;
+ obt->recalc |= OB_RECALC_ALL;
}
modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
@@ -367,15 +367,15 @@
if(cu->bevobj==ob) {
cu->bevobj= NULL;
- obt->recalc |= OB_RECALC;
+ obt->recalc |= OB_RECALC_ALL;
}
if(cu->taperobj==ob) {
cu->taperobj= NULL;
- obt->recalc |= OB_RECALC;
+ obt->recalc |= OB_RECALC_ALL;
}
if(cu->textoncurve==ob) {
cu->textoncurve= NULL;
- obt->recalc |= OB_RECALC;
+ obt->recalc |= OB_RECALC_ALL;
}
}
else if(obt->type==OB_ARMATURE && obt->pose) {
@@ -1087,7 +1087,7 @@
base= scene_add_base(scene, ob);
scene_select_base(scene, base);
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
return ob;
}
@@ -1533,7 +1533,7 @@
ob->proxy_group= gob;
id_lib_extern(&target->id);
- ob->recalc= target->recalc= OB_RECALC;
+ ob->recalc= target->recalc= OB_RECALC_ALL;
/* copy transform */
if(gob) {
@@ -2474,14 +2474,15 @@
/* requires flags to be set! */
void object_handle_update(Scene *scene, Object *ob)
{
- if(ob->recalc & OB_RECALC) {
+ if(ob->recalc & OB_RECALC_ALL) {
/* speed optimization for animation lookups */
if(ob->pose)
make_pose_channels_hash(ob->pose);
/* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers,
which is only in where_is_object now */
- if(ob->recalc & OB_RECALC) {
+ // XXX: should this case be OB_RECALC_OB instead?
+ if(ob->recalc & OB_RECALC_ALL) {
if (G.f & G_DEBUG)
printf("recalcob %s\n", ob->id.name+2);
@@ -2623,7 +2624,7 @@
object_handle_update(scene, ob->proxy);
}
- ob->recalc &= ~OB_RECALC;
+ ob->recalc &= ~OB_RECALC_ALL;
}
/* the case when this is a group proxy, object_update is called in group.c */
Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -3943,7 +3943,7 @@
BKE_animsys_evaluate_animdata(&part->id, part->adt, cfra, ADT_RECALC_DRIVERS);
/* TODO: only free child paths in case of PSYS_RECALC_CHILD */
- if(psys->recalc & PSYS_RECALC || ob->recalc & OB_RECALC)
+ if(psys->recalc & PSYS_RECALC || ob->recalc & OB_RECALC_ALL)
psys_free_path_cache(psys, NULL);
if(psys->recalc & PSYS_RECALC_CHILD)
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -2244,7 +2244,7 @@
}
if(rebuild) {
- ob->recalc= OB_RECALC;
+ ob->recalc= OB_RECALC_ALL;
pose->flag |= POSE_RECALC;
}
}
@@ -3458,7 +3458,7 @@
/* this triggers object_update to always use a copy */
ob->proxy->proxy_from= ob;
/* force proxy updates after load/undo, a bit weak */
- ob->recalc= ob->proxy->recalc= OB_RECALC;
+ ob->recalc= ob->proxy->recalc= OB_RECALC_ALL;
}
}
ob->proxy_group= newlibadr(fd, ob->id.lib, ob->proxy_group);
@@ -7892,7 +7892,7 @@
if(ob->type==OB_ARMATURE) {
if(ob->pose)
ob->pose->flag |= POSE_RECALC;
- ob->recalc |= OB_RECALC; // cannot call stuff now (pointers!), done in setup_app_data
+ ob->recalc |= OB_RECALC_ALL; // cannot call stuff now (pointers!), done in setup_app_data
/* new generic xray option */
arm= newlibadr(fd, lib, ob->data);
@@ -12069,7 +12069,7 @@
base= scene_add_base(scene, ob);
base->flag |= SELECT;
base->object->flag= base->flag;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
scene->basact= base;
/* assign the group */
Modified: trunk/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_defines.c 2010-07-05 03:54:27 UTC (rev 29961)
+++ trunk/blender/source/blender/editors/animation/anim_channels_defines.c 2010-07-05 03:55:28 UTC (rev 29962)
@@ -3206,6 +3206,7 @@
*/
if ((draw_sliders) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_SHAPEKEY)) {
/* adjust offset */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list