@@ -11,26 +11,55 @@ global string $unityFamilyLabel = "The UnityFbxForMaya plugin allows you to reli
11
11
global string $unityImportLabel = "Import FBX file from Unity Project and auto-configure for exporting";
12
12
global string $unityExportLabel = "Export Model to Unity";
13
13
14
+ global string $unityCommandsFile = "unityCommands.mel";
15
+ global string $unityImportMenuName = "Import";
16
+ global string $unityExportMenuName = "Export";
17
+ global string $unityImportCommand = "unityImport";
18
+ global string $unityExportCommand = "unityExport";
14
19
15
20
global proc string unityWhatsNewVersion(){
16
21
return `about -q -version`;
17
22
18
23
}
19
24
20
25
global proc unitySetupUI(){
21
-
22
26
$isHeadless = `optionVar -q "UnityFbxForMaya_Headless"`;
23
27
if($isHeadless){
24
28
// headless install, don't add UI
25
29
return;
26
30
}
31
+
32
+ evalDeferred -lowestPriority "unityInstallUI";
33
+ }
34
+
35
+ global proc unityInstallUI(){
36
+ global string $unityMenuName;
37
+ global string $unityMenuDivider;
38
+ global string $unityMenuLabel;
39
+ global string $unityMenuInsertAfter;
40
+
41
+ global string $unityImportIconPath;
42
+ global string $unityExportIconPath;
43
+ global string $unityIconPath;
44
+
45
+ global string $unityFamilyLabel;
46
+ global string $unityImportLabel;
47
+ global string $unityExportLabel;
48
+
49
+ global string $unityCommandsFile;
50
+ global string $unityImportMenuName;
51
+ global string $unityExportMenuName;
52
+ global string $unityImportCommand;
53
+ global string $unityExportCommand;
54
+
55
+ global string $gMainFileMenu;
27
56
28
- evalDeferred -lowestPriority " buildFileMenu; \
29
- $parentMenu = $gMainFileMenu; \
30
- $pluginVersion = unityWhatsNewVersion(); \
31
- source \"unityCommands.mel\"; \
32
- menuItem -parent $parentMenu -insertAfter $unityMenuInsertAfter -divider true -longDivider false -version $pluginVersion $unityMenuDivider; \
33
- menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName; \
34
- menuItem -parent $unityMenuName -label \"Import\" -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command \"unityImport\"; \
35
- menuItem -parent $unityMenuName -label \"Export\" -version $pluginVersion -image $unityExportIconPath -annotation $unityExportLabel -command \"unityExport\";" ;
57
+ buildFileMenu;
58
+ $parentMenu = $gMainFileMenu;
59
+ $pluginVersion = unityWhatsNewVersion();
60
+ eval (" source " + $unityCommandsFile);
61
+ menuItem -parent $parentMenu -insertAfter $unityMenuInsertAfter -divider true -longDivider false -version $pluginVersion $unityMenuDivider;
62
+ menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
63
+ menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;
64
+ menuItem -parent $unityMenuName -label $unityExportMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportLabel -command $unityExportCommand ;
36
65
}
0 commit comments