- if self.selected_only:
- objs = context.selected_objects
- else:
- objs = context.scene.objects
- if self.visible_only:
- collections = [c.collection for c in context.view_layer.layer_collection.children if not (c.hide_viewport or c.collection.hide_viewport)]
- objs = [o for o in objs if any((o.name in c.all_objects) for c in collections)]
- objs = [o for o in objs if o.type=="MESH" and not o.lod_for_parent and o.data.vertices]
- objs = [o for o in objs if (not o.compound or o.parent not in objs)]
- objs.sort(key=lambda x:x.name)
+ from .scene import create_scene_from_current
+ scene = create_scene_from_current(context, selected_only=self.selected_only, visible_only=self.visible_only)