Added single column UI layouts
authorWilliam Reynish <william@reynish.com>
Thu, 12 Nov 2009 12:35:37 +0000 (12:35 +0000)
committerWilliam Reynish <william@reynish.com>
Thu, 12 Nov 2009 12:35:37 +0000 (12:35 +0000)
This changes the layout when the properties window gets too narrow to render the contents properly.

Currently implemented for render, scene, world, object and materials, but the rest can be done easily.
Here's a video for demonstration:

http://www.reynish.com/files/blender25/properties_resize.mov

It automatically detects the window width and then skips the indicators that tells the layout to go to the next column. It requires very minimal changes to the UI scripts so we don't have to maintain two versions of the layouts.

release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_scene.py
release/scripts/ui/properties_world.py
source/blender/makesrna/intern/rna_userdef.c

index 67d9cea09345ebf3acf8074b332209a80ef7bec8..61ce917180f77dd4a40d031798530b09a24d385a 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 def active_node_mat(mat):
     # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
@@ -89,22 +90,28 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
                 row.itemO("object.material_slot_select", text="Select")
                 row.itemO("object.material_slot_deselect", text="Deselect")
 
-        split = layout.split(percentage=0.65)
-
-        if ob:
-            split.template_ID(ob, "active_material", new="material.new")
-            row = split.row()
-            if slot:
-                row.itemR(slot, "link", text="")
-            else:
-                row.itemL()
-        elif mat:
-            split.template_ID(space, "pin_id")
-            split.itemS()
+        if (context.region.width > narrowui):
+            split = layout.split(percentage=0.65)
+    
+            if ob:
+                split.template_ID(ob, "active_material", new="material.new")
+                row = split.row()
+                if slot:
+                    row.itemR(slot, "link", text="")
+                else:
+                    row.itemL()
+            elif mat:
+                split.template_ID(space, "pin_id")
+                split.itemS()
+        else:
+            layout.template_ID(ob, "active_material", new="material.new")
 
         if mat:
-            layout.itemR(mat, "type", expand=True)
-
+            if (context.region.width > narrowui):
+                layout.itemR(mat, "type", expand=True)
+            else:
+                layout.itemR(mat, "type", text="")
+                
 
 class MATERIAL_PT_shading(MaterialButtonsPanel):
     bl_label = "Shading"
@@ -131,7 +138,8 @@ class MATERIAL_PT_shading(MaterialButtonsPanel):
             sub = col.column()
             sub.itemR(mat, "translucency")
 
-            col = split.column()
+            if (context.region.width > narrowui):
+                col = split.column()
             col.itemR(mat, "shadeless")
             sub = col.column()
             sub.active = not mat.shadeless
@@ -160,18 +168,20 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
 
         split = layout.split()
 
-        col = split.column(align=True)
-        col.itemL(text="Size:")
-        col.itemR(tan, "root_size", text="Root")
-        col.itemR(tan, "tip_size", text="Tip")
-        col.itemR(tan, "min_size", text="Minimum")
-        col.itemR(tan, "blender_units")
+        col = split.column()
+        sub = col.column(align=True)
+        sub.itemL(text="Size:")
+        sub.itemR(tan, "root_size", text="Root")
+        sub.itemR(tan, "tip_size", text="Tip")
+        sub.itemR(tan, "min_size", text="Minimum")
+        sub.itemR(tan, "blender_units")
         sub = col.column()
         sub.active = (not mat.shadeless)
         sub.itemR(tan, "tangent_shading")
         col.itemR(tan, "shape")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL(text="Shading:")
         col.itemR(tan, "width_fade")
         ob = context.object
@@ -204,7 +214,8 @@ class MATERIAL_PT_physics(MaterialButtonsPanel):
         col.itemR(phys, "friction")
         col.itemR(phys, "align_to_normal")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(phys, "force", slider=True)
         col.itemR(phys, "elasticity", slider=True)
         col.itemR(phys, "damp", slider=True)
@@ -242,7 +253,8 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
         row.active = mat.light_group
         row.itemR(mat, "light_group_exclusive", text="Exclusive")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(mat, "face_texture")
         sub = col.column()
         sub.active = mat.face_texture
@@ -277,7 +289,8 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
         col.itemR(mat, "cast_shadows_only", text="Cast Only")
         col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(mat, "cast_buffer_shadows")
         sub = col.column()
         sub.active = mat.cast_buffer_shadows
