*More single column stuff.
authorWilliam Reynish <william@reynish.com>
Sat, 14 Nov 2009 23:24:15 +0000 (23:24 +0000)
committerWilliam Reynish <william@reynish.com>
Sat, 14 Nov 2009 23:24:15 +0000 (23:24 +0000)
*Fixed and changed minor layout issues in curve and game properties
*Merged Curve and Text properties py file as they share a lot of options.

release/scripts/ui/properties_data_camera.py
release/scripts/ui/properties_data_curve.py
release/scripts/ui/properties_data_lamp.py
release/scripts/ui/properties_data_lattice.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_data_metaball.py
release/scripts/ui/properties_data_text.py [deleted file]
release/scripts/ui/properties_game.py
release/scripts/ui/properties_material.py

index e3db1e6af4167d6e9fea15bd26014e6da4e21dc1..5dafe57532cbeb45d132b619e1d95f1b1f219a34 100644 (file)
@@ -45,7 +45,6 @@ class DATA_PT_context_camera(DataButtonsPanel):
 
         if col2:
             split = layout.split(percentage=0.65)
-
             if ob:
                 split.template_ID(ob, "data")
                 split.itemS()
@@ -53,7 +52,10 @@ class DATA_PT_context_camera(DataButtonsPanel):
                 split.template_ID(space, "pin_id")
                 split.itemS()
         else:
-            layout.template_ID(ob, "data")
+            if ob:
+                layout.template_ID(ob, "data")
+            elif cam:
+                layout.template_ID(space, "pin_id")
 
 
 class DATA_PT_camera(DataButtonsPanel):
index a7fb6a615d49697b6cb1dd648adc5b65bc50c18d..87efa20dc8c6e87db29fd9fe7d6ee651a84660ba 100644 (file)
@@ -28,7 +28,7 @@ class DataButtonsPanel(bpy.types.Panel):
     bl_context = "data"
 
     def poll(self, context):
-        return (context.object and context.object.type in ('CURVE', 'SURFACE') and context.curve)
+        return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
 
 
 class DataButtonsPanelCurve(DataButtonsPanel):
@@ -82,48 +82,47 @@ class DATA_PT_shape_curve(DataButtonsPanel):
         curve = context.curve
         col2 = context.region.width > narrowui
         is_surf = (ob.type == 'SURFACE')
+        is_curve = (ob.type == 'CURVE')
+        is_text = (ob.type == 'TEXT')
 
-        if not is_surf:
+        if is_curve:
             row = layout.row()
             row.itemR(curve, "dimensions", expand=True)
 
         split = layout.split()
 
         col = split.column()
-
-        if not is_surf:
-            sub = col.column()
-            sub.active = (curve.dimensions == '2D')
-            sub.itemL(text="Caps:")
-            row = sub.row()
-            row.itemR(curve, "front")
-            row.itemR(curve, "back")
-
-        col.itemL(text="Textures:")
-#              col.itemR(curve, "uv_orco")
-        col.itemR(curve, "auto_texspace")
-
-        if col2:
-            col = split.column()
         col.itemL(text="Resolution:")
         sub = col.column(align=True)
         sub.itemR(curve, "resolution_u", text="Preview U")
         sub.itemR(curve, "render_resolution_u", text="Render U")
-
+        if is_curve:
+            col.itemL(text="Twisting:")
+            col.itemR(curve, "twist_mode", text="")
+            col.itemR(curve, "twist_smooth", text="Smooth")
+        if is_text:
+            col.itemL(text="Display:")
+            col.itemR(curve, "fast", text="Fast Editing")
+        
+        if col2:
+            col = split.column()
+        
         if is_surf:
             sub = col.column(align=True)
+            sub.itemL(text="")
             sub.itemR(curve, "resolution_v", text="Preview V")
             sub.itemR(curve, "render_resolution_v", text="Render V")
+        
+        if is_curve or is_text:
+            sub = col.column()
+            sub.active = (curve.dimensions == '2D')
+            sub.itemL(text="Caps:")
+            sub.itemR(curve, "front")
+            sub.itemR(curve, "back")
 
