Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/modules/bpy_types.py
| Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | class Library(bpy_types.ID): | ||||
| @property | @property | ||||
| def users_id(self): | def users_id(self): | ||||
| """ID data blocks which use this library""" | """ID data blocks which use this library""" | ||||
| import bpy | import bpy | ||||
| # See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, | # See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, | ||||
| # we could make this an attribute in rna. | # we could make this an attribute in rna. | ||||
| attr_links = ("actions", "armatures", "brushes", "cameras", | attr_links = ("actions", "armatures", "brushes", "cameras", | ||||
| "curves", "grease_pencil", "groups", "images", | "curves", "grease_pencil", "collections", "images", | ||||
| "lamps", "lattices", "materials", "metaballs", | "lamps", "lattices", "materials", "metaballs", | ||||
| "meshes", "node_groups", "objects", "scenes", | "meshes", "node_groups", "objects", "scenes", | ||||
| "sounds", "speakers", "textures", "texts", | "sounds", "speakers", "textures", "texts", | ||||
| "fonts", "worlds") | "fonts", "worlds") | ||||
| return tuple(id_block | return tuple(id_block | ||||
| for attr in attr_links | for attr in attr_links | ||||
| for id_block in getattr(bpy.data, attr) | for id_block in getattr(bpy.data, attr) | ||||
| Show All 19 Lines | def users_object_modifier(self): | ||||
| import bpy | import bpy | ||||
| return tuple(obj for obj in bpy.data.objects if | return tuple(obj for obj in bpy.data.objects if | ||||
| self in [mod.texture | self in [mod.texture | ||||
| for mod in obj.modifiers | for mod in obj.modifiers | ||||
| if mod.type == 'DISPLACE'] | if mod.type == 'DISPLACE'] | ||||
| ) | ) | ||||
| class Group(bpy_types.ID): | class Collection(bpy_types.ID): | ||||
| __slots__ = () | __slots__ = () | ||||
| @property | @property | ||||
| def users_dupli_group(self): | def users_dupli_collection(self): | ||||
| """The dupli group this group is used in""" | """The collection instance objects this collection is used in""" | ||||
| import bpy | import bpy | ||||
| return tuple(obj for obj in bpy.data.objects | return tuple(obj for obj in bpy.data.objects | ||||
| if self == obj.dupli_group) | if self == obj.dupli_group) | ||||
| class Object(bpy_types.ID): | class Object(bpy_types.ID): | ||||
| __slots__ = () | __slots__ = () | ||||
| @property | @property | ||||
| def children(self): | def children(self): | ||||
| """All the children of this object""" | """All the children of this object""" | ||||
| import bpy | import bpy | ||||
| return tuple(child for child in bpy.data.objects | return tuple(child for child in bpy.data.objects | ||||
| if child.parent == self) | if child.parent == self) | ||||
| @property | @property | ||||
| def users_group(self): | def users_group(self): | ||||
| """The groups this object is in""" | """The collections this object is in""" | ||||
| import bpy | import bpy | ||||
| return tuple(group for group in bpy.data.groups | return tuple(group for group in bpy.data.collections | ||||
| if self in group.objects[:]) | if self in group.objects[:]) | ||||
| @property | @property | ||||
| def users_scene(self): | def users_scene(self): | ||||
| """The scenes this object is in""" | """The scenes this object is in""" | ||||
| import bpy | import bpy | ||||
| return tuple(scene for scene in bpy.data.scenes | return tuple(scene for scene in bpy.data.scenes | ||||
| if self in scene.objects[:]) | if self in scene.objects[:]) | ||||
| ▲ Show 20 Lines • Show All 874 Lines • Show Last 20 Lines | |||||