[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24537] trunk/blender/release/scripts/ui: Made a few more property areas work with a single column.

William Reynish william at reynish.com
Thu Nov 12 22:44:35 CET 2009


Revision: 24537
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24537
Author:   billrey
Date:     2009-11-12 22:44:35 +0100 (Thu, 12 Nov 2009)

Log Message:
-----------
Made a few more property areas work with a single column. 
Also fixed a few minor layout issues.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_data_armature.py
    trunk/blender/release/scripts/ui/properties_data_bone.py
    trunk/blender/release/scripts/ui/properties_data_camera.py
    trunk/blender/release/scripts/ui/properties_data_lamp.py
    trunk/blender/release/scripts/ui/properties_object.py
    trunk/blender/release/scripts/ui/properties_world.py

Modified: trunk/blender/release/scripts/ui/properties_data_armature.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_armature.py	2009-11-12 19:49:26 UTC (rev 24536)
+++ trunk/blender/release/scripts/ui/properties_data_armature.py	2009-11-12 21:44:35 UTC (rev 24537)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class DataButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -39,17 +40,20 @@
         ob = context.object
         arm = context.armature
         space = context.space_data
+        col2 = context.region.width > narrowui
+        
+        if col2:
+            split = layout.split(percentage=0.65)
+            if ob:
+                split.template_ID(ob, "data")
+                split.itemS()
+            elif arm:
+                split.template_ID(space, "pin_id")
+                split.itemS()
+        else:
+            layout.template_ID(ob, "data")
 
-        split = layout.split(percentage=0.65)
 
-        if ob:
-            split.template_ID(ob, "data")
-            split.itemS()
-        elif arm:
-            split.template_ID(space, "pin_id")
-            split.itemS()
-
-
 class DATA_PT_skeleton(DataButtonsPanel):
     bl_label = "Skeleton"
 
@@ -59,6 +63,7 @@
         ob = context.object
         arm = context.armature
         space = context.space_data
+        col2 = context.region.width > narrowui
 
         layout.itemR(arm, "pose_position", expand=True)
 
@@ -70,7 +75,8 @@
         col.itemL(text="Protected Layers:")
         col.itemR(arm, "layer_protection", text="")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Deform:")
         col.itemR(arm, "deform_vertexgroups", text="Vertex Groups")
         col.itemR(arm, "deform_envelope", text="Envelopes")
@@ -85,17 +91,26 @@
         layout = self.layout
 
         arm = context.armature
+        col2 = context.region.width > narrowui
 
-        layout.row().itemR(arm, "drawtype", expand=True)
+        if col2:
+            layout.row().itemR(arm, "drawtype", expand=True)
+        else:
+            layout.row().itemR(arm, "drawtype", text="")
 
-        flow = layout.column_flow()
-        flow.itemR(arm, "draw_names", text="Names")
-        flow.itemR(arm, "draw_axes", text="Axes")
-        flow.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
-        flow.itemR(arm, "draw_group_colors", text="Colors")
-        flow.itemR(arm, "delay_deform", text="Delay Refresh")
+        split = layout.split()
 
+        col = split.column()
+        col.itemR(arm, "draw_names", text="Names")
+        col.itemR(arm, "draw_axes", text="Axes")
+        col.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
+        
+        if col2:
+            col = split.column()
+        col.itemR(arm, "draw_group_colors", text="Colors")
+        col.itemR(arm, "delay_deform", text="Delay Refresh")
 
+
 class DATA_PT_bone_groups(DataButtonsPanel):
     bl_label = "Bone Groups"
 
@@ -107,6 +122,7 @@
 
         ob = context.object
         pose = ob.pose
+        col2 = context.region.width > narrowui
 
         row = layout.row()
         row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2)
@@ -122,11 +138,15 @@
             col.active = (ob.proxy == None)
             col.itemR(group, "name")
 
-            split = layout.split(0.5)
+            split = layout.split()
             split.active = (ob.proxy == None)
-            split.itemR(group, "color_set")
+            
+            col = split.column()
+            col.itemR(group, "color_set")
             if group.color_set:
-                split.template_triColorSet(group, "colors")
+                if col2:
+                    col = split.column()
+                col.template_triColorSet(group, "colors")
 
         row = layout.row(align=True)
         row.active = (ob.proxy == None)
@@ -144,8 +164,12 @@
         layout = self.layout
 
         arm = context.armature
+        col2 = context.region.width > narrowui
 
-        layout.itemR(arm, "paths_type", expand=True)
+        if col2:
+            layout.itemR(arm, "paths_type", expand=True)
+        else:
+            layout.itemR(arm, "paths_type", text="")
 
         split = layout.split()
 
@@ -161,7 +185,8 @@
         sub.itemR(arm, "path_size", text="Step")
         col.row().itemR(arm, "paths_location", expand=True)
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Display:")
         col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers")
         col.itemR(arm, "paths_highlight_keyframes", text="Keyframes")
@@ -169,11 +194,16 @@
 
         layout.itemS()
 
-        row = layout.row()
-        row.itemO("pose.paths_calculate", text="Calculate Paths")
-        row.itemO("pose.paths_clear", text="Clear Paths")
+        split = layout.split()
 
