2.5 Buttons:
authorThomas Dinges <blender@dingto.org>
Thu, 9 Jul 2009 16:09:44 +0000 (16:09 +0000)
committerThomas Dinges <blender@dingto.org>
Thu, 9 Jul 2009 16:09:44 +0000 (16:09 +0000)
* Fixed some Bugs from Commit 21458.

* Show Preview Render only when there is an active id block.

* Some Code Cleanup (especially in polls). Please try to keep it clean ;-)

release/ui/buttons_data_camera.py
release/ui/buttons_data_lamp.py
release/ui/buttons_data_lattice.py
release/ui/buttons_data_mesh.py
release/ui/buttons_data_text.py
release/ui/buttons_material.py
release/ui/buttons_objects.py
release/ui/buttons_texture.py
release/ui/buttons_world.py

index 197f45f1a0c1270a9f14118074ab80eff4e4f493..b4b53f1c5a1456509b13a7b68fc7476b2f0cf0a8 100644 (file)
@@ -14,7 +14,7 @@ class DATA_PT_context_camera(DataButtonsPanel):
        __label__ = " "
        
        def poll(self, context):
-               return (context.object and context.object.type == 'CAMERA')
+               return (context.object.type == 'CAMERA')
 
        def draw(self, context):
                layout = self.layout
@@ -32,51 +32,44 @@ class DATA_PT_context_camera(DataButtonsPanel):
                        split.template_ID(space, "pin_id")
                        split.itemS()
 
-
 class DATA_PT_camera(DataButtonsPanel):
        __idname__ = "DATA_PT_camera"
        __label__ = "Lens"
-       
-       def poll(self, context):
-               return (context.object and context.object.type == 'CAMERA')
 
        def draw(self, context):
                layout = self.layout
                
-               ob = context.object
                cam = context.camera
-               space = context.space_data
 
-               if cam:
-                       layout.itemS()
-                       layout.itemR(cam, "type", expand=True)
+               layout.itemS()
+               layout.itemR(cam, "type", expand=True)
                        
-                       row = layout.row(align=True)
-                       if cam.type == 'PERSP':
-                               row.itemR(cam, "lens_unit", text="")
-                               if cam.lens_unit == 'MILLIMETERS':
-                                       row.itemR(cam, "lens", text="Angle")
-                               elif cam.lens_unit == 'DEGREES':
-                                       row.itemR(cam, "angle")
+               row = layout.row(align=True)
+               if cam.type == 'PERSP':
+                       row.itemR(cam, "lens_unit", text="")
+                       if cam.lens_unit == 'MILLIMETERS':
+                               row.itemR(cam, "lens", text="Angle")
+                       elif cam.lens_unit == 'DEGREES':
+                               row.itemR(cam, "angle")
 
-                       elif cam.type == 'ORTHO':
-                               row.itemR(cam, "ortho_scale")
+               elif cam.type == 'ORTHO':
+                       row.itemR(cam, "ortho_scale")
                                
-                       split = layout.split()
+               split = layout.split()
                        
-                       sub = split.column(align=True)
-                       sub.itemL(text="Shift:")
-                       sub.itemR(cam, "shift_x", text="X")
-                       sub.itemR(cam, "shift_y", text="Y")
+               sub = split.column(align=True)
+               sub.itemL(text="Shift:")
+               sub.itemR(cam, "shift_x", text="X")
+               sub.itemR(cam, "shift_y", text="Y")
                        
-                       sub = split.column(align=True)
-                       sub.itemL(text="Clipping:")
-                       sub.itemR(cam, "clip_start", text="Start")
-                       sub.itemR(cam, "clip_end", text="End")
+               sub = split.column(align=True)
+               sub.itemL(text="Clipping:")
+               sub.itemR(cam, "clip_start", text="Start")
+               sub.itemR(cam, "clip_end", text="End")
                        
-                       row = layout.row()
-                       row.itemR(cam, "dof_object")
-                       row.itemR(cam, "dof_distance")
+               row = layout.row()
+               row.itemR(cam, "dof_object")
+               row.itemR(cam, "dof_distance")
                
 class DATA_PT_camera_display(DataButtonsPanel):
        __idname__ = "DATA_PT_camera_display"
index 00d54aa5b70778f6aa4d0a3a7972ee9645e61a83..e6e870bad5db87f83124b5e65b2cd009dfc30ef5 100644 (file)
@@ -24,8 +24,8 @@ class DATA_PT_context_lamp(DataButtonsPanel):
        __label__ = " "
        
        def poll(self, context):
-               return ((context.object and context.object.type == 'LAMP') or context.lamp)
-
+               return (context.object.type == 'LAMP')
+               
        def draw(self, context):
                layout = self.layout
                