-        # XXX - put somewhere nicer.
-        split = layout.split()
-
-        col = split.column()
-        col.itemR(curve, "twist_mode", text="Twist")
-
-        if col2:
-            col = split.column()
-        col.itemR(curve, "twist_smooth") # XXX - may not be kept
+        col.itemL(text="Textures:")
+#              col.itemR(curve, "uv_orco")
+        col.itemR(curve, "auto_texspace")
 
 
 class DATA_PT_geometry_curve(DataButtonsPanel):
@@ -173,11 +172,18 @@ class DATA_PT_pathanim(DataButtonsPanelCurve):
 
         col = split.column()
         col.itemR(curve, "path_length", text="Frames")
+        if col2:
+            col = split.column()
+        
+        split = layout.split()
+
+        col = split.column()
         col.itemR(curve, "use_path_follow")
+        col.itemR(curve, "use_stretch")
 
         if col2:
             col = split.column()
-        col.itemR(curve, "use_stretch")
+        
         col.itemR(curve, "use_radius")
         col.itemR(curve, "use_time_offset", text="Offset Children")
 
@@ -255,8 +261,122 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
             col = split.column()
             col.itemR(act_spline, "smooth")
 
+class DATA_PT_font(DataButtonsPanel):
+    bl_label = "Font"
+    
+    def poll(self, context):
+        return (context.object and context.object.type == 'TEXT' and context.curve)
+
+    def draw(self, context):
+        layout = self.layout
+
+        text = context.curve
+        char = context.curve.edit_format
+        col2 = context.region.width > narrowui
+
+        if col2:
+            layout.itemR(text, "font")
+        else:
+            layout.itemR(text, "font", text="")
+
+        split = layout.split()
+
+        col = split.column()
+        col.itemR(text, "text_size", text="Size")
+        if col2:
+            col = split.column()
+        col.itemR(text, "shear")
+
+        split = layout.split()
+
+        col = split.column()
+        col.itemL(text="Object Font:")
+        col.itemR(text, "family", text="")
+
+        if col2:
+            col = split.column()
+        col.itemL(text="Text on Curve:")
+        col.itemR(text, "text_on_curve", text="")
+
+        split = layout.split()
+        
+        col = split.column(align=True)
+        col.itemL(text="Underline:")
+        col.itemR(text, "ul_position", text="Position")
+        col.itemR(text, "ul_height", text="Thickness")
+        
+        if col2:
+            col = split.column()
+        col.itemL(text="Character:")
+        col.itemR(char, "bold")
+        col.itemR(char, "italic")
+        col.itemR(char, "underline")
+#              col.itemR(char, "style")
+#              col.itemR(char, "wrap")
+
+
+class DATA_PT_paragraph(DataButtonsPanel):
+    bl_label = "Paragraph"
+    def poll(self, context):
+        return (context.object and context.object.type == 'TEXT' and context.curve)
+
+    def draw(self, context):
+        layout = self.layout
+
+        text = context.curve
+        col2 = context.region.width > narrowui
+        
+        layout.itemL(text="Align:")
+        if col2:
+            layout.itemR(text, "spacemode", expand=True)
+        else:
+            layout.itemR(text, "spacemode", text="")
+
+        split = layout.split()
+
+        col = split.column(align=True)
+        col.itemL(text="Spacing:")
+        col.itemR(text, "spacing", text="Character")
+        col.itemR(text, "word_spacing", text="Word")
+        col.itemR(text, "line_dist", text="Line")
+
+        if col2:
+            col = split.column(align=True)
+        col.itemL(text="Offset:")
+        col.itemR(text, "offset_x", text="X")
+        col.itemR(text, "offset_y", text="Y")
+
+
+class DATA_PT_textboxes(DataButtonsPanel):
+    bl_label = "Text Boxes"
+    def poll(self, context):
+        return (context.object and context.object.type == 'TEXT' and context.curve)
+        
+    def draw(self, context):
+        layout = self.layout
+
+        text = context.curve
+        col2 = context.region.width > narrowui
+
+        for box in text.textboxes:
+            split = layout.box().split()
+
+            col = split.column(align=True)
+            col.itemL(text="Dimensions:")
+            col.itemR(box, "width", text="Width")
+            col.itemR(box, "height", text="Height")
+
+            if col2:
+                col = split.column(align=True)
+            col.itemL(text="Offset:")
+            col.itemR(box, "x", text="X")
+            col.itemR(box, "y", text="Y")
+
 bpy.types.register(DATA_PT_context_curve)
 bpy.types.register(DATA_PT_shape_curve)
 bpy.types.register(DATA_PT_geometry_curve)
 bpy.types.register(DATA_PT_pathanim)
 bpy.types.register(DATA_PT_active_spline)
