Blender V5.0
sequencer_buttons.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstring>
10
11#include "MEM_guardedalloc.h"
12
13#include "BLI_listbase.h"
14#include "BLI_string_utf8.h"
15
16#include "BLT_translation.hh"
17
18#include "BKE_context.hh"
19#include "BKE_global.hh"
20#include "BKE_screen.hh"
21
22#include "ED_screen.hh"
23#include "ED_sequencer.hh"
24
25#include "IMB_imbuf.hh"
26#include "IMB_imbuf_types.hh"
27
28#include "sequencer_intern.hh"
29
30namespace blender::ed::vse {
31
32/* **************************** buttons ********************************* */
33
34#if 0
35static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType * /*pt*/)
36{
38
39 /* Don't show the gpencil if we are not showing the image. */
40 return check_show_imbuf(sseq);
41}
42#endif
43
44static bool metadata_panel_context_poll(const bContext *C, PanelType * /*pt*/)
45{
46 SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
47 if (space_sequencer == nullptr) {
48 return false;
49 }
50 return check_show_imbuf(*space_sequencer);
51}
52
53static void metadata_panel_context_draw(const bContext *C, Panel *panel)
54{
55 /* Image buffer can not be acquired during render, similar to
56 * draw_image_seq(). */
57 if (G.is_rendering) {
58 return;
59 }
60
62 SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
63 /* NOTE: We can only reliably show metadata for the original (current)
64 * frame when split view is used. */
65 const bool show_split = (scene->ed &&
67 (space_sequencer->mainb == SEQ_DRAW_IMG_IMBUF));
68 if (show_split && (space_sequencer->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_REFERENCE)) {
69 return;
70 }
71 /* NOTE: We disable multiview for drawing, since we don't know what is the
72 * from the panel (is kind of all the views?). */
73 ImBuf *ibuf = sequencer_ibuf_get(C, scene->r.cfra, "");
74 if (ibuf != nullptr) {
76 IMB_freeImBuf(ibuf);
77 }
78}
79
81{
82 PanelType *pt;
83
84#if 0
85 pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
86 STRNCPY_UTF8(pt->idname, "SEQUENCER_PT_gpencil");
87 STRNCPY_UTF8(pt->label, N_("Grease Pencil"));
89 pt->draw_header = ED_gpencil_panel_standard_header;
90 pt->draw = ED_gpencil_panel_standard;
91 pt->poll = sequencer_grease_pencil_panel_poll;
92 BLI_addtail(&art->paneltypes, pt);
93#endif
94
95 pt = MEM_callocN<PanelType>("spacetype sequencer panel metadata");
96 STRNCPY_UTF8(pt->idname, "SEQUENCER_PT_metadata");
97 STRNCPY_UTF8(pt->label, N_("Metadata"));
98 STRNCPY_UTF8(pt->category, "Metadata");
102 pt->order = 10;
103 BLI_addtail(&art->paneltypes, pt);
104}
105
106} // namespace blender::ed::vse
SpaceSeq * CTX_wm_space_seq(const bContext *C)
Scene * CTX_data_sequencer_scene(const bContext *C)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
@ SEQ_EDIT_OVERLAY_FRAME_SHOW
@ SEQ_OVERLAY_FRAME_TYPE_REFERENCE
@ SEQ_DRAW_IMG_IMBUF
struct SpaceSeq SpaceSeq
void ED_region_image_metadata_panel_draw(ImBuf *ibuf, uiLayout *layout)
Definition area.cc:4149
void IMB_freeImBuf(ImBuf *ibuf)
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
#define G(x, y, z)
static bool metadata_panel_context_poll(const bContext *C, PanelType *)
static void metadata_panel_context_draw(const bContext *C, Panel *panel)
bool check_show_imbuf(const SpaceSeq &sseq)
ImBuf * sequencer_ibuf_get(const bContext *C, int timeline_frame, const char *viewname)
void sequencer_buttons_register(ARegionType *art)
ListBase paneltypes
void(* draw)(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
bool(* poll)(const bContext *C, PanelType *pt)
char translation_context[BKE_ST_MAXNAME]
char category[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
void(* draw_header)(const bContext *C, Panel *panel)
struct uiLayout * layout
struct Editing * ed
struct RenderData r
char overlay_frame_type
#define N_(msgid)