diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-03 00:56:52 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-03 00:56:52 +0400 |
commit | 723e129252f82cc81faa8834a68c79e4439ee8fa (patch) | |
tree | 9c1c1e2aa9265e33702007da68b28b3159766aac /source/blender/blenkernel/intern/scene.c | |
parent | ac52c79cb19ac85e06651a7b9af2e54efcd45a97 (diff) |
Depsgraph/Python: callbacks and properties to detect datablock changes
* Adds two new python handlers: scene_update_pre() and scene_update_post()
These run before and after Blender does a scene update on making modifications
to the scene.
* Datablocks now have an is_updated property. This will be set to true in the
above callbacks if the datablock was tagged to be updated. This works for the
most common datablocks used for rendering: object, material, world, lamsp,
texture, mesh, curve.
* Datablock collections also have an is_updated property. If this is set, it
means one datablock of this type was added, removed or modified. It's also
useful as a quick check to avoid looping over all datablocks.
* RenderEngine.view_update() can also check these properties, for interactive
viewport rendering.
http://wiki.blender.org/index.php/Dev:2.6/Source/Render/UpdateAPI
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index c902bee80a8..b25120c0fff 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -992,6 +992,8 @@ void scene_update_tagged(Main *bmain, Scene *scene) { DAG_ids_flush_tagged(bmain); + BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); + scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set @@ -1011,10 +1013,19 @@ void scene_update_tagged(Main *bmain, Scene *scene) if (scene->physics_settings.quick_cache_step) BKE_ptcache_quick_cache_all(bmain, scene); + DAG_ids_check_recalc(bmain); + + BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST); + /* in the future this should handle updates for all datablocks, not only objects and scenes. - brecht */ } +void scene_clear_tagged(Main *bmain, Scene *UNUSED(scene)) +{ + DAG_ids_clear_recalc(bmain); +} + /* applies changes right away, does all sets too */ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) { @@ -1039,6 +1050,8 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) * so dont call within 'scene_update_tagged_recursive' */ DAG_scene_update_flags(bmain, sce, lay, TRUE); // only stuff that moves or needs display still + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_SCENE_UPDATE_PRE); + /* 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 @@ -1052,6 +1065,7 @@ 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_SCENE_UPDATE_POST); BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_POST); } |