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:
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user