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_sequencer | |
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_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_buttons.c | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index abe6a58c9ef..39d674b421a 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -27,10 +27,12 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLT_translation.h" #include "BKE_context.h" +#include "BKE_global.h" #include "BKE_screen.h" #include "ED_screen.h" @@ -40,6 +42,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "IMB_imbuf_types.h" +#include "IMB_imbuf.h" #include "sequencer_intern.h" @@ -55,11 +59,51 @@ static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNU } #endif -void sequencer_buttons_register(ARegionType *UNUSED(art)) +static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + SpaceSeq *space_sequencer = CTX_wm_space_seq(C); + if (space_sequencer == NULL) { + return false; + } + return ED_space_sequencer_check_show_imbuf(space_sequencer); +} + +static void metadata_panel_context_draw(const bContext *C, Panel *panel) +{ + /* Image buffer can not be acquired during render, similar to + * draw_image_seq(). */ + if (G.is_rendering) { + return; + } + struct Main *bmain = CTX_data_main(C); + struct Depsgraph *depsgraph = CTX_data_depsgraph(C); + struct Scene *scene = CTX_data_scene(C); + SpaceSeq *space_sequencer = CTX_wm_space_seq(C); + /* NOTE: We can only reliably show metadata for the original (current) + * frame when split view is used. */ + const bool show_split = ( + scene->ed && + (scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) && + (space_sequencer->mainb == SEQ_DRAW_IMG_IMBUF)); + if (show_split && + space_sequencer->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) + { + return; + } + /* NOTE: We disable multiview for drawing, since we don't know what is the + * from the panel (is kind of all the views?). */ + ImBuf *ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, space_sequencer, scene->r.cfra, 0, ""); + if (ibuf != NULL) { + ED_region_image_metadata_panel_draw(ibuf, panel->layout); + IMB_freeImBuf(ibuf); + } +} + +void sequencer_buttons_register(ARegionType *art) { -#if 0 PanelType *pt; +#if 0 pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil"); strcpy(pt->idname, "SEQUENCER_PT_gpencil"); strcpy(pt->label, N_("Grease Pencil")); @@ -69,6 +113,14 @@ void sequencer_buttons_register(ARegionType *UNUSED(art)) pt->poll = sequencer_grease_pencil_panel_poll; BLI_addtail(&art->paneltypes, pt); #endif + + pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel metadata"); + strcpy(pt->idname, "SEQUENCER_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); } /* **************** operator to open/close properties view ************* */ |