[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24589] trunk/blender: Added single column support to modifiers

William Reynish william at reynish.com
Mon Nov 16 17:07:23 CET 2009


Revision: 24589
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24589
Author:   billrey
Date:     2009-11-16 17:07:22 +0100 (Mon, 16 Nov 2009)

Log Message:
-----------
Added single column support to modifiers
Tiny cleanups and improvements in some modifier layouts 

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_data_modifier.py
    trunk/blender/source/blender/makesrna/intern/rna_modifier.c

Modified: trunk/blender/release/scripts/ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_modifier.py	2009-11-16 14:29:46 UTC (rev 24588)
+++ trunk/blender/release/scripts/ui/properties_data_modifier.py	2009-11-16 16:07:22 UTC (rev 24589)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class DataButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -33,31 +34,37 @@
         layout = self.layout
 
         ob = context.object
+        col2 = context.region.width > narrowui
 
         row = layout.row()
         row.item_menu_enumO("object.modifier_add", "type")
-        row.itemL()
+        if col2:
+            row.itemL()
 
         for md in ob.modifiers:
             box = layout.template_modifier(md)
             if box:
                 # match enum type to our functions, avoids a lookup table.
-                getattr(self, md.type)(box, ob, md)
+                getattr(self, md.type)(box, ob, md, col2)
 
     # the mt.type enum is (ab)used for a lookup on function names
     # ...to avoid lengthy if statements
     # so each type must have a function here.
 
-    def ARMATURE(self, layout, ob, md):
-        layout.itemR(md, "object")
+    def ARMATURE(self, layout, ob, md, col2):
+        if col2:
+            layout.itemR(md, "object")
+        else:
+            layout.itemR(md, "object", text="")
 
-        split = layout.split(percentage=0.5)
-        split.itemL(text="Vertex Group:")
-        sub = split.split(percentage=0.7)
+        row = layout.row()
+        if col2:
+            row.itemL(text="Vertex Group:")
+        sub = row.split(percentage=0.7)
         sub.item_pointerR(md, "vertex_group", ob, "vertex_groups", text="")
         subsub = sub.row()
         subsub.active = md.vertex_group
-        subsub.itemR(md, "invert")
+        subsub.itemR(md, "invert", text="Inv")
 
         layout.itemS()
 
@@ -68,13 +75,19 @@
         col.itemR(md, "use_vertex_groups", text="Vertex Groups")
         col.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Deformation:")
         col.itemR(md, "quaternion")
         col.itemR(md, "multi_modifier")
 
-    def ARRAY(self, layout, ob, md):
-        layout.itemR(md, "fit_type")
+    def ARRAY(self, layout, ob, md, col2):
+        if col2:
+            layout.itemR(md, "fit_type")
+        else:
+            layout.itemR(md, "fit_type", text="")
+        
+        
         if md.fit_type == 'FIXED_COUNT':
             layout.itemR(md, "count")
         elif md.fit_type == 'FIT_LENGTH':
@@ -100,7 +113,8 @@
         sub.itemR(md, "merge_end_vertices", text="First Last")
         sub.itemR(md, "merge_distance", text="Distance")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemR(md, "relative_offset")
         sub = col.column()
         sub.active = md.relative_offset
@@ -119,11 +133,16 @@
         col.itemR(md, "start_cap")
         col.itemR(md, "end_cap")
 
-    def BEVEL(self, layout, ob, md):
-        row = layout.row()
-        row.itemR(md, "width")
-        row.itemR(md, "only_vertices")
+    def BEVEL(self, layout, ob, md, col2):
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(md, "width")
 
+        if col2:
+            col = split.column()
+        col.itemR(md, "only_vertices")
+
         layout.itemL(text="Limit Method:")
         layout.row().itemR(md, "limit_method", expand=True)
         if md.limit_method == 'ANGLE':
@@ -131,61 +150,76 @@
         elif md.limit_method == 'WEIGHT':
             layout.row().itemR(md, "edge_weight_method", expand=True)
 
-    def BOOLEAN(self, layout, ob, md):
+    def BOOLEAN(self, layout, ob, md, col2):
         layout.itemR(md, "operation")
         layout.itemR(md, "object")
 
-    def BUILD(self, layout, ob, md):
+    def BUILD(self, layout, ob, md, col2):
         split = layout.split()
 
         col = split.column()
         col.itemR(md, "start")
         col.itemR(md, "length")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemR(md, "randomize")
         sub = col.column()
         sub.active = md.randomize
         sub.itemR(md, "seed")
 
-    def CAST(self, layout, ob, md):
+    def CAST(self, layout, ob, md, col2):
         layout.itemR(md, "cast_type")
         layout.itemR(md, "object")
         if md.object:
             layout.itemR(md, "use_transform")
 
-        flow = layout.column_flow()
-        flow.itemR(md, "x")
-        flow.itemR(md, "y")
-        flow.itemR(md, "z")
-        flow.itemR(md, "factor")
-        flow.itemR(md, "radius")
-        flow.itemR(md, "size")
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(md, "x")
+        col.itemR(md, "y")
+        col.itemR(md, "z")
+        
+        if col2:
+            col = split.column()
+        col.itemR(md, "factor")
+        col.itemR(md, "radius")
+        col.itemR(md, "size")
 
         layout.itemR(md, "from_radius")
 
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
 
