diff options
author | Ton Roosendaal <ton@blender.org> | 2009-02-09 18:50:09 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-02-09 18:50:09 +0300 |
commit | f33309b0285079c14a8f9fc913157129ff6cbc81 (patch) | |
tree | a9a1e7dd869b8c09a8e8c1411bf995ddeb5703c3 /source/blender/blenkernel/intern | |
parent | c58d336a33b4105530af326dccef077ba0274fa6 (diff) |
2.5
- Added depsgraph tag for object-change in AnimData, so the
new animsys doesn't have to all objects anymore.
(Still WIP, depsgraph has to do this much better)
- Bugfix in notifiers; only 1 notifier was handled for
frame updates
Result: 2 windows, displaying 2 scenes, now can be edited
independently, and play independent. Not when they share
data, of course. :)
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 56 |
3 files changed, 49 insertions, 41 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 8bc914d5be0..a7e65a9c585 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -587,7 +587,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re * - NLA before Active Action, as Active Action behaves as 'tweaking track' * that overrides 'rough' work in NLA */ - if ((recalc & ADT_RECALC_ANIM) /*|| (adt->recalc & ADT_RECALC_ANIM)*/) // XXX for now,don't check yet, as depsgraph doesn't know this yet + if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) { /* evaluate NLA data */ if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) @@ -599,6 +599,9 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re // FIXME: what if the solo track was not tweaking one, then nla-solo should be checked too? if (adt->action) animsys_evaluate_action(&id_ptr, adt->action, adt->remap, ctime); + + /* reset tag */ + adt->recalc &= ~ADT_RECALC_ANIM; } /* recalculate drivers @@ -639,29 +642,29 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) printf("Evaluate all animation - %f \n", ctime); /* macro for less typing */ -#define EVAL_ANIM_IDS(first) \ +#define EVAL_ANIM_IDS(first, flag) \ for (id= first; id; id= id->next) { \ AnimData *adt= BKE_animdata_from_id(id); \ - BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM); \ + BKE_animsys_evaluate_animdata(id, adt, ctime, flag); \ } /* nodes */ // TODO... /* textures */ - EVAL_ANIM_IDS(main->tex.first); + EVAL_ANIM_IDS(main->tex.first, ADT_RECALC_ANIM); /* lamps */ - EVAL_ANIM_IDS(main->lamp.first); + EVAL_ANIM_IDS(main->lamp.first, ADT_RECALC_ANIM); /* materials */ - EVAL_ANIM_IDS(main->mat.first); + EVAL_ANIM_IDS(main->mat.first, ADT_RECALC_ANIM); /* cameras */ - EVAL_ANIM_IDS(main->camera.first); + EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM); /* shapekeys */ - EVAL_ANIM_IDS(main->key.first); + EVAL_ANIM_IDS(main->key.first, ADT_RECALC_ANIM); /* curves */ // TODO... @@ -670,13 +673,13 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) // TODO... /* objects */ - EVAL_ANIM_IDS(main->object.first); + EVAL_ANIM_IDS(main->object.first, 0); /* worlds */ - EVAL_ANIM_IDS(main->world.first); + EVAL_ANIM_IDS(main->world.first, ADT_RECALC_ANIM); /* scenes */ - EVAL_ANIM_IDS(main->scene.first); + EVAL_ANIM_IDS(main->scene.first, ADT_RECALC_ANIM); } /* ***************************************** */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 265fb1258a1..0f48133efc7 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -324,7 +324,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node /* 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(fcu->driver); + Object **obarray = NULL; // XXX BPY_pydriver_get_objects(fcu->driver); if (obarray) { Object *ob, **oba = obarray; @@ -2045,7 +2045,12 @@ static void dag_object_time_update_flags(Object *ob) } } #endif // XXX old animation system - if(animdata_use_time(ob->adt)) ob->recalc |= OB_RECALC; + + 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; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9cdd67428ac..7b3ac9e4ec2 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -565,16 +565,44 @@ int scene_check_setscene(Scene *sce) return 1; } +/* This (evil) function is needed to cope with two legacy Blender rendering features +* mblur (motion blur that renders 'subframes' and blurs them together), and fields +* rendering. Thus, the use of ugly globals from object.c +*/ +// BAD... EVIL... JUJU...!!!! +// XXX moved here temporarily +float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in object.c */ +{ + extern float bluroffs; /* bad stuff borrowed from object.c */ + extern float fieldoffs; + float ctime; + + ctime= (float)cfra; + ctime+= bluroffs+fieldoffs; + ctime*= scene->r.framelen; + + return ctime; +} + static void scene_update(Scene *sce, unsigned int lay) { Base *base; Object *ob; + float ctime = frame_to_float(sce, sce->r.cfra); if(sce->theDag==NULL) DAG_scene_sort(sce); DAG_scene_update_flags(sce, lay); // only stuff that moves or needs display still + /* All 'standard' (i.e. without any dependencies) animation is handled here, + * with an 'local' to 'macro' order of evaluation. This should ensure that + * settings stored nestled within a hierarchy (i.e. settings in a Texture block + * can be overridden by settings from Scene, which owns the Texture through a hierarchy + * such as Scene->World->MTex/Texture) can still get correctly overridden. + */ + BKE_animsys_evaluate_all_animation(G.main, ctime); + for(base= sce->base.first; base; base= base->next) { ob= base->object; @@ -588,43 +616,15 @@ static void scene_update(Scene *sce, unsigned int lay) } } -/* This (evil) function is needed to cope with two legacy Blender rendering features - * mblur (motion blur that renders 'subframes' and blurs them together), and fields - * rendering. Thus, the use of ugly globals from object.c - */ -// BAD... EVIL... JUJU...!!!! -// XXX moved here temporarily -float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in object.c */ -{ - extern float bluroffs; /* bad stuff borrowed from object.c */ - extern float fieldoffs; - float ctime; - - ctime= (float)cfra; - ctime+= bluroffs+fieldoffs; - ctime*= scene->r.framelen; - - return ctime; -} /* applies changes right away, does all sets too */ void scene_update_for_newframe(Scene *sce, unsigned int lay) { Scene *scene= sce; - float ctime = frame_to_float(sce, sce->r.cfra); /* clear animation overrides */ // XXX TODO... - /* All 'standard' (i.e. without any dependencies) animation is handled here, - * with an 'local' to 'macro' order of evaluation. This should ensure that - * settings stored nestled within a hierarchy (i.e. settings in a Texture block - * can be overridden by settings from Scene, which owns the Texture through a hierarchy - * such as Scene->World->MTex/Texture) can still get correctly overridden. - */ - BKE_animsys_evaluate_all_animation(G.main, ctime); - - #ifndef DISABLE_PYTHON if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0); #endif |