[Bf-blender-cvs] [1f98596023f] greasepencil-edit-curve: GPencil: New Error Threshold parameter

Antonio Vazquez noreply at git.blender.org
Fri Jun 12 10:33:20 CEST 2020


Commit: 1f98596023f59014e9b68fcda35639d7ae5df77c
Author: Antonio Vazquez
Date:   Fri Jun 12 10:32:51 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB1f98596023f59014e9b68fcda35639d7ae5df77c

GPencil: New Error Threshold parameter

This parameter is used to determine how precise is the curve conversion.

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

M	release/scripts/startup/bl_ui/space_view3d.py
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_sculpt_paint.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1cd84930510..249d6d19004 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -731,6 +731,12 @@ class VIEW3D_HT_header(Header):
                 row = layout.row(align=True)
                 row.prop(gpd, "use_curve_edit", text="",
                          icon='IPO_BEZIER')
+                sub = row.row(align=True)
+                sub.enabled = gpd.use_curve_edit
+                sub.popover(
+                    panel="VIEW3D_PT_gpencil_curve_edit",
+                    text="Curve Editing",
+                )
 
             # Select mode for Sculpt
             if gpd.is_stroke_sculpt_mode:
@@ -756,7 +762,7 @@ class VIEW3D_HT_header(Header):
                 row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING')
 
                 sub = row.row(align=True)
-                sub.active = gpd.use_multiedit
+                sub.enabled = gpd.use_multiedit
                 sub.popover(
                     panel="VIEW3D_PT_gpencil_multi_frame",
                     text="Multiframe",
@@ -6960,6 +6966,20 @@ class VIEW3D_PT_gpencil_multi_frame(Panel):
             layout.template_curve_mapping(settings, "multiframe_falloff_curve", brush=True)
 
 
+# Grease Pencil Object - Curve Editing tools
+class VIEW3D_PT_gpencil_curve_edit(Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'HEADER'
+    bl_label = "Curve Editing"
+
+    def draw(self, context):
+        settings = context.tool_settings.gpencil_sculpt
+
+        layout = self.layout
+        col = layout.column(align=True)
+        col.prop(settings, "curve_edit_threshold")
+
+
 class VIEW3D_MT_gpencil_edit_context_menu(Menu):
     bl_label = ""
 
@@ -7592,6 +7612,7 @@ classes = (
     VIEW3D_PT_grease_pencil,
     VIEW3D_PT_annotation_onion,
     VIEW3D_PT_gpencil_multi_frame,
+    VIEW3D_PT_gpencil_curve_edit,
     VIEW3D_PT_quad_view,
     VIEW3D_PT_view3d_stereo,
     VIEW3D_PT_shading,
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 69a07513741..28b1d07b8f7 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -287,5 +287,15 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
         gpd->editcurve_resolution = GP_DEFAULT_CURVE_RESOLUTION;
       }
     }
+    /* 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;
+        }
+      }
+    }
   }
 }
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 799590c5bde..b41a8a2b656 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -39,6 +39,7 @@ struct Curve;
 #define GP_MATERIAL_BUFFER_LEN 256
 
 #define GP_DEFAULT_CURVE_RESOLUTION 16
+#define GP_DEFAULT_CURVE_ERROR 0.1f
 
 /* ***************************************** */
 /* GP Stroke Points */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c50e48982b3..54fd6f1050a 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1085,7 +1085,8 @@ typedef struct GP_Sculpt_Settings {
   int lock_axis;
   /** Threshold for intersections */
   float isect_threshold;
-  char _pad_[4];
+  /** Curve Editing error threshold */
+  float curve_edit_threshold;
   /** Multiframe edit falloff effect by frame. */
   struct CurveMapping *cur_falloff;
   /** Curve used for primitive tools. */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 381908f7ada..2c5f6e90372 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1498,6 +1498,14 @@ 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