[Bf-blender-cvs] [d1cf5b54b57] greasepencil-object: Apply scale weight to Offset modifier

Antonio Vazquez noreply at git.blender.org
Tue Dec 12 09:29:32 CET 2017


Commit: d1cf5b54b57da0ab9ce7c77ab36e72746b69e61f
Author: Antonio Vazquez
Date:   Tue Dec 12 09:29:22 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBd1cf5b54b57da0ab9ce7c77ab36e72746b69e61f

Apply scale weight to Offset modifier

This parameter was using the weight in a wrong way. As the offset is a change in the values, the default value change is 0, not 1, so a scale offset of 1 means add 1 to default scale.

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

M	source/blender/modifiers/intern/MOD_gpenciloffset.c

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

diff --git a/source/blender/modifiers/intern/MOD_gpenciloffset.c b/source/blender/modifiers/intern/MOD_gpenciloffset.c
index 6842a371474..d8581bbc37b 100644
--- a/source/blender/modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/modifiers/intern/MOD_gpenciloffset.c
@@ -55,7 +55,7 @@ static void initData(ModifierData *md)
 	gpmd->vgname[0] = '\0';
 	ARRAY_SET_ITEMS(gpmd->loc, 0.0f, 0.0f, 0.0f);
 	ARRAY_SET_ITEMS(gpmd->rot, 0.0f, 0.0f, 0.0f);
-	ARRAY_SET_ITEMS(gpmd->scale, 1.0f, 1.0f, 1.0f);
+	ARRAY_SET_ITEMS(gpmd->scale, 0.0f, 0.0f, 0.0f);
 }
 
 static void copyData(ModifierData *md, ModifierData *target)
@@ -71,7 +71,7 @@ static void deformStroke(ModifierData *md, const EvaluationContext *UNUSED(eval_
 	int vindex = defgroup_name_index(ob, mmd->vgname);
 	
 	float mat[4][4];
-	float loc[3], rot[3];
+	float loc[3], rot[3], scale[3];
 
 	if (!is_stroke_affected_by_modifier(
 	        mmd->layername, mmd->pass_index, 1, gpl, gps,
@@ -88,10 +88,12 @@ static void deformStroke(ModifierData *md, const EvaluationContext *UNUSED(eval_
 		if (weight < 0) {
 			continue;
 		}
-		/* calculate matrix (weight value cannot be used in scale) */
+		/* calculate matrix */
 		mul_v3_v3fl(loc, mmd->loc, weight);
 		mul_v3_v3fl(rot, mmd->rot, weight);
-		loc_eul_size_to_mat4(mat, loc, rot, mmd->scale);
+		mul_v3_v3fl(scale, mmd->scale, weight);
+		add_v3_fl(scale, 1.0);
+		loc_eul_size_to_mat4(mat, loc, rot, scale);
 
 		mul_m4_v3(mat, &pt->x);
 	}



More information about the Bf-blender-cvs mailing list