Skip to content

Commit 01b8178

Browse files
committed
add basic unity Import implmentation
- missing callbacks that create export set and store file path
1 parent d63a05c commit 01b8178

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

Assets/Integrations/Autodesk/mayalt/scripts/setupUnityUI.mel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ global proc setupUnityUI(){
99
$pluginVersion = whatsNewVersion(); \
1010
menuItem -parent $parentMenu -insertAfter $kMenuInsertAfter -divider true -longDivider false -version $pluginVersion $kMenuDivider; \
1111
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\"; \
1313
menuItem -parent $kMenuName -label \"Export\" -version $pluginVersion;";
1414
}
1515

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
}

0 commit comments

Comments
 (0)