Skip to content

Commit 5b50bff

Browse files
committed
set units to centimeters before importing or exporting
set back to original units once import/export complete
1 parent 283951d commit 5b50bff

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Assets/Integrations/Autodesk/max/scripts/UnityFbxForMaxPlugin.ms

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ macroScript UnityImport category:"Unity"
3737
origObjects = objects as array
3838
callbacks.addScript #postImport ("afterImport()") id:#unityPlugin
3939

40+
-- set the system units to centimeters
41+
local origUnits = units.SystemType
42+
units.SystemType = #Centimeters
43+
4044
importFile fbxFileName using:FBXIMP
4145

46+
units.SystemType = origUnits
47+
4248
unityFbxFilePathAttr = getFilenamePath fbxFileName
4349
unityFbxFileNameAttr = filenameFromPath fbxFileName
4450

@@ -83,6 +89,9 @@ macroScript UnityExport category:"Unity"
8389
select exportSet
8490
)
8591

92+
local origUnits = units.SystemType
93+
units.SystemType = #Centimeters
94+
8695
exportFileName = undefined
8796
if unityFbxFilePathAttr != undefined and unityFbxFileNameAttr != undefined then(
8897
exportFileName = unityFbxFilePathAttr + unityFbxFileNameAttr
@@ -96,6 +105,8 @@ macroScript UnityExport category:"Unity"
96105
exportFile exportFileName #noPrompt selectedOnly:true using:FBXEXP
97106
)
98107

108+
units.SystemType = origUnits
109+
99110
if origSelection != undefined then (
100111
select origSelection
101112
)

Assets/Integrations/Autodesk/max/scripts/unityFbxExportSettings.ms

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FbxExporterSetParam "Lights" true
1717
FbxExporterSetParam "EmbedTextures" false
1818

1919
-- Units
20-
--FbxExporterSetParam "ScaleFactor" 1
20+
FbxExporterSetParam "ScaleFactor" 1
2121
FbxExporterSetParam "ConvertUnit" "cm"
2222

2323
-- Axis Conversion

0 commit comments

Comments
 (0)