File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed
Assets/Integrations/Autodesk/mayalt/scripts Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ global proc setupUnityUI(){
9
9
$pluginVersion = whatsNewVersion(); \
10
10
menuItem -parent $parentMenu -insertAfter $kMenuInsertAfter -divider true -longDivider false -version $pluginVersion $kMenuDivider; \
11
11
menuItem -parent $parentMenu -insertAfter $kMenuDivider -subMenu true -label $kMenuLabel -tearOff true -version $pluginVersion $kMenuName; \
12
- menuItem -parent $kMenuName -label \"Import\" -version $pluginVersion; \
12
+ menuItem -parent $kMenuName -label \"Import\" -version $pluginVersion -command \"unityImport\" ; \
13
13
menuItem -parent $kMenuName -label \"Export\" -version $pluginVersion;";
14
14
}
15
15
Original file line number Diff line number Diff line change
1
+ global proc unityImport(){
2
+ loadUnityDependencies;
3
+
4
+ // set Unity project as the current workspace
5
+ $currWorkspace = `workspace -o -q`;
6
+ $unityProject = `optionVar -q "UnityProject"`;
7
+
8
+ if ($unityProject != ""){
9
+ workspace -o $unityProject;
10
+ }
11
+
12
+ $tempPath = "";
13
+ $tempName = "";
14
+ $origItemsInScene = "";
15
+
16
+ $callbackId = -1;
17
+ $callbackId2 = -1;
18
+
19
+ Import;
20
+
21
+ if ($currWorkspace != "") {
22
+ workspace -o $currWorkspace;
23
+ }
24
+
25
+ }
26
+
27
+
28
+ global proc int loadUnityPlugin(string $plugin){
29
+ if (`pluginInfo -q -loaded $plugin` == false){
30
+ loadPlugin $plugin;
31
+ if (`pluginInfo -q -loaded $plugin` == false){
32
+ return 0 /*false*/;
33
+ }
34
+ }
35
+ return 1 /*true*/;
36
+ };
37
+
38
+
39
+ global proc int loadUnityDependencies(){
40
+ // GamePipeline plugin 'SendToUnitySelection' command used in export
41
+ $pluginsToLoad = {"GamePipeline", "fbxmaya"};
42
+
43
+ $ext = "mll";
44
+ if (`about -macOS` == true){
45
+ $ext = "bundle";
46
+ }
47
+
48
+ // iterate over all the plugins, loading them with extenstion ext, and combining the results
49
+ // to return if any of the loads failed
50
+ $result = true;
51
+ for($plugin in $pluginsToLoad){
52
+ $result = $result && `loadUnityPlugin ($plugin + "." + $ext)`;
53
+ }
54
+ return $result;
55
+ }
You can’t perform that action at this time.
0 commit comments