@@ -310,7 +323,8 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
         sub.active = (not mat.shadeless)
         sub.itemR(mat, "diffuse_intensity", text="Intensity")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.active = (not mat.shadeless)
         col.itemR(mat, "diffuse_shader", text="")
         col.itemR(mat, "use_diffuse_ramp", text="Ramp")
@@ -322,25 +336,37 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
         elif mat.diffuse_shader == 'MINNAERT':
             col.itemR(mat, "darkness")
         elif mat.diffuse_shader == 'TOON':
-            row = col.row()
-            row.itemR(mat, "diffuse_toon_size", text="Size")
-            row.itemR(mat, "diffuse_toon_smooth", text="Smooth")
+            split = col.split()
+            
+            col = split.column()
+            col.itemR(mat, "diffuse_toon_size", text="Size")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(mat, "diffuse_toon_smooth", text="Smooth")
         elif mat.diffuse_shader == 'FRESNEL':
-            row = col.row()
-            row.itemR(mat, "diffuse_fresnel", text="Fresnel")
-            row.itemR(mat, "diffuse_fresnel_factor", text="Factor")
+            split = col.split()
+            
+            col = split.column()
+            col.itemR(mat, "diffuse_fresnel", text="Fresnel")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(mat, "diffuse_fresnel_factor", text="Factor")
 
         if mat.use_diffuse_ramp:
             layout.itemS()
             layout.template_color_ramp(mat, "diffuse_ramp", expand=True)
             layout.itemS()
-            row = layout.row()
-            split = row.split(percentage=0.3)
-            split.itemL(text="Input:")
-            split.itemR(mat, "diffuse_ramp_input", text="")
-            split = row.split(percentage=0.3)
-            split.itemL(text="Blend:")
-            split.itemR(mat, "diffuse_ramp_blend", text="")
+            
+            split = layout.split()
+            
+            col = split.column()
+            col.itemR(mat, "diffuse_ramp_input", text="Input")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(mat, "diffuse_ramp_blend", text="Blend")
             row = layout.row()
             row.itemR(mat, "diffuse_ramp_factor", text="Factor")
 
@@ -367,7 +393,8 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
         col.itemR(mat, "specular_color", text="")
         col.itemR(mat, "specular_intensity", text="Intensity")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(mat, "specular_shader", text="")
         col.itemR(mat, "use_specular_ramp", text="Ramp")
 
@@ -375,27 +402,39 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
         if mat.specular_shader in ('COOKTORR', 'PHONG'):
             col.itemR(mat, "specular_hardness", text="Hardness")
         elif mat.specular_shader == 'BLINN':
-            row = col.row()
-            row.itemR(mat, "specular_hardness", text="Hardness")
-            row.itemR(mat, "specular_ior", text="IOR")
+            split = layout.split()
+            
+            col = split.column()
+            col.itemR(mat, "specular_hardness", text="Hardness")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(mat, "specular_ior", text="IOR")
         elif mat.specular_shader == 'WARDISO':
             col.itemR(mat, "specular_slope", text="Slope")
         elif mat.specular_shader == 'TOON':
-            row = col.row()
-            row.itemR(mat, "specular_toon_size", text="Size")
-            row.itemR(mat, "specular_toon_smooth", text="Smooth")
+            split = layout.split()
+            
+            col = split.column()
+            col.itemR(mat, "specular_toon_size", text="Size")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(mat, "specular_toon_smooth", text="Smooth")
 
         if mat.use_specular_ramp:
             layout.itemS()
             layout.template_color_ramp(mat, "specular_ramp", expand=True)
             layout.itemS()
-            row = layout.row()
-            split = row.split(percentage=0.3)
-            split.itemL(text="Input:")
-            split.itemR(mat, "specular_ramp_input", text="")
-            split = row.split(percentage=0.3)
-            split.itemL(text="Blend:")
-            split.itemR(mat, "specular_ramp_blend", text="")
+            split = layout.split()
+            
+            col = split.column()
+            col.itemR(mat, "specular_ramp_input", text="Input")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(mat, "specular_ramp_blend", text="Blend")
+            
             row = layout.row()
             row.itemR(mat, "specular_ramp_factor", text="Factor")
 
@@ -434,7 +473,8 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
         col.itemR(sss, "color", text="")
         col.itemR(sss, "radius", text="RGB Radius")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         sub = col.column(align=True)
         sub.itemL(text="Blend:")
         sub.itemR(sss, "color_factor", text="Color")
@@ -475,7 +515,8 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
         col.itemR(raym, "reflect_factor")
         col.itemR(mat, "mirror_color", text="")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(raym, "fresnel")
         sub = col.column()
         sub.active = raym.fresnel > 0
@@ -492,7 +533,8 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
         sub.itemL(text="Fade To:")
         sub.itemR(raym, "fade_to", text="")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL(text="Gloss:")
         col.itemR(raym, "gloss_factor", text="Amount")
         sub = col.column()
@@ -525,7 +567,10 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
 
         row = layout.row()
         row.active = mat.transparency and (not mat.shadeless)
-        row.itemR(mat, "transparency_method", expand=True)
+        if (context.region.width > narrowui):
+            row.itemR(mat, "transparency_method", expand=True)
+        else:
+            row.itemR(mat, "transparency_method", text="")
 
         split = layout.split()
 
@@ -535,7 +580,8 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
         row.active = mat.transparency and (not mat.shadeless)
         row.itemR(mat, "specular_alpha", text="Specular")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.active = (not mat.shadeless)
         col.itemR(rayt, "fresnel")
         sub = col.column()
@@ -554,7 +600,8 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
             col.itemR(rayt, "limit")
             col.itemR(rayt, "depth")
 
-            col = split.column()
+            if (context.region.width > narrowui):
+                col = split.column()
             col.itemL(text="Gloss:")
             col.itemR(rayt, "gloss_factor", text="Amount")
             sub = col.column()
@@ -592,7 +639,8 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
         col.itemR(halo, "shaded")
         col.itemR(halo, "soft")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(halo, "ring")
         sub = col.column()
         sub.active = halo.ring
@@ -639,7 +687,8 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
         col.itemR(halo, "flare_size", text="Size")
         col.itemR(halo, "flare_boost", text="Boost")
         col.itemR(halo, "flare_seed", text="Seed")
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(halo, "flares_sub", text="Subflares")
         col.itemR(halo, "flare_subsize", text="Subsize")
 
@@ -681,9 +730,12 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel):
         vol = context.material.volume # dont use node material
 
         split = layout.split()
-        row = split.row()
-        row.itemR(vol, "density")
-        row.itemR(vol, "density_scale")
+        col = split.column()
+        col.itemR(vol, "density")
+        
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.itemR(vol, "density_scale")
 
 
 class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
@@ -703,7 +755,8 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
         col.itemR(vol, "asymmetry")
         col.itemR(vol, "transmission_color")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         sub = col.column(align=True)
         sub.itemR(vol, "emission")
         sub.itemR(vol, "emission_color", text="")
@@ -727,7 +780,8 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
         col = split.column()
         col.itemR(vol, "lighting_mode", text="")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
 
         if vol.lighting_mode == 'SHADED':
             col.itemR(vol, "external_shadows")
@@ -757,7 +811,10 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
 
         mat = context.material # dont use node material
 
-        layout.itemR(mat, "transparency_method", expand=True)
+        if (context.region.width > narrowui):
+            layout.itemR(mat, "transparency_method", expand=True)
+        else:
+            layout.itemR(mat, "transparency_method", text="")
 
 
 class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
@@ -778,7 +835,8 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
         col = col.column(align=True)
         col.itemR(vol, "step_size")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL()
         col.itemR(vol, "depth_cutoff")
 
index f6f1cf0e03c9123b6dafb5691630a7153bb36001..a45539e612e534d1ac79c2c54c071cfc5958eada 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class ObjectButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -48,22 +49,34 @@ class OBJECT_PT_transform(ObjectButtonsPanel):
 
         ob = context.object
 
-        row = layout.row()
-
-        row.column().itemR(ob, "location")
-        if ob.rotation_mode == 'QUATERNION':
-            row.column().itemR(ob, "rotation_quaternion", text="Rotation")
-        elif ob.rotation_mode == 'AXIS_ANGLE':
-            #row.column().itemL(text="Rotation")
-            #row.column().itemR(pchan, "rotation_angle", text="Angle")
-            #row.column().itemR(pchan, "rotation_axis", text="Axis")
-            row.column().itemR(ob, "rotation_axis_angle", text="Rotation")
+        if (context.region.width > narrowui):
+            row = layout.row()
+            
+            row.column().itemR(ob, "location")
+            if ob.rotation_mode == 'QUATERNION':
+                row.column().itemR(ob, "rotation_quaternion", text="Rotation")
+            elif ob.rotation_mode == 'AXIS_ANGLE':
+                #row.column().itemL(text="Rotation")
+                #row.column().itemR(pchan, "rotation_angle", text="Angle")
+                #row.column().itemR(pchan, "rotation_axis", text="Axis")
+                row.column().itemR(ob, "rotation_axis_angle", text="Rotation")
+            else:
+                row.column().itemR(ob, "rotation_euler", text="Rotation")
+    
+            row.column().itemR(ob, "scale")
+    
+            layout.itemR(ob, "rotation_mode")
         else:
-            row.column().itemR(ob, "rotation_euler", text="Rotation")
-
-        row.column().itemR(ob, "scale")
-
-        layout.itemR(ob, "rotation_mode")
+            col = layout.column()
+            col.itemR(ob, "location")
+            col.itemR(ob, "rotation_mode", text="")
+            if ob.rotation_mode == 'QUATERNION':
+                col.itemR(ob, "rotation_quaternion")
+            elif ob.rotation_mode == 'AXIS_ANGLE':
+                col.itemR(ob, "rotation_axis_angle", text="Rotation")
+            else:
+                col.itemR(ob, "rotation_euler", text="Rotation")
+            col.itemR(ob, "scale")
 
 
 class OBJECT_PT_transform_locks(ObjectButtonsPanel):
@@ -107,14 +120,13 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
         col.itemS()
         col.itemR(ob, "pass_index")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL(text="Parent:")
         col.itemR(ob, "parent", text="")
 
         sub = col.column()
-        split = sub.split(percentage=0.3)
-        split.itemL(text="Type:")
-        split.itemR(ob, "parent_type", text="")
+        sub.itemR(ob, "parent_type", text="")
         parent = ob.parent
         if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
             sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
@@ -128,10 +140,13 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
         layout = self.layout
 
         ob = context.object
-
-        split = layout.split()
-        split.item_menu_enumO("object.group_add", "group", text="Add to Group")
-        split.itemL()
+        
+        if (context.region.width > narrowui):
+            split = layout.split()
+            split.item_menu_enumO("object.group_add", "group", text="Add to Group")
+            split.itemL()
+        else:
+            layout.item_menu_enumO("object.group_add", "group", text="Add to Group")
 
         for group in bpy.data.groups:
             if ob.name in group.objects:
@@ -144,8 +159,13 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
                 row.itemO("object.group_remove", text="", icon='VICON_X')
 
                 split = col.box().split()
-                split.column().itemR(group, "layer", text="Dupli")
-                split.column().itemR(group, "dupli_offset", text="")
+                
+                col = split.column()
+                col.itemR(group, "layer", text="Dupli")
+                
+                if (context.region.width > narrowui):
+                    col = split.column()
+                col.itemR(group, "dupli_offset", text="")
 
 
 class OBJECT_PT_display(ObjectButtonsPanel):
@@ -159,20 +179,27 @@ class OBJECT_PT_display(ObjectButtonsPanel):
         split = layout.split()
         col = split.column()
         col.itemR(ob, "max_draw_type", text="Type")
-        col = split.column()
+        
+        if (context.region.width > narrowui):
+            col = split.column()
         row = col.row()
         row.itemR(ob, "draw_bounds", text="Bounds")
         sub = row.row()
         sub.active = ob.draw_bounds
         sub.itemR(ob, "draw_bounds_type", text="")
 
-        flow = layout.column_flow()
-        flow.itemR(ob, "draw_name", text="Name")
-        flow.itemR(ob, "draw_axis", text="Axis")
-        flow.itemR(ob, "draw_wire", text="Wire")
-        flow.itemR(ob, "draw_texture_space", text="Texture Space")
-        flow.itemR(ob, "x_ray", text="X-Ray")
-        flow.itemR(ob, "draw_transparent", text="Transparency")
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(ob, "draw_name", text="Name")
+        col.itemR(ob, "draw_axis", text="Axis")
+        col.itemR(ob, "draw_wire", text="Wire")
+        
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.itemR(ob, "draw_texture_space", text="Texture Space")
+        col.itemR(ob, "x_ray", text="X-Ray")
+        col.itemR(ob, "draw_transparent", text="Transparency")
 
 
 class OBJECT_PT_duplication(ObjectButtonsPanel):
@@ -182,9 +209,12 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
         layout = self.layout
 
         ob = context.object
-
-        layout.itemR(ob, "dupli_type", expand=True)
-
+        
+        if (context.region.width > narrowui):
+            layout.itemR(ob, "dupli_type", expand=True)
+        else:
+            layout.itemR(ob, "dupli_type", text="")
+        
         if ob.dupli_type == 'FRAMES':
             split = layout.split()
 
@@ -192,7 +222,8 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
             col.itemR(ob, "dupli_frames_start", text="Start")
             col.itemR(ob, "dupli_frames_end", text="End")
 
-            col = split.column(align=True)
+            if (context.region.width > narrowui):
+                col = split.column(align=True)
             col.itemR(ob, "dupli_frames_on", text="On")
             col.itemR(ob, "dupli_frames_off", text="Off")
 
@@ -202,12 +233,20 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
             layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
 
         elif ob.dupli_type == 'FACES':
-            row = layout.row()
-            row.itemR(ob, "dupli_faces_scale", text="Scale")
-            row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
+            split = layout.split()
+
+            col = split.column()
+            col.itemR(ob, "dupli_faces_scale", text="Scale")
+            
+            if (context.region.width > narrowui):
+                col = split.column()
+            col.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
 
         elif ob.dupli_type == 'GROUP':
-            layout.itemR(ob, "dupli_group", text="Group")
+            if (context.region.width > narrowui):
+                layout.itemR(ob, "dupli_group", text="Group")
+            else:
+                layout.itemR(ob, "dupli_group", text="")
 
 
 class OBJECT_PT_animation(ObjectButtonsPanel):
@@ -234,7 +273,8 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
         row.active = ob.parent != None
         col.itemR(ob, "time_offset", text="Offset")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL(text="Track:")
         col.itemR(ob, "track", text="")
         col.itemR(ob, "track_axis", text="Axis")
index d1d512e189935cf59742fdb67771ef43c12611b6..51a3a359b5fa0ede5fa2e8dd952efe1691053ae6 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class RenderButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -26,10 +27,13 @@ class RenderButtonsPanel(bpy.types.Panel):
     bl_context = "render"
     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
 
+    
+
     def poll(self, context):
         rd = context.scene.render_data
         return (context.scene and rd.use_game_engine == False) and (rd.engine in self.COMPAT_ENGINES)
-
+   
+    
 
 class RENDER_PT_render(RenderButtonsPanel):
     bl_label = "Render"
@@ -39,10 +43,16 @@ class RENDER_PT_render(RenderButtonsPanel):
         layout = self.layout
 
         rd = context.scene.render_data
-
-        row = layout.row()
-        row.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL')
-        row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
+        global narrowui
+        
+        split = layout.split()
+        
+        col = split.column()
+        col.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL')
+        
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
 
         layout.itemR(rd, "display_mode", text="Display")
 
@@ -74,7 +84,8 @@ class RENDER_PT_layers(RenderButtonsPanel):
 
         col = split.column()
         col.itemR(scene, "visible_layers", text="Scene")
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rl, "visible_layers", text="Layer")
 
         layout.itemR(rl, "light_override", text="Light")
@@ -121,7 +132,8 @@ class RENDER_PT_layers(RenderButtonsPanel):
         col.itemR(rl, "pass_mist")
         col.itemR(rl, "pass_object_index")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL()
         col.itemR(rl, "pass_color")
         col.itemR(rl, "pass_diffuse")
@@ -158,8 +170,9 @@ class RENDER_PT_shading(RenderButtonsPanel):
         col.itemR(rd, "render_shadows", text="Shadows")
         col.itemR(rd, "render_sss", text="Subsurface Scattering")
         col.itemR(rd, "render_envmaps", text="Environment Map")
-
-        col = split.column()
+        
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rd, "render_raytracing", text="Ray Tracing")
         col.itemR(rd, "color_management")
         col.itemR(rd, "alpha_mode", text="Alpha")
@@ -187,7 +200,8 @@ class RENDER_PT_performance(RenderButtonsPanel):
         col.itemR(rd, "parts_x", text="X")
         col.itemR(rd, "parts_y", text="Y")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemL(text="Memory:")
         sub = col.column()
         sub.itemR(rd, "save_buffers")
@@ -213,16 +227,17 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
 
     def draw(self, context):
         layout = self.layout
-
+        
         rd = context.scene.render_data
-
+        
         split = layout.split()
 
         col = split.column()
         col.itemR(rd, "use_compositing")
         col.itemR(rd, "use_sequencer")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rd, "dither_intensity", text="Dither", slider=True)
 
         layout.itemS()
@@ -236,7 +251,11 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
         sub.row().itemR(rd, "field_order", expand=True)
         sub.itemR(rd, "fields_still", text="Still")
 
-        col = split.column()
+
+        if (context.region.width > narrowui):
+            col = split.column()
+        else:
+            col.itemS()
         col.itemR(rd, "edge")
         sub = col.column()
         sub.active = rd.edge
@@ -250,9 +269,10 @@ class RENDER_PT_output(RenderButtonsPanel):
 
     def draw(self, context):
         layout = self.layout
-
+        
         rd = context.scene.render_data
 
+        
         layout.itemR(rd, "output_path", text="")
 
         split = layout.split()
@@ -260,7 +280,8 @@ class RENDER_PT_output(RenderButtonsPanel):
         col.itemR(rd, "file_format", text="")
         col.row().itemR(rd, "color_mode", text="Color", expand=True)
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rd, "file_extensions")
         col.itemR(rd, "use_overwrite")
         col.itemR(rd, "use_placeholder")
@@ -275,12 +296,15 @@ class RENDER_PT_output(RenderButtonsPanel):
             col = split.column()
             col.itemL(text="Codec:")
             col.itemR(rd, "exr_codec", text="")
-
-            subsplit = split.split()
-            col = subsplit.column()
+            
+            if (context.region.width > narrowui):
+                subsplit = split.split()
+                col = subsplit.column()
             col.itemR(rd, "exr_half")
             col.itemR(rd, "exr_zbuf")
-            col = subsplit.column()
+            
+            if (context.region.width > narrowui):
+                col = subsplit.column()
             col.itemR(rd, "exr_preview")
 
         elif rd.file_format == 'JPEG2000':
@@ -289,7 +313,8 @@ class RENDER_PT_output(RenderButtonsPanel):
             col.itemL(text="Depth:")
             col.row().itemR(rd, "jpeg2k_depth", expand=True)
 
-            col = split.column()
+            if (context.region.width > narrowui):
+                col = split.column()
             col.itemR(rd, "jpeg2k_preset", text="")
             col.itemR(rd, "jpeg2k_ycc")
 
@@ -298,7 +323,8 @@ class RENDER_PT_output(RenderButtonsPanel):
             col = split.column()
             col.itemR(rd, "cineon_log", text="Convert to Log")
 
-            col = split.column(align=True)
+            if (context.region.width > narrowui):
+                col = split.column(align=True)
             col.active = rd.cineon_log
             col.itemR(rd, "cineon_black", text="Black")
             col.itemR(rd, "cineon_white", text="White")
@@ -340,7 +366,8 @@ class RENDER_PT_encoding(RenderButtonsPanel):
         col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
         col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rd, "ffmpeg_gopsize")
         col.itemR(rd, "ffmpeg_autosplit")
         col.itemL(text="Mux:")
@@ -357,7 +384,9 @@ class RENDER_PT_encoding(RenderButtonsPanel):
         col = split.column()
         col.itemR(rd, "ffmpeg_audio_bitrate")
         col.itemR(rd, "ffmpeg_audio_mixrate")
-        col = split.column()
+        
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rd, "ffmpeg_multiplex_audio")
         col.itemR(rd, "ffmpeg_audio_volume")
 
@@ -375,16 +404,16 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
         layout = self.layout
 
         rd = context.scene.render_data
-
         layout.active = rd.antialiasing
-
+        
         split = layout.split()
 
         col = split.column()
         col.row().itemR(rd, "antialiasing_samples", expand=True)
         col.itemR(rd, "full_sample")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.itemR(rd, "pixel_filter", text="")
         col.itemR(rd, "filter_size", text="Size", slider=True)
 
@@ -398,7 +427,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
 
         scene = context.scene
         rd = scene.render_data
-
+        
         split = layout.split()
 
         col = split.column()
@@ -418,15 +447,18 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
         rowsub.active = rd.use_border
         rowsub.itemR(rd, "crop_to_border", text="Crop")
 
-        col = split.column(align=True)
-        col.itemL(text="Frame Range:")
-        col.itemR(scene, "start_frame", text="Start")
-        col.itemR(scene, "end_frame", text="End")
-        col.itemR(scene, "frame_step", text="Step")
-
-        col.itemL(text="Frame Rate:")
-        col.itemR(rd, "fps")
-        col.itemR(rd, "fps_base", text="/")
+        if (context.region.width > narrowui):
+            col = split.column()
+        sub = col.column(align=True)
+        sub.itemL(text="Frame Range:")
+        sub.itemR(scene, "start_frame", text="Start")
+        sub.itemR(scene, "end_frame", text="End")
+        sub.itemR(scene, "frame_step", text="Step")
+        
+        sub = col.column(align=True)
+        sub.itemL(text="Frame Rate:")
+        sub.itemR(rd, "fps")
+        sub.itemR(rd, "fps_base", text="/")
 
 
 class RENDER_PT_stamp(RenderButtonsPanel):
