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:
authorTon Roosendaal <ton@blender.org>2009-02-09 18:50:09 +0300
committerTon Roosendaal <ton@blender.org>2009-02-09 18:50:09 +0300
commitf33309b0285079c14a8f9fc913157129ff6cbc81 (patch)
treea9a1e7dd869b8c09a8e8c1411bf995ddeb5703c3
parentc58d336a33b4105530af326dccef077ba0274fa6 (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. :)
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c25
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c9
-rw-r--r--source/blender/blenkernel/intern/scene.c56
-rw-r--r--source/blender/editors/screen/screen_ops.c3
-rw-r--r--source/blender/windowmanager/WM_types.h4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c34
6 files changed, 72 insertions, 59 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
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 6f064b3db86..b2995836732 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -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;
}
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 1ace7bce09c..9382e170a21 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -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)
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index dcca2fa60c9..886456733f9 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -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;
+
+ /* 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);
+ /* 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);
+ /* 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) {
+ 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);
}