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. :)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/* ***************************************** */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -565,33 +565,10 @@ int scene_check_setscene(Scene *sce)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void scene_update(Scene *sce, unsigned int lay)
|
||||
{
|
||||
Base *base;
|
||||
Object *ob;
|
||||
|
||||
if(sce->theDag==NULL)
|
||||
DAG_scene_sort(sce);
|
||||
|
||||
DAG_scene_update_flags(sce, lay); // only stuff that moves or needs display still
|
||||
|
||||
for(base= sce->base.first; base; base= base->next) {
|
||||
ob= base->object;
|
||||
|
||||
object_handle_update(sce, ob); // bke_object.h
|
||||
|
||||
/* only update layer when an ipo */
|
||||
// XXX old animation system
|
||||
//if(ob->ipo && has_ipo_code(ob->ipo, OB_LAY) ) {
|
||||
// base->lay= ob->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
|
||||
*/
|
||||
* 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 */
|
||||
@@ -607,24 +584,47 @@ float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in objec
|
||||
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;
|
||||
|
||||
object_handle_update(sce, ob); // bke_object.h
|
||||
|
||||
/* only update layer when an ipo */
|
||||
// XXX old animation system
|
||||
//if(ob->ipo && has_ipo_code(ob->ipo, OB_LAY) ) {
|
||||
// base->lay= ob->lay;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -1002,6 +1002,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
|
||||
delta = RNA_int_get(op->ptr, "delta");
|
||||
|
||||
CTX_data_scene(C)->r.cfra += delta;
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -1760,7 +1761,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
|
||||
scene->r.cfra= scene->r.sfra;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
|
||||
/* ************** Notifiers ****************** */
|
||||
|
||||
typedef struct wmNotifier {
|
||||
struct wmNotifier *prev, *next;
|
||||
struct wmNotifier *next, *prev;
|
||||
|
||||
struct wmWindowManager *wm;
|
||||
struct wmWindow *window;
|
||||
@@ -162,9 +162,9 @@ typedef struct wmNotifier {
|
||||
|
||||
/* NC_SCREEN screen */
|
||||
#define ND_SCREENBROWSE (1<<16)
|
||||
#define ND_SCENEBROWSE (2<<16)
|
||||
|
||||
/* NC_SCENE Scene */
|
||||
#define ND_SCENEBROWSE (1<<16)
|
||||
#define ND_MARKERS (2<<16)
|
||||
#define ND_FRAME (3<<16)
|
||||
#define ND_RENDER_OPTIONS (4<<16)
|
||||
|
||||
@@ -162,29 +162,33 @@ void wm_event_do_notifiers(bContext *C)
|
||||
wmWindow *win;
|
||||
|
||||
for(win= wm->windows.first; win; win= win->next) {
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
|
||||
/* XXX context in notifiers? */
|
||||
CTX_wm_window_set(C, win);
|
||||
|
||||
/* printf("notifier win %d screen %s\n", win->winid, win->screen->id.name+2); */
|
||||
ED_screen_do_listen(win, note);
|
||||
|
||||
for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
|
||||
ED_region_do_listen(ar, note);
|
||||
}
|
||||
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
ED_area_do_listen(sa, note);
|
||||
for(ar=sa->regionbase.first; ar; ar= ar->next) {
|
||||
/* filter out notifiers */
|
||||
if(note->category==NC_SCREEN && note->reference && note->reference!=win->screen);
|
||||
else if(note->category==NC_SCENE && note->reference && note->reference!=win->screen->scene);
|
||||
else {
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
|
||||
/* XXX context in notifiers? */
|
||||
CTX_wm_window_set(C, win);
|
||||
|
||||
/* printf("notifier win %d screen %s\n", win->winid, win->screen->id.name+2); */
|
||||
ED_screen_do_listen(win, note);
|
||||
|
||||
for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
|
||||
ED_region_do_listen(ar, note);
|
||||
}
|
||||
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
ED_area_do_listen(sa, note);
|
||||
for(ar=sa->regionbase.first; ar; ar= ar->next) {
|
||||
ED_region_do_listen(ar, note);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CTX_wm_window_set(C, NULL);
|
||||
|
||||
MEM_freeN(note);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user