-    def CLOTH(self, layout, ob, md):
+    def CLOTH(self, layout, ob, md, col2):
         layout.itemL(text="See Cloth panel.")
 
-    def COLLISION(self, layout, ob, md):
+    def COLLISION(self, layout, ob, md, col2):
         layout.itemL(text="See Collision panel.")
 
-    def CURVE(self, layout, ob, md):
+    def CURVE(self, layout, ob, md, col2):
         layout.itemR(md, "object")
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
         layout.itemR(md, "deform_axis")
 
-    def DECIMATE(self, layout, ob, md):
+    def DECIMATE(self, layout, ob, md, col2):
         layout.itemR(md, "ratio")
         layout.itemR(md, "face_count")
 
-    def DISPLACE(self, layout, ob, md):
+    def DISPLACE(self, layout, ob, md, col2):
+        
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(md, "midlevel")
+        
+        if col2:
+            col = split.column()
+        col.itemR(md, "strength")
+        
+        layout.itemS()
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
         layout.itemR(md, "texture")
-        layout.itemR(md, "midlevel")
-        layout.itemR(md, "strength")
         layout.itemR(md, "direction")
         layout.itemR(md, "texture_coordinates")
         if md.texture_coordinates == 'OBJECT':
@@ -193,7 +227,7 @@
         elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
             layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
 
-    def EDGE_SPLIT(self, layout, ob, md):
+    def EDGE_SPLIT(self, layout, ob, md, col2):
         split = layout.split()
 
         col = split.column()
@@ -202,25 +236,31 @@
         sub.active = md.use_edge_angle
         sub.itemR(md, "split_angle")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemR(md, "use_sharp", text="Sharp Edges")
 
-    def EXPLODE(self, layout, ob, md):
+    def EXPLODE(self, layout, ob, md, col2):
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
         layout.itemR(md, "protect")
 
-        flow = layout.column_flow(2)
-        flow.itemR(md, "split_edges")
-        flow.itemR(md, "unborn")
-        flow.itemR(md, "alive")
-        flow.itemR(md, "dead")
+        split = layout.split()
 
+        col = split.column()
+        col.itemR(md, "split_edges")
+        col.itemR(md, "unborn")
+        
+        if col2:
+            col = split.column()
+        col.itemR(md, "alive")
+        col.itemR(md, "dead")
+
         layout.itemO("object.explode_refresh", text="Refresh")
 
-    def FLUID_SIMULATION(self, layout, ob, md):
+    def FLUID_SIMULATION(self, layout, ob, md, col2):
         layout.itemL(text="See Fluid panel.")
 
-    def HOOK(self, layout, ob, md):
+    def HOOK(self, layout, ob, md, col2):
         col = layout.column()
         col.itemR(md, "object")
         if md.object and md.object.type == 'ARMATURE':
@@ -229,25 +269,35 @@
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
 
         split = layout.split()
-        split.itemR(md, "falloff")
-        split.itemR(md, "force", slider=True)
 
+        col = split.column()
+        col.itemR(md, "falloff")
+        
+        if col2:
+            col = split.column()
+        col.itemR(md, "force", slider=True)
+
         layout.itemS()
 
-        row = layout.row()
-        row.itemO("object.hook_reset", text="Reset")
-        row.itemO("object.hook_recenter", text="Recenter")
+        split = layout.split()
 
+        col = split.column()
+        col.itemO("object.hook_reset", text="Reset")
+        
+        if col2:
+            col = split.column()
+        col.itemO("object.hook_recenter", text="Recenter")
+
         if ob.mode == 'EDIT':
             row = layout.row()
             row.itemO("object.hook_select", text="Select")
             row.itemO("object.hook_assign", text="Assign")
 
-    def LATTICE(self, layout, ob, md):
+    def LATTICE(self, layout, ob, md, col2):
         layout.itemR(md, "object")
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
 
-    def MASK(self, layout, ob, md):
+    def MASK(self, layout, ob, md, col2):
         layout.itemR(md, "mode")
         if md.mode == 'ARMATURE':
             layout.itemR(md, "armature")
@@ -255,7 +305,7 @@
             layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
         layout.itemR(md, "inverse")
 
-    def MESH_DEFORM(self, layout, ob, md):
+    def MESH_DEFORM(self, layout, ob, md, col2):
         layout.itemR(md, "object")
         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
         layout.itemR(md, "invert")
@@ -266,12 +316,17 @@
             layout.itemO("object.meshdeform_bind", text="Unbind")
         else:
             layout.itemO("object.meshdeform_bind", text="Bind")
-            row = layout.row()
-            row.itemR(md, "precision")
-            row.itemR(md, "dynamic")
+            split = layout.split()
 
-    def MIRROR(self, layout, ob, md):
-        layout.itemR(md, "merge_limit")
+            col = split.column()
+            col.itemR(md, "precision")
+            
+            if col2:
+                col = split.column()

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list