Skip to content

Commit

Permalink
Merge pull request #240 from Unity-Technologies/UNI-32578-reset-max-e…
Browse files Browse the repository at this point in the history
…xport-path-on-new-scene

UNI-32578 reset export options on loading new scene in Max
  • Loading branch information
vkovec authored Dec 1, 2017
2 parents a9ff2fd + 140b373 commit a100ef3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Assets/Integrations/Autodesk/max/scripts/UnityFbxForMaxPlugin.ms
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ fn createUnityExportAction title parentMenu = (
createUnityActionItem "UnityExport" "Unity" title parentMenu;
);

global unityResetExportOptions;
fn unityResetExportOptions = (
unityFbxFilePathAttr=undefined;
unityFbxFileNameAttr=undefined;
unityAskSetUnits=undefined;
);

-- Setup UI in existing Import/Export menus if using 3ds Max 2018+
if (maxVersion())[1] >= 20000 then(
global importMenuName = "File-Import"
Expand Down Expand Up @@ -221,6 +228,11 @@ if (maxVersion())[1] >= 20000 then(
exportMenu.removeItem unityExportAction; \
)"
)

-- when opening a new scene, reset the export options to make
-- sure we don't accidentally overwrite anything
callbacks.addScript #postSceneReset ("unityResetExportOptions()")
callbacks.addScript #systemPreNew ("unityResetExportOptions()")
)
else if (maxVersion())[1] == 19000 then (
-- for 3ds Max 2017
Expand Down Expand Up @@ -266,6 +278,11 @@ else if (maxVersion())[1] == 19000 then (
menuMan.unRegisterMenu unityMenu; \
)"
)

-- when opening a new scene, reset the export options to make
-- sure we don't accidentally overwrite anything
callbacks.addScript #postSceneReset ("unityResetExportOptions()")
callbacks.addScript #systemPreNew ("unityResetExportOptions()")
)
else(
print "Error: Unity Integration only supports 3ds Max 2017 or later"
Expand Down

0 comments on commit a100ef3

Please sign in to comment.