+bpy.types.register(DATA_PT_font)
+bpy.types.register(DATA_PT_paragraph)
+bpy.types.register(DATA_PT_textboxes)
index bb1bb4ca146ba3dc4f2772a3c07be1c40f50da27..b7ddf227dae0afa81248f1a5144655cd6a2694f7 100644 (file)
@@ -60,7 +60,10 @@ class DATA_PT_context_lamp(DataButtonsPanel):
                 split.template_ID(space, "pin_id")
                 split.itemS()
         else:
-            layout.template_ID(ob, "data")
+            if ob:
+                layout.template_ID(ob, "data")
+            elif lamp:
+                layout.template_ID(space, "pin_id")
 
 
 class DATA_PT_lamp(DataButtonsPanel):
index 3a18a09670af20505e5aff4f35fd56443275d225..20b239248303a0218ee11213b6e72bffadf6067f 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class DataButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -39,15 +40,21 @@ class DATA_PT_context_lattice(DataButtonsPanel):
         ob = context.object
         lat = context.lattice
         space = context.space_data
-
-        split = layout.split(percentage=0.65)
-
-        if ob:
-            split.template_ID(ob, "data")
-            split.itemS()
-        elif lat:
-            split.template_ID(space, "pin_id")
-            split.itemS()
+        col2 = context.region.width > narrowui
+
+        if col2:
+            split = layout.split(percentage=0.65)
+            if ob:
+                split.template_ID(ob, "data")
+                split.itemS()
+            elif lat:
+                split.template_ID(space, "pin_id")
+                split.itemS()
+        else:
+            if ob:
+                layout.template_ID(ob, "data")
+            elif lat:
+                layout.template_ID(space, "pin_id")
 
 
 class DATA_PT_lattice(DataButtonsPanel):
@@ -57,21 +64,30 @@ class DATA_PT_lattice(DataButtonsPanel):
         layout = self.layout
 
         lat = context.lattice
+        col2 = context.region.width > narrowui
+
+        split = layout.split()
+        col = split.column()
+        col.itemR(lat, "points_u")
+        if col2:
+            col = split.column()
+        col.itemR(lat, "interpolation_type_u", text="")
+        
+        split = layout.split()
+        col = split.column()
+        col.itemR(lat, "points_v")
+        if col2:
+            col = split.column()
+        col.itemR(lat, "interpolation_type_v", text="")
+        
+        split = layout.split()
+        col = split.column()
+        col.itemR(lat, "points_w")
+        if col2:
+            col = split.column()
+        col.itemR(lat, "interpolation_type_w", text="")
 
         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_w")
-        row.itemR(lat, "interpolation_type_w", expand=True)
-
-        row = layout.row()
-        row.itemO("lattice.make_regular")
         row.itemR(lat, "outside")
 
 bpy.types.register(DATA_PT_context_lattice)
index 74fce28961245e5a0cb1fe0e90eddb9f3baf7215..a3b835dc2515b33d60b791df18a1a8d62725c1e5 100644 (file)
@@ -41,15 +41,21 @@ class DATA_PT_context_mesh(DataButtonsPanel):
         ob = context.object
         mesh = context.mesh
         space = context.space_data
+        col2 = context.region.width > narrowui
 
