Blender V5.3
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 "MEM_guardedalloc.h"
10
11#include "BLI_listbase.hh"
12#include "BLI_string_utf8.hh"
13
14#include "BLT_translation.hh"
15
16#include "BKE_context.hh"
17#include "BKE_global.hh"
18#include "BKE_screen.hh"
19
20#include "ED_screen.hh"
21#include "ED_sequencer.hh"
22
23#include "IMB_imbuf.hh"
24
25#include "sequencer_intern.hh"
26
27namespace blender::ed::vse {
28
29/* **************************** buttons ********************************* */
30
31#if 0
32static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType * /*pt*/)
33{
34 SpaceSeq *sseq = CTX_wm_space_seq(C);
35
36 /* Don't show the gpencil if we are not showing the image. */
37 return check_show_imbuf(sseq);
38}
39#endif
40
41static bool metadata_panel_context_poll(const bContext *C, PanelType * /*pt*/)
42{
43 SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
44 if (space_sequencer == nullptr) {
45 return false;
46 }
47 return check_show_imbuf(*space_sequencer);
48}
49
50static void metadata_panel_context_draw(const bContext *C, Panel *panel)
51{
52 /* Image buffer can not be acquired during render, similar to
53 * draw_image_seq(). */
54 if (G.is_rendering) {
55 return;
56 }
57
59 SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
60 if (!scene || !space_sequencer) {
61 return;
62 }
63
64 /* NOTE: We can only reliably show metadata for the original (current)
65 * frame when split view is used. */
66 const bool show_split = (scene->ed &&
68 (space_sequencer->mainb == SEQ_DRAW_IMG_IMBUF));
69 if (show_split && (space_sequencer->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_REFERENCE)) {
70 return;
71 }
72 /* NOTE: We disable multiview for drawing, since we don't know what is the
73 * from the panel (is kind of all the views?). */
74 ImBuf *ibuf = sequencer_ibuf_get(C, scene->r.cfra, "");
75 if (ibuf != nullptr) {
77 IMB_freeImBuf(ibuf);
78 }
79}
80
82{
83 PanelType *pt;
84
85#if 0
86 pt = MEM_new_zeroed<PanelType>("spacetype sequencer panel gpencil");
87 STRNCPY_UTF8(pt->idname, "SEQUENCER_PT_gpencil");
88 STRNCPY_UTF8(pt->label, N_("Grease Pencil"));
90 pt->draw_header = ED_gpencil_panel_standard_header;
91 pt->draw = ED_gpencil_panel_standard;
92 pt->poll = sequencer_grease_pencil_panel_poll;
93 BLI_addtail(&art->paneltypes, pt);
94#endif
95
96 pt = MEM_new_zeroed<PanelType>("spacetype sequencer panel metadata");
97 STRNCPY_UTF8(pt->idname, "SEQUENCER_PT_metadata");
98 STRNCPY_UTF8(pt->label, N_("Metadata"));
99 STRNCPY_UTF8(pt->category, "Metadata");
103 pt->order = 10;
104 BLI_addtail(&art->paneltypes, pt);
105}
106
107} // namespace blender::ed::vse
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
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)
Scene * CTX_data_sequencer_scene(const bContext *C)
@ SEQ_EDIT_OVERLAY_FRAME_SHOW
SpaceSeq * CTX_wm_space_seq(const bContext *C)
Global G
Definition blender.cc:57
@ SEQ_OVERLAY_FRAME_TYPE_REFERENCE
void IMB_freeImBuf(ImBuf *ibuf)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void ED_region_image_metadata_panel_draw(ImBuf *ibuf, ui::Layout *layout)
Definition area.cc:4623
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
ListBaseT< PanelType > paneltypes
eEditingOverlayFrameFlag overlay_frame_flag
char translation_context[BKE_ST_MAXNAME]
void(*) draw(const bContext *C, Panel *panel)
char category[BKE_ST_MAXNAME]
bool(*) poll(const bContext *C, PanelType *pt)
void(*) draw_header(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
ui::Layout * layout
struct Editing * ed
struct RenderData r
eSpaceSeq_OverlayFrameType overlay_frame_type
eSpaceSeq_RegionType mainb
#define N_(msgid)