- if self.active_layers:
- layers = context.scene.layers
- objs = [o for o in objs if any(a and b for a, b in zip(layers, o.layers))]
+ if self.visible_collections:
+ 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)]