-        split = layout.split(percentage=0.65)
-
-        if ob:
-            split.template_ID(ob, "data")
-            split.itemS()
-        elif mesh:
-            split.template_ID(space, "pin_id")
-            split.itemS()
+        if col2:
+            split = layout.split(percentage=0.65)
+            if ob:
+                split.template_ID(ob, "data")
+                split.itemS()
+            elif mesh:
+                split.template_ID(space, "pin_id")
+                split.itemS()
+        else:
+            if ob:
+                layout.template_ID(ob, "data")
+            elif mesh:
+                layout.template_ID(space, "pin_id")
 
 
 class DATA_PT_normals(DataButtonsPanel):
index 45330acd8e4de94ce9345c8d806742fd2113a2dd..cb24e99ca2261aa8d75272995b3f38a6c8f9f1a1 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class DataButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -39,15 +40,21 @@ class DATA_PT_context_metaball(DataButtonsPanel):
         ob = context.object
         mball = context.meta_ball
         space = context.space_data
-
-        split = layout.split(percentage=0.65)
-
-        if ob:
-            split.template_ID(ob, "data")
-            split.itemS()
-        elif mball:
-            split.template_ID(space, "pin_id")
-            split.itemS()
+        col2 = context.region.width > narrowui
+
+        if col2:
+            split = layout.split(percentage=0.65)
+            if ob:
+                split.template_ID(ob, "data")
+                split.itemS()
+            elif mball:
+                split.template_ID(space, "pin_id")
+                split.itemS()
+        else:
+            if ob:
+                layout.template_ID(ob, "data")
+            elif mball:
+                layout.template_ID(space, "pin_id")
 
 
 class DATA_PT_metaball(DataButtonsPanel):
@@ -57,6 +64,7 @@ class DATA_PT_metaball(DataButtonsPanel):
         layout = self.layout
 
         mball = context.meta_ball
+        col2 = context.region.width > narrowui
 
         split = layout.split()
 
@@ -66,12 +74,16 @@ class DATA_PT_metaball(DataButtonsPanel):
         sub.itemR(mball, "wire_size", text="View")
         sub.itemR(mball, "render_size", text="Render")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Settings:")
         col.itemR(mball, "threshold", text="Threshold")
 
         layout.itemL(text="Update:")
-        layout.itemR(mball, "flag", expand=True)
+        if col2:
+            layout.itemR(mball, "flag", expand=True)
+        else:
+            layout.itemR(mball, "flag", text="")
 
 
 class DATA_PT_metaball_element(DataButtonsPanel):
@@ -84,42 +96,40 @@ class DATA_PT_metaball_element(DataButtonsPanel):
         layout = self.layout
 
         metaelem = context.meta_ball.active_element
+        col2 = context.region.width > narrowui
 
-        split = layout.split(percentage=0.3)
-        split.itemL(text="Type:")
-        split.itemR(metaelem, "type", text="")
+        if col2:
+            layout.itemR(metaelem, "type")
+        else:
+            layout.itemR(metaelem, "type", text="")
 
         split = layout.split()
 
-        col = split.column()
+        col = split.column(align=True)
         col.itemL(text="Settings:")
         col.itemR(metaelem, "stiffness", text="Stiffness")
         col.itemR(metaelem, "negative", text="Negative")
         col.itemR(metaelem, "hide", text="Hide")
-
-        if metaelem.type == 'BALL':
+        
+        if col2:
             col = split.column(align=True)
 
-        elif metaelem.type == 'CUBE':
-            col = split.column(align=True)
+        if metaelem.type == 'CUBE':
             col.itemL(text="Size:")
             col.itemR(metaelem, "size_x", text="X")
             col.itemR(metaelem, "size_y", text="Y")
             col.itemR(metaelem, "size_z", text="Z")
 
         elif metaelem.type == 'TUBE':
-            col = split.column(align=True)
             col.itemL(text="Size:")
             col.itemR(metaelem, "size_x", text="X")
 
         elif metaelem.type == 'PLANE':
-            col = split.column(align=True)
             col.itemL(text="Size:")
             col.itemR(metaelem, "size_x", text="X")
             col.itemR(metaelem, "size_y", text="Y")
 
         elif metaelem.type == 'ELLIPSOID':
