Skip to content

Commit d05e4f6

Browse files
authored
Merge pull request #364 from Unity-Technologies/UNI-42753-max-add-import-settings-file
Uni 42753 max add import settings file
2 parents bc6df6e + 70d4f0a commit d05e4f6

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,13 @@ public class MaxIntegration : DCCIntegration
577577
private const string ConfigureMaxScript = MaxScriptsPath + "configureUnityFbxForMax.ms";
578578

579579
private const string ExportSettingsFile = MaxScriptsPath + "unityFbxExportSettings.ms";
580+
private const string ImportSettingsFile = MaxScriptsPath + "unityFbxImportSettings.ms";
580581

581582
private const string PluginSourceTag = "UnityPluginScript_Source";
582583
private const string PluginNameTag = "UnityPluginScript_Name";
583584
private const string ProjectTag = "UnityProject";
584585
private const string ExportSettingsTag = "UnityFbxExportSettings";
586+
private const string ImportSettingsTag = "UnityFbxImportSettings";
585587

586588
public override string IntegrationZipPath { get { return "FbxExporters/UnityFbxForMax.zip"; } }
587589

@@ -600,7 +602,8 @@ private static string GetInstallScript(){
600602
{PluginSourceTag, GetAbsPath(PluginPath) },
601603
{PluginNameTag, PluginName },
602604
{ProjectTag, GetProjectPath() },
603-
{ExportSettingsTag, GetAbsPath(ExportSettingsFile) }
605+
{ExportSettingsTag, GetAbsPath(ExportSettingsFile) },
606+
{ImportSettingsTag, GetAbsPath(ImportSettingsFile) }
604607
};
605608

606609
var installScript = "";

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@ macroScript UnityImport category:"Unity" tooltip:"Import an FBX file from a Unit
2222
)
2323
selectionSets["UnityFbxExportSet"] = unityFbxExportSet
2424
);
25+
26+
fn loadUnityFbxImportSettings = (
27+
fbxImportSettings = getINISetting (GetMAXIniFile()) "Unity" "UnityFbxImportSettings"
28+
if fbxImportSettings != undefined and doesFileExist fbxImportSettings then(
29+
filein fbxImportSettings
30+
)
31+
);
2532

2633
-- Make sure the FbxImporter plugin is loaded
2734
pluginManager.loadClass FbxImporter
2835

36+
loadUnityFbxImportSettings()
37+
2938
unityProjectPath = getINISetting (GetMAXIniFile()) "Unity" "UnityProject"
3039
fbxFileName = getOpenFileName caption:"Import FBX from Unity" filename:(unityProjectPath + "/Assets/") types:"FBX (*.fbx)|*.fbx|"
3140
if fbxFileName != undefined then
@@ -56,7 +65,7 @@ macroScript UnityImport category:"Unity" tooltip:"Import an FBX file from a Unit
5665
origObjects = objects as array
5766
callbacks.addScript #postImport ("afterImport()") id:#unityPlugin
5867

59-
importFile fbxFileName using:FBXIMP
68+
importFile fbxFileName #noPrompt using:FBXIMP
6069

6170
unityFbxFilePathAttr = getFilenamePath fbxFileName
6271
unityFbxFileNameAttr = filenameFromPath fbxFileName

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ maxIniFile = (GetMAXIniFile())
66
unityCategory = "Unity"
77
setINISetting maxIniFile unityCategory "UnityProject" UnityProject
88
setINISetting maxIniFile unityCategory "UnityFbxExportSettings" UnityFbxExportSettings
9+
setINISetting maxIniFile unityCategory "UnityFbxImportSettings" UnityFbxImportSettings
910

1011
quitMax()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FbxImporterSetParam "ResetImport"
2+
3+
FbxImporterSetParam "Mode" #merge -- update animation
4+
5+
-- Geometry
6+
FbxImporterSetParam "SmoothingGroups" true
7+
FbxImporterSetParam "Shape" true
8+
FbxImporterSetParam "Skin" true
9+
10+
-- Animation
11+
FbxImporterSetParam "Animation" true
12+
FbxImporterSetParam "ImportBoneAsDummy" true
13+
FbxImporterSetParam "KeepFrameRate" true
14+
15+
FbxImporterSetParam "Cameras" true
16+
FbxImporterSetParam "Lights" true
17+
18+
-- Axis Conversion
19+
FbxImporterSetParam "UpAxis" "Y"

0 commit comments

Comments
 (0)