@@ -85,6 +85,32 @@ proc int showConfirmDialog(string $title, string $message, string $confirmButton
85
85
return ( $response == $confirmButtonName );
86
86
}
87
87
88
+ // get the namespace of the given object
89
+ proc string getObjectNamespace(string $objectName){
90
+ string $lsResult[] = `ls -showNamespace -an $objectName`;
91
+ return $lsResult[1];
92
+ }
93
+
94
+ proc string getNewNamespace(string $n1, string $n2){
95
+ string $n2Tokens[];
96
+ int $n2NumTokens = `tokenize $n2 ":" $n2Tokens`;
97
+
98
+ string $newNamespace = ":";
99
+ string $n1BaseName = `namespaceInfo -baseName $n1`;
100
+
101
+ for($i=$n2NumTokens-1; $i>=0; --$i){
102
+ if($n2Tokens[$i] == $n1BaseName){
103
+ break;
104
+ }
105
+ $n2Tokens[$i] = "";
106
+ }
107
+ $newNamespace = $newNamespace + stringArrayToString($n2Tokens, ":");
108
+ if($newNamespace == ":"){
109
+ return $n2;
110
+ }
111
+ return $newNamespace;
112
+ }
113
+
88
114
proc importFile(string $filePathStr){
89
115
// get the global variables
90
116
global string $UnityExportSets[];
@@ -302,6 +328,20 @@ proc exportSet(string $unitySet, int $exportAnim){
302
328
global string $UnityFbxNamespaceAttr;
303
329
304
330
string $unitySetContents[] = `listConnections $unitySet`;
331
+ string $unity_fbx_namespace = getAttribute($unitySet, $UnityFbxNamespaceAttr);
332
+
333
+ if(size($unitySetContents) > 0){
334
+ string $newNamespace = getNewNamespace($unity_fbx_namespace, getObjectNamespace($unitySetContents[0]));
335
+ if($unity_fbx_namespace != $newNamespace){
336
+ // popup asking to change namespace value to new namespace
337
+ if(showConfirmDialog($unitySet,
338
+ "Set namespace has been modified from "+$unity_fbx_namespace+" to "+$newNamespace+", update export set namespace attribute?",
339
+ "Yes", "No"
340
+ )){
341
+ storeAttribute($unitySet, $UnityFbxNamespaceAttr, $newNamespace);
342
+ }
343
+ }
344
+ }
305
345
306
346
string $animatedObjectSet = "";
307
347
if($exportAnim){
@@ -328,7 +368,7 @@ proc exportSet(string $unitySet, int $exportAnim){
328
368
329
369
string $unity_fbx_file_path = getAttribute($unitySet, $pathAttr);
330
370
string $unity_fbx_file_name = getAttribute($unitySet, $nameAttr);
331
- string $unity_fbx_namespace = getAttribute($unitySet, $UnityFbxNamespaceAttr);
371
+ $unity_fbx_namespace = getAttribute($unitySet, $UnityFbxNamespaceAttr);
332
372
333
373
$strCmd = "";
334
374
if ($unity_fbx_file_path != "" && $unity_fbx_file_name != ""){
0 commit comments