io_scene_3ds: Added imperial unit length measure #104805

Merged
Sebastian Sille merged 58 commits from :main into main 2023-07-31 00:39:53 +02:00
2 changed files with 14 additions and 2 deletions
Showing only changes of commit a70ce67693 - Show all commits

View File

@ -1541,12 +1541,18 @@ def save(operator, context, filepath="", scale_factor=1.0, use_scene_unit=False,
unit_measure = 1.0 unit_measure = 1.0
if use_scene_unit: if use_scene_unit:
unit_length = scene.unit_settings.length_unit unit_length = scene.unit_settings.length_unit
if unit_length == 'KILOMETERS': if unit_length == 'MILES':
unit_measure = 0.000621371
elif unit_length == 'KILOMETERS':
unit_measure = 0.001 unit_measure = 0.001
elif unit_length == 'INCHES':
unit_measure = 39.37007874
elif unit_length == 'CENTIMETERS': elif unit_length == 'CENTIMETERS':
unit_measure = 100 unit_measure = 100
elif unit_length == 'MILLIMETERS': elif unit_length == 'MILLIMETERS':
unit_measure = 1000 unit_measure = 1000
elif unit_length == 'THOU':
unit_measure = 39370.07874
elif unit_length == 'MICROMETERS': elif unit_length == 'MICROMETERS':
unit_measure = 1000000 unit_measure = 1000000

View File

@ -1475,12 +1475,18 @@ def load_3ds(filepath, context, CONSTRAIN=10.0, UNITS=False, IMAGE_SEARCH=True,
if UNITS: if UNITS:
unit_length = scn.unit_settings.length_unit unit_length = scn.unit_settings.length_unit
if unit_length == 'KILOMETERS': if unit_length == 'MILES':
MEASURE = 1609.344
elif unit_length == 'KILOMETERS':
MEASURE = 1000.0 MEASURE = 1000.0
elif unit_length == 'INCHES':
MEASURE = 0.3048
elif unit_length == 'CENTIMETERS': elif unit_length == 'CENTIMETERS':
MEASURE = 0.01 MEASURE = 0.01
elif unit_length == 'MILLIMETERS': elif unit_length == 'MILLIMETERS':
MEASURE = 0.001 MEASURE = 0.001
elif unit_length == 'THOU':
MEASURE = 0.0000254
elif unit_length == 'MICROMETERS': elif unit_length == 'MICROMETERS':
MEASURE = 0.000001 MEASURE = 0.000001