Blender
V3.3
|
Go to the source code of this file.
Classes | |
struct | bCallbackFuncStore |
Typedefs | |
typedef struct bCallbackFuncStore | bCallbackFuncStore |
Functions | |
void | BKE_callback_exec (struct Main *bmain, struct PointerRNA **pointers, int num_pointers, eCbEvent evt) |
void | BKE_callback_exec_null (struct Main *bmain, eCbEvent evt) |
void | BKE_callback_exec_id (struct Main *bmain, struct ID *id, eCbEvent evt) |
void | BKE_callback_exec_id_depsgraph (struct Main *bmain, struct ID *id, struct Depsgraph *depsgraph, eCbEvent evt) |
void | BKE_callback_add (bCallbackFuncStore *funcstore, eCbEvent evt) |
void | BKE_callback_remove (bCallbackFuncStore *funcstore, eCbEvent evt) |
void | BKE_callback_global_init (void) |
void | BKE_callback_global_finalize (void) |
typedef struct bCallbackFuncStore bCallbackFuncStore |
enum eCbEvent |
{ACTION}
use in cases where only a single callback is required, VERSION_UPDATE
and RENDER_STATS
for example.PRE/POST
are useful to differentiate since renaming callbacks may break Python scripts.{ACTION}_PRE
run before the action.{ACTION}_POST
run after the action.{ACTION}_INIT
when the handler may manipulate the context used to run the action.
Examples where INIT
functions may be useful are:
INIT
function may change the camera or render settings, things which a PRE
function can't support as this information has already been used.INIT
function could temporarily change the preferences.{ACTION}_POST_FAIL
should be included if the action may fail.
Use this so a call to the PRE
callback always has a matching call to POST
or POST_FAIL
.
PRE/POST
are required.{ACTION}_INIT
{ACTION}_COMPLETE
when a background job has finished.{ACTION}_CANCEL
When a background job is canceled partway through.
While cancellation may be caused by any number of reasons, common causes may include:
PRE/POST
handlers may be used along side modal task handlers as is the case for rendering, where rendering an animation uses modal task handlers, rendering a single frame has PRE/POST
handlers.All callbacks here must be exposed via the Python module bpy.app.handlers
, see bpy_app_handlers.c
.
Definition at line 74 of file BKE_callbacks.h.
void BKE_callback_add | ( | bCallbackFuncStore * | funcstore, |
eCbEvent | evt | ||
) |
Definition at line 72 of file callbacks.c.
References ASSERT_CALLBACKS_INITIALIZED, BLI_addtail(), and callback_slots.
Referenced by blender::bke::AssetLibraryService::app_handler_register(), BPY_app_handlers_struct(), FRS_init(), and blender::bke::AssetLibrary::on_blend_save_handler_register().
void BKE_callback_exec | ( | struct Main * | bmain, |
struct PointerRNA ** | pointers, | ||
int | num_pointers, | ||
eCbEvent | evt | ||
) |
Definition at line 27 of file callbacks.c.
References ASSERT_CALLBACKS_INITIALIZED, callback_slots, and LISTBASE_FOREACH_MUTABLE.
Referenced by BKE_callback_exec_id(), BKE_callback_exec_id_depsgraph(), and BKE_callback_exec_null().
Definition at line 46 of file callbacks.c.
References BKE_callback_exec(), and RNA_id_pointer_create().
Referenced by bake_invoke(), bake_job_canceled(), bake_job_complete(), BKE_scene_graph_update_for_newframe_ex(), blender::ed::space_node::compo_canceljob(), blender::ed::space_node::compo_completejob(), blender::ed::space_node::compo_startjob(), ed_undo_step_post(), ed_undo_step_pre(), render_callback_exec_id(), and scene_graph_update_tagged().
void BKE_callback_exec_id_depsgraph | ( | struct Main * | bmain, |
struct ID * | id, | ||
struct Depsgraph * | depsgraph, | ||
eCbEvent | evt | ||
) |
Definition at line 56 of file callbacks.c.
References BKE_callback_exec(), depsgraph, NULL, RNA_id_pointer_create(), and RNA_pointer_create().
Referenced by annotation_paint_initstroke(), annotation_paint_strokeend(), BKE_scene_graph_update_for_newframe_ex(), and scene_graph_update_tagged().
Definition at line 41 of file callbacks.c.
References BKE_callback_exec(), and NULL.
Referenced by render_callback_exec_null(), stats_background(), wm_file_read_post(), wm_file_read_pre(), wm_file_write(), wm_homefile_write_exec(), and wm_xr_session_create_cb().
Call on application exit.
Definition at line 105 of file callbacks.c.
References BKE_callback_remove(), BKE_CB_EVT_TOT, callback_slots, callbacks_initialized, ListBase::first, and bCallbackFuncStore::next.
Referenced by BKE_blender_free(), blender::bke::tests::AssetLibraryServiceTest::TearDownTestSuite(), and blender::bke::tests::AssetLibraryTest::TearDownTestSuite().
Definition at line 100 of file callbacks.c.
References callbacks_initialized.
Referenced by main(), BlendfileLoadingBaseTest::SetUpTestCase(), blender::bke::tests::AssetLibraryServiceTest::SetUpTestSuite(), and blender::bke::tests::AssetLibraryTest::SetUpTestSuite().
void BKE_callback_remove | ( | bCallbackFuncStore * | funcstore, |
eCbEvent | evt | ||
) |
Definition at line 79 of file callbacks.c.
References bCallbackFuncStore::alloc, BLI_assert_msg, BLI_findindex(), BLI_remlink(), callback_slots, callbacks_initialized, and MEM_freeN.
Referenced by blender::bke::AssetLibraryService::app_handler_unregister(), BKE_callback_global_finalize(), and blender::bke::AssetLibrary::on_blend_save_handler_unregister().