[Bf-blender-cvs] [a53a6a80fd8] greasepencil-object: Fix problem with primitive reproject

Antonio Vazquez noreply at git.blender.org
Sat Dec 30 16:58:16 CET 2017


Commit: a53a6a80fd84a46953ebfa3ac797652e5a5ccf8c
Author: Antonio Vazquez
Date:   Sat Dec 30 13:18:07 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBa53a6a80fd84a46953ebfa3ac797652e5a5ccf8c

Fix problem with primitive reproject

The apply parent must be applied after reproject.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 2ba68d1c0d8..70b80ccc9f0 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -245,8 +245,6 @@ static void gp_primitive_rectangle(tGPDprimitive *tgpi, bGPDstroke *gps)
 		/* convert screen-coordinates to 3D coordinates */
 		gp_stroke_convertcoords_tpoint(tgpi->scene, tgpi->ar, tgpi->v3d, tgpi->ob, tgpi->gpl, &point2D, r_out);
 		copy_v3_v3(&pt->x, r_out);
-		/* if parented change position relative to parent object */
-		gp_apply_parent_point(tgpi->ob, tgpi->gpd, tgpi->gpl, pt);
 
 		pt->pressure = 1.0f;
 		pt->strength = tgpi->brush->draw_strength;
@@ -268,6 +266,12 @@ static void gp_primitive_rectangle(tGPDprimitive *tgpi, bGPDstroke *gps)
 			tgpi->lock_axis - 1, ts->gpencil_src);
 	}
 
+	/* if parented change position relative to parent object */
+	for (int i = 0; i < totpoints; i++) {
+		pt = &gps->points[i];
+		gp_apply_parent_point(tgpi->ob, tgpi->gpd, tgpi->gpl, pt);
+	}
+
 	/* force fill recalc */
 	gps->flag |= GP_STROKE_RECALC_CACHES;
 }
@@ -298,8 +302,6 @@ static void gp_primitive_circle(tGPDprimitive *tgpi, bGPDstroke *gps)
 		/* convert screen-coordinates to 3D coordinates */
 		gp_stroke_convertcoords_tpoint(tgpi->scene, tgpi->ar, tgpi->v3d, tgpi->ob, tgpi->gpl, &point2D, r_out);
 		copy_v3_v3(&pt->x, r_out);
-		/* if parented change position relative to parent object */
-		gp_apply_parent_point(tgpi->ob, tgpi->gpd, tgpi->gpl, pt);
 
 		pt->pressure = 1.0f;
 		pt->strength = tgpi->brush->draw_strength;
@@ -324,6 +326,12 @@ static void gp_primitive_circle(tGPDprimitive *tgpi, bGPDstroke *gps)
 		}
 	}
 
+	/* if parented change position relative to parent object */
+	for (int i = 0; i < totpoints; i++) {
+		pt = &gps->points[i];
+		gp_apply_parent_point(tgpi->ob, tgpi->gpd, tgpi->gpl, pt);
+	}
+
 	/* force fill recalc */
 	gps->flag |= GP_STROKE_RECALC_CACHES;
 }



More information about the Bf-blender-cvs mailing list