diff options
author | Antonioya <blendergit@gmail.com> | 2018-08-09 17:14:14 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-09 17:14:29 +0300 |
commit | 85cac2221c543e67a9070c94d89d61bf27c7190f (patch) | |
tree | dcee747a093d8f5778e9f168635866306ce2a8d4 /source/blender/editors | |
parent | b70f85f2aae977dc361d40b73cf5a110495c6cab (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform.c | 34 |
1 files changed, 21 insertions, 13 deletions
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] = { |