Skip to content

Commit c35b273

Browse files
committed
handle case where namespace is current namespace
- if the namespace we want to add to is the current namespace, then namespace -exists will return false and namespace -set will fail with an error. Check that we are already the correct namespace, and don't do anything if we are
1 parent 3c6550a commit c35b273

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ proc importFile(string $filePathStr){
113113
string $origNamespace = `namespaceInfo -cur`;
114114

115115
// warn if namespace already exists
116-
if(`namespace -exists $nameWithoutExt`){
116+
if(`namespace -exists $nameWithoutExt` || $origNamespace == $nameWithoutExt){
117117
if(!showConfirmDialog("Warning",
118118
"Namespace already exists, the imported objects will be added to the existing namespace and export set.",
119119
"Continue", "Cancel"
@@ -146,10 +146,14 @@ proc importFile(string $filePathStr){
146146
storeAttribute($unityExportSet, $UnityFbxFileNameAttr, "");
147147
}
148148

149-
namespace -set $nameWithoutExt;
149+
if($origNamespace != $nameWithoutExt){
150+
namespace -set $nameWithoutExt;
151+
}
150152
file -import -type "FBX" -ignoreVersion -ra true -mergeNamespacesOnClash true -pr -importFrameRate true -importTimeRange "override" $filePathStr;
151153

152-
namespace -set $origNamespace;
154+
if($origNamespace != $nameWithoutExt){
155+
namespace -set $origNamespace;
156+
}
153157

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ FBXResetImport;
33
FBXImportAxisConversionEnable -v true;
44
FBXImportCameras -v true;
55
FBXImportLights -v true;
6-
FBXImportSetMayaFrameRate -v true;
76

87
FBXImportSetTake -takeIndex -1;
98

0 commit comments

Comments
 (0)