Blender V5.0
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.h"
16#include "BLI_listbase.h"
17#include "BLI_utildefines.h"
18
20#include "DNA_scene_types.h"
21#include "DNA_screen_types.h"
22
23#include "BKE_context.hh"
24#include "BKE_gpencil_legacy.h"
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
50/* -------------------------------------------------------------------- */
53
55{
58
59 /* only if there's an active layer with an active frame */
60 return (gpl && gpl->actframe);
61}
62
63/* delete active frame - wrapper around API calls */
65{
68
69 Scene *scene = CTX_data_scene(C);
70
72
73 /* if there's no existing Grease-Pencil data there, add some */
74 if (gpd == nullptr) {
75 BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
76 return OPERATOR_CANCELLED;
77 }
78 if (ELEM(nullptr, gpl, gpf)) {
79 BKE_report(op->reports, RPT_ERROR, "No active frame to delete");
80 return OPERATOR_CANCELLED;
81 }
82
83 /* delete it... */
85
86 /* notifiers */
89
90 return OPERATOR_FINISHED;
91}
92
94{
95 /* identifiers */
96 ot->name = "Delete Active Frame";
97 ot->idname = "GPENCIL_OT_annotation_active_frame_delete";
98 ot->description = "Delete the active frame for the active Annotation Layer";
99
101
102 /* callbacks */
105}
106
Scene * CTX_data_scene(const bContext *C)
bool BKE_gpencil_layer_frame_delete(struct bGPDlayer *gpl, struct bGPDframe *gpf)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
struct bGPDlayer * BKE_gpencil_layer_active_get(struct bGPdata *gpd)
@ GP_GETFRAME_USE_PREV
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
#define ND_DATA
Definition WM_types.hh:509
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NA_EDITED
Definition WM_types.hh:584
#define NC_GPENCIL
Definition WM_types.hh:399
static wmOperatorStatus gpencil_actframe_delete_exec(bContext *C, wmOperator *op)
static bool annotation_actframe_delete_poll(bContext *C)
void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot)
bGPdata * ED_annotation_data_get_active(const bContext *C)
struct RenderData r
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4237