1
$\begingroup$

I would like to bypass the linked objects in a "for" loop, but I wouldn't know what condition to use. I'd write something like this:

for o in bpy.context.scene:
    if o is ###"single user":
        print(o.name)

Linked object example: enter image description here

$\endgroup$
4
  • $\begingroup$ Do you mean whether an specific object has more than 1 user? $\endgroup$
    – brockmann
    Commented Aug 26, 2019 at 7:44
  • $\begingroup$ @brockmann, Yes, like to, if object have 1 or more copy linked $\endgroup$
    – Noob Cat
    Commented Aug 26, 2019 at 14:18
  • 1
    $\begingroup$ Object.data.users returns the number of users $\endgroup$
    – brockmann
    Commented Aug 26, 2019 at 14:22
  • $\begingroup$ @brockmann ,I think this should be posted as an answer in order to earn points, that's exactly what I was looking for. Ty! $\endgroup$
    – Noob Cat
    Commented Aug 26, 2019 at 18:18

1 Answer 1

2
$\begingroup$

Object.data.users returns the number of data-block users. Proof using the Console:

>>> for ob in bpy.context.scene.objects:
...     print ("Object name:", ob.name, "- Users:", ob.data.users)

Object name: Cube - Users: 1
Object name: Light - Users: 1
Object name: Camera - Users: 1
$\endgroup$

You must log in to answer this question.

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