[Bf-blender-cvs] [085a59ae6fa] greasepencil-edit-curve: GPencil: Remove curve flag and replace with RNA dynamic prop

Antonio Vazquez noreply at git.blender.org
Tue Jun 9 16:15:54 CEST 2020


Commit: 085a59ae6fa0f5f76056729bf4251d24890f213f
Author: Antonio Vazquez
Date:   Tue Jun 9 16:15:47 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB085a59ae6fa0f5f76056729bf4251d24890f213f

GPencil: Remove curve flag and replace with RNA dynamic prop

We don't need this flag because we can check the struct pointer itself.

===================================================================

M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_gpencil.c

===================================================================

diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 4ca060a39a9..ea19108bbe9 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -296,8 +296,6 @@ typedef enum eGPDstroke_Flag {
   GP_STROKE_TAG = (1 << 14),
   /* only for use with stroke-buffer (while drawing eraser) */
   GP_STROKE_ERASER = (1 << 15),
-  /* Stroke is actually using curve edition */
-  GP_STROKE_CURVE_MODE = (1 << 16),
 } eGPDstroke_Flag;
 
 /* bGPDstroke->caps */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index ea1f874ac86..6522c0341e8 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1027,6 +1027,16 @@ static void rna_point_index_set(PointerRNA *ptr, const int *values)
   }
 }
 
+static bool rna_stroke_has_edit_curve_get(PointerRNA *ptr)
+{
+  bGPDstroke *gps = (bGPDstroke *)ptr->data;
+  if (gps->editcurve != NULL) {
+    return true;
+  }
+
+  return false;
+}
+
 #else
 
 static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
@@ -1348,11 +1358,11 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Cyclic", "Enable cyclic drawing, closing the stroke");
   RNA_def_property_update(prop, 0, "rna_GPencil_update");
 
-  /* The stroke is actually using Curve Edit mode. */
-  prop = RNA_def_property(srna, "use_curve_edit", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_CURVE_MODE);
-  RNA_def_property_ui_text(prop, "Curve Edit", "Stroke is using a Curve to edit shape");
-  RNA_def_property_update(prop, 0, "rna_GPencil_update");
+  /* The stroke has Curve Edit data. */
+  prop = RNA_def_property(srna, "has_edit_curve", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_funcs(prop, "rna_stroke_has_edit_curve_get", NULL);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Has Curve Data", "Stroke has Curve data to edit shape");
 
   /* Caps mode */
   prop = RNA_def_property(srna, "start_cap_mode", PROP_ENUM, PROP_NONE);



More information about the Bf-blender-cvs mailing list