[Bf-blender-cvs] [01b43c53ffa] greasepencil-edit-curve: GPencil: Moves Curve Threshold to bGPdata

Antonio Vazquez noreply at git.blender.org
Fri Jun 12 13:27:29 CEST 2020


Commit: 01b43c53ffaf7d5afcc15f7a8a4c13ea8bee0be2
Author: Antonio Vazquez
Date:   Fri Jun 12 13:27:12 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB01b43c53ffaf7d5afcc15f7a8a4c13ea8bee0be2

GPencil: Moves Curve Threshold to bGPdata

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_gpencil.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index fbeb480aa21..95fb1b52240 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6979,7 +6979,7 @@ class VIEW3D_PT_gpencil_curve_edit(Panel):
         layout = self.layout
         col = layout.column(align=True)
         col.prop(gpd, "edit_curve_resolution")
-        col.prop(settings, "curve_edit_threshold")
+        col.prop(gpd, "curve_edit_threshold")
 
 
 class VIEW3D_MT_gpencil_edit_context_menu(Menu):
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 8d81528fdcf..95549c9d3f9 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -508,6 +508,7 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
   gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
 
   gpd->editcurve_resolution = GP_DEFAULT_CURVE_RESOLUTION;
+  gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
 
   gpd->zdepth_offset = 0.150f;
 
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 28b1d07b8f7..03b035b644b 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -288,13 +288,9 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
       }
     }
     /* Init grease pencil curve editing error threshold. */
-    if (!DNA_struct_elem_find(
-            fd->filesdna, "GP_Sculpt_Settings", "float", "curve_edit_threshold")) {
-      for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-        GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
-        if (gset) {
-          gset->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
-        }
+    if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "curve_edit_threshold")) {
+      for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+        gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
       }
     }
   }
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index f108272617a..8c5f818c8b6 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -594,6 +594,9 @@ typedef struct bGPdata {
   int flag;
   /** Default resolution for generated curves using curve editing method. */
   int editcurve_resolution;
+  /** Curve Editing error threshold */
+  float curve_edit_threshold;
+  char _pad[4];
 
   /* Palettes */
   /** List of bGPDpalette's   - Deprecated (2.78 - 2.79 only). */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 54fd6f1050a..f52ff83bc61 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1085,8 +1085,7 @@ typedef struct GP_Sculpt_Settings {
   int lock_axis;
   /** Threshold for intersections */
   float isect_threshold;
-  /** Curve Editing error threshold */
-  float curve_edit_threshold;
+  char _pad[4];
   /** Multiframe edit falloff effect by frame. */
   struct CurveMapping *cur_falloff;
   /** Curve used for primitive tools. */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 6da44fa02e2..20fa275b589 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -2231,6 +2231,14 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
       "Number of segments generated between control points when editing strokes in curve mode");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_curve_resolution_update");
 
+  /* Curve editing error threshold. */
+  prop = RNA_def_property(srna, "curve_edit_threshold", PROP_FLOAT, PROP_FACTOR);
+  RNA_def_property_float_sdna(prop, NULL, "curve_edit_threshold");
+  RNA_def_property_range(prop, 0.0f, 1.0f);
+  RNA_def_property_float_default(prop, GP_DEFAULT_CURVE_ERROR);
+  RNA_def_property_ui_text(prop, "Threshold", "Curve conversion error threshold");
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
   prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_MULTIEDIT);
   RNA_def_property_ui_text(prop,
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 2c5f6e90372..381908f7ada 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1498,14 +1498,6 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
   RNA_def_property_float_default(prop, 0.1f);
   RNA_def_property_ui_text(prop, "Threshold", "Threshold for stroke intersections");
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
-  /* Curve editing error threshold. */
-  prop = RNA_def_property(srna, "curve_edit_threshold", PROP_FLOAT, PROP_FACTOR);
-  RNA_def_property_float_sdna(prop, NULL, "curve_edit_threshold");
-  RNA_def_property_range(prop, 0.0f, 1.0f);
-  RNA_def_property_float_default(prop, GP_DEFAULT_CURVE_ERROR);
-  RNA_def_property_ui_text(prop, "Threshold", "Curve conversion error threshold");
-  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 }
 
 void RNA_def_sculpt_paint(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list