Skip to content

Commit 4edf283

Browse files
committed
fix so sets don't get nested on creation
- in Maya if you select a set then create another set, the selected set will be nested under the new set. In order to avoid this, temporarily clear the selection while creating the set
1 parent 5b9df87 commit 4edf283

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Assets/Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ proc string getNewNamespace(string $n1, string $n2){
112112
}
113113

114114
proc string checkNamespaceNeedsUpdate(string $unitySet, string $unityFbxNamespace, string $objectNamespace){
115+
global string $UnityFbxNamespaceAttr;
116+
115117
string $newNamespace = getNewNamespace($unityFbxNamespace, $objectNamespace);
116118
if($unityFbxNamespace != $newNamespace){
117119
// popup asking to change namespace value to new namespace
@@ -120,6 +122,7 @@ proc string checkNamespaceNeedsUpdate(string $unitySet, string $unityFbxNamespac
120122
"Yes", "No"
121123
)){
122124
storeAttribute($unitySet, $UnityFbxNamespaceAttr, $newNamespace);
125+
123126
return $newNamespace;
124127
}
125128
}
@@ -197,10 +200,20 @@ proc importFile(string $filePathStr){
197200
if(!`namespaceInfo -isRootNamespace $origNamespace`){
198201
namespace -set ":";
199202
}
200-
203+
204+
// if a set is selected when creating a new set, then
205+
// the selected set will be added into the new set.
206+
// avoid this by temporarily deselecting everything.
207+
$origSelection = `ls -sl`;
208+
select -clear;
209+
201210
// couldn't find export set so create it
202211
sets -name $unityExportSet;
203212
$setCreated = true;
213+
214+
if(size($origSelection) > 0){
215+
select -r $origSelection;
216+
}
204217
}
205218

206219
// unlock set so we can add attributes to it

0 commit comments

Comments
 (0)