0
$\begingroup$

I have a list of all multi user objects per layer:

multi_user_list = []

for obj in bpy.data.objects:
    if obj.layers[0]:
        if obj.data.users > 1:
            multi_user_list.append(obj)

How I can sort the list by objects with the same user? E.g.: [(cube, cube1), (cube2, cube3)]

$\endgroup$

1 Answer 1

0
$\begingroup$

It's probably not optimal but I found a method that works:

multi_user_list = []

for obj in bpy.data.objects:
    if obj.layers[0]:
        if obj.data.users > 1:
            multi_user_list.append(obj)

group_list = []
group = []

for obj in multi_user_list[:]:
    for ob in multi_user_list[:]:
        if obj.data == ob.data:

            group.append(ob.name)
            if ob in multi_user_list:
                multi_user_list.remove(ob)

    if group:
        group_list.append(group)
    group = []

print(group_list)
$\endgroup$

You must log in to answer this question.

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