From 8c87af74409a3e6681698ba1bf150dd6155e202f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 6 Feb 2019 11:49:41 +0100 Subject: 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..>", which allows to have information about all layers in a multi-layer EXR file. Ideally we can store simplified "cycles." 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 --- source/blender/editors/space_clip/clip_buttons.c | 36 ++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_clip/clip_buttons.c') diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 3810b60adf2..4b91d98718d 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -29,8 +29,9 @@ #include "DNA_screen_types.h" #include "DNA_space_types.h" -#include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_math.h" #include "BLI_path_util.h" #include "BLI_string.h" @@ -43,7 +44,9 @@ #include "DEG_depsgraph.h" +#include "ED_clip.h" #include "ED_gpencil.h" +#include "ED_screen.h" #include "UI_interface.h" #include "UI_resources.h" @@ -60,9 +63,38 @@ /* Panels */ -void ED_clip_buttons_register(ARegionType *UNUSED(art)) +static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + return ED_space_clip_poll((bContext *)C); +} + +static void metadata_panel_context_draw(const bContext *C, Panel *panel) { + SpaceClip *space_clip = CTX_wm_space_clip(C); + /* NOTE: This might not be exactly the same image buffer as shown in the + * clip editor itself, since that might be coming from proxy, or being + * postprocessed (stabilized or undistored). + * Ideally we need to query metadata from an original image or movie without + * reading actual pixels to speed up the process. */ + ImBuf *ibuf = ED_space_clip_get_buffer(space_clip); + if (ibuf != NULL) { + ED_region_image_metadata_panel_draw(ibuf, panel->layout); + IMB_freeImBuf(ibuf); + } +} +void ED_clip_buttons_register(ARegionType *art) +{ + PanelType *pt; + + pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel metadata"); + strcpy(pt->idname, "CLIP_PT_metadata"); + strcpy(pt->label, N_("Metadata")); + strcpy(pt->category, "Footage"); + 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); } /********************* MovieClip Template ************************/ -- cgit v1.2.3