Commit: 287296565260373232146f3b4c6648d3800fe03e
Author: Campbell Barton
Date:   Mon Apr 9 12:39:43 2018 +0200
Branches: master
https://developer.blender.org/rB287296565260373232146f3b4c6648d3800fe03e

Cleanup: avoid recalculating global center

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

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

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

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 6ca9485599c..90014667b43 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1694,23 +1694,13 @@ static void drawHelpline(bContext *UNUSED(C), int x, 
int y, void *customdata)
        TransInfo *t = (TransInfo *)customdata;
 
        if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) {
-               float vecrot[3], cent[2];
+               float cent[2];
                int mval[2];
 
                mval[0] = x;
                mval[1] = y;
 
-               copy_v3_v3(vecrot, t->center);
-               if (t->flag & T_EDIT) {
-                       Object *ob = t->obedit;
-                       if (ob) mul_m4_v3(ob->obmat, vecrot);
-               }
-               else if (t->flag & T_POSE) {
-                       Object *ob = t->poseobj;
-                       if (ob) mul_m4_v3(ob->obmat, vecrot);
-               }
-
-               projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
+               projectFloatViewEx(t, t->center_global, cent, 
V3D_PROJ_TEST_CLIP_ZERO);
 
                glPushMatrix();
 
diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index 618b8a37320..92f596c5063 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1884,14 +1884,6 @@ void calculateCenter(TransInfo *t)
        
        if (t->spacetype == SPACE_VIEW3D) {
                /* ED_view3d_calc_zfac() defines a factor for perspective depth 
correction, used in ED_view3d_win_to_delta() */
-               float vec[3];
-               if (t->flag & (T_EDIT | T_POSE)) {
-                       Object *ob = t->obedit ? t->obedit : t->poseobj;
-                       mul_v3_m4v3(vec, ob->obmat, t->center);
-               }
-               else {
-                       copy_v3_v3(vec, t->center);
-               }
 
                /* zfac is only used convertViewVec only in cases operator was 
invoked in RGN_TYPE_WINDOW
                 * and never used in other cases.
@@ -1900,7 +1892,7 @@ void calculateCenter(TransInfo *t)
                 * for a region different from RGN_TYPE_WINDOW.
                 */
                if (t->ar->regiontype == RGN_TYPE_WINDOW) {
-                       t->zfac = ED_view3d_calc_zfac(t->ar->regiondata, vec, 
NULL);
+                       t->zfac = ED_view3d_calc_zfac(t->ar->regiondata, 
t->center_global, NULL);
                }
                else {
                        t->zfac = 0.0f;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to