diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-26 09:19:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-26 09:21:04 +0300 |
commit | 09e89f01a6ee5314833cf8838ea124e0cf75c60e (patch) | |
tree | 6e832b8c690b6c2875f4d9b65967af251aefb77a /source/blender/editors/transform/transform_snap.c | |
parent | c74255181e59d21e8d580d1694bc15359bfa1e6d (diff) |
Cleanup: transform center
store global center in transform struct,
some code was calculating all the time, this is useful to keep available.
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index db6620b0d46..8e100b9c925 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -841,16 +841,10 @@ static float TranslationBetween(TransInfo *UNUSED(t), const float p1[3], const f static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) { - float angle, start[3], end[3], center[3]; - - copy_v3_v3(center, t->center); - if (t->flag & (T_EDIT | T_POSE)) { - Object *ob = t->obedit ? t->obedit : t->poseobj; - mul_m4_v3(ob->obmat, center); - } + float angle, start[3], end[3]; - sub_v3_v3v3(start, p1, center); - sub_v3_v3v3(end, p2, center); + sub_v3_v3v3(start, p1, t->center_global); + sub_v3_v3v3(end, p2, t->center_global); // Angle around a constraint axis (error prone, will need debug) if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) { @@ -897,16 +891,10 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) static float ResizeBetween(TransInfo *t, const float p1[3], const float p2[3]) { - float d1[3], d2[3], center[3], len_d1; - - copy_v3_v3(center, t->center); - if (t->flag & (T_EDIT | T_POSE)) { - Object *ob = t->obedit ? t->obedit : t->poseobj; - mul_m4_v3(ob->obmat, center); - } + float d1[3], d2[3], len_d1; - sub_v3_v3v3(d1, p1, center); - sub_v3_v3v3(d2, p2, center); + sub_v3_v3v3(d1, p1, t->center_global); + sub_v3_v3v3(d2, p2, t->center_global); if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) { mul_m3_v3(t->con.pmtx, d1); @@ -1112,13 +1100,7 @@ static void TargetSnapCenter(TransInfo *t) { /* Only need to calculate once */ if ((t->tsnap.status & TARGET_INIT) == 0) { - copy_v3_v3(t->tsnap.snapTarget, t->center); - - if (t->flag & (T_EDIT | T_POSE)) { - Object *ob = t->obedit ? t->obedit : t->poseobj; - mul_m4_v3(ob->obmat, t->tsnap.snapTarget); - } - + copy_v3_v3(t->tsnap.snapTarget, t->center_global); TargetSnapOffset(t, NULL); t->tsnap.status |= TARGET_INIT; |