Blender  V3.3
sequencer_buttons.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
8 #include <stdio.h>
9 #include <string.h>
10 
11 #include "MEM_guardedalloc.h"
12 
13 #include "BLI_listbase.h"
14 #include "BLI_utildefines.h"
15 
16 #include "BLT_translation.h"
17 
18 #include "BKE_context.h"
19 #include "BKE_global.h"
20 #include "BKE_screen.h"
21 
22 #include "ED_screen.h"
23 #include "ED_sequencer.h"
24 
25 #include "IMB_imbuf.h"
26 #include "IMB_imbuf_types.h"
27 
28 #include "sequencer_intern.h"
29 
30 /* **************************** buttons ********************************* */
31 
32 #if 0
33 static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt))
34 {
35  SpaceSeq *sseq = CTX_wm_space_seq(C);
36 
37  /* Don't show the gpencil if we are not showing the image. */
39 }
40 #endif
41 
43 {
44  SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
45  if (space_sequencer == NULL) {
46  return false;
47  }
48  return ED_space_sequencer_check_show_imbuf(space_sequencer);
49 }
50 
51 static void metadata_panel_context_draw(const bContext *C, Panel *panel)
52 {
53  /* Image buffer can not be acquired during render, similar to
54  * draw_image_seq(). */
55  if (G.is_rendering) {
56  return;
57  }
58  struct Main *bmain = CTX_data_main(C);
60  struct Scene *scene = CTX_data_scene(C);
61  ARegion *region = CTX_wm_region(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 &&
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(
74  bmain, region, depsgraph, scene, space_sequencer, scene->r.cfra, 0, "");
75  if (ibuf != NULL) {
77  IMB_freeImBuf(ibuf);
78  }
79 }
80 
82 {
83  PanelType *pt;
84 
85 #if 0
86  pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
87  strcpy(pt->idname, "SEQUENCER_PT_gpencil");
88  strcpy(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_callocN(sizeof(PanelType), "spacetype sequencer panel metadata");
97  strcpy(pt->idname, "SEQUENCER_PT_metadata");
98  strcpy(pt->label, N_("Metadata"));
99  strcpy(pt->category, "Metadata");
103  pt->order = 10;
104  BLI_addtail(&art->paneltypes, pt);
105 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct SpaceSeq * CTX_wm_space_seq(const bContext *C)
Definition: context.c:851
struct Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
Definition: context.c:1519
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
#define UNUSED(x)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
#define SEQ_EDIT_OVERLAY_FRAME_SHOW
@ SEQ_OVERLAY_FRAME_TYPE_REFERENCE
@ SEQ_DRAW_IMG_IMBUF
void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout)
Definition: area.c:3612
bool ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
Scene scene
const Depsgraph * depsgraph
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
#define G(x, y, z)
static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
void sequencer_buttons_register(ARegionType *art)
static void metadata_panel_context_draw(const bContext *C, Panel *panel)
ImBuf * sequencer_ibuf_get(struct Main *bmain, ARegion *region, struct Depsgraph *depsgraph, Scene *scene, SpaceSeq *sseq, int timeline_frame, int frame_ofs, const char *viewname)
ListBase paneltypes
Definition: BKE_screen.h:198
int overlay_frame_flag
Definition: BKE_main.h:121
void(* draw)(const struct bContext *C, struct Panel *panel)
Definition: BKE_screen.h:248
bool(* poll)(const struct bContext *C, struct PanelType *pt)
Definition: BKE_screen.h:242
void(* draw_header)(const struct bContext *C, struct Panel *panel)
Definition: BKE_screen.h:244
char idname[BKE_ST_MAXNAME]
Definition: BKE_screen.h:223
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:226
char category[BKE_ST_MAXNAME]
Definition: BKE_screen.h:228
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:224
struct uiLayout * layout
struct Editing * ed
struct RenderData r
char overlay_frame_type
#define N_(msgid)