-            col = split.column(align=True)
             col.itemL(text="Size:")
             col.itemR(metaelem, "size_x", text="X")
             col.itemR(metaelem, "size_y", text="Y")
diff --git a/release/scripts/ui/properties_data_text.py b/release/scripts/ui/properties_data_text.py
deleted file mode 100644 (file)
index 0aee130..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-import bpy
-
-
-class DataButtonsPanel(bpy.types.Panel):
-    bl_space_type = 'PROPERTIES'
-    bl_region_type = 'WINDOW'
-    bl_context = "data"
-
-    def poll(self, context):
-        return (context.object and context.object.type == 'TEXT' and context.curve)
-
-
-class DATA_PT_context_text(DataButtonsPanel):
-    bl_label = ""
-    bl_show_header = False
-
-    def draw(self, context):
-        layout = self.layout
-
-        ob = context.object
-        curve = context.curve
-        space = context.space_data
-
-        split = layout.split(percentage=0.65)
-
-        if ob:
-            split.template_ID(ob, "data")
-            split.itemS()
-        elif curve:
-            split.template_ID(space, "pin_id")
-            split.itemS()
-
-
-class DATA_PT_shape_text(DataButtonsPanel):
-    bl_label = "Shape Text"
-
-    def draw(self, context):
-        layout = self.layout
-
-        curve = context.curve
-
-        split = layout.split()
-
-        col = split.column()
-        col.itemL(text="Caps:")
-        row = col.row()
-        row .itemR(curve, "front")
-        row .itemR(curve, "back")
-        # col = split.column()
-        col.itemL(text="Textures:")
-        col.itemR(curve, "uv_orco")
-        col.itemR(curve, "auto_texspace")
-
-        col = split.column()
-        col.itemL(text="Resolution:")
-        sub = col.column(align=True)
-        sub.itemR(curve, "resolution_u", text="Preview")
-        sub.itemR(curve, "render_resolution_u", text="Render")
-
-        # resolution_v is not used for text
-
-        sub = col.column(align=True)
-        col.itemL(text="Display:")
-        col.itemR(curve, "fast", text="Fast Editing")
-
-
-class DATA_PT_geometry_text(DataButtonsPanel):
-    bl_label = "Geometry"
-
-    def draw(self, context):
-        layout = self.layout
-
-        curve = context.curve
-
-        split = layout.split()
-
-        col = split.column()
-        col.itemL(text="Modification:")
-        col.itemR(curve, "width")
-        col.itemR(curve, "extrude")
-        col.itemL(text="Taper Object:")
-        col.itemR(curve, "taper_object", text="")
-
-        col = split.column()
-        col.itemL(text="Bevel:")
-        col.itemR(curve, "bevel_depth", text="Depth")
-        col.itemR(curve, "bevel_resolution", text="Resolution")
-        col.itemL(text="Bevel Object:")
-        col.itemR(curve, "bevel_object", text="")
-
-
-class DATA_PT_font(DataButtonsPanel):
-    bl_label = "Font"
-
-    def draw(self, context):
-        layout = self.layout
-
-        text = context.curve
-        char = context.curve.edit_format
-
-        layout.itemR(text, "font")
-
-        row = layout.row()
-        row.itemR(text, "text_size", text="Size")
-        row.itemR(text, "shear")
-
-        split = layout.split()
-
-        col = split.column()
-        col.itemL(text="Object Font:")
-        col.itemR(text, "family", text="")
-
-        col = split.column()
-        col.itemL(text="Text on Curve:")
-        col.itemR(text, "text_on_curve", text="")
-
-        split = layout.split()
-
-        col = split.column()
-        col.itemL(text="Character:")
-        col.itemR(char, "bold")
-        col.itemR(char, "italic")
-        col.itemR(char, "underline")
-#              col.itemR(char, "style")
-#              col.itemR(char, "wrap")
-
-        col = split.column(align=True)
-        col.itemL(text="Underline:")
-        col.itemR(text, "ul_position", text="Position")
-        col.itemR(text, "ul_height", text="Thickness")
-
-
-class DATA_PT_paragraph(DataButtonsPanel):
-    bl_label = "Paragraph"
-
-    def draw(self, context):
-        layout = self.layout
-
-        text = context.curve
-
-        layout.itemL(text="Align:")
-        layout.itemR(text, "spacemode", expand=True)
-
-        split = layout.split()
-
-        col = split.column(align=True)
-        col.itemL(text="Spacing:")
-        col.itemR(text, "spacing", text="Character")
-        col.itemR(text, "word_spacing", text="Word")
-        col.itemR(text, "line_dist", text="Line")
-
-        col = split.column(align=True)
-        col.itemL(text="Offset:")
-        col.itemR(text, "offset_x", text="X")
-        col.itemR(text, "offset_y", text="Y")
-
-
-class DATA_PT_textboxes(DataButtonsPanel):
-    bl_label = "Text Boxes"
-
-    def draw(self, context):
-        layout = self.layout
-
-        text = context.curve
-
-        for box in text.textboxes:
-            split = layout.box().split()
-
-            col = split.column(align=True)
-            col.itemL(text="Dimensions:")
-            col.itemR(box, "width", text="Width")
-            col.itemR(box, "height", text="Height")
-
-            col = split.column(align=True)
-            col.itemL(text="Offset:")
-            col.itemR(box, "x", text="X")
-            col.itemR(box, "y", text="Y")
-
-bpy.types.register(DATA_PT_context_text)
-bpy.types.register(DATA_PT_shape_text)
-bpy.types.register(DATA_PT_geometry_text)
-bpy.types.register(DATA_PT_font)
-bpy.types.register(DATA_PT_paragraph)
-bpy.types.register(DATA_PT_textboxes)
index b445585507da0fabd9efe09089294ff8e61e7551..10d4c604d17f8c988e758c31c12acfa5fb4b69f7 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class PhysicsButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -40,8 +41,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
         ob = context.active_object
         game = ob.game
         soft = ob.game.soft_body
+        col2 = context.region.width > narrowui
 
-        layout.itemR(game, "physics_type")
+        if col2:
+            layout.itemR(game, "physics_type")
+        else:
+            layout.itemR(game, "physics_type", text="")
         layout.itemS()
 
         #if game.physics_type == 'DYNAMIC':
@@ -53,7 +58,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
             col.itemR(game, "ghost")
             col.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
 
-            col = split.column()
+            if col2:
+                col = split.column()
             col.itemR(game, "material_physics")
             col.itemR(game, "rotate_from_normal")
             col.itemR(game, "no_sleeping")
@@ -68,7 +74,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
             col.itemR(game, "radius")
             col.itemR(game, "form_factor")
 
-            col = split.column()
+            if col2:
+                col = split.column()
             sub = col.column()
             sub.active = (game.physics_type == 'RIGID_BODY')
             sub.itemR(game, "anisotropic_friction")
@@ -84,7 +91,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
             sub.itemR(game, "minimum_velocity", text="Minimum")
             sub.itemR(game, "maximum_velocity", text="Maximum")
 
-            col = split.column()
+            if col2:
+                col = split.column()
             col.itemL(text="Damping:")
             sub = col.column(align=True)
             sub.itemR(game, "damping", text="Translation", slider=True)
@@ -126,7 +134,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
             col.itemR(soft, "margin", slider=True)
             col.itemR(soft, "bending_const", text="Bending Constraints")
 
-            col = split.column()
+            if col2:
+                col = split.column()
             col.itemR(soft, "shape_match")
             sub = col.column()
             sub.active = soft.shape_match
@@ -168,13 +177,23 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
         layout = self.layout
 
         game = context.active_object.game
+        col2 = context.region.width > narrowui
 
         layout.active = game.use_collision_bounds
-        layout.itemR(game, "collision_bounds", text="Bounds")
+        if col2:
+            layout.itemR(game, "collision_bounds", text="Bounds")
+        else:
+            layout.itemR(game, "collision_bounds", text="")
 