@@ -459,7 +491,8 @@ class RENDER_PT_stamp(RenderButtonsPanel):
         col.itemR(rd, "stamp_marker", text="Marker")
         col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
 
-        col = split.column()
+        if (context.region.width > narrowui):
+            col = split.column()
         col.active = rd.render_stamp
         col.itemR(rd, "stamp_foreground", slider=True)
         col.itemR(rd, "stamp_background", slider=True)
index 9ab431a2d6df7494615a377233deb37b3c7679d0..3f8889afbcfbeac4bd68a1fe9b482836e9d98894 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class SceneButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -37,9 +38,13 @@ class SCENE_PT_scene(SceneButtonsPanel):
         layout = self.layout
 
         scene = context.scene
-
-        layout.itemR(scene, "camera")
-        layout.itemR(scene, "set", text="Background")
+        
+        if (context.region.width > narrowui):
+            layout.itemR(scene, "camera")
+            layout.itemR(scene, "set", text="Background")
+        else:
+            layout.itemR(scene, "camera", text="")
+            layout.itemR(scene, "set", text="")
 
 
 class SCENE_PT_unit(SceneButtonsPanel):
@@ -54,10 +59,15 @@ class SCENE_PT_unit(SceneButtonsPanel):
         col = layout.column()
         col.row().itemR(unit, "system", expand=True)
 
-        row = layout.row()
-        row.active = (unit.system != 'NONE')
-        row.itemR(unit, "scale_length", text="Scale")
-        row.itemR(unit, "use_separate")
+        split = layout.split()
+        split.active = (unit.system != 'NONE')
+        
+        col = split.column()
+        col.itemR(unit, "scale_length", text="Scale")
+        
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.itemR(unit, "use_separate")
 
 
 class SCENE_PT_keying_sets(SceneButtonsPanel):
@@ -85,7 +95,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
             col.itemR(ks, "name")
             col.itemR(ks, "absolute")
 
-            col = row.column()
+            if (context.region.width > narrowui):
+                col = row.column()
             col.itemL(text="Keyframing Settings:")
             col.itemR(ks, "insertkey_needed", text="Needed")
             col.itemR(ks, "insertkey_visual", text="Visual")
@@ -131,7 +142,8 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
             if ksp.entire_array == False:
                 col.itemR(ksp, "array_index")
 
-            col = row.column()
+            if (context.region.width > narrowui):
+                col = row.column()
             col.itemL(text="F-Curve Grouping:")
             col.itemR(ksp, "grouping")
             if ksp.grouping == 'NAMED':
@@ -151,8 +163,11 @@ class SCENE_PT_physics(SceneButtonsPanel):
         scene = context.scene
 
         layout.active = scene.use_gravity
-
-        layout.itemR(scene, "gravity", text="")
+        
+        if (context.region.width > narrowui):
+            layout.itemR(scene, "gravity", text="")
+        else:
+            layout.column().itemR(scene, "gravity", text="")
 
 bpy.types.register(SCENE_PT_scene)
 bpy.types.register(SCENE_PT_unit)
index d00592470f05c54bfa3d7bfb169b6384ccc336d7..61190f3cb609e26c5f93de8999a51cdf089c5278 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 
+narrowui = 180
 
 class WorldButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -71,11 +72,17 @@ class WORLD_PT_world(WorldButtonsPanel):
         layout = self.layout
 
         world = context.world
-
-        row = layout.row()
-        row.itemR(world, "paper_sky")
-        row.itemR(world, "blend_sky")
-        row.itemR(world, "real_sky")
+        
+        if (context.region.width > narrowui):
+            row = layout.row()
+            row.itemR(world, "paper_sky")
+            row.itemR(world, "blend_sky")
+            row.itemR(world, "real_sky")
+        else:
+            col = layout.column()
+            col.itemR(world, "paper_sky")
+            col.itemR(world, "blend_sky")
+            col.itemR(world, "real_sky")
 
         row = layout.row()
         row.column().itemR(world, "horizon_color")
