Patch from William
[blender-staging.git] / release / ui / buttons_texture.py
index 31908d5ec9c72b6c14a0e29165eda0fec132d20a..4771a550555796cc47b90a611a2cf4352aaac12a 100644 (file)
@@ -22,16 +22,16 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
                
                layout.template_preview(tex)
 
-class TEXTURE_PT_texture(TextureButtonsPanel):
-       __idname__= "TEXTURE_PT_texture"
-       __label__ = "Texture"
+class TEXTURE_PT_context(TextureButtonsPanel):
+       __idname__= "TEXTURE_PT_context"
+       __label__ = " "
 
        def poll(self, context):
                return (context.material or context.world or context.lamp or context.texture)
 
        def draw(self, context):
                layout = self.layout
-               
+
                tex = context.texture
                ma = context.material
                la = context.lamp
@@ -39,6 +39,24 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
                space = context.space_data
                slot = context.texture_slot
 
+               row = layout.row()
+               if ma:
+                       row.template_list(ma, "textures", ma, "active_texture_index")
+                       col = row.column(align=True)
+                       col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
+                       #col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
+               elif la:
+                       row.template_list(la, "textures", la, "active_texture_index")
+                       col = row.column(align=True)
+                       col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
+                       #col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
+               elif wo:
+                       row.template_list(wo, "textures", wo, "active_texture_index")
+                       col = row.column(align=True)
+                       col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
+                       #col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
+
+
                split = layout.split(percentage=0.65)
 
                if ma or la or wo:
@@ -47,17 +65,12 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
                        else:
                                split.itemS()
 
-                       if ma:
-                               split.itemR(ma, "active_texture_index", text="Active")
-                       elif la:
-                               split.itemR(la, "active_texture_index", text="Active")
-                       elif wo:
-                               split.itemR(wo, "active_texture_index", text="Active")
+
                elif tex:
                        split.template_ID(space, "pin_id")
                        split.itemS()
-
-               layout.itemS()
+                       
+                       layout.itemS()
                
                if tex:
                        split = layout.split(percentage=0.2)
@@ -66,6 +79,21 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
                        col.itemL(text="Type:")
                        col = split.column()
                        col.itemR(tex, "type", text="")
+               
+
+class TEXTURE_PT_texture(TextureButtonsPanel):
+       __idname__= "TEXTURE_PT_texture"
+       __label__ = "Texture"
+
+       def poll(self, context):
+               return (context.material or context.world or context.lamp or context.texture)
+
+       def draw(self, context):
+               layout = self.layout
+               
+               tex = context.texture
+
+
 
 class TEXTURE_PT_mapping(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_mapping"
@@ -511,6 +539,7 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel):
                sub = split.column()
                sub.itemR(tex, "nabla") 
 
+bpy.types.register(TEXTURE_PT_context)
 bpy.types.register(TEXTURE_PT_preview)
 bpy.types.register(TEXTURE_PT_texture)
 bpy.types.register(TEXTURE_PT_clouds)