-        row = layout.row()
-        row.itemR(game, "collision_compound", text="Compound")
-        row.itemR(game, "collision_margin", text="Margin", slider=True)
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(game, "collision_margin", text="Margin", slider=True)
+        
+        if col2:
+            col = split.column()
+        col.itemR(game, "collision_compound", text="Compound")
+        
 
 bpy.types.register(PHYSICS_PT_game_physics)
 bpy.types.register(PHYSICS_PT_game_collision_bounds)
@@ -208,6 +227,7 @@ class RENDER_PT_game_player(RenderButtonsPanel):
         layout = self.layout
 
         gs = context.scene.game_data
+        col2 = context.region.width > narrowui
 
         layout.itemR(gs, "fullscreen")
 
@@ -219,7 +239,8 @@ class RENDER_PT_game_player(RenderButtonsPanel):
         sub.itemR(gs, "resolution_x", slider=False, text="X")
         sub.itemR(gs, "resolution_y", slider=False, text="Y")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Quality:")
         sub = col.column(align=True)
         sub.itemR(gs, "depth", text="Bit Depth", slider=False)
@@ -228,7 +249,10 @@ class RENDER_PT_game_player(RenderButtonsPanel):
         # framing:
         col = layout.column()
         col.itemL(text="Framing:")
-        col.row().itemR(gs, "framing_type", expand=True)
+        if col2:
+            col.row().itemR(gs, "framing_type", expand=True)
+        else:
+            col.itemR(gs, "framing_type", text="")
         if gs.framing_type == 'LETTERBOX':
             col.itemR(gs, "framing_color", text="")
 
@@ -241,6 +265,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
 
         gs = context.scene.game_data
         stereo_mode = gs.stereo
+        col2 = context.region.width > narrowui
 
         # stereo options:
         layout.itemR(gs, "stereo", expand=True)
@@ -253,7 +278,10 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
 
         # dome:
         elif stereo_mode == 'DOME':
-            layout.itemR(gs, "dome_mode", text="Dome Type")
+            if col2:
+                layout.itemR(gs, "dome_mode", text="Dome Type")
+            else:
+                layout.itemR(gs, "dome_mode", text="")
 
             dome_type = gs.dome_mode
 
@@ -264,21 +292,27 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
                dome_type == 'TRUNCATED_FRONT':
 
                 col = split.column()
+                col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
                 col.itemR(gs, "dome_angle", slider=True)
-                col.itemR(gs, "dome_tilt")
 
-                col = split.column()
+                if col2:
+                    col = split.column()
                 col.itemR(gs, "dome_tesselation", text="Tesselation")
-                col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+                col.itemR(gs, "dome_tilt")
 
             elif dome_type == 'PANORAM_SPH':
                 col = split.column()
-                col.itemR(gs, "dome_tesselation", text="Tesselation")
+                
                 col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+                if col2:
+                    col = split.column()
+                col.itemR(gs, "dome_tesselation", text="Tesselation")
 
             else: # cube map
                 col = split.column()
                 col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+                if col2:
+                    col = split.column()
 
             layout.itemR(gs, "dome_text")
 
@@ -290,7 +324,12 @@ class RENDER_PT_game_shading(RenderButtonsPanel):
         layout = self.layout
 
         gs = context.scene.game_data
-        layout.itemR(gs, "material_mode", expand=True)
+        col2 = context.region.width > narrowui
+        
+        if col2:
+            layout.itemR(gs, "material_mode", expand=True)
+        else:
+            layout.itemR(gs, "material_mode", text="")
 
         if gs.material_mode == 'GLSL':
             split = layout.split()
@@ -313,7 +352,8 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
         layout = self.layout
 
         gs = context.scene.game_data
-
+        col2 = context.region.width > narrowui
+        
         split = layout.split()
 
         col = split.column()
@@ -323,7 +363,8 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
         col.itemR(gs, "show_physics_visualization", text="Physics Visualization")
         col.itemR(gs, "deprecation_warnings")
 
-        col = split.column()
+        if col2:
+            col = split.column()
         col.itemL(text="Render:")
         col.itemR(gs, "all_frames")
         col.itemR(gs, "display_lists")