@@ -100,12 +107,17 @@ class WORLD_PT_mist(WorldButtonsPanel):
         world = context.world
 
         layout.active = world.mist.enabled
+        
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(world.mist, "intensity", slider=True)
+        col.itemR(world.mist, "start")
 
-        flow = layout.column_flow()
-        flow.itemR(world.mist, "intensity", slider=True)
-        flow.itemR(world.mist, "start")
-        flow.itemR(world.mist, "depth")
-        flow.itemR(world.mist, "height")
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.itemR(world.mist, "depth")
+        col.itemR(world.mist, "height")
 
         layout.itemR(world.mist, "falloff")
 
@@ -126,11 +138,16 @@ class WORLD_PT_stars(WorldButtonsPanel):
 
         layout.active = world.stars.enabled
 
-        flow = layout.column_flow()
-        flow.itemR(world.stars, "size")
-        flow.itemR(world.stars, "color_randomization", text="Colors")
-        flow.itemR(world.stars, "min_distance", text="Min. Dist")
-        flow.itemR(world.stars, "average_separation", text="Separation")
+        split = layout.split()
+        
+        col = split.column()
+        col.itemR(world.stars, "size")
+        col.itemR(world.stars, "color_randomization", text="Colors")
+
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.itemR(world.stars, "min_distance", text="Min. Dist")
+        col.itemR(world.stars, "average_separation", text="Separation")
 
 
 class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
@@ -163,7 +180,8 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
         sub.itemR(ao, "falloff_strength", text="Strength")
 
         if ao.gather_method == 'RAYTRACE':
-            col = split.column()
+            if (context.region.width > narrowui):
+                col = split.column()
 
             col.itemL(text="Sampling:")
             col.itemR(ao, "sample_method", text="")
@@ -178,7 +196,8 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
                 sub.itemR(ao, "bias")
 
         if ao.gather_method == 'APPROXIMATE':
-            col = split.column()
+            if (context.region.width > narrowui):
+                col = split.column()
 
             col.itemL(text="Sampling:")
             col.itemR(ao, "passes")
@@ -196,10 +215,9 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
         col = split.column()
         col.itemR(ao, "energy")
 
-        col = split.column()
-        sub = col.split(percentage=0.3)
-        sub.itemL(text="Color:")
-        sub.itemR(ao, "color", text="")
+        if (context.region.width > narrowui):
+            col = split.column()
+        col.itemR(ao, "color")
 
 bpy.types.register(WORLD_PT_context_world)
 bpy.types.register(WORLD_PT_preview)
index 9ec9af6f064a3e2356dbee6db3cfce40b72806a0..c9056e386ac6fedf7f6978d4a826dc903c0e61fa 100644 (file)
@@ -1424,21 +1424,22 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
        
        static EnumPropertyItem active_theme_group[] = {
                {0, "USER_INTERFACE", ICON_UI, "User Interface", ""},
-               {1, "VIEW_3D", ICON_VIEW3D, "View 3D", ""},
-               {2, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""},
-               {3, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""},
-               {4, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""},
-               {5, "DOPESHEET_EDITOR", ICON_ACTION, "Dopesheet Editor", ""},
-               {6, "IMAGE_EDITOR", ICON_IMAGE_COL, "Image Editor", ""},
-               {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Sequence Editor", ""},
-               {8, "PROPERTIES", ICON_BUTS, "Properties", ""},
-               {9, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""},
-               {10, "TIMELINE", ICON_TIME, "Timeline", ""},
-               {11, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""},
-               {12, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""},
-               {13, "OUTLINER", ICON_OOPS, "Outliner", ""},
-               {14, "INFO", ICON_INFO, "Info", ""},
-               {15, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""},
+               {1, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
+               {2, "TIMELINE", ICON_TIME, "Timeline", ""},
+               {3, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""},
+               {4, "DOPESHEET_EDITOR", ICON_ACTION, "Dopesheet", ""},
+               {5, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""},
+               {6, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", ""},
+               {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""},
+               {8, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""},
+               {9, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""},
+               {10, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""},
+               {11, "PROPERTIES", ICON_BUTS, "Properties", ""},
+               {12, "OUTLINER", ICON_OOPS, "Outliner", ""},
+               {14, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""},
+               {15, "INFO", ICON_INFO, "Info", ""},
+               {16, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""},
+               {17, "CONSOLE", ICON_CONSOLE, "Console", ""},
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "Theme", NULL);