+        col = split.column()
+        col.itemO("pose.paths_calculate", text="Calculate Paths")
+        
+        if col2:
+            col = split.column()
+        col.itemO("pose.paths_clear", text="Clear Paths")
 
+
 class DATA_PT_ghost(DataButtonsPanel):
     bl_label = "Ghost"
 
@@ -181,8 +211,12 @@
         layout = self.layout
 
         arm = context.armature
+        col2 = context.region.width > narrowui
 
-        layout.itemR(arm, "ghost_type", expand=True)
+        if col2:
+            layout.itemR(arm, "ghost_type", expand=True)
+        else:
+            layout.itemR(arm, "ghost_type", text="")
 
         split = layout.split()
 
@@ -197,7 +231,8 @@
             sub.itemR(arm, "ghost_step", text="Range")
             sub.itemR(arm, "ghost_size", text="Step")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Display:")
         col.itemR(arm, "ghost_only_selected", text="Selected Only")
 

Modified: trunk/blender/release/scripts/ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_bone.py	2009-11-12 19:49:26 UTC (rev 24536)
+++ trunk/blender/release/scripts/ui/properties_data_bone.py	2009-11-12 21:44:35 UTC (rev 24537)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class BoneButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -53,44 +54,67 @@
 
         ob = context.object
         bone = context.bone
+        col2 = context.region.width > narrowui
+        
         if not bone:
             bone = context.edit_bone
+            if col2:
+                row = layout.row()
+                row.column().itemR(bone, "head")
+                row.column().itemR(bone, "tail")
+    
+                col = row.column()
+                sub = col.column(align=True)
+                sub.itemL(text="Roll:")
+                sub.itemR(bone, "roll", text="")
+                sub.itemL()
+                sub.itemR(bone, "locked")
+            else:
+                col = layout.column()
+                col.itemR(bone, "head")
+                col.itemR(bone, "tail")
+                col.itemR(bone, "roll")
+                col.itemR(bone, "locked")
 
-            row = layout.row()
-            row.column().itemR(bone, "head")
-            row.column().itemR(bone, "tail")
-
-            col = row.column()
-            sub = col.column(align=True)
-            sub.itemL(text="Roll:")
-            sub.itemR(bone, "roll", text="")
-            sub.itemL()
-            sub.itemR(bone, "locked")
-
         else:
             pchan = ob.pose.pose_channels[context.bone.name]
-
-            row = layout.row()
-            col = row.column()
-            col.itemR(pchan, "location")
-            col.active = not (bone.parent and bone.connected)
-
-            col = row.column()
-            if pchan.rotation_mode == 'QUATERNION':
-                col.itemR(pchan, "rotation_quaternion", text="Rotation")
-            elif pchan.rotation_mode == 'AXIS_ANGLE':
-                #col.itemL(text="Rotation")
-                #col.itemR(pchan, "rotation_angle", text="Angle")
-                #col.itemR(pchan, "rotation_axis", text="Axis")
-                col.itemR(pchan, "rotation_axis_angle", text="Rotation")
+            
+            if col2:
+                row = layout.row()
+                col = row.column()
+                col.itemR(pchan, "location")
+                col.active = not (bone.parent and bone.connected)
+    
+                col = row.column()
+                if pchan.rotation_mode == 'QUATERNION':
+                    col.itemR(pchan, "rotation_quaternion", text="Rotation")
+                elif pchan.rotation_mode == 'AXIS_ANGLE':
+                    #col.itemL(text="Rotation")
+                    #col.itemR(pchan, "rotation_angle", text="Angle")
+                    #col.itemR(pchan, "rotation_axis", text="Axis")
+                    col.itemR(pchan, "rotation_axis_angle", text="Rotation")
+                else:
+                    col.itemR(pchan, "rotation_euler", text="Rotation")
+    
+                row.column().itemR(pchan, "scale")
+    
+                layout.itemR(pchan, "rotation_mode")
             else:
-                col.itemR(pchan, "rotation_euler", text="Rotation")
+                col = layout.column()
+                sub = col.column()
+                sub.active = not (bone.parent and bone.connected)
+                sub.itemR(pchan, "location")
+                col.itemL(text="Rotation:")
+                col.itemR(pchan, "rotation_mode", text="")
+                if pchan.rotation_mode == 'QUATERNION':
+                    col.itemR(pchan, "rotation_quaternion", text="")
+                elif pchan.rotation_mode == 'AXIS_ANGLE':
+                    col.itemR(pchan, "rotation_axis_angle", text="")
+                else:
+                    col.itemR(pchan, "rotation_euler", text="")
+                col.itemR(pchan, "scale")
 
-            row.column().itemR(pchan, "scale")
 
-            layout.itemR(pchan, "rotation_mode")
-
-
 class BONE_PT_transform_locks(BoneButtonsPanel):
     bl_label = "Transform Locks"
     bl_default_closed = True
@@ -131,6 +155,7 @@
         ob = context.object
         bone = context.bone
         arm = context.armature
+        col2 = context.region.width > narrowui
 
         if not bone:
             bone = context.edit_bone
@@ -150,7 +175,8 @@
             col.itemL(text="Bone Group:")

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list