@@ -42,20 +42,14 @@ class DATA_PT_context_lamp(DataButtonsPanel):
                        split.template_ID(space, "pin_id")
                        split.itemS()
 
-
 class DATA_PT_lamp(DataButtonsPanel):
        __idname__ = "DATA_PT_lamp"
        __label__ = "Lamp"
-       
-       def poll(self, context):
-               return ((context.object and context.object.type == 'LAMP') or context.lamp)
 
        def draw(self, context):
                layout = self.layout
                
-               ob = context.object
                lamp = context.lamp
-               space = context.space_data
 
                layout.itemR(lamp, "type", expand=True)
                
index 6636cbf533defa790d17d8a178934ba104f1ef08..e9c17839abd42f1d43b899bb0c5b86cd60fe2c53 100644 (file)
@@ -36,33 +36,27 @@ class DATA_PT_context_lattice(DataButtonsPanel):
 class DATA_PT_lattice(DataButtonsPanel):
        __idname__ = "DATA_PT_lattice"
        __label__ = "Lattice"
-       
-       def poll(self, context):
-               return (context.object and context.object.type == 'LATTICE')
 
        def draw(self, context):
                layout = self.layout
                
-               ob = context.object
                lat = context.lattice
-               space = context.space_data
 
-               if lat:
-                       row = layout.row()
-                       row.itemR(lat, "points_u")
-                       row.itemR(lat, "interpolation_type_u", expand=True)
+               row = layout.row()
+               row.itemR(lat, "points_u")
+               row.itemR(lat, "interpolation_type_u", expand=True)
                        
-                       row = layout.row()
-                       row.itemR(lat, "points_v")
-                       row.itemR(lat, "interpolation_type_v", expand=True)
+               row = layout.row()
+               row.itemR(lat, "points_v")
+               row.itemR(lat, "interpolation_type_v", expand=True)
                        
-                       row = layout.row()
-                       row.itemR(lat, "points_w")
-                       row.itemR(lat, "interpolation_type_w", expand=True)
+               row = layout.row()
+               row.itemR(lat, "points_w")
+               row.itemR(lat, "interpolation_type_w", expand=True)
                        
-                       row = layout.row()
-                       row.itemO("LATTICE_OT_make_regular")
-                       row.itemR(lat, "outside")
+               row = layout.row()
+               row.itemO("LATTICE_OT_make_regular")
+               row.itemR(lat, "outside")
 
 bpy.types.register(DATA_PT_context_lattice)
 bpy.types.register(DATA_PT_lattice)
index 1f9b958aabbf00d3d957f13b9c1188731f650619..d8ffac6e859fa92872535f64d9f0a3260449821a 100644 (file)
@@ -9,7 +9,6 @@ class DataButtonsPanel(bpy.types.Panel):
        def poll(self, context):
                return (context.mesh != None)
 
-
 class DATA_PT_context_mesh(DataButtonsPanel):
        __idname__ = "DATA_PT_context_mesh"
        __label__ = " "
@@ -33,38 +32,28 @@ class DATA_PT_context_mesh(DataButtonsPanel):
                        split.template_ID(space, "pin_id")
                        split.itemS()
 
-
-
-
 class DATA_PT_mesh(DataButtonsPanel):
        __idname__ = "DATA_PT_mesh"
        __label__ = "Mesh"
-       
-       def poll(self, context):
-               return (context.object and context.object.type == 'MESH')
 
        def draw(self, context):
                layout = self.layout
                
-               ob = context.object
                mesh = context.mesh
-               space = context.space_data
-
-               if mesh:
-                       split = layout.split()
                
-                       col = split.column()
-                       col.itemR(mesh, "autosmooth")
-                       colsub = col.column()
-                       colsub.active = mesh.autosmooth
-                       colsub.itemR(mesh, "autosmooth_angle", text="Angle")
-                       sub = split.column()
-                       sub.itemR(mesh, "vertex_normal_flip")
-                       sub.itemR(mesh, "double_sided")
+               split = layout.split()
+               
+               col = split.column()
+               col.itemR(mesh, "autosmooth")
+               colsub = col.column()
+               colsub.active = mesh.autosmooth
+               colsub.itemR(mesh, "autosmooth_angle", text="Angle")
+               sub = split.column()
+               sub.itemR(mesh, "vertex_normal_flip")
+               sub.itemR(mesh, "double_sided")
                        
-                       layout.itemS()
-                       layout.itemR(mesh, "texco_mesh")
-
+               layout.itemS()
+               layout.itemR(mesh, "texco_mesh")
 
 class DATA_PT_materials(DataButtonsPanel):
        __idname__ = "DATA_PT_materials"
