[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24663] trunk/blender/release/scripts/ui: 2.5 Single Column Layout:

Thomas Dinges dingto at gmx.de
Wed Nov 18 22:57:13 CET 2009


Revision: 24663
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24663
Author:   dingto
Date:     2009-11-18 22:57:13 +0100 (Wed, 18 Nov 2009)

Log Message:
-----------
2.5 Single Column Layout:
* Added code to enable single column layout for general physic panels. 
Note: Force Field Falloff panel has some issues with single layout. 

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_particle.py
    trunk/blender/release/scripts/ui/properties_physics_cloth.py
    trunk/blender/release/scripts/ui/properties_physics_common.py
    trunk/blender/release/scripts/ui/properties_physics_field.py
    trunk/blender/release/scripts/ui/properties_physics_smoke.py
    trunk/blender/release/scripts/ui/properties_physics_softbody.py

Modified: trunk/blender/release/scripts/ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_particle.py	2009-11-18 21:01:04 UTC (rev 24662)
+++ trunk/blender/release/scripts/ui/properties_particle.py	2009-11-18 21:57:13 UTC (rev 24663)
@@ -253,7 +253,7 @@
 
         psys = context.particle_system
 
-        point_cache_ui(self, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0)
+        point_cache_ui(self, context, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0)
 
 
 class PARTICLE_PT_velocity(ParticleButtonsPanel):
@@ -889,7 +889,7 @@
 
     def draw(self, context):
         part = context.particle_system.settings
-        effector_weights_ui(self, part.effector_weights)
+        effector_weights_ui(self, context, part.effector_weights)
 
         if part.type == 'HAIR':
             self.layout.itemR(part.effector_weights, "do_growing_hair")
@@ -909,8 +909,8 @@
         split = layout.split(percentage=0.2)
         split.itemL(text="Type 1:")
         split.itemR(part.force_field_1, "type", text="")
-        basic_force_field_settings_ui(self, part.force_field_1)
-        basic_force_field_falloff_ui(self, part.force_field_1)
+        basic_force_field_settings_ui(self, context, part.force_field_1)
+        basic_force_field_falloff_ui(self, context, part.force_field_1)
 
         if part.force_field_1.type != 'NONE':
             layout.itemL(text="")
@@ -918,8 +918,8 @@
         split = layout.split(percentage=0.2)
         split.itemL(text="Type 2:")
         split.itemR(part.force_field_2, "type", text="")
-        basic_force_field_settings_ui(self, part.force_field_2)
-        basic_force_field_falloff_ui(self, part.force_field_2)
+        basic_force_field_settings_ui(self, context, part.force_field_2)
+        basic_force_field_falloff_ui(self, context, part.force_field_2)
 
 
 class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):

Modified: trunk/blender/release/scripts/ui/properties_physics_cloth.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_cloth.py	2009-11-18 21:01:04 UTC (rev 24662)
+++ trunk/blender/release/scripts/ui/properties_physics_cloth.py	2009-11-18 21:57:13 UTC (rev 24663)
@@ -119,7 +119,7 @@
 
     def draw(self, context):
         md = context.cloth
-        point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0)
+        point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 0, 0)
 
 
 class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
@@ -204,7 +204,7 @@
 
     def draw(self, context):
         cloth = context.cloth.settings
-        effector_weights_ui(self, cloth.effector_weights)
+        effector_weights_ui(self, context, cloth.effector_weights)
 
 bpy.types.register(PHYSICS_PT_cloth)
 bpy.types.register(PHYSICS_PT_cloth_cache)

Modified: trunk/blender/release/scripts/ui/properties_physics_common.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_common.py	2009-11-18 21:01:04 UTC (rev 24662)
+++ trunk/blender/release/scripts/ui/properties_physics_common.py	2009-11-18 21:57:13 UTC (rev 24663)
@@ -18,9 +18,13 @@
 
 # <pep8 compliant>
 
+narrowui = 180
 
-def point_cache_ui(self, cache, enabled, particles, smoke):
+
+def point_cache_ui(self, context, cache, enabled, particles, smoke):
     layout = self.layout
+    
+    col2 = context.region.width > narrowui
     layout.set_context_pointer("PointCache", cache)
 
     row = layout.row()
@@ -86,34 +90,49 @@
         layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame")
 
 
-def effector_weights_ui(self, weights):
+def effector_weights_ui(self, context, weights):
     layout = self.layout
+    
+    col2 = context.region.width > narrowui
 
     layout.itemR(weights, "group")
 
     split = layout.split()
-    split.itemR(weights, "gravity", slider=True)
-    split.itemR(weights, "all", slider=True)
+    
+    col = split.column()
+    col.itemR(weights, "gravity", slider=True)
+    
+    if col2:
+        col = split.column()
+    col.itemR(weights, "all", slider=True)
 
     layout.itemS()
+    
+    split = layout.split()
 
-    flow = layout.column_flow()
-    flow.itemR(weights, "force", slider=True)
-    flow.itemR(weights, "vortex", slider=True)
-    flow.itemR(weights, "magnetic", slider=True)
-    flow.itemR(weights, "wind", slider=True)
-    flow.itemR(weights, "curveguide", slider=True)
-    flow.itemR(weights, "texture", slider=True)
-    flow.itemR(weights, "harmonic", slider=True)
-    flow.itemR(weights, "charge", slider=True)
-    flow.itemR(weights, "lennardjones", slider=True)
-    flow.itemR(weights, "turbulence", slider=True)
-    flow.itemR(weights, "drag", slider=True)
-    flow.itemR(weights, "boid", slider=True)
+    col = split.column()
+    col.itemR(weights, "force", slider=True)
+    col.itemR(weights, "vortex", slider=True)
+    col.itemR(weights, "magnetic", slider=True)
+    col.itemR(weights, "wind", slider=True)
+    col.itemR(weights, "curveguide", slider=True)
+    col.itemR(weights, "texture", slider=True)
 
+    if col2:
+        col = split.column()
+    col.itemR(weights, "harmonic", slider=True)
+    col.itemR(weights, "charge", slider=True)
+    col.itemR(weights, "lennardjones", slider=True)
+    col.itemR(weights, "turbulence", slider=True)
+    col.itemR(weights, "drag", slider=True)
+    col.itemR(weights, "boid", slider=True)
 
-def basic_force_field_settings_ui(self, field):
+
+def basic_force_field_settings_ui(self, context, field):
     layout = self.layout
+    
+    col2 = context.region.width > narrowui
+    
     split = layout.split()
 
     if not field or field.type == 'NONE':
@@ -128,7 +147,7 @@
 
     if field.type == 'TURBULENCE':
         col.itemR(field, "size")
-        col.itemR(field, "flow")
+        col.itemR(field, "col")
     elif field.type == 'HARMONIC':
         col.itemR(field, "harmonic_damping", text="Damping")
     elif field.type == 'VORTEX' and field.shape != 'POINT':
@@ -137,8 +156,9 @@
         col.itemR(field, "quadratic_drag", text="Quadratic")
     else:
         col.itemR(field, "flow")
-
-    col = split.column()
+    
+    if col2:
+        col = split.column()
     col.itemR(field, "noise")
     col.itemR(field, "seed")
     if field.type == 'TURBULENCE':
@@ -150,15 +170,23 @@
     col.itemL(text="Effect point:")
     col.itemR(field, "do_location")
     col.itemR(field, "do_rotation")
+    
+    if col2:
+        col = split.column()
+    col.itemL(text="Collision:")
+    col.itemR(field, "do_absorption")
 
-    sub = split.column()
-    sub.itemL(text="Collision:")
-    sub.itemR(field, "do_absorption")
 
-
-def basic_force_field_falloff_ui(self, field):
+def basic_force_field_falloff_ui(self, context, field):
     layout = self.layout
-    split = layout.split(percentage=0.35)
+    
+    col2 = context.region.width > narrowui
+    
+    # XXX: This doesn't update for some reason. 
+    #if col2:
+    #    split = layout.split()
+    #else:
+        split = layout.split(percentage=0.35)
 
     if not field or field.type == 'NONE':
         return
@@ -168,7 +196,8 @@
     col.itemR(field, "use_min_distance", text="Use Minimum")
     col.itemR(field, "use_max_distance", text="Use Maximum")
 
-    col = split.column()
+    if col2:
+        col = split.column()
     col.itemR(field, "falloff_power", text="Power")
 
     sub = col.column()

Modified: trunk/blender/release/scripts/ui/properties_physics_field.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_field.py	2009-11-18 21:01:04 UTC (rev 24662)
+++ trunk/blender/release/scripts/ui/properties_physics_field.py	2009-11-18 21:57:13 UTC (rev 24663)
@@ -97,14 +97,14 @@
             col.itemR(field, "root_coordinates")
             col.itemR(field, "force_2d")
         else:
-            basic_force_field_settings_ui(self, field)
+            basic_force_field_settings_ui(self, context, field)
 
         if field.type not in ('NONE', 'GUIDE'):
 
             layout.itemL(text="Falloff:")
             layout.itemR(field, "falloff_type", expand=True)
 
-            basic_force_field_falloff_ui(self, field)
+            basic_force_field_falloff_ui(self, context, field)
 
             if field.falloff_type == 'CONE':
                 layout.itemS()

Modified: trunk/blender/release/scripts/ui/properties_physics_smoke.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_smoke.py	2009-11-18 21:01:04 UTC (rev 24662)
+++ trunk/blender/release/scripts/ui/properties_physics_smoke.py	2009-11-18 21:57:13 UTC (rev 24663)
@@ -146,7 +146,7 @@
         md = context.smoke.domain_settings
         cache = md.point_cache_low
 
-        point_cache_ui(self, cache, cache.baked == False, 0, 1)
+        point_cache_ui(self, context, cache, cache.baked == False, 0, 1)
 
 
 class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
@@ -192,7 +192,7 @@
         md = context.smoke.domain_settings
         cache = md.point_cache_high
 
-        point_cache_ui(self, cache, cache.baked == False, 0, 1)
+        point_cache_ui(self, context, cache, cache.baked == False, 0, 1)
 
 
 class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
@@ -205,7 +205,7 @@
 
     def draw(self, context):
         domain = context.smoke.domain_settings
-        effector_weights_ui(self, domain.effector_weights)
+        effector_weights_ui(self, context, domain.effector_weights)
 
 bpy.types.register(PHYSICS_PT_smoke)
 bpy.types.register(PHYSICS_PT_smoke_field_weights)

Modified: trunk/blender/release/scripts/ui/properties_physics_softbody.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_softbody.py	2009-11-18 21:01:04 UTC (rev 24662)
+++ trunk/blender/release/scripts/ui/properties_physics_softbody.py	2009-11-18 21:57:13 UTC (rev 24663)
@@ -91,7 +91,7 @@
 
     def draw(self, context):
         md = context.soft_body
-        point_cache_ui(self, md.point_cache, softbody_panel_enabled(md), 0, 0)
+        point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 0, 0)
 
 
 class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
@@ -261,7 +261,7 @@

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list