[Bf-blender-cvs] [53822bd1d76] greasepencil-object: Fix error when axis not locked

Antonio Vazquez noreply at git.blender.org
Tue Nov 7 11:58:44 CET 2017


Commit: 53822bd1d7696da491582ec30dbd583ca09a8cf1
Author: Antonio Vazquez
Date:   Tue Nov 7 11:58:22 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB53822bd1d7696da491582ec30dbd583ca09a8cf1

Fix error when axis not locked

The size of the stroke was not correct when the axis was not locked.

It needs a vector to the view to calculate the real size of the stroke.

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

M	source/blender/editors/gpencil/gpencil_utils.c

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

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index b8d2f34347a..92856346926 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1230,15 +1230,18 @@ void ED_gp_project_point_to_plane(Object *ob, RegionView3D *rv3d, const float or
 	float ray[3];
 	float rpoint[3];
 
-	/* no need reproject */
+	/* normal vector for a plane locked to axis */
+	zero_v3(plane_normal);
 	if (axis < 0) {
-		return;
+		/* if the axis is not locked, need a vector to the view direction 
+		 * in order to get the right size of the stroke.
+		 */
+		ED_view3d_global_to_vector(rv3d, &pt->x, plane_normal);
+	}
+	else {
+		plane_normal[axis] = 1.0f;
 	}
 
-	/* normal vector for a plane locked to axis */
-	zero_v3(plane_normal);
-	plane_normal[axis] = 1.0f;
-	
 	/* if object, apply object rotation */
 	if (ob && (ob->type == OB_GPENCIL)) {
 		mul_mat3_m4_v3(ob->obmat, plane_normal);



More information about the Bf-blender-cvs mailing list