@@ -229,4 +218,3 @@ bpy.types.register(DATA_PT_vertex_groups)
 bpy.types.register(DATA_PT_shape_keys)
 bpy.types.register(DATA_PT_uv_texture)
 bpy.types.register(DATA_PT_vertex_colors)
-
index ee8b0dbd56810d77d5e412463ba962b6bf4ac3ba..b8b0e324609e6e5931c5b3d79e3c7a7a96146af5 100644 (file)
@@ -37,10 +37,6 @@ class DATA_PT_context_text(DataButtonsPanel):
 class DATA_PT_shape_text(DataButtonsPanel):
        __idname__ = "DATA_PT_shape_text"
        __label__ = "Shape Text"
-       
-       def poll(self, context):
-               ob = context.object
-               return (context.object and context.object.type == 'TEXT')
 
        def draw(self, context):
                layout = self.layout
@@ -149,7 +145,7 @@ class DATA_PT_paragraph(DataButtonsPanel):
                sub.itemL(text="Offset:")
                sub.itemR(text, "x_offset", text="X")
                sub.itemR(text, "y_offset", text="Y")
-               sub.itemR(text, "wrap")
+               #sub.itemR(text, "wrap")
 
 """            
 class DATA_PT_textboxes(DataButtonsPanel):
index 6cb3da470b65726a13e2b6a9d6e227ad2f00082f..ede28e6fb54bd5a2b29c0b88be7f3009a26b19a7 100644 (file)
@@ -13,9 +13,6 @@ class MATERIAL_PT_preview(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_preview"
        __label__ = "Preview"
 
-       def poll(self, context):
-               return (context.material or context.material_slot)
-
        def draw(self, context):
                layout = self.layout
                mat = context.material
@@ -27,7 +24,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
        __label__ = " "
 
        def poll(self, context):
-               return (context.material or context.material_slot)
+               return (context.object)
 
        def draw(self, context):
                layout = self.layout
@@ -59,9 +56,6 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_material"
        __label__ = "Material"
 
-       def poll(self, context):
-               return (context.material or context.material_slot)
-
        def draw(self, context):
                layout = self.layout
                
index 15fe0378dfd0909524e5663857e93e4c65d5f234..b993d789ac472fdc96f04d0bd0f7bfcea20181f0 100644 (file)
@@ -17,9 +17,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
                split = layout.split(percentage=0.06)
                split.itemL(text="", icon="ICON_OBJECT_DATA")
                split.itemR(ob, "name", text="")
-               
-                       
-                       
+
 class OBJECT_PT_transform(ObjectButtonsPanel):
        __idname__ = "OBJECT_PT_transform"
        __label__ = "Transform"
index 4d2db7d36a32de8b32a473b0238425065f1b9eda..6c3ae9412b7faba9ca93a0da954e7242223a5c95 100644 (file)
@@ -13,9 +13,6 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_preview"
        __label__ = "Preview"
 
-       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
@@ -27,7 +24,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
        __label__ = " "
 
        def poll(self, context):
-               return (context.material or context.world or context.lamp or context.texture)
+               return (context.material or context.world or context.lamp)
 
        def draw(self, context):
                layout = self.layout
@@ -42,20 +39,15 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
                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")
+               """if ma or la or wo: 
                        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)
 
@@ -65,7 +57,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
                        else:
                                split.itemS()
 
-
                elif tex:
                        split.template_ID(space, "pin_id")
                        split.itemS()
@@ -79,21 +70,6 @@ class TEXTURE_PT_context_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"
@@ -541,7 +517,6 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel):
 
 bpy.types.register(TEXTURE_PT_context_texture)
 bpy.types.register(TEXTURE_PT_preview)
-bpy.types.register(TEXTURE_PT_texture)
 bpy.types.register(TEXTURE_PT_clouds)
 bpy.types.register(TEXTURE_PT_wood)
 bpy.types.register(TEXTURE_PT_marble)
index 266e417e49242e704c640a6275915a88cd2b1ed6..c93e37a0c6a951526f85d695dedbfc2041863fa4 100644 (file)
@@ -12,9 +12,6 @@ class WorldButtonsPanel(bpy.types.Panel):
 class WORLD_PT_preview(WorldButtonsPanel):
        __label__ = "Preview"
 
-       def poll(self, context):
-               return (context.scene or context.world)
-
        def draw(self, context):
                layout = self.layout
                world = context.world
@@ -44,17 +41,10 @@ class WORLD_PT_context_world(WorldButtonsPanel):
 class WORLD_PT_world(WorldButtonsPanel):
        __label__ = "World"
 
-       def poll(self, context):
-               return (context.scene != None)
-
        def draw(self, context):
                layout = self.layout
-               
-               scene = context.scene
-               world = context.world
-               space = context.space_data
-
 
+               world = context.world
 
                if world: