diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-10 14:08:38 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-10 14:08:38 +0300 |
commit | 11ca70b42d2bb46202365358f40e63822a42a840 (patch) | |
tree | fcb8d571e3f9d1fd8eae40921989c23c9cc965cc | |
parent | 6b7544bfda1d51e6d256240316ed1900e838faeb (diff) |
Update Handling: moved wm_data_handle_update from windowmanager to
scene_update_tagged in blenkernel, code fits better there.
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 41 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 43 |
3 files changed, 43 insertions, 42 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 686fc265de0..ecff62a7952 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -74,6 +74,7 @@ void scene_select_base(struct Scene *sce, struct Base *selbase); /* checks for cycle, returns 1 if it's all OK */ int scene_check_setscene(struct Scene *sce); +void scene_update_tagged(struct Scene *sce); void scene_update_for_newframe(struct Scene *sce, unsigned int lay); void scene_add_render_layer(struct Scene *sce); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 27cb3ad834b..cd9487862ea 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -77,6 +77,7 @@ #include "BKE_node.h" #include "BKE_object.h" #include "BKE_paint.h" +#include "BKE_pointcache.h" #include "BKE_scene.h" #include "BKE_sequence.h" #include "BKE_world.h" @@ -772,7 +773,7 @@ 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) +static void scene_update_newframe(Scene *sce, unsigned int lay) { Base *base; Object *ob; @@ -804,6 +805,40 @@ static void scene_update(Scene *sce, unsigned int lay) } } +/* this is called in main loop, doing tagged updates before redraw */ +void scene_update_tagged(Scene *scene) +{ + Scene *sce; + Base *base; + float ctime = frame_to_float(scene, scene->r.cfra); + + /* update all objects: drivers, matrices, displists, etc. flags set + by depgraph or manual, no layer check here, gets correct flushed */ + + /* sets first, we allow per definition current scene to have + dependencies on sets, but not the other way around. */ + if(scene->set) { + for(SETLOOPER(scene->set, base)) + object_handle_update(scene, base->object); + } + + for(base= scene->base.first; base; base= base->next) { + object_handle_update(scene, base->object); + } + + /* recalc scene animation data here (for sequencer) */ + { + AnimData *adt= BKE_animdata_from_id(&scene->id); + + if(adt && (adt->recalc & ADT_RECALC_ANIM)) + BKE_animsys_evaluate_animdata(&scene->id, adt, ctime, 0); + } + + BKE_ptcache_quick_cache_all(scene); + + /* in the future this should handle updates for all datablocks, not + only objects and scenes. - brecht */ +} /* applies changes right away, does all sets too */ void scene_update_for_newframe(Scene *sce, unsigned int lay) @@ -815,9 +850,9 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) /* sets first, we allow per definition current scene to have dependencies on sets */ for(sce= sce->set; sce; sce= sce->set) - scene_update(sce, lay); + scene_update_newframe(sce, lay); - scene_update(scene, lay); + scene_update_newframe(scene, lay); } /* return default layer, also used to patch old files */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 8bc258f7c0a..ce3acece776 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -29,7 +29,6 @@ #include <stdlib.h> #include <string.h> -#include "DNA_anim_types.h" #include "DNA_listBase.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" @@ -42,17 +41,14 @@ #include "BLI_blenlib.h" -#include "BKE_animsys.h" #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_idprop.h" #include "BKE_global.h" #include "BKE_main.h" -#include "BKE_object.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_utildefines.h" -#include "BKE_pointcache.h" #include "ED_fileselect.h" #include "ED_info.h" @@ -149,40 +145,6 @@ static wmNotifier *wm_notifier_next(wmWindowManager *wm) return note; } -static void wm_data_handle_update(Scene *scene) -{ - Scene *sce; - Base *base; - - /* XXX make lock in future, or separated derivedmesh users in scene */ - if(G.rendering) - return; - - /* update all objects, drivers, matrices, displists, etc. Flags set by depgraph or manual, - no layer check here, gets correct flushed */ - /* sets first, we allow per definition current scene to have dependencies on sets */ - if(scene->set) { - for(SETLOOPER(scene->set, base)) - object_handle_update(scene, base->object); - } - - for(base= scene->base.first; base; base= base->next) { - object_handle_update(scene, base->object); - } - - /* recalc scene animation data here (for sequencer). actually - this should be doing all datablocks including e.g. materials, - but for now this solves some update issues - brecht. */ - { - AnimData *adt= BKE_animdata_from_id(&scene->id); - - if(adt && (adt->recalc & ADT_RECALC_ANIM)) - BKE_animsys_evaluate_animdata(&scene->id, adt, scene->r.cfra, 0); - } - - BKE_ptcache_quick_cache_all(scene); -} - /* called in mainloop */ void wm_event_do_notifiers(bContext *C) { @@ -296,7 +258,10 @@ void wm_event_do_notifiers(bContext *C) } } - wm_data_handle_update(win->screen->scene); + /* XXX make lock in future, or separated derivedmesh users in scene */ + if(!G.rendering) + /* depsgraph & animation: update tagged datablocks */ + scene_update_tagged(win->screen->scene); } CTX_wm_window_set(C, NULL); |