@@ -298,43 +298,42 @@ struct UnityExportHelpers (
298
298
)
299
299
300
300
origSelection = getCurrentSelection()
301
-
302
- local origUnits = units.SystemType
303
- units.SystemType = #Centimeters
304
-
305
- -- get all the unity export sets
306
- local unityExportSets = UnityExportHelpers.getUnityExportSets()
307
-
308
- -- find all sets that contain at least one object from the current selection
309
- local setsToExport = #()
310
- for expSet in unityExportSets do (
311
- for obj in origSelection do (
312
- -- append export set as set to export if obj is in the set or obj is
313
- -- dummy for this set
314
- if (findItem expSet obj > 0 ) or (obj.name == expSet.name and (isProperty obj " modelFilePath" )) do (
315
- appendIfUnique setsToExport expSet
316
- break
301
+
302
+ if origSelection != undefined and origSelection.count > 0 then (
303
+ local origUnits = units.SystemType
304
+ units.SystemType = #Centimeters
305
+
306
+ -- get all the unity export sets
307
+ local unityExportSets = UnityExportHelpers.getUnityExportSets()
308
+
309
+ -- find all sets that contain at least one object from the current selection
310
+ local setsToExport = #()
311
+ for expSet in unityExportSets do (
312
+ for obj in origSelection do (
313
+ -- append export set as set to export if obj is in the set or obj is
314
+ -- dummy for this set
315
+ if (findItem expSet obj > 0 ) or (obj.name == expSet.name and (isProperty obj " modelFilePath" )) do (
316
+ appendIfUnique setsToExport expSet
317
+ break
318
+ )
317
319
)
318
320
)
319
- )
320
-
321
- -- if no sets are selected, then export selection, otherwise export each set to its corresponding file
322
- if (setsToExport.count <= 0 ) then (
323
- local unityProjectPath = getINISetting (GetMAXIniFile()) " Unity " " UnityProject "
324
- local exportFileName = getSaveFileName caption: " Export FBX to Unity " filename: (unityProjectPath + " /Assets/ " ) types: " FBX (*.fbx)|*.fbx| "
325
- if exportFileName != undefined do (
326
- exportFile exportFileName #noPrompt selectedOnly: true using: FBXEXP
321
+
322
+ -- if no sets are selected, then export selection, otherwise export each set to its corresponding file
323
+ if (setsToExport.count <= 0 ) then (
324
+ local unityProjectPath = getINISetting (GetMAXIniFile()) " Unity " " UnityProject "
325
+ local exportFileName = getSaveFileName caption: " Export FBX to Unity " filename: (unityProjectPath + " /Assets/ " ) types: " FBX (*.fbx)|*.fbx| "
326
+ if exportFileName != undefined do (
327
+ exportFile exportFileName #noPrompt selectedOnly: true using: FBXEXP
328
+ )
327
329
)
328
- )
329
- else (
330
- for expSet in setsToExport do (
331
- UnityExportHelpers.exportUnitySet expSet
330
+ else (
331
+ for expSet in setsToExport do (
332
+ UnityExportHelpers.exportUnitySet expSet
333
+ )
332
334
)
333
- )
334
-
335
- units.SystemType = origUnits
336
-
337
- if origSelection != undefined then (
335
+
336
+ units.SystemType = origUnits
338
337
select origSelection
339
338
)
340
339
)
0 commit comments