@@ -344,49 +344,49 @@ struct UnityGUI (
344
344
345
345
-- Setup UI in existing Import/Export menus if using 3ds Max 2018+
346
346
if (maxVersion())[1 ] >= 20000 then (
347
- global importMenuName = " File-Import"
348
- global exportMenuName = " File-Export"
349
-
350
- -- get the import menu
351
- global getImportMenu
352
- fn getImportMenu = (
353
- menuMan.findMenu importMenuName
354
- );
347
+ global importMenuName = " File-Import"
348
+ global exportMenuName = " File-Export"
349
+
350
+ -- get the import menu
351
+ global getImportMenu
352
+ fn getImportMenu = (
353
+ menuMan.findMenu importMenuName
354
+ );
355
355
356
- -- get the export menu
357
- global getExportMenu
358
- fn getExportMenu = (
359
- menuMan.findMenu exportMenuName
360
- );
361
-
362
- -- Setup UI
363
- fn setupUnityPluginUI = (
364
- local importMenu = getImportMenu()
365
- local exportMenu = getExportMenu()
366
- if importMenu != undefined and exportMenu != undefined do
367
- (
368
- local unityImportTitle = " Import from Unity..."
369
- local unityExportTitle = " Export to Unity"
356
+ -- get the export menu
357
+ global getExportMenu
358
+ fn getExportMenu = (
359
+ menuMan.findMenu exportMenuName
360
+ );
361
+
362
+ -- Setup UI
363
+ fn setupUnityPluginUI = (
364
+ local importMenu = getImportMenu()
365
+ local exportMenu = getExportMenu()
366
+ if importMenu != undefined and exportMenu != undefined do
367
+ (
368
+ local unityImportTitle = " Import from Unity..."
369
+ local unityExportTitle = " Export to Unity"
370
370
local unityExportModelTitle = " Export to Unity (Model Only)"
371
-
372
- -- check if menu items already exist, delete if they do
373
- local foundUnityImport = false
374
- for i= 1 to importMenu.numItems() while not foundUnityImport do (
375
- local mi = importMenu.getItem i
376
- if mi.getTitle() == unityImportTitle then (
377
- importMenu.removeItem mi
378
- foundUnityImport = true
379
- )
380
- )
381
- local foundUnityExport = false
382
- for i= 1 to exportMenu.numItems() while not foundUnityExport do (
383
- local mi = exportMenu.getItem i
384
- if mi.getTitle() == unityExportTitle then (
385
- exportMenu.removeItem mi
386
- foundUnityExport = true
387
- )
388
- )
389
-
371
+
372
+ -- check if menu items already exist, delete if they do
373
+ local foundUnityImport = false
374
+ for i= 1 to importMenu.numItems() while not foundUnityImport do (
375
+ local mi = importMenu.getItem i
376
+ if mi.getTitle() == unityImportTitle then (
377
+ importMenu.removeItem mi
378
+ foundUnityImport = true
379
+ )
380
+ )
381
+ local foundUnityExport = false
382
+ for i= 1 to exportMenu.numItems() while not foundUnityExport do (
383
+ local mi = exportMenu.getItem i
384
+ if mi.getTitle() == unityExportTitle then (
385
+ exportMenu.removeItem mi
386
+ foundUnityExport = true
387
+ )
388
+ )
389
+
390
390
id = genClassID returnValue: true
391
391
if menuMan.registerMenuContext id[1 ] then
392
392
(
@@ -396,76 +396,76 @@ if (maxVersion())[1] >= 20000 then(
396
396
397
397
menuMan.updateMenuBar() -- update the menu bar
398
398
)
399
- )
400
- );
401
- setupUnityPluginUI()
399
+ )
400
+ );
401
+ setupUnityPluginUI()
402
402
403
- -- Make sure that Menu gets removed at shutdown, force menu to reload each time Max is opened
404
- callbacks.addScript #preSavingMenus (
405
- " importMenu = getImportMenu(); \
406
- exportMenu = getExportMenu(); \
407
- if importMenu != undefined and unityImportAction != undefined then( \
408
- importMenu.removeItem unityImportAction; \
409
- ) \
410
- if exportMenu != undefined and unityExportAction != undefined then( \
411
- exportMenu.removeItem unityExportAction; \
412
- ) \
413
- if exportMenu != undefined and unityExportModelAction != undefined then( \
414
- exportMenu.removeItem unityExportModelAction; \
415
- )"
416
- )
403
+ -- Make sure that Menu gets removed at shutdown, force menu to reload each time Max is opened
404
+ callbacks.addScript #preSavingMenus (
405
+ " importMenu = getImportMenu(); \
406
+ exportMenu = getExportMenu(); \
407
+ if importMenu != undefined and unityImportAction != undefined then( \
408
+ importMenu.removeItem unityImportAction; \
409
+ ) \
410
+ if exportMenu != undefined and unityExportAction != undefined then( \
411
+ exportMenu.removeItem unityExportAction; \
412
+ ) \
413
+ if exportMenu != undefined and unityExportModelAction != undefined then( \
414
+ exportMenu.removeItem unityExportModelAction; \
415
+ )"
416
+ )
417
417
418
418
-- when opening a new scene, reset the export options to make
419
419
-- sure we don't accidentally overwrite anything
420
420
callbacks.addScript #postSceneReset (" UnityGUI.unityResetExportOptions()" )
421
421
callbacks.addScript #systemPreNew (" UnityGUI.unityResetExportOptions()" )
422
422
)
423
423
else if (maxVersion())[1 ] == 19000 then (
424
- -- for 3ds Max 2017
425
-
426
- global unityMenuName = " Unity"
427
-
428
- global getUnityMenu
429
- fn getUnityMenu = (
430
- menuMan.findMenu unityMenuName
431
- );
432
-
433
- -- Setup UI
434
- fn setupUnityPluginUI = (
435
- local unityMenu = getUnityMenu()
436
- local unityImportTitle = " Import..."
437
- local unityExportTitle = " Export"
424
+ -- for 3ds Max 2017
425
+
426
+ global unityMenuName = " Unity"
427
+
428
+ global getUnityMenu
429
+ fn getUnityMenu = (
430
+ menuMan.findMenu unityMenuName
431
+ );
432
+
433
+ -- Setup UI
434
+ fn setupUnityPluginUI = (
435
+ local unityMenu = getUnityMenu()
436
+ local unityImportTitle = " Import..."
437
+ local unityExportTitle = " Export"
438
438
local unityExportModelTitle = " Export Model Only"
439
- if unityMenu != undefined do
440
- (
441
- -- remove the menu if it still exists
442
- menuMan.unRegisterMenu unityMenu
443
- )
444
-
445
- id = genClassID returnValue: true
446
- if menuMan.registerMenuContext id[1 ] then
447
- (
448
- local mainMenuBar = menuMan.getMainMenuBar()
449
- local unityMenu = menuMan.createMenu unityMenuName
450
- local unityMenuItem = menuMan.createSubMenuItem unityMenuName unityMenu
451
- mainMenuBar.addItem unityMenuItem (mainMenuBar.numItems())
452
-
453
- UnityGUI.createUnityImportAction unityImportTitle unityMenu
454
- UnityGUI.createUnityExportAction unityExportTitle unityMenu
439
+ if unityMenu != undefined do
440
+ (
441
+ -- remove the menu if it still exists
442
+ menuMan.unRegisterMenu unityMenu
443
+ )
444
+
445
+ id = genClassID returnValue: true
446
+ if menuMan.registerMenuContext id[1 ] then
447
+ (
448
+ local mainMenuBar = menuMan.getMainMenuBar()
449
+ local unityMenu = menuMan.createMenu unityMenuName
450
+ local unityMenuItem = menuMan.createSubMenuItem unityMenuName unityMenu
451
+ mainMenuBar.addItem unityMenuItem (mainMenuBar.numItems())
452
+
453
+ UnityGUI.createUnityImportAction unityImportTitle unityMenu
454
+ UnityGUI.createUnityExportAction unityExportTitle unityMenu
455
455
UnityGUI.createUnityExportModelAction unityExportModelTitle unityMenu
456
-
457
- menuMan.updateMenuBar() -- update the menu bar
458
- )
459
- );
460
- setupUnityPluginUI()
456
+
457
+ menuMan.updateMenuBar() -- update the menu bar
458
+ )
459
+ );
460
+ setupUnityPluginUI()
461
461
462
- -- Make sure that Menu gets removed at shutdown, force menu to reload each time Max is opened
463
- callbacks.addScript #preSavingMenus (
464
- " unityMenu = getUnityMenu(); \
465
- if unityMenu != undefined do ( \
466
- menuMan.unRegisterMenu unityMenu; \
467
- )"
468
- )
462
+ -- Make sure that Menu gets removed at shutdown, force menu to reload each time Max is opened
463
+ callbacks.addScript #preSavingMenus (
464
+ " unityMenu = getUnityMenu(); \
465
+ if unityMenu != undefined do ( \
466
+ menuMan.unRegisterMenu unityMenu; \
467
+ )"
468
+ )
469
469
470
470
-- when opening a new scene, reset the export options to make
471
471
-- sure we don't accidentally overwrite anything
0 commit comments