[Bf-blender-cvs] [d646652d609] greasepencil-object: GPencil: Add option to scale thickness

Antonio Vazquez noreply at git.blender.org
Sat Nov 30 16:47:09 CET 2019


Commit: d646652d609f0c78e636e8365d2d0e9455677ac7
Author: Antonio Vazquez
Date:   Sat Nov 30 16:47:01 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBd646652d609f0c78e636e8365d2d0e9455677ac7

GPencil: Add option to scale thickness

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/transform/transform_convert_gpencil.c
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 c1b11bb02fa..99025e8643e 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4730,6 +4730,7 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
 
     def draw(self, _context):
         layout = self.layout
+        settings = _context.tool_settings.gpencil_sculpt
 
         layout.operator("gpencil.stroke_subdivide", text="Subdivide").only_selected = False
         layout.menu("VIEW3D_MT_gpencil_simplify")
@@ -4760,6 +4761,7 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
         layout.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
         layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps", property="type")
         layout.operator("gpencil.stroke_flip", text="Switch Direction")
+        layout.prop(settings, "use_scale_thickness")
 
         layout.separator()
         layout.operator("gpencil.reset_transform_fill", text="Reset Fill Transform")
diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c
index 16ed7c4475e..a542a48a031 100644
--- a/source/blender/editors/transform/transform_convert_gpencil.c
+++ b/source/blender/editors/transform/transform_convert_gpencil.c
@@ -80,7 +80,7 @@ void createTransGPencil(bContext *C, TransInfo *t)
 
   const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
   const bool is_prop_edit_connected = (t->flag & T_PROP_CONNECTED) != 0;
-
+  const bool is_scale_thickness = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_SCALE_THICKNESS);
   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
 
   /* == Grease Pencil Strokes to Transform Data ==
@@ -311,7 +311,7 @@ void createTransGPencil(bContext *C, TransInfo *t)
                   /* for other transform modes (e.g. shrink-fatten), need to additional data
                    * but never for mirror
                    */
-                  if (t->mode != TFM_MIRROR) {
+                  if ((t->mode != TFM_MIRROR) && (is_scale_thickness)) {
                     if (t->mode != TFM_GPENCIL_OPACITY) {
                       td->val = &pt->pressure;
                       td->ival = pt->pressure;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 506d727d56c..a9da26500c4 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1096,6 +1096,8 @@ typedef enum eGP_Sculpt_SettingsFlag {
   GP_SCULPT_SETT_FLAG_FRAME_FALLOFF = (1 << 0),
   /* apply primitive curve */
   GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE = (1 << 1),
+  /* Scale thickness. */
+  GP_SCULPT_SETT_FLAG_SCALE_THICKNESS = (1 << 3),
 } eGP_Sculpt_SettingsFlag;
 
 /* GP_Sculpt_Settings.gpencil_selectmode_sculpt */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 3a7f243422a..a7310e9fa71 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1405,6 +1405,14 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 
+  prop = RNA_def_property(srna, "use_scale_thickness", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_SCALE_THICKNESS);
+  RNA_def_property_ui_text(prop,
+                           "Scale Stroke Thickness",
+                           "Scale the stroke thickness when transforming strokes in edit mode");
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
   /* custom falloff curve */
   prop = RNA_def_property(srna, "multiframe_falloff_curve", PROP_POINTER, PROP_NONE);
   RNA_def_property_pointer_sdna(prop, NULL, "cur_falloff");



More information about the Bf-blender-cvs mailing list