bpy.app.handlers.frame_change_pre/post handlers.

This commit is contained in:
Campbell Barton
2011-09-27 10:43:45 +00:00
parent 7fbfca48d2
commit 768806adc0
3 changed files with 11 additions and 0 deletions

View File

@@ -56,6 +56,7 @@
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_callbacks.h"
#include "BKE_anim.h" #include "BKE_anim.h"
#include "BKE_animsys.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); float ctime = BKE_curframe(sce);
Scene *sce_iter; Scene *sce_iter;
/* keep this first */
BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_PRE);
sound_set_cfra(sce->r.cfra); sound_set_cfra(sce->r.cfra);
/* clear animation overrides */ /* 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 */ /* object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(bmain, sce, sce); 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 */ /* return default layer, also used to patch old files */

View File

@@ -40,6 +40,8 @@ struct Main;
struct ID; struct ID;
typedef enum { typedef enum {
BLI_CB_EVT_FRAME_CHANGE_PRE,
BLI_CB_EVT_FRAME_CHANGE_POST,
BLI_CB_EVT_RENDER_PRE, BLI_CB_EVT_RENDER_PRE,
BLI_CB_EVT_RENDER_POST, BLI_CB_EVT_RENDER_POST,
BLI_CB_EVT_RENDER_STATS, BLI_CB_EVT_RENDER_STATS,

View File

@@ -40,6 +40,8 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
static PyTypeObject BlenderAppCbType; static PyTypeObject BlenderAppCbType;
static PyStructSequence_Field app_cb_info_fields[]= { static PyStructSequence_Field app_cb_info_fields[]= {
{(char *)"frame_change_pre", NULL},
{(char *)"frame_change_post", NULL},
{(char *)"render_pre", NULL}, {(char *)"render_pre", NULL},
{(char *)"render_post", NULL}, {(char *)"render_post", NULL},
{(char *)"render_stats", NULL}, {(char *)"render_stats", NULL},