Fix: Sculpt Scale tool adds up scale with non-uniform object scaling

This has already been tried to solve in f71d89bb04 (but apparently
still wrong).

This PR will hopefully address part of the scaling issues (rotation
needs another look, see below)

wrt. to scaling, the is code in place to reorient the size matrix in
`ElementResize` (for `Sculpt`, `Object`, `ObjectTexSpace` & `Pose`) that
multiplies by `td->axismtx` and it can be assumed that this code expects
`td->axismtx` to be normalized (otherwise the scaling adds up). And it
looks like all code coming here actually does this (except sculpt code
from `createTransSculpt`).

So to resolve, normalize `td->axismtx` in `createTransSculpt`.

NOTE: even after this PR, there can still be issues with scaling, namely
with rotated objects and global orientation, or when the pivot is set to 3D
cursor, those need another look.

NOTE: for rotation, I need another look at git history, atm. it seems
puzzling that f71d89bb04 e.g. uses `TransDataExtension::l_smtx` (this
is only ever used for pose related rotation?!)

part of #127398

Pull Request: https://projects.blender.org/blender/blender/pulls/127495
This commit is contained in:
Philipp Oeser
2024-09-20 18:02:31 +02:00
committed by Philipp Oeser
parent 52be15071f
commit 2ba13677ad

View File

@@ -94,6 +94,7 @@ static void createTransSculpt(bContext *C, TransInfo *t)
copy_m3_m3(td->smtx, obmat_inv);
copy_m3_m4(td->mtx, ob.object_to_world().ptr());
copy_m3_m4(td->axismtx, ob.object_to_world().ptr());
normalize_m3(td->axismtx);
BLI_assert(!(t->options & CTX_PAINT_CURVE));
sculpt_paint::init_transform(C, ob, t->mval, t->undo_name);