Fix T50103: Transform not working if scale is zero
If any axis of the scale of an object was zero, transforming failed. This was because `td->smtx` was set to a zero matrix. orthogonalize_m3_zero_axes is used to fill in the zeroed axes. Thanks to @filedescriptor for the initial fix: D10869.
This commit is contained in:
parent
8a144b73c0
commit
d5cefc1844
Notes:
blender-bot
2023-02-14 07:23:29 +01:00
Referenced by commit 18412744c8
, Fix T93687: Transform Gpencil vertices not working if scale is zero
Referenced by issue #50103, Parented object with Scale 1,1,0 seems to have Loc and Rot locked.
|
@ -282,9 +282,17 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
|
|||
*/
|
||||
BKE_object_to_mat3(ob, obmtx);
|
||||
copy_m3_m4(totmat, ob->obmat);
|
||||
invert_m3_m3(obinv, totmat);
|
||||
|
||||
/* If the object scale is zero on any axis, this might result in a zero matrix.
|
||||
* In this case, the transformation would not do anything, see: T50103. */
|
||||
orthogonalize_m3_zero_axes(obmtx, 1.0f);
|
||||
orthogonalize_m3_zero_axes(totmat, 1.0f);
|
||||
|
||||
/* Use safe invert even though the input matrices have had zero axes set to unit length,
|
||||
* in the unlikely case of failure (float precision for eg) this uses unit matrix fallback. */
|
||||
invert_m3_m3_safe_ortho(obinv, totmat);
|
||||
mul_m3_m3m3(td->smtx, obmtx, obinv);
|
||||
invert_m3_m3(td->mtx, td->smtx);
|
||||
invert_m3_m3_safe_ortho(td->mtx, td->smtx);
|
||||
}
|
||||
else {
|
||||
/* no conversion to/from dataspace */
|
||||
|
|
Loading…
Reference in New Issue