unitySetupUI.mel 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. global string $unityMenuName = "UnityFbxForMaya";
  2. global string $unityMenuDivider = "UnityFbxForMayaDivider";
  3. global string $unityMenuLabel = "Unity";
  4. global string $unityMenuInsertAfter = "exportActiveFileOptions";
  5. global string $unityImportIconPath = "import.png";
  6. global string $unityExportIconPath = "export.png";
  7. global string $unityIconPath = "unity.png";
  8. global string $unityFamilyLabel = "The UnityFbxForMaya () plugin allows you to reliably exchange and review your work between Maya and Unity.";
  9. global string $unityImportLabel = "Import an FBX file from a Unity project and auto-configure for exporting";
  10. global string $unityExportModelLabel = "Export Model to Unity";
  11. global string $unityExportAnimLabel = "Export Animation to Unity";
  12. global string $unityExportModelAnimLabel = "Export Model and Animation to Unity in a single file";
  13. global string $unityCreateExportSetLabel = "Setup an export set containing the current selection for simple one click export";
  14. global string $unityCommandsFile = "unityCommands.mel";
  15. global string $unityImportMenuName = "Import";
  16. global string $unityExportModelMenuName = "Export Model Only";
  17. global string $unityExportAnimMenuName = "Export Animation Only";
  18. global string $unityExportModelAnimMenuName = "Export";
  19. global string $unityCreateExportSetMenuName = "Create Export Set";
  20. global string $unityImportCommand = "unityImport";
  21. global string $unityExportModelCommand = "unityExportModel";
  22. global string $unityExportAnimCommand = "unityExportAnim";
  23. global string $unityExportModelAnimCommand = "unityExportModelAnim";
  24. global string $unityCreateExportSetCommand = "unityCreateExportSet";
  25. global proc string unityWhatsNewVersion(){
  26. return `about -q -version`;
  27. }
  28. global proc unitySetupUI(){
  29. global string $unityCommandsFile;
  30. $isHeadless = `optionVar -q "UnityFbxForMaya_Headless"`;
  31. if($isHeadless){
  32. // headless install, don't add UI
  33. return;
  34. }
  35. eval ("source " + $unityCommandsFile);
  36. loadUnityDependencies();
  37. evalDeferred -lowestPriority "unityInstallUI";
  38. }
  39. global proc unityInstallUI(){
  40. global string $unityMenuName;
  41. global string $unityMenuDivider;
  42. global string $unityMenuLabel;
  43. global string $unityMenuInsertAfter;
  44. global string $unityImportIconPath;
  45. global string $unityExportIconPath;
  46. global string $unityIconPath;
  47. global string $unityPluginVersion;
  48. global string $unityFamilyLabel;
  49. global string $unityImportLabel;
  50. global string $unityExportModelLabel;
  51. global string $unityExportAnimLabel;
  52. global string $unityExportModelAnimLabel;
  53. global string $unityCreateExportSetLabel;
  54. global string $unityCommandsFile;
  55. global string $unityImportMenuName;
  56. global string $unityExportModelMenuName;
  57. global string $unityExportAnimMenuName;
  58. global string $unityExportModelAnimMenuName;
  59. global string $unityCreateExportSetMenuName;
  60. global string $unityImportCommand;
  61. global string $unityExportModelCommand;
  62. global string $unityExportAnimCommand;
  63. global string $unityExportModelAnimCommand;
  64. global string $unityCreateExportSetCommand;
  65. global string $gMainFileMenu;
  66. buildFileMenu;
  67. $parentMenu = $gMainFileMenu;
  68. $pluginVersion = unityWhatsNewVersion();
  69. eval ("source " + $unityCommandsFile);
  70. menuItem -parent $parentMenu -insertAfter $unityMenuInsertAfter -divider true -longDivider false -version $pluginVersion $unityMenuDivider;
  71. menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
  72. menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;
  73. menuItem -parent $unityMenuName -label $unityExportModelAnimMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportModelAnimLabel -command $unityExportModelAnimCommand;
  74. menuItem -parent $unityMenuName -label $unityExportModelMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportModelLabel -command $unityExportModelCommand;
  75. menuItem -parent $unityMenuName -label $unityExportAnimMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportAnimLabel -command $unityExportAnimCommand;
  76. menuItem -parent $unityMenuName -label $unityCreateExportSetMenuName -version $pluginVersion -annotation $unityCreateExportSetLabel -command $unityCreateExportSetCommand;
  77. unityRemoveNativeMenuOnLoad();
  78. }