File tree Expand file tree Collapse file tree 2 files changed +17
-17
lines changed
Arma3ObjectBuilder/io_p3d Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 1010from ..utils_io import ExportFileHandler
1111
1212
13+ # Simple check to not even start the export if there are
14+ # no LOD objects in the scene.
15+ def can_export (operator , context ):
16+ scene = context .scene
17+ export_objects = scene .objects
18+
19+ if operator .use_selection :
20+ export_objects = context .selected_objects
21+
22+ for obj in export_objects :
23+ if (not operator .visible_only or obj .visible_get ()) and obj .type == 'MESH' and obj .a3ob_properties_object .is_a3_lod and obj .parent == None :
24+ return True
25+
26+ return False
27+
28+
1329class A3OB_OT_import_p3d (bpy .types .Operator , bpy_extras .io_utils .ImportHelper ):
1430 """Import Arma 3 MLOD P3D"""
1531
@@ -322,7 +338,7 @@ def draw(self, context):
322338 pass
323339
324340 def execute (self , context ):
325- if not exporter . can_export (self , context ):
341+ if not can_export (self , context ):
326342 op_report (self , {'ERROR' }, "There are no LODs to export" )
327343 return {'FINISHED' }
328344
Original file line number Diff line number Diff line change 2020from ..logger import ProcessLogger , ProcessLoggerNull
2121
2222
23- # Simple check to not even start the export if there are
24- # no LOD objects in the scene.
25- def can_export (operator , context ):
26- scene = context .scene
27- export_objects = scene .objects
28-
29- if operator .use_selection :
30- export_objects = context .selected_objects
31-
32- for obj in export_objects :
33- if (not operator .visible_only or obj .visible_get ()) and obj .type == 'MESH' and obj .a3ob_properties_object .is_a3_lod and obj .parent == None :
34- return True
35-
36- return False
37-
38-
3923def create_temp_collection (context ):
4024 temp = bpy .data .collections .get ("A3OB_temp" )
4125 if temp is None :
You can’t perform that action at this time.
0 commit comments