diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-06 13:49:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-06 18:11:51 +0300 |
commit | 8c87af74409a3e6681698ba1bf150dd6155e202f (patch) | |
tree | a9549a2315fed37625e8bd126e91c8855a00147a /source/blender/editors/space_image/image_buttons.c | |
parent | e21ae0bb267a54482108ddd4feed99c89241804b (diff) |
Improvements and fixes to Cycles metadata
This is a request by the studio here to make it possible to see how
many samples were used to render a specific shot or a frame. It is a
bit more tricky than simply stamping number of samples from a scene
since rendering is happening in multiple ranges of samples.
This change makes it so Cycles saves configured number of samples for
the specific view layer, and also stores start sample and number of
samples when rendering only a subrange of all samples.
The format used is "cycles.<view_layer_name>.><field>", which allows
to have information about all layers in a multi-layer EXR file.
Ideally we can store simplified "cycles.<field>" if we know that there
is only one render layer in the file, but detecting this is somewhat
tricky since Cycles operates on an evaluated scene which always have
single view layer.
The metadata is shown in the Metadata panels for clip, image and
sequencer spaces.
Example screenshot which shows the metadata:
{F6527727}
Reviewers: brecht
Reviewed By: brecht
Subscribers: fsiddi
Differential Revision: https://developer.blender.org/D4311
Diffstat (limited to 'source/blender/editors/space_image/image_buttons.c')
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index db0fa34879a..1a7e81f55aa 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -1269,9 +1269,35 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i #undef MAX_IMAGE_INFO_LEN -void image_buttons_register(ARegionType *UNUSED(art)) +static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt)) { + SpaceImage *space_image = CTX_wm_space_image(C); + return space_image != NULL && space_image->image != NULL; +} +static void metadata_panel_context_draw(const bContext *C, Panel *panel) +{ + void *lock; + SpaceImage *space_image = CTX_wm_space_image(C); + Image *image = space_image->image; + ImBuf *ibuf = BKE_image_acquire_ibuf(image, &space_image->iuser, &lock); + if (ibuf != NULL) { + ED_region_image_metadata_panel_draw(ibuf, panel->layout); + } + BKE_image_release_ibuf(image, ibuf, lock); +} + +void image_buttons_register(ARegionType *art) +{ + PanelType *pt; + + pt = MEM_callocN(sizeof(PanelType), "spacetype image panel metadata"); + strcpy(pt->idname, "IMAGE_PT_metadata"); + strcpy(pt->label, N_("Metadata")); + strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + pt->poll = metadata_panel_context_poll; + pt->draw = metadata_panel_context_draw; + BLI_addtail(&art->paneltypes, pt); } static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) |