0
$\begingroup$

I want to select all objects in a collection (collection names are known).

pseudo:

selectedObjs1 = allObjectsInCollectionName; <--- How?
for all objects in selectedObjs1:
    process...

Thanks.

$\endgroup$
0

1 Answer 1

2
$\begingroup$

If you want to process every object in a collection, you would have to iterate through Collection.all_objects:

collection = bpy.data.collections["collection_name"]
for obj in collection.all_objects:
    print(obj.name) 

Further reading: How to list all collections and their objects?

$\endgroup$
2
  • $\begingroup$ Yes you're right! I edited my post, thanks. $\endgroup$
    – Tomreggae
    Dec 15, 2020 at 21:15
  • $\begingroup$ thanks a lot Tomreggae and Brockmann $\endgroup$
    – Xvier
    Dec 15, 2020 at 22:33

Not the answer you're looking for? Browse other questions tagged .