Blender V5.3
gpencil_edit.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#include <cstdlib>
11#include <cstring>
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_ghash.hh"
16#include "BLI_listbase.hh"
17#include "BLI_utildefines.hh"
18
20#include "DNA_scene_types.h"
21#include "DNA_screen_types.h"
22
23#include "BKE_annotations.h"
24#include "BKE_context.hh"
25#include "BKE_lib_id.hh"
26#include "BKE_paint.hh"
27#include "BKE_report.hh"
28#include "BKE_scene.hh"
29
30#include "WM_api.hh"
31#include "WM_message.hh"
32#include "WM_toolsystem.hh"
33#include "WM_types.hh"
34
35#include "RNA_access.hh"
36
37#include "UI_view2d.hh"
38
39#include "ED_gpencil_legacy.hh"
40#include "ED_image.hh"
41#include "ED_object.hh"
42#include "ED_outliner.hh"
43#include "ED_screen.hh"
44#include "ED_view3d.hh"
45
46#include "DEG_depsgraph.hh"
47
48#include "gpencil_intern.hh"
49
50namespace blender {
51
52/* -------------------------------------------------------------------- */
55
57{
60
61 /* only if there's an active layer with an active frame */
62 return (gpl && gpl->actframe);
63}
64
65/* delete active frame - wrapper around API calls */
67{
70
71 Scene *scene = CTX_data_scene(C);
72
74
75 /* if there's no existing Grease-Pencil data there, add some */
76 if (gpd == nullptr) {
77 BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
78 return OPERATOR_CANCELLED;
79 }
80 if (ELEM(nullptr, gpl, gpf)) {
81 BKE_report(op->reports, RPT_ERROR, "No active frame to delete");
82 return OPERATOR_CANCELLED;
83 }
84
85 /* delete it... */
87
88 /* notifiers */
91
92 return OPERATOR_FINISHED;
93}
94
96{
97 /* identifiers */
98 ot->name = "Delete Active Frame";
99 ot->idname = "GPENCIL_OT_annotation_active_frame_delete";
100 ot->description = "Delete the active frame for the active Annotation Layer";
101
103
104 /* callbacks */
107}
108
110
111} // namespace blender
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ND_DATA
Definition WM_types.hh:552
#define NA_EDITED
Definition WM_types.hh:634
#define NC_GPENCIL
Definition WM_types.hh:412
#define ELEM(...)
BMesh Iterators.
struct bGPDframe * BKE_annotations_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
static wmOperatorStatus gpencil_actframe_delete_exec(bContext *C, wmOperator *op)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot)
bGPdata * ED_annotation_data_get_active(const bContext *C)
struct bGPDlayer * BKE_annotations_layer_active_get(struct bGPdata *gpd)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
static bool annotation_actframe_delete_poll(bContext *C)
bool BKE_annotations_layer_frame_delete(struct bGPDlayer *gpl, struct bGPDframe *gpf)
Scene * CTX_data_scene(const bContext *C)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
struct RenderData r
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
struct ReportList * reports