@@ -336,8 +377,12 @@ class RENDER_PT_game_sound(RenderButtonsPanel):
         layout = self.layout
 
         scene = context.scene
+        col2 = context.region.width > narrowui
 
-        layout.itemR(scene, "distance_model")
+        if col2:
+            layout.itemR(scene, "distance_model")
+        else:
+            layout.itemR(scene, "distance_model", text="")
         layout.itemR(scene, "speed_of_sound", text="Speed")
         layout.itemR(scene, "doppler_factor")
 
@@ -373,14 +418,19 @@ class WORLD_PT_game_context_world(WorldButtonsPanel):
         scene = context.scene
         world = context.world
         space = context.space_data
-
-        split = layout.split(percentage=0.65)
-
-        if scene:
-            split.template_ID(scene, "world", new="world.new")
-        elif world:
-            split.template_ID(space, "pin_id")
-
+        col2 = context.region.width > narrowui
+
+        if col2:
+            split = layout.split(percentage=0.65)
+            if scene:
+                split.template_ID(scene, "world", new="world.new")
+            elif world:
+                split.template_ID(space, "pin_id")
+        else:   
+            if scene:
+                layout.template_ID(scene, "world", new="world.new")
+            elif world:
+                layout.template_ID(space, "pin_id")
 
 class WORLD_PT_game_world(WorldButtonsPanel):
     bl_label = "World"
@@ -389,18 +439,40 @@ class WORLD_PT_game_world(WorldButtonsPanel):
         layout = self.layout
 
         world = context.world
+        col2 = context.region.width > narrowui
 
-        row = layout.row()
-        row.column().itemR(world, "horizon_color")
-        row.column().itemR(world, "ambient_color")
-
-        layout.itemR(world.mist, "enabled", text="Mist")
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(world, "horizon_color")
+        
+        if col2:
+            col = split.column()
+        col.itemR(world, "ambient_color")
 
-        row = layout.column_flow()
-        row.active = world.mist.enabled
-        row.itemR(world.mist, "start")
-        row.itemR(world.mist, "depth")
+class WORLD_PT_game_mist(WorldButtonsPanel):
+    bl_label = "Mist"
+    
+    def draw_header(self, context):
+        world = context.world
+        
+        self.layout.itemR(world.mist, "enabled", text="")
+    
+    def draw(self, context):
+        layout = self.layout
 
+        world = context.world
+        col2 = context.region.width > narrowui
+        
+        layout.active = world.mist.enabled
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(world.mist, "start")
+        
+        if col2:
+            col = split.column()
+        col.itemR(world.mist, "depth")
 
 class WORLD_PT_game_physics(WorldButtonsPanel):
     bl_label = "Physics"
@@ -409,6 +481,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
         layout = self.layout
 
         gs = context.scene.game_data
+        col2 = context.region.width > narrowui
 
         layout.itemR(gs, "physics_engine")
         if gs.physics_engine != 'NONE':
@@ -423,7 +496,8 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
             sub.itemR(gs, "physics_step_sub", text="Substeps")
             col.itemR(gs, "fps", text="FPS")
 
-            col = split.column()
+            if col2:
+                col = split.column()
             col.itemL(text="Logic Steps:")
             col.itemR(gs, "logic_step_max", text="Max")
 
@@ -446,4 +520,5 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
 
 bpy.types.register(WORLD_PT_game_context_world)
 bpy.types.register(WORLD_PT_game_world)
-bpy.types.register(WORLD_PT_game_physics)
+bpy.types.register(WORLD_PT_game_mist)
+bpy.types.register(WORLD_PT_game_physics)
\ No newline at end of file
index 8a9a40f2b12f090badccbef59221d49504caa92b..e0f5d94a863a3b1bfea6fb20e217420a5197c5ed 100644 (file)
@@ -106,7 +106,10 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
                 split.template_ID(space, "pin_id")
                 split.itemS()
         else:
-            layout.template_ID(ob, "active_material", new="material.new")
+            if ob:
+                layout.template_ID(ob, "active_material", new="material.new")
+            elif mat:
+                layout.template_ID(space, "pin_id")
 
         if mat:
             if col2: