To get a list of collections with all internal collections, we can use the following function:
1 2 3 4 |
def collections(collection, col_list): col_list.append(collection) for sub_collection in collection.children: collections(sub_collection, col_list) |
Let’s print a list of all the scene collections:
1 2 3 4 5 6 7 8 9 10 11 12 |
import bpy def collections(collection, col_list): col_list.append(collection) for sub_collection in collection.children: collections(sub_collection, col_list) rez_list = [] collections(bpy.context.collection, rez_list) print(rez_list) # [bpy.data.scenes['Scene'].collection, bpy.data.collections['scene'], bpy.data.collections['objects'], bpy.data.collections['camera']] |
hey there,
this doesn’t seem to work in Blender 3.1 what yould be the reason? 😉
nerver mind =D it works