Fix object.users_collection not including scene collections.

This commit is contained in:
Brecht Van Lommel
2019-02-07 12:59:40 +01:00
parent 9c68ac0448
commit 58a1259469
+4 -2
View File
@@ -120,10 +120,12 @@ class Object(bpy_types.ID):
@property
def users_collection(self):
"""The collections this object is in. Warning: takes O(len(bpy.data.collections)) time."""
"""The collections this object is in. Warning: takes O(len(bpy.data.collections) + len(bpy.data.scenes)) time."""
import bpy
return tuple(collection for collection in bpy.data.collections
if self in collection.objects[:])
if self in collection.objects[:]) + \
tuple(scene.collection for scene in bpy.data.scenes
if self in scene.collection.objects[:])
@property
def users_scene(self):