Revision: 21464
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21464
Author:   dingto
Date:     2009-07-09 18:09:44 +0200 (Thu, 09 Jul 2009)

Log Message:
-----------
2.5 Buttons:

* 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 ;-)

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_camera.py
    branches/blender2.5/blender/release/ui/buttons_data_lamp.py
    branches/blender2.5/blender/release/ui/buttons_data_lattice.py
    branches/blender2.5/blender/release/ui/buttons_data_mesh.py
    branches/blender2.5/blender/release/ui/buttons_data_text.py
    branches/blender2.5/blender/release/ui/buttons_material.py
    branches/blender2.5/blender/release/ui/buttons_objects.py
    branches/blender2.5/blender/release/ui/buttons_texture.py
    branches/blender2.5/blender/release/ui/buttons_world.py

Modified: branches/blender2.5/blender/release/ui/buttons_data_camera.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_camera.py       
2009-07-09 16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_data_camera.py       
2009-07-09 16:09:44 UTC (rev 21464)
@@ -14,7 +14,7 @@
        __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 @@
                        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"

Modified: branches/blender2.5/blender/release/ui/buttons_data_lamp.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lamp.py 2009-07-09 
16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_data_lamp.py 2009-07-09 
16:09:44 UTC (rev 21464)
@@ -24,8 +24,8 @@
        __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 @@
                        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)
                

Modified: branches/blender2.5/blender/release/ui/buttons_data_lattice.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lattice.py      
2009-07-09 16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_data_lattice.py      
2009-07-09 16:09:44 UTC (rev 21464)
@@ -36,33 +36,27 @@
 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)

Modified: branches/blender2.5/blender/release/ui/buttons_data_mesh.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_mesh.py 2009-07-09 
16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_data_mesh.py 2009-07-09 
16:09:44 UTC (rev 21464)
@@ -9,7 +9,6 @@
        def poll(self, context):
                return (context.mesh != None)
 
-
 class DATA_PT_context_mesh(DataButtonsPanel):
        __idname__ = "DATA_PT_context_mesh"
        __label__ = " "
@@ -33,39 +32,29 @@
                        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"
        __label__ = "Materials"
@@ -229,4 +218,3 @@
 bpy.types.register(DATA_PT_shape_keys)
 bpy.types.register(DATA_PT_uv_texture)
 bpy.types.register(DATA_PT_vertex_colors)
-

Modified: branches/blender2.5/blender/release/ui/buttons_data_text.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_text.py 2009-07-09 
16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_data_text.py 2009-07-09 
16:09:44 UTC (rev 21464)
@@ -37,10 +37,6 @@
 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 @@
                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):

Modified: branches/blender2.5/blender/release/ui/buttons_material.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_material.py  2009-07-09 
16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_material.py  2009-07-09 
16:09:44 UTC (rev 21464)
@@ -13,9 +13,6 @@
        __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 @@
        __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 @@
        __idname__= "MATERIAL_PT_material"
        __label__ = "Material"
 
-       def poll(self, context):
-               return (context.material or context.material_slot)
-
        def draw(self, context):
                layout = self.layout
                

Modified: branches/blender2.5/blender/release/ui/buttons_objects.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_objects.py   2009-07-09 
16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_objects.py   2009-07-09 
16:09:44 UTC (rev 21464)
@@ -17,9 +17,7 @@
                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"

Modified: branches/blender2.5/blender/release/ui/buttons_texture.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_texture.py   2009-07-09 
16:05:01 UTC (rev 21463)
+++ branches/blender2.5/blender/release/ui/buttons_texture.py   2009-07-09 
16:09:44 UTC (rev 21464)
@@ -13,9 +13,6 @@
        __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 @@
        __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)
 

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to