Blender V4.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
9#include <cstdio>
10#include <cstring>
11
12#include "MEM_guardedalloc.h"
13
14#include "BLI_listbase.h"
15#include "BLI_string.h"
16#include "BLI_utildefines.h"
17
18#include "BLT_translation.hh"
19
20#include "BKE_context.hh"
21#include "BKE_global.hh"
22#include "BKE_screen.hh"
23
24#include "ED_screen.hh"
25#include "ED_sequencer.hh"
26
27#include "IMB_imbuf.hh"
28#include "IMB_imbuf_types.hh"
29
30#include "sequencer_intern.hh"
31
32/* **************************** buttons ********************************* */
33
34#if 0
35static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType * /*pt*/)
36{
37 SpaceSeq *sseq = CTX_wm_space_seq(C);
38
39 /* Don't show the gpencil if we are not showing the image. */
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 ED_space_sequencer_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
61 Scene *scene = CTX_data_scene(C);
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 &&
66 (scene->ed->overlay_frame_flag & SEQ_EDIT_OVERLAY_FRAME_SHOW) &&
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, 0, "");
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(pt->idname, "SEQUENCER_PT_gpencil");
87 STRNCPY(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_cnew<PanelType>("spacetype sequencer panel metadata");
96 STRNCPY(pt->idname, "SEQUENCER_PT_metadata");
97 STRNCPY(pt->label, N_("Metadata"));
98 STRNCPY(pt->category, "Metadata");
102 pt->order = 10;
103 BLI_addtail(&art->paneltypes, pt);
104}
Scene * CTX_data_scene(const bContext *C)
SpaceSeq * CTX_wm_space_seq(const bContext *C)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
#define STRNCPY(dst, src)
Definition BLI_string.h:593
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
@ SEQ_EDIT_OVERLAY_FRAME_SHOW
@ SEQ_OVERLAY_FRAME_TYPE_REFERENCE
@ SEQ_DRAW_IMG_IMBUF
void ED_region_image_metadata_panel_draw(ImBuf *ibuf, uiLayout *layout)
Definition area.cc:3859
bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
void IMB_freeImBuf(ImBuf *)
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
#define G(x, y, z)
void sequencer_buttons_register(ARegionType *art)
static bool metadata_panel_context_poll(const bContext *C, PanelType *)
static void metadata_panel_context_draw(const bContext *C, Panel *panel)
ImBuf * sequencer_ibuf_get(const bContext *C, int timeline_frame, int frame_ofs, const char *viewname)
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
char overlay_frame_type
#define N_(msgid)