Fix #125070: Handle "Unit Scale" correctly in the STL and PLY importers

When importing an STL file with the "Scene Unit" option enabled, we
should divide by the Unit Scale instead of multiply (which was already
done when Exporting with "Unit Scale" enabled)

The PLY importer had the same issue.

The prior "legacy" implementation did this correctly:
b42d686277/io_mesh_stl/__init__.py (L110)

Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/124718
This commit is contained in:
bartus
2024-08-13 19:22:58 +02:00
committed by Jesse Yurkovich
parent 5b75c5b89d
commit 7207015a58
2 changed files with 2 additions and 2 deletions

View File

@@ -247,7 +247,7 @@ void importer_main(Main *bmain,
/* Object matrix and finishing up. */
float global_scale = import_params.global_scale;
if ((scene->unit.system != USER_UNIT_NONE) && import_params.use_scene_unit) {
global_scale *= scene->unit.scale_length;
global_scale /= scene->unit.scale_length;
}
float scale_vec[3] = {global_scale, global_scale, global_scale};
float obmat3x3[3][3];

View File

@@ -134,7 +134,7 @@ void importer_main(Main *bmain,
float global_scale = import_params.global_scale;
if ((scene->unit.system != USER_UNIT_NONE) && import_params.use_scene_unit) {
global_scale *= scene->unit.scale_length;
global_scale /= scene->unit.scale_length;
}
float scale_vec[3] = {global_scale, global_scale, global_scale};
float obmat3x3[3][3];