[Bf-blender-cvs] [e485836b3a1] soc-2020-greasepencil-curve: GPencil: created a new file for edit curve mode operators
Falk David
noreply at git.blender.org
Tue Jun 2 10:11:38 CEST 2020
Commit: e485836b3a1f9653a6ca965605e2741fdfded812
Author: Falk David
Date: Mon Jun 1 18:51:50 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBe485836b3a1f9653a6ca965605e2741fdfded812
GPencil: created a new file for edit curve mode operators
This new file will hold all the operators for curve edit mode.
Initially only one dummy operator was moved from gpencil_edit
to this file.
===================================================================
M source/blender/editors/gpencil/CMakeLists.txt
M source/blender/editors/gpencil/gpencil_edit.c
A source/blender/editors/gpencil/gpencil_edit_curve.c
===================================================================
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index 4083169d65c..b67d03b1c25 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -46,6 +46,7 @@ set(SRC
gpencil_convert.c
gpencil_data.c
gpencil_edit.c
+ gpencil_edit_curve.c
gpencil_fill.c
gpencil_interpolate.c
gpencil_merge.c
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 0b0c89ecbf6..8771fcb0c8d 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -5057,48 +5057,3 @@ void GPENCIL_OT_stroke_merge_by_distance(wmOperatorType *ot)
}
/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Test Operator for curve editing
- * \{ */
-
-static int gp_test_stroke_curve_data_exec(bContext *C, wmOperator *op)
-{
- Object *ob = CTX_data_active_object(C);
- bGPdata *gpd = (bGPdata *)ob->data;
-
- /* sanity checks */
- if (ELEM(NULL, gpd)) {
- return OPERATOR_CANCELLED;
- }
-
- /* TODO: create new gp object with curve data */
-
- /* notifiers */
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-void GPENCIL_OT_test_stroke_curve_data(wmOperatorType *ot)
-{
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name = "Test stroke curve data";
- ot->idname = "GPENCIL_OT_test_stroke_curve_data";
- ot->description = "Test operator to test the curve data in a grease pencil stroke.";
-
- /* api callbacks */
- ot->exec = gp_test_stroke_curve_data_exec;
- ot->poll = gp_active_layer_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* properties */
- /* XXX: no props for now */
-}
-
-/** \} */
\ No newline at end of file
diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
new file mode 100644
index 00000000000..caca83cdd5c
--- /dev/null
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -0,0 +1,96 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008, Blender Foundation
+ * This is a new part of Blender
+ * Operators for editing Grease Pencil strokes
+ */
+
+/** \file
+ * \ingroup edgpencil
+ */
+
+#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_gpencil_types.h"
+#include "DNA_view3d_types.h"
+
+#include "BKE_context.h"
+#include "BKE_gpencil.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_gpencil.h"
+
+#include "DEG_depsgraph.h"
+
+#include "gpencil_intern.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Test Operator for curve editing
+ * \{ */
+
+static int gp_test_stroke_curve_data_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
+
+ /* sanity checks */
+ if (ELEM(NULL, gpd)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* TODO: create new gp object with curve data */
+ bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
+ bGPDlayer *gpf = gpl->actframe;
+ if (ELEM(NULL, gpf)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_test_stroke_curve_data(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Test stroke curve data";
+ ot->idname = "GPENCIL_OT_test_stroke_curve_data";
+ ot->description = "Test operator to test the curve data in a grease pencil stroke.";
+
+ /* api callbacks */
+ ot->exec = gp_test_stroke_curve_data_exec;
+ ot->poll = gp_active_layer_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ /* XXX: no props for now */
+}
+
+/** \} */
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list