[Bf-blender-cvs] [85cac2221c5] blender2.8: Fix T56279: Grease Pencil transformations show a help line with wrong origin

Antonioya noreply at git.blender.org
Thu Aug 9 16:14:42 CEST 2018


Commit: 85cac2221c543e67a9070c94d89d61bf27c7190f
Author: Antonioya
Date:   Thu Aug 9 16:14:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB85cac2221c543e67a9070c94d89d61bf27c7190f

Fix T56279: Grease Pencil transformations show a help line with wrong origin

As grease pencil use multiedit frames instead of multiobject edit, this fix solves the issue.

In the future maybe will need modifications if we add multiobject support, but we need a solution now.

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

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

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 85229ddd041..5249b27fb70 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1790,7 +1790,7 @@ static bool helpline_poll(bContext *C)
 	return 0;
 }
 
-static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
+static void drawHelpline(bContext *C, int x, int y, void *customdata)
 {
 	TransInfo *t = (TransInfo *)customdata;
 
@@ -1806,23 +1806,31 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
 		    (float)t->mval[1],
 		};
 
-
-#if 0 /* XXX: Fix from 1c9690e7607bc990cc4a3e6ba839949bb83a78af cannot be used anymore */
-		if ((t->flag & T_POINTS) && (t->options & CTX_GPENCIL_STROKES)) {
-			FOREACH_TRANS_DATA_CONTAINER (t, tc) {
-				Object *ob = tc->obedit;
-				float vecrot[3];
-				copy_v3_v3(vecrot, t->center);
-				mul_m4_v3(ob->obmat, vecrot);
-				projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
+		/* grease pencil only can edit one object at time because GP has
+		 * multiframe edition that replaces multiobject edition.
+		 * If multiobject edition is added, maybe this code will need
+		 * an update
+		 */
+		if ((t->flag & T_POINTS) && (t->options & CTX_GPENCIL_STROKES) &&
+			(t->around != V3D_AROUND_ACTIVE))
+		{
+			Object *ob = CTX_data_active_object(C);
+			if ((ob) && (ob->type == OB_GPENCIL)) {
+				FOREACH_TRANS_DATA_CONTAINER(t, tc) {
+					float vecrot[3];
+					copy_v3_v3(vecrot, t->center_global);
+					mul_m4_v3(ob->obmat, vecrot);
+					projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
+				}
+			}
+			else {
+				/* normally, never must be used */
+				projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
 			}
 		}
 		else {
 			projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
 		}
-#else
-		projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
-#endif
 
 		/* Offset the values for the area region. */
 		const float offset[2] = {



More information about the Bf-blender-cvs mailing list