diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-08 17:03:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-08 17:03:49 +0400 |
commit | 728799e0d87e93522b68bacdcf064f514171ede5 (patch) | |
tree | bfe960d3fa9e175dcaa1632162490e0e373d1e19 | |
parent | c5cee166309d3e334a3565b081173a151e554bb6 (diff) |
texture user attributes, users_material, users_object_modifier
-rw-r--r-- | release/scripts/modules/bpy_types.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 28a30c232a9..d33b43f2e58 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -38,6 +38,22 @@ class Context(StructRNA): return new_context +class Texture(bpy_types.ID): + __slots__ = () + + @property + def users_material(self): + """Materials that use this texture""" + import bpy + return tuple(mat for mat in bpy.data.materials if self in [slot.texture for slot in mat.texture_slots if slot]) + + @property + def users_object_modifier(self): + """Object modifiers that use this texture""" + import bpy + return tuple(obj for obj in bpy.data.objects if self in [mod.texture for mod in obj.modifiers if mod.type == 'DISPLACE']) + + class Group(bpy_types.ID): __slots__ = () |