Python API: bpy.app.handlers.depsgraph_update_pre/post
Reviewers: brecht Differential Revision: https://developer.blender.org/D3978
This commit is contained in:
parent
2ded8fca79
commit
4b06d0bf51
|
@ -1412,6 +1412,11 @@ void BKE_scene_graph_update_tagged(Depsgraph *depsgraph,
|
|||
Scene *scene = DEG_get_input_scene(depsgraph);
|
||||
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
||||
|
||||
bool run_callbacks = DEG_id_type_any_updated(depsgraph);
|
||||
if (run_callbacks) {
|
||||
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_PRE);
|
||||
}
|
||||
|
||||
/* TODO(sergey): Some functions here are changing global state,
|
||||
* for example, clearing update tags from bmain.
|
||||
*/
|
||||
|
@ -1429,6 +1434,11 @@ void BKE_scene_graph_update_tagged(Depsgraph *depsgraph,
|
|||
DEG_evaluate_on_refresh(depsgraph);
|
||||
/* Update sound system animation (TODO, move to depsgraph). */
|
||||
BKE_sound_update_scene(bmain, scene);
|
||||
|
||||
/* Notify python about depsgraph update */
|
||||
if (run_callbacks) {
|
||||
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_POST);
|
||||
}
|
||||
/* Inform editors about possible changes. */
|
||||
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false);
|
||||
/* Clear recalc flags. */
|
||||
|
|
|
@ -53,6 +53,8 @@ typedef enum {
|
|||
BLI_CB_EVT_UNDO_POST,
|
||||
BLI_CB_EVT_REDO_PRE,
|
||||
BLI_CB_EVT_REDO_POST,
|
||||
BLI_CB_EVT_DEPSGRAPH_UPDATE_PRE,
|
||||
BLI_CB_EVT_DEPSGRAPH_UPDATE_POST,
|
||||
BLI_CB_EVT_VERSION_UPDATE,
|
||||
BLI_CB_EVT_TOT
|
||||
} eCbEvent;
|
||||
|
|
|
@ -46,24 +46,26 @@ 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", (char *)"on frame change for playback and rendering (before)"},
|
||||
{(char *)"frame_change_post", (char *)"on frame change for playback and rendering (after)"},
|
||||
{(char *)"render_pre", (char *)"on render (before)"},
|
||||
{(char *)"render_post", (char *)"on render (after)"},
|
||||
{(char *)"render_write", (char *)"on writing a render frame (directly after the frame is written)"},
|
||||
{(char *)"render_stats", (char *)"on printing render statistics"},
|
||||
{(char *)"render_init", (char *)"on initialization of a render job"},
|
||||
{(char *)"render_complete", (char *)"on completion of render job"},
|
||||
{(char *)"render_cancel", (char *)"on canceling a render job"},
|
||||
{(char *)"load_pre", (char *)"on loading a new blend file (before)"},
|
||||
{(char *)"load_post", (char *)"on loading a new blend file (after)"},
|
||||
{(char *)"save_pre", (char *)"on saving a blend file (before)"},
|
||||
{(char *)"save_post", (char *)"on saving a blend file (after)"},
|
||||
{(char *)"undo_pre", (char *)"on loading an undo step (before)"},
|
||||
{(char *)"undo_post", (char *)"on loading an undo step (after)"},
|
||||
{(char *)"redo_pre", (char *)"on loading a redo step (before)"},
|
||||
{(char *)"redo_post", (char *)"on loading a redo step (after)"},
|
||||
{(char *)"version_update", (char *)"on ending the versioning code"},
|
||||
{(char *)"frame_change_pre", (char *)"on frame change for playback and rendering (before)"},
|
||||
{(char *)"frame_change_post", (char *)"on frame change for playback and rendering (after)"},
|
||||
{(char *)"render_pre", (char *)"on render (before)"},
|
||||
{(char *)"render_post", (char *)"on render (after)"},
|
||||
{(char *)"render_write", (char *)"on writing a render frame (directly after the frame is written)"},
|
||||
{(char *)"render_stats", (char *)"on printing render statistics"},
|
||||
{(char *)"render_init", (char *)"on initialization of a render job"},
|
||||
{(char *)"render_complete", (char *)"on completion of render job"},
|
||||
{(char *)"render_cancel", (char *)"on canceling a render job"},
|
||||
{(char *)"load_pre", (char *)"on loading a new blend file (before)"},
|
||||
{(char *)"load_post", (char *)"on loading a new blend file (after)"},
|
||||
{(char *)"save_pre", (char *)"on saving a blend file (before)"},
|
||||
{(char *)"save_post", (char *)"on saving a blend file (after)"},
|
||||
{(char *)"undo_pre", (char *)"on loading an undo step (before)"},
|
||||
{(char *)"undo_post", (char *)"on loading an undo step (after)"},
|
||||
{(char *)"redo_pre", (char *)"on loading a redo step (before)"},
|
||||
{(char *)"redo_post", (char *)"on loading a redo step (after)"},
|
||||
{(char *)"depsgraph_update_pre", (char *)"on depsgraph update (pre)"},
|
||||
{(char *)"depsgraph_update_post", (char *)"on depsgraph update (post)"},
|
||||
{(char *)"version_update", (char *)"on ending the versioning code"},
|
||||
|
||||
/* sets the permanent tag */
|
||||
# define APP_CB_OTHER_FIELDS 1
|
||||
|
|
Loading…
Reference in New Issue