@@ -5,6 +5,12 @@ global string $UnityFbxAnimFileNameAttr = "unityFbxAnimFileName";
5
5
global string $UnityFbxNamespaceAttr = "unityFbxNamespace";
6
6
global string $UnityExportSetNameFormat = "^1s_UnityExportSet";
7
7
8
+ global int $UnityFbxFilePathIndex = 0;
9
+ global int $UnityFbxFileNameIndex = 1;
10
+ global int $UnityFbxAnimFilePathIndex = 2;
11
+ global int $UnityFbxAnimFileNameIndex = 3;
12
+ global int $UnityFileNameWithoutExtIndex = 4;
13
+
8
14
/* Enum */
9
15
global int $UnityExportAnim = 0;
10
16
global int $UnityExportModel = 1;
@@ -136,6 +142,12 @@ proc string checkNamespaceNeedsUpdate(string $unitySet, string $unityFbxNamespac
136
142
// =======================
137
143
138
144
proc string[] getExportSetAttributes(string $exportPath, int $exportAnimOnly){
145
+ global int $UnityFbxFilePathIndex;
146
+ global int $UnityFbxFileNameIndex;
147
+ global int $UnityFbxAnimFilePathIndex;
148
+ global int $UnityFbxAnimFileNameIndex;
149
+ global int $UnityFileNameWithoutExtIndex;
150
+
139
151
string $exportAttributes[5];
140
152
141
153
$exportDir = dirname($exportPath);
@@ -154,11 +166,11 @@ proc string[] getExportSetAttributes(string $exportPath, int $exportAnimOnly){
154
166
}
155
167
$fileNameWithoutExt = formValidObjectName($fileNameWithoutExt);
156
168
157
- $exportAttributes[0 ] = $exportDir;
158
- $exportAttributes[1 ] = $exportFileName;
159
- $exportAttributes[2 ] = $exportAnimDir;
160
- $exportAttributes[3 ] = $exportAnimFileName;
161
- $exportAttributes[4 ] = $fileNameWithoutExt;
169
+ $exportAttributes[$UnityFbxFilePathIndex ] = $exportDir;
170
+ $exportAttributes[$UnityFbxFileNameIndex ] = $exportFileName;
171
+ $exportAttributes[$UnityFbxAnimFilePathIndex ] = $exportAnimDir;
172
+ $exportAttributes[$UnityFbxAnimFileNameIndex ] = $exportAnimFileName;
173
+ $exportAttributes[$UnityFileNameWithoutExtIndex ] = $fileNameWithoutExt;
162
174
163
175
return $exportAttributes;
164
176
}
@@ -233,11 +245,17 @@ proc setExportSetAttributes(
233
245
global string $UnityFbxAnimFileNameAttr;
234
246
global string $UnityFbxNamespaceAttr;
235
247
236
- $exportDir = $exportAttrs[0];
237
- $exportFileName = $exportAttrs[1];
238
- $exportAnimDir = $exportAttrs[2];
239
- $exportAnimFileName = $exportAttrs[3];
240
- $fileNameWithoutExt = $exportAttrs[4];
248
+ global int $UnityFbxFilePathIndex;
249
+ global int $UnityFbxFileNameIndex;
250
+ global int $UnityFbxAnimFilePathIndex;
251
+ global int $UnityFbxAnimFileNameIndex;
252
+ global int $UnityFileNameWithoutExtIndex;
253
+
254
+ $exportDir = $exportAttrs[$UnityFbxFilePathIndex];
255
+ $exportFileName = $exportAttrs[$UnityFbxFileNameIndex];
256
+ $exportAnimDir = $exportAttrs[$UnityFbxAnimFilePathIndex];
257
+ $exportAnimFileName = $exportAttrs[$UnityFbxAnimFileNameIndex];
258
+ $fileNameWithoutExt = $exportAttrs[$UnityFileNameWithoutExtIndex];
241
259
242
260
// unlock set so we can add attributes to it
243
261
lockNode -lock false $unityExportSet;
@@ -273,6 +291,12 @@ proc importFile(string $filePathStr){
273
291
global string $UnityFbxAnimFileNameAttr;
274
292
global string $UnityFbxNamespaceAttr;
275
293
294
+ global int $UnityFbxFilePathIndex;
295
+ global int $UnityFbxFileNameIndex;
296
+ global int $UnityFbxAnimFilePathIndex;
297
+ global int $UnityFbxAnimFileNameIndex;
298
+ global int $UnityFileNameWithoutExtIndex;
299
+
276
300
$isAnimFile = false;
277
301
if(match("@", basename($filePathStr, ".fbx")) != ""){
278
302
// import as animation
@@ -281,11 +305,11 @@ proc importFile(string $filePathStr){
281
305
282
306
$exportAttrs = getExportSetAttributes($filePathStr, $isAnimFile);
283
307
284
- $currentDir = $exportAttrs[0 ];
285
- $fileName = $exportAttrs[1 ];
286
- $currentAnimDir = $exportAttrs[2 ];
287
- $animFileName = $exportAttrs[3 ];
288
- $fileNameWithoutExt = $exportAttrs[4 ];
308
+ $currentDir = $exportAttrs[$UnityFbxFilePathIndex ];
309
+ $fileName = $exportAttrs[$UnityFbxFileNameIndex ];
310
+ $currentAnimDir = $exportAttrs[$UnityFbxAnimFilePathIndex ];
311
+ $animFileName = $exportAttrs[$UnityFbxAnimFileNameIndex ];
312
+ $fileNameWithoutExt = $exportAttrs[$UnityFileNameWithoutExtIndex ];
289
313
290
314
$unityExportSet = getNewExportSetName($fileNameWithoutExt);
291
315
@@ -523,15 +547,21 @@ proc string[] getUnityExportSets(){
523
547
}
524
548
525
549
proc setupNewExportSet(string $exportPath, int $exportAnimOnly, string $selectedObjects[]){
550
+ global int $UnityFbxFilePathIndex;
551
+ global int $UnityFbxFileNameIndex;
552
+ global int $UnityFbxAnimFilePathIndex;
553
+ global int $UnityFbxAnimFileNameIndex;
554
+ global int $UnityFileNameWithoutExtIndex;
555
+
526
556
$isAnimFile = $exportAnimOnly;
527
557
528
558
// Get the export set attributes
529
559
$exportAttrs = getExportSetAttributes($exportPath, $exportAnimOnly);
530
- $exportDir = $exportAttrs[0 ];
531
- $exportFileName = $exportAttrs[1 ];
532
- $exportAnimDir = $exportAttrs[2 ];
533
- $exportAnimFileName = $exportAttrs[3 ];
534
- $fileNameWithoutExt = $exportAttrs[4 ];
560
+ $exportDir = $exportAttrs[$UnityFbxFilePathIndex ];
561
+ $exportFileName = $exportAttrs[$UnityFbxFileNameIndex ];
562
+ $exportAnimDir = $exportAttrs[$UnityFbxAnimFilePathIndex ];
563
+ $exportAnimFileName = $exportAttrs[$UnityFbxAnimFileNameIndex ];
564
+ $fileNameWithoutExt = $exportAttrs[$UnityFileNameWithoutExtIndex ];
535
565
536
566
$unityExportSet = getNewExportSetName($fileNameWithoutExt);
537
567
0 commit comments