Compositor: add pre/post/cancel handlers and background job info

Main motivation is from T54314 where there was no way to read from a
Viewer image datablock after the compositor has run.
The only solution there was to do a full rerender (which obviously takes
much longer). Adding a handler avoids having to rerender.

This uses new syntax from rBf4456a4d3c97 and also adds "COMPOSITE" as a
job type that can be queried by `bpy.app.is_job_running`.

NOTE: there is another issue when multiple viewers are used and these
get active via RNA (compo execution is not triggered there yet -- unlike
when a viewer is selected in the Editor -- this is an issue of
`ED_node_set_active` vs. only `nodeSetActive`, but this will be tackled
separately)

Maniphest Tasks: T54314

Differential Revision: https://developer.blender.org/D15078
This commit is contained in:
2022-05-31 10:22:43 +02:00
parent 9babe39de9
commit 16d329da28
4 changed files with 32 additions and 2 deletions

View File

@@ -66,10 +66,12 @@ static PyStructSequence_Field app_cb_info_fields[] = {
{"xr_session_start_pre", "on starting an xr session (before)"},
{"annotation_pre", "on drawing an annotation (before)"},
{"annotation_post", "on drawing an annotation (after)"},
{"object_bake_pre", "before starting a bake job"},
{"object_bake_complete", "on completing a bake job; will be called in the main thread"},
{"object_bake_cancel", "on canceling a bake job; will be called in the main thread"},
{"composite_pre", "on a compositing background job (before)"},
{"composite_post", "on a compositing background job (after)"},
{"composite_cancel", "on a compositing background job (cancel)"},
/* sets the permanent tag */
#define APP_CB_OTHER_FIELDS 1