Skip to content

Commit 140b373

Browse files
committed
reset export options on loading new scene
1 parent 4fffb44 commit 140b373

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ fn createUnityExportAction title parentMenu = (
154154
createUnityActionItem "UnityExport" "Unity" title parentMenu;
155155
);
156156

157+
global unityResetExportOptions;
158+
fn unityResetExportOptions = (
159+
unityFbxFilePathAttr=undefined;
160+
unityFbxFileNameAttr=undefined;
161+
unityAskSetUnits=undefined;
162+
);
163+
157164
-- Setup UI in existing Import/Export menus if using 3ds Max 2018+
158165
if (maxVersion())[1] >= 20000 then(
159166
global importMenuName = "File-Import"
@@ -221,6 +228,11 @@ if (maxVersion())[1] >= 20000 then(
221228
exportMenu.removeItem unityExportAction; \
222229
)"
223230
)
231+
232+
-- when opening a new scene, reset the export options to make
233+
-- sure we don't accidentally overwrite anything
234+
callbacks.addScript #postSceneReset ("unityResetExportOptions()")
235+
callbacks.addScript #systemPreNew ("unityResetExportOptions()")
224236
)
225237
else if (maxVersion())[1] == 19000 then (
226238
-- for 3ds Max 2017
@@ -266,6 +278,11 @@ else if (maxVersion())[1] == 19000 then (
266278
menuMan.unRegisterMenu unityMenu; \
267279
)"
268280
)
281+
282+
-- when opening a new scene, reset the export options to make
283+
-- sure we don't accidentally overwrite anything
284+
callbacks.addScript #postSceneReset ("unityResetExportOptions()")
285+
callbacks.addScript #systemPreNew ("unityResetExportOptions()")
269286
)
270287
else(
271288
print "Error: Unity Integration only supports 3ds Max 2017 or later"

0 commit comments

Comments
 (0)