@@ -215,7 +215,7 @@ global proc unityImport(){
215
215
216
216
global proc unityExport(){
217
217
// get the global variables
218
- global string $UnityExportSet ;
218
+ global string $UnityExportSets[] ;
219
219
global string $UnityFbxFilePathAttr;
220
220
global string $UnityFbxFileNameAttr;
221
221
@@ -227,24 +227,49 @@ global proc unityExport(){
227
227
return;
228
228
}
229
229
230
- // select the export set for export, if it exists,
231
- // otherwise take what is currently selected
232
230
$origSelection = `ls -sl`;
233
- if (setExists($UnityExportSet)){
234
- select -r -ne $UnityExportSet;
231
+ if(size($origSelection) <= 0){
232
+ // nothing selected
233
+ return;
235
234
}
236
235
237
- $unity_fbx_file_path = getAttribute($UnityExportSet, $UnityFbxFilePathAttr);
238
- $unity_fbx_file_name = getAttribute($UnityExportSet, $UnityFbxFileNameAttr);
236
+ // create temporary set containing selection
237
+ string $selectedSet = `sets`;
238
+ $selectedSetList = {$selectedSet};
239
239
240
- $strCmd = "";
241
- if ($unity_fbx_file_path != "" && $unity_fbx_file_name != ""){
242
- $strCmd = "file -force -options \"\" -typ \"FBX export\" -pr -es \"" + $unity_fbx_file_path + "/" + $unity_fbx_file_name + "\"";
240
+ $i = 0;
241
+ string $setsToExport[];
242
+ for($exportSet in $UnityExportSets){
243
+ if(!setExists($exportSet)){
244
+ continue;
245
+ }
246
+
247
+ if(`sets -isIntersecting $exportSet $selectedSetList`){
248
+ $setsToExport[$i] = $exportSet;
249
+ $i++;
250
+ }
243
251
}
244
- else {
245
- $strCmd = "SendToUnitySelection";
252
+
253
+ // delete temporary selection set
254
+ delete $selectedSet;
255
+
256
+ for($unitySet in $setsToExport){
257
+ print ("exporting set: " + $unitySet);
258
+
259
+ select -r -ne $unitySet;
260
+
261
+ $unity_fbx_file_path = getAttribute($unitySet, $UnityFbxFilePathAttr);
262
+ $unity_fbx_file_name = getAttribute($unitySet, $UnityFbxFileNameAttr);
263
+
264
+ $strCmd = "";
265
+ if ($unity_fbx_file_path != "" && $unity_fbx_file_name != ""){
266
+ $strCmd = "file -force -options \"\" -typ \"FBX export\" -pr -es \"" + $unity_fbx_file_path + "/" + $unity_fbx_file_name + "\"";
267
+ }
268
+ else {
269
+ $strCmd = "SendToUnitySelection";
270
+ }
271
+ eval $strCmd;
246
272
}
247
- eval $strCmd;
248
273
249
274
select -cl;
250
275
if (size($origSelection) > 0){
0 commit comments