diff options
author | Aras Pranckevicius <aras_p> | 2022-03-20 00:13:21 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-03-23 13:59:57 +0300 |
commit | 9ed566efb67a20c66e6d8c2965546b89bdd9764e (patch) | |
tree | 4b023782098d06e9d14a00aeae81bd99c03e7dd2 | |
parent | 3a1e6bc1d5807b732536c73170f11268fb398726 (diff) |
Fix T96415: new OBJ exporter was applying scaling factor incorrectly
Instead of scaling "the scene" (i.e. transform vertices by object matrix,
then multiply by scale factor), it was instead first applying the scale
factor in local space, and then transforming by the object matrix.
Cherry picked from 5bfdaaa80082, original differential D14347.
-rw-r--r-- | source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc | 2 | ||||
-rw-r--r-- | source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc index c1b9b0a8ccf..2670272f4b7 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc @@ -248,8 +248,8 @@ float3 OBJMesh::calc_vertex_coords(const int vert_index, const float scaling_fac { float3 r_coords; copy_v3_v3(r_coords, export_mesh_eval_->mvert[vert_index].co); - mul_v3_fl(r_coords, scaling_factor); mul_m4_v3(world_and_axes_transform_, r_coords); + mul_v3_fl(r_coords, scaling_factor); return r_coords; } diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc index 7e60492bac2..07b799b80b3 100644 --- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc @@ -443,6 +443,17 @@ TEST_F(obj_exporter_regression_test, cube_normal_edit) _export.params); } +TEST_F(obj_exporter_regression_test, cubes_positioned) +{ + OBJExportParamsDefault _export; + _export.params.export_materials = false; + _export.params.scaling_factor = 2.0f; + compare_obj_export_to_golden("io_tests/blend_geometry/cubes_positioned.blend", + "io_tests/obj/cubes_positioned.obj", + "", + _export.params); +} + TEST_F(obj_exporter_regression_test, suzanne_all_data) { OBJExportParamsDefault _export; |