Revision: 20377
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20377
Author:   dingto
Date:     2009-05-24 14:37:55 +0200 (Sun, 24 May 2009)

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

* Code Cleanup.
* Tiny layout changes.
* Added proper context for bone, curve, mesh and text objects. 

* Fixed Sun/Sky context.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_armature.py
    branches/blender2.5/blender/release/ui/buttons_data_bone.py
    branches/blender2.5/blender/release/ui/buttons_data_camera.py
    branches/blender2.5/blender/release/ui/buttons_data_curve.py
    branches/blender2.5/blender/release/ui/buttons_data_empty.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_modifier.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_scene.py
    branches/blender2.5/blender/release/ui/buttons_world.py

Modified: branches/blender2.5/blender/release/ui/buttons_data_armature.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_armature.py     
2009-05-24 11:26:01 UTC (rev 20376)
+++ branches/blender2.5/blender/release/ui/buttons_data_armature.py     
2009-05-24 12:37:55 UTC (rev 20377)
@@ -1,3 +1,4 @@
+
 import bpy
  
 class DataButtonsPanel(bpy.types.Panel):
@@ -17,13 +18,11 @@
                arm = context.active_object.data
                layout = self.layout
                
-               row = layout.row()
-               row.itemR(arm, "rest_position")
+               layout.itemR(arm, "rest_position")
 
                split = layout.split()
 
                sub = split.column()
-
                sub.itemL(text="Deform:")
                sub.itemR(arm, "deform_vertexgroups", text="Vertes Groups")
                sub.itemR(arm, "deform_envelope", text="Envelopes")
@@ -38,7 +37,6 @@
                #sub.itemR(arm, "layer")
                #sub.itemR(arm, "layer_protection")
 
-
 class DATA_PT_display(DataButtonsPanel):
        __idname__ = "DATA_PT_display"
        __label__ = "Display"
@@ -59,7 +57,6 @@
                sub.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
                sub.itemR(arm, "draw_group_colors", text="Colors")
 
-
 class DATA_PT_paths(DataButtonsPanel):
        __idname__ = "DATA_PT_paths"
        __label__ = "Paths"
@@ -71,11 +68,10 @@
                split = layout.split()
                
                sub = split.column()
-
                sub.itemR(arm, "paths_show_around_current_frame", text="Around 
Frame")
                if (arm.paths_show_around_current_frame):
-                               sub.itemR(arm, "path_before_current", 
text="Before")
-                               sub.itemR(arm, "path_after_current", 
text="After")
+                       sub.itemR(arm, "path_before_current", text="Before")
+                       sub.itemR(arm, "path_after_current", text="After")
                else:
                        sub.itemR(arm, "path_start_frame", text="Start")
                        sub.itemR(arm, "path_end_frame", text="End")
@@ -89,7 +85,6 @@
                sub.itemR(arm, "paths_highlight_keyframes", text="Keyframes")
                sub.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe 
Numbers")
 
-               
 class DATA_PT_ghost(DataButtonsPanel):
        __idname__ = "DATA_PT_ghost"
        __label__ = "Ghost"
@@ -101,7 +96,6 @@
                split = layout.split()
 
                sub = split.column()
-
                sub.itemR(arm, "ghost_type", text="Scope")
                if arm.ghost_type == 'RANGE':
                        sub.itemR(arm, "ghost_start_frame", text="Start")
@@ -112,10 +106,9 @@
                        sub.itemR(arm, "ghost_size", text="Step")
 
                sub = split.column()
-
                sub.itemR(arm, "ghost_only_selected", text="Selected Only")
 
 bpy.types.register(DATA_PT_skeleton)
 bpy.types.register(DATA_PT_display)
 bpy.types.register(DATA_PT_paths)
-bpy.types.register(DATA_PT_ghost)
+bpy.types.register(DATA_PT_ghost)
\ No newline at end of file

Modified: branches/blender2.5/blender/release/ui/buttons_data_bone.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_bone.py 2009-05-24 
11:26:01 UTC (rev 20376)
+++ branches/blender2.5/blender/release/ui/buttons_data_bone.py 2009-05-24 
12:37:55 UTC (rev 20377)
@@ -15,7 +15,7 @@
        __label__ = "Bone"
 
        def draw(self, context):
-               bone = context.main.armatures[0].bones[0]
+               bone = context.active_object.data.bones[0]
                layout = self.layout
 
                split = layout.split()
@@ -26,7 +26,6 @@
                sub.itemR(bone, "connected")
                sub.itemR(bone, "deform")
 
-                               
                sub.itemL(text="Inherit:")
                sub.itemR(bone, "hinge")
                sub.itemR(bone, "inherit_scale")
@@ -48,20 +47,18 @@
                sub.itemR(bone, "bbone_in", text="Ease In")
                sub.itemR(bone, "bbone_out", text="Ease Out")
                
-               
                sub.itemR(bone, "cyclic_offset")
 
-
 class DATA_PT_constraints(DataButtonsPanel):
        __idname__ = "DATA_PT_constraints"
        __label__ = "Constraints"
        
        def draw(self, context):
-               bone = context.main.armatures[0].bones[0]
+               bone = context.active_object.data.bones[0]
                layout = self.layout
                split = layout.split()
                
                sub = split.column()
 
 bpy.types.register(DATA_PT_bone)
-bpy.types.register(DATA_PT_constraints)
+#bpy.types.register(DATA_PT_constraints)
\ No newline at end of file

Modified: branches/blender2.5/blender/release/ui/buttons_data_camera.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_camera.py       
2009-05-24 11:26:01 UTC (rev 20376)
+++ branches/blender2.5/blender/release/ui/buttons_data_camera.py       
2009-05-24 12:37:55 UTC (rev 20377)
@@ -18,19 +18,16 @@
                cam = context.active_object.data
                layout = self.layout
 
-               if not cam:
-                       return
-               
                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.itemR(cam, "lens_unit", text="")
                elif cam.type == 'ORTHO':
                        row.itemR(cam, "ortho_scale")
                        
@@ -58,9 +55,6 @@
                cam = context.active_object.data
                layout = self.layout
 
-               if not cam:
-                       return
-                       
                split = layout.split()
                
                sub = split.column()
@@ -76,6 +70,4 @@
                sub.itemR(cam, "draw_size", text="Size")
                
 bpy.types.register(DATA_PT_cameralens)
-bpy.types.register(DATA_PT_cameradisplay)
-
-
+bpy.types.register(DATA_PT_cameradisplay)
\ No newline at end of file

Modified: branches/blender2.5/blender/release/ui/buttons_data_curve.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_curve.py        
2009-05-24 11:26:01 UTC (rev 20376)
+++ branches/blender2.5/blender/release/ui/buttons_data_curve.py        
2009-05-24 12:37:55 UTC (rev 20377)
@@ -9,20 +9,16 @@
        def poll(self, context):
                ob = context.active_object
                return (ob and ob.type == 'CURVE')
-       
 
 class DATA_PT_shape_curve(DataButtonsPanel):
                __idname__ = "DATA_PT_shape_curve"
                __label__ = "Shape"
 
                def draw(self, context):
-                       curve = context.main.curves[0]
+                       curve = context.active_object.data
                        layout = self.layout
 
-                       if not curve:
-                               return
-                       row = layout.row()
-                       row.itemR(curve, "curve_2d")                    
+                       layout.itemR(curve, "curve_2d")                 
                                                        
                        split = layout.split()
                
@@ -47,19 +43,14 @@
                        sub.itemL(text="NORMALS")
                        sub.itemR(curve, "vertex_normal_flip")
 
-
 class DATA_PT_geometry(DataButtonsPanel):
                __idname__ = "DATA_PT_geometry"
                __label__ = "Geometry"
 
                def draw(self, context):
-                       curve = context.main.curves[0]
+                       curve = context.active_object.data
                        layout = self.layout
 
-                       if not curve:
-                               return
-                               
-                               
                        split = layout.split()
                
                        sub = split.column()
@@ -67,33 +58,25 @@
                        sub.itemR(curve, "width")
                        sub.itemR(curve, "extrude")
                        sub.itemR(curve, "taper_object")
+                       
                        sub = split.column()
                        sub.itemL(text="Bevel:")
                        sub.itemR(curve, "bevel_depth", text="Depth")
                        sub.itemR(curve, "bevel_resolution", text="Resolution")
                        sub.itemR(curve, "bevel_object")
-
-
-
        
 class DATA_PT_pathanim(DataButtonsPanel):
                __idname__ = "DATA_PT_pathanim"
                __label__ = "Path Animation"
 
                def draw(self, context):
-                       curve = context.main.curves[0]
+                       curve = context.active_object.data
                        layout = self.layout
 
-                       if not curve:
-                               return
-                               
-                               
-                       split = layout.split()          
-                       sub = split.column(1)
-                       sub.itemR(curve, "path", text="Enable")
-
+                       layout.itemR(curve, "path", text="Enable")
                        
                        split = layout.split()          
+                       
                        sub = split.column()
                        sub.itemR(curve, "path_length", text="Frames")
                        sub.itemR(curve, "follow")
@@ -101,19 +84,15 @@
                        sub = split.column()
                        sub.itemR(curve, "stretch")
                        sub.itemR(curve, "offset_path_distance", text="Offset 
Children")
-
-                       
+       
 class DATA_PT_current_curve(DataButtonsPanel):
                __idname__ = "DATA_PT_current_curve"
                __label__ = "Current Curve"
 
                def draw(self, context):
-                       currentcurve = context.main.curves[0].curves[0]
+                       currentcurve = context.active_object.data.curves[0]
                        layout = self.layout
 
-                       if not currentcurve:
-                               return
-                               
                        split = layout.split()
                
                        sub = split.column()
@@ -129,6 +108,7 @@
                        sub.itemL(text="Endpoints:")
                        sub.itemR(currentcurve, "endpoint_u", text="U")
                        sub.itemR(currentcurve, "endpoint_v", text="V")
+                       
                        sub = split.column()
                        sub.itemL(text="Bezier:")
                        sub.itemR(currentcurve, "bezier_u", text="U")
@@ -144,4 +124,4 @@
 bpy.types.register(DATA_PT_shape_curve)
 bpy.types.register(DATA_PT_geometry)
 bpy.types.register(DATA_PT_pathanim)
-bpy.types.register(DATA_PT_current_curve)
+bpy.types.register(DATA_PT_current_curve)
\ No newline at end of file

Modified: branches/blender2.5/blender/release/ui/buttons_data_empty.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_empty.py        
2009-05-24 11:26:01 UTC (rev 20376)
+++ branches/blender2.5/blender/release/ui/buttons_data_empty.py        
2009-05-24 12:37:55 UTC (rev 20377)
@@ -18,10 +18,7 @@
                ob = context.active_object
                layout = self.layout
 
-               if not ob:
-                       return
-                       
                layout.itemR(ob, "empty_draw_type")
                layout.itemR(ob, "empty_draw_size")
                
-bpy.types.register(DATA_PT_empty)
+bpy.types.register(DATA_PT_empty)
\ No newline at end of file

Modified: branches/blender2.5/blender/release/ui/buttons_data_lamp.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lamp.py 2009-05-24 
11:26:01 UTC (rev 20376)
+++ branches/blender2.5/blender/release/ui/buttons_data_lamp.py 2009-05-24 
12:37:55 UTC (rev 20377)
@@ -18,12 +18,8 @@
                lamp = context.active_object.data
                layout = self.layout
 
-               if not lamp:
-                       return
+               layout.itemR(lamp, "type", expand=True)
                
-               row = layout.row()
-               row.itemR(lamp, "type", expand=True)
-               
                split = layout.split()
                
                sub = split.column()
@@ -64,12 +60,9 @@
                return (ob.type == 'LAMP' and ob.data.type == 'SUN')
 
        def draw(self, context):
-               lamp = context.active_object.data
+               lamp = context.active_object.data.sky
                layout = self.layout
 
-               if not lamp:
-                       return
-               
                row = layout.row()
                row.itemR(lamp, "sky")
                row.itemR(lamp, "atmosphere")
@@ -86,6 +79,7 @@
                                sub.itemR(lamp, "sky_blend")
                                sub.itemR(lamp, "sky_color_space", text="Color 
Space")
                                sub.itemR(lamp, "sky_exposure")
+                               
                                sub = col.column()
                                sub.itemR(lamp, "horizon_brightness", text="Hor 
Bright")
                                sub.itemR(lamp, "spread", text="Hor Spread")
@@ -112,9 +106,6 @@
                lamp = context.active_object.data
                layout = self.layout
 
-               if not lamp:
-                       return
-               
                layout.itemR(lamp, "shadow_method", expand=True)
                
                if lamp.shadow_method in ('BUFFER_SHADOW', 'RAY_SHADOW'):
@@ -194,9 +185,6 @@
                lamp = context.active_object.data

@@ 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