Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- all_collections = []
- def get_all_layer_collections():
- def get_all_collections_rec(parent):
- for child in parent.children:
- global all_collections
- all_collections.append(child)
- try:
- get_all_collections_rec(child)
- except:
- pass
- rec_start = bpy.context.view_layer.layer_collection
- get_all_collections_rec(rec_start)
- return all_collections
- def hide_view_set_on_visible(unselected):
- for lCollection in get_all_layer_collections():
- if lCollection.visible_get() == True:
- for obj in lCollection.collection.objects:
- if obj.select_get() != unselected:
- obj.hide_set(True)
- def hide_view_clear_on_visible():
- for obj in bpy.data.objects:
- obj.select_set(False)
- for lCollection in get_all_layer_collections():
- if lCollection.visible_get() == True:
- for obj in lCollection.collection.objects:
- if obj.hide_get() == True:
- obj.hide_set(False)
- obj.select_set(True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement