How to elegantly turn a group visible or invisible?

If I want to turn a group “visible” through Python, I only know the Python method, where you go through every object in the database, check whether its in the group and then change its visibility.

But when you 1000 objects in the database, this is terribly slow.

Is there a better method? (The group-visibility in the panel cannot be accessed through Python?)

Hi chrissie

The group has an objects collection.


import bpy

for ob in bpy.data.groups['Group'].objects:
    ob.hide = False

alternatively


bpy.data.groups['Group'].objects.foreach_set('hide', [False] * len(bpy.data.groups['Group'].objects))

Thank you!!

The group has an objects collection.


import bpy

for ob in bpy.data.groups['Group'].objects:
    ob.hide = False

alternatively


bpy.data.groups['Group'].objects.foreach_set('hide', [False] * len(bpy.data.groups['Group'].objects))

[/QUOTE]