Fix T46434: Shear w/ local-center & editmode fails

This commit is contained in:
Campbell Barton 2015-10-12 12:02:22 +11:00
parent 1b8a4fd9bd
commit c2ce38b102
Notes: blender-bot 2023-02-14 10:37:50 +01:00
Referenced by issue #46434, Shear doesn't work as expected with Individual Origins on
1 changed files with 17 additions and 4 deletions

View File

@ -3085,6 +3085,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
float value;
int i;
char str[MAX_INFO_LEN];
const bool is_local_center = transdata_check_local_center(t, t->around);
copy_m3_m4(persmat, t->viewmat);
invert_m3_m3(persinv, persmat);
@ -3120,8 +3121,10 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
mul_m3_m3m3(tmat, smat, persmat);
mul_m3_m3m3(totmat, persinv, tmat);
for (i = 0; i < t->total; i++, td++) {
const float *center, *co;
if (td->flag & TD_NOACTION)
break;
@ -3136,12 +3139,22 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
else {
copy_m3_m3(tmat, totmat);
}
sub_v3_v3v3(vec, td->center, t->center);
if (is_local_center) {
center = td->center;
co = td->loc;
}
else {
center = t->center;
co = td->center;
}
sub_v3_v3v3(vec, co, center);
mul_m3_v3(tmat, vec);
add_v3_v3(vec, t->center);
sub_v3_v3(vec, td->center);
add_v3_v3(vec, center);
sub_v3_v3(vec, co);
mul_v3_fl(vec, td->factor);