Skip to content

Commit 0c7907a

Browse files
committed
add to namespace based on filename on import
for each file imported, create a namespace from it's filename and add contents to that namespace. This will prevent name clashes when importing multiple files that contain the same object names
1 parent 67fa621 commit 0c7907a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ proc importFile(string $filePathStr){
116116
storeAttribute($unityExportSet, $UnityFbxFileNameAttr, "");
117117
}
118118

119-
FBXImport -f $filePathStr;
119+
string $origNamespace = `namespaceInfo -cur`;
120+
121+
namespace -add $nameWithoutExt;
122+
namespace -set $nameWithoutExt;
123+
file -import -type "fbx" -namespace $nameWithoutExt $filePathStr;
124+
125+
namespace -set $origNamespace;
120126

121127
if ((!$isAnimFile || ($isAnimFile && $setCreated)) && $tempPath != ""){
122128
storeAttribute($unityExportSet, $UnityFbxFilePathAttr, $tempPath);

0 commit comments

Comments
 (0)