[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29340] trunk/blender/release/scripts/ modules/bpy_types.py: texture user attributes, users_material, users_object_modifier

Campbell Barton ideasman42 at gmail.com
Tue Jun 8 15:03:49 CEST 2010


Revision: 29340
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29340
Author:   campbellbarton
Date:     2010-06-08 15:03:49 +0200 (Tue, 08 Jun 2010)

Log Message:
-----------
texture user attributes, users_material, users_object_modifier

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_types.py

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2010-06-08 11:39:13 UTC (rev 29339)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2010-06-08 13:03:49 UTC (rev 29340)
@@ -38,6 +38,22 @@
         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__ = ()
 





More information about the Bf-blender-cvs mailing list