4
$\begingroup$

How to get all of the groups an object is assigned to in Blender Python?

for obj in bpy.data.objects: # All objects
    # TODO: Retrieve the groups of obj.
$\endgroup$
  • $\begingroup$ Do you mean all the groups that an object is in? - or all the dupligroup objects that the object instances? Please try be more precise with questions. $\endgroup$ – ideasman42 Oct 8 '14 at 11:50
  • $\begingroup$ I mean all the groups that an object is in. $\endgroup$ – Roi Danton Oct 8 '14 at 11:51
5
$\begingroup$

Found it myself: Use obj.users_group, e.g.

for obj in bpy.data.objects: # All objects
    for group in obj.users_group: # All groups
        # Do something, e.g. use group.name to find specific groups.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.