diff options
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6b3786663df..a9de75dc7d0 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -72,6 +72,8 @@ #include "BKE_sound.h" +#include "RE_engine.h" + //XXX #include "BIF_previewrender.h" //XXX #include "BIF_editseq.h" @@ -988,16 +990,22 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* this is called in main loop, doing tagged updates before redraw */ void scene_update_tagged(Main *bmain, Scene *scene) { + /* keep this first */ + BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); + + /* flush recalc flags to dependencies */ DAG_ids_flush_tagged(bmain); scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set - by depgraph or manual, no layer check here, gets correct flushed */ + by depgraph or manual, no layer check here, gets correct flushed + in the future this should handle updates for all datablocks, not + only objects and scenes. - brecht */ scene_update_tagged_recursive(bmain, scene, scene); - /* recalc scene animation data here (for sequencer) */ + /* extra call here to recalc scene animation (for sequencer) */ { AnimData *adt= BKE_animdata_from_id(&scene->id); float ctime = BKE_curframe(scene); @@ -1006,11 +1014,20 @@ void scene_update_tagged(Main *bmain, Scene *scene) BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0); } + /* quick point cache updates */ if (scene->physics_settings.quick_cache_step) BKE_ptcache_quick_cache_all(bmain, scene); - /* in the future this should handle updates for all datablocks, not - only objects and scenes. - brecht */ + /* notify editors about recalc */ + DAG_ids_check_recalc(bmain); + + /* keep this last */ + BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST); +} + +void scene_clear_tagged(Main *bmain, Scene *UNUSED(scene)) +{ + DAG_ids_clear_recalc(bmain); } /* applies changes right away, does all sets too */ @@ -1020,7 +1037,8 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) Scene *sce_iter; /* keep this first */ - BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_PRE); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE); sound_set_cfra(sce->r.cfra); @@ -1032,6 +1050,10 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) DAG_scene_sort(bmain, sce_iter); } + /* flush recalc flags to dependencies, if we were only changing a frame + this would not be necessary, but if a user or a script has modified + some datablock before scene_update_tagged was called, we need the flush */ + DAG_ids_flush_tagged(bmain); /* Following 2 functions are recursive * so dont call within 'scene_update_tagged_recursive' */ @@ -1050,7 +1072,10 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) scene_update_tagged_recursive(bmain, sce, sce); /* keep this last */ - BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_POST); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST); + + DAG_ids_clear_recalc(bmain); } /* return default layer, also used to patch old files */ @@ -1127,3 +1152,10 @@ Base *_setlooper_base_step(Scene **sce_iter, Base *base) return NULL; } + +int scene_use_new_shading_nodes(Scene *scene) +{ + RenderEngineType *type= RE_engines_find(scene->r.engine); + return (type->flag & RE_USE_SHADING_NODES); +} + |