diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-27 14:43:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-27 14:43:45 +0400 |
commit | 768806adc08e2dd5b1fccb4baafec8129076e659 (patch) | |
tree | 77165f380e9d1609cbd90acf986422339732b63c /source/blender | |
parent | 7fbfca48d2f7efd8e8072beb65475de8b4e0e797 (diff) |
bpy.app.handlers.frame_change_pre/post handlers.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 7 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_callbacks.h | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_handlers.c | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6741ff2d018..d8ae36b4ab5 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -56,6 +56,7 @@ #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_callbacks.h" #include "BKE_anim.h" #include "BKE_animsys.h" @@ -1022,6 +1023,9 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) float ctime = BKE_curframe(sce); Scene *sce_iter; + /* keep this first */ + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_PRE); + sound_set_cfra(sce->r.cfra); /* clear animation overrides */ @@ -1048,6 +1052,9 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* object_handle_update() on all objects, groups and sets */ scene_update_tagged_recursive(bmain, sce, sce); + + /* keep this last */ + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_POST); } /* return default layer, also used to patch old files */ diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index f20cef9c3ea..b490317fdac 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -40,6 +40,8 @@ struct Main; struct ID; typedef enum { + BLI_CB_EVT_FRAME_CHANGE_PRE, + BLI_CB_EVT_FRAME_CHANGE_POST, BLI_CB_EVT_RENDER_PRE, BLI_CB_EVT_RENDER_POST, BLI_CB_EVT_RENDER_STATS, diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index b909a0d5f55..6aaeb4d9807 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -40,6 +40,8 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg); static PyTypeObject BlenderAppCbType; static PyStructSequence_Field app_cb_info_fields[]= { + {(char *)"frame_change_pre", NULL}, + {(char *)"frame_change_post", NULL}, {(char *)"render_pre", NULL}, {(char *)"render_post", NULL}, {(char *)"render_stats", NULL}, |