Fix T99070: Apply transform fails to clear delta transform values

Clear delta transform value after applying transform.
Include delta location while applying transform.
Use `copy_v3_fl` for resetting object scale

Reviewed By: mano-wii

Maniphest Tasks: T99070

Differential Revision: https://developer.blender.org/D15270
This commit is contained in:
Pratik Borhade 2022-06-27 10:37:09 -03:00 committed by Germano Cavalcante
parent 83c2cbb880
commit 279e7dac7d
Notes: blender-bot 2023-02-14 09:24:53 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #99070, Apply transform fails to clear delta transform values
1 changed files with 5 additions and 2 deletions

View File

@ -855,7 +855,7 @@ static int apply_objects_internal(bContext *C,
/* calculate translation */
if (apply_loc) {
copy_v3_v3(mat[3], ob->loc);
add_v3_v3v3(mat[3], ob->loc, ob->dloc);
if (!(apply_scale && apply_rot)) {
float tmat[3][3];
@ -1023,12 +1023,15 @@ static int apply_objects_internal(bContext *C,
else {
if (apply_loc) {
zero_v3(ob->loc);
zero_v3(ob->dloc);
}
if (apply_scale) {
ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f;
copy_v3_fl(ob->scale, 1.0f);
copy_v3_fl(ob->dscale, 1.0f);
}
if (apply_rot) {
zero_v3(ob->rot);
zero_v3(ob->drot);
unit_qt(ob->quat);
unit_axis_angle(ob->rotAxis, &ob->rotAngle);
}