[Bf-blender-cvs] [617839721da] greasepencil-object: Scale stroke thickness when scale stroke

Antonio Vazquez noreply at git.blender.org
Sat Jan 6 10:53:35 CET 2018


Commit: 617839721da9b78fe230d27d6414eb9c57df96b9
Author: Antonio Vazquez
Date:   Sat Jan 6 10:53:17 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB617839721da9b78fe230d27d6414eb9c57df96b9

Scale stroke thickness when scale stroke

Now when scale a stroke, the thickness is scale to.

The operator to scale only thickness is available too using Shift+S

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

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_conversions.c

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9ba4139e101..17df37da9bd 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -3444,6 +3444,18 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
 	if (t->options & CTX_GPENCIL_STROKES) {
 		bGPDstroke *gps = (bGPDstroke *)td->extra;
 		mul_v3_fl(vec, td->factor * gps->falloff);
+
+		/* scale stroke thickness */
+		if (td->val) {
+			float ratio = t->values[0];
+			snapGridIncrement(t, &ratio);
+			applyNumInput(&t->num, &ratio);
+			t->values[0] = ratio;
+
+			*td->val = td->ival * ratio * gps->falloff;
+			CLAMP_MIN(*td->val, 0.001f);
+		}
+
 	}
 	else {
 		mul_v3_fl(vec, td->factor);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 04b3d8a85f4..78271eeb794 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -8065,10 +8065,8 @@ static void createTransGPencil(bContext *C, TransInfo *t)
 										td->flag |= TD_SELECTED;
 
 									/* for other transform modes (e.g. shrink-fatten), need to additional data */
-									if (t->mode == TFM_GPENCIL_SHRINKFATTEN) {
-										td->val = &pt->pressure;
-										td->ival = pt->pressure;
-									}
+									td->val = &pt->pressure;
+									td->ival = pt->pressure;
 
 									/* screenspace needs special matrices... */
 									if ((gps->flag & (GP_STROKE_3DSPACE | GP_STROKE_2DSPACE | GP_STROKE_2DIMAGE)) == 0) {



More information about the Bf-blender-cvs mailing list