[Bf-blender-cvs] [84d4037363b] blender2.8: UI: Single-column and flow layout for Scene properties

Vuk Gardašević noreply at git.blender.org
Tue Jul 17 12:20:30 CEST 2018


Commit: 84d4037363b325a279ef87b6b1c430be29984357
Author: Vuk Gardašević
Date:   Tue Jul 17 12:17:42 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB84d4037363b325a279ef87b6b1c430be29984357

UI: Single-column and flow layout for Scene properties

See D3532

===================================================================

M	release/scripts/modules/rna_prop_ui.py
M	release/scripts/startup/bl_ui/properties_physics_common.py
M	release/scripts/startup/bl_ui/properties_scene.py

===================================================================

diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index bdb0751c973..8453077be85 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -132,6 +132,11 @@ def draw(layout, context, context_member, property_type, use_edit=True):
     show_developer_ui = context.user_preferences.view.show_developer_ui
     rna_properties = {prop.identifier for prop in rna_item.bl_rna.properties if prop.is_runtime} if items else None
 
+    layout.use_property_split = True
+    layout.use_property_decorate = False  # No animation.
+
+    flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+
     for key, val in items:
 
         if key == '_RNA_UI':
@@ -143,7 +148,6 @@ def draw(layout, context, context_member, property_type, use_edit=True):
         if is_rna and not show_developer_ui:
             continue
 
-        row = layout.row()
         to_dict = getattr(val, "to_dict", None)
         to_list = getattr(val, "to_list", None)
 
@@ -157,17 +161,20 @@ def draw(layout, context, context_member, property_type, use_edit=True):
         else:
             val_draw = val
 
+        row = flow.row(align=True)
         box = row.box()
 
         if use_edit:
             split = box.split(percentage=0.75)
-            row = split.row()
+            row = split.row(align=True)
         else:
-            row = box.row()
+            row = box.row(align=True)
+
+        row.alignment = "RIGHT"
 
         row.label(text=key, translate=False)
 
-        # explicit exception for arrays
+        # explicit exception for arrays.
         if to_dict or to_list:
             row.label(text=val_draw, translate=False)
         else:
@@ -186,6 +193,8 @@ def draw(layout, context, context_member, property_type, use_edit=True):
             else:
                 row.label(text="API Defined")
 
+    del flow
+
 
 class PropertyPanel:
     """
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index e071de0108b..c9bde32c53d 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -97,7 +97,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
                             'CONSTRAINT')  # RB_TODO needs better icon
 
 
-# cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc
+# cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc.
 
 def point_cache_ui(self, context, cache, enabled, cachetype):
     layout = self.layout
@@ -112,8 +112,8 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
         col.operator("ptcache.add", icon='ZOOMIN', text="")
         col.operator("ptcache.remove", icon='ZOOMOUT', text="")
 
-    row = layout.row()
     if cachetype in {'PSYS', 'HAIR', 'SMOKE'}:
+        row = layout.row()
         row.prop(cache, "use_external")
 
         if cachetype == 'SMOKE':
@@ -131,7 +131,9 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
 
         cache_info = cache.info
         if cache_info:
-            layout.label(text=cache_info)
+            col = layout.column()
+            col.alignment = "RIGHT"
+            col.label(text=cache_info)
     else:
         if cachetype in {'SMOKE', 'DYNAMIC_PAINT'}:
             if not bpy.data.is_saved:
@@ -147,45 +149,54 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
             col.enabled = enabled
             col.prop(cache, "frame_start", text="Simulation Start")
             col.prop(cache, "frame_end")
+
         if cachetype not in {'SMOKE', 'CLOTH', 'DYNAMIC_PAINT', 'RIGID_BODY'}:
             col.prop(cache, "frame_step")
 
-        if cachetype != 'SMOKE':
-            layout.label(text=cache.info)
+        cache_info = cache.info
+        if cachetype != 'SMOKE' and cache_info:  # avoid empty space.
+            col = layout.column(align=True)
+            col.alignment = "RIGHT"
+            col.label(text=cache_info)
 
         can_bake = True
 
         if cachetype not in {'SMOKE', 'DYNAMIC_PAINT', 'RIGID_BODY'}:
-            split = layout.split()
-            split.enabled = enabled and bpy.data.is_saved
+            flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+            flow.enabled = enabled and bpy.data.is_saved
 
-            col = split.column()
-            col.prop(cache, "use_disk_cache")
+            flow.use_property_split = True
 
-            col = split.column()
-            col.active = cache.use_disk_cache
-            col.prop(cache, "use_library_path", "Use Lib Path")
+            # NOTE: TODO temporarly used until the animate properties are properly skipped.
+            flow.use_property_decorate = False  # No animation (remove this later on)
 
-            row = layout.row()
-            row.enabled = enabled and bpy.data.is_saved
-            row.active = cache.use_disk_cache
-            row.label(text="Compression:")
-            row.prop(cache, "compression", expand=True)
+            col = flow.column()
+            col.prop(cache, "use_disk_cache")
 
-            layout.separator()
+            subcol = col.column()
+            subcol.active = cache.use_disk_cache
+            subcol.prop(cache, "use_library_path", "Use Lib Path")
+
+            col = flow.column()
+            col.enabled = enabled and bpy.data.is_saved
+            col.active = cache.use_disk_cache
+            col.prop(cache, "compression", text="Compression", expand=True)
 
             if cache.id_data.library and not cache.use_disk_cache:
                 can_bake = False
 
                 col = layout.column(align=True)
-                col.label(text="Linked object baking requires Disk Cache to be enabled", icon='INFO')
+                col.alignment = "RIGHT"
+
+                col.separator()
+
+                col.label(text="Linked object baking requires Disk Cache to be enabled")
         else:
             layout.separator()
 
-        split = layout.split()
-        split.active = can_bake
-
-        col = split.column()
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
+        col = flow.column()
+        col.active = can_bake
 
         if cache.is_baked is True:
             col.operator("ptcache.free_bake", text="Free Bake")
@@ -200,7 +211,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
         sub.enabled = enabled
         sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
 
-        col = split.column()
+        col = flow.column()
         col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
         col.operator("ptcache.free_bake_all", text="Free All Bakes")
         col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
@@ -212,31 +223,31 @@ def effector_weights_ui(self, context, weights, weight_type):
 
     layout.prop(weights, "group")
 
-    layout.use_property_split = False
-
-    split = layout.split()
-
-    split.prop(weights, "gravity", slider=True)
-    split.prop(weights, "all", slider=True)
+    # NOTE: TODO temporarly used until the animate properties are properly skipped
+    layout.use_property_decorate = False  # No animation (remove this later on)
 
-    layout.separator()
+    flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
 
-    split = layout.split()
-
-    col = split.column()
+    col = flow.column()
+    col.prop(weights, "gravity", slider=True)
+    col.prop(weights, "all", slider=True)
     col.prop(weights, "force", slider=True)
     col.prop(weights, "vortex", slider=True)
+
+    col = flow.column()
     col.prop(weights, "magnetic", slider=True)
+    col.prop(weights, "harmonic", slider=True)
+    col.prop(weights, "charge", slider=True)
+    col.prop(weights, "lennardjones", slider=True)
+
+    col = flow.column()
     col.prop(weights, "wind", slider=True)
     col.prop(weights, "curve_guide", slider=True)
     col.prop(weights, "texture", slider=True)
     if weight_type != 'SMOKE':
         col.prop(weights, "smokeflow", slider=True)
 
-    col = split.column()
-    col.prop(weights, "harmonic", slider=True)
-    col.prop(weights, "charge", slider=True)
-    col.prop(weights, "lennardjones", slider=True)
+    col = flow.column()
     col.prop(weights, "turbulence", slider=True)
     col.prop(weights, "drag", slider=True)
     col.prop(weights, "boid", slider=True)
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index d0fce0a2582..c0b8233a796 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -17,9 +17,9 @@
 # ##### END GPL LICENSE BLOCK #####
 
 # <pep8 compliant>
+
 import bpy
 from bpy.types import (
-    Menu,
     Panel,
     UIList,
 )
@@ -71,6 +71,7 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel):
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
+
         scene = context.scene
 
         layout.prop(scene, "camera")
@@ -92,13 +93,13 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel):
 
         layout.use_property_split = True
 
-        col = layout.column()
-        col.prop(unit, "system")
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
 
-        col = layout.column()
+        col = flow.column()
+        col.prop(unit, "system")
         col.prop(unit, "system_rotation")
 
-        col = layout.column()
+        col = flow.column()
         col.enabled = unit.system != 'NONE'
         col.prop(unit, "scale_length")
         col.prop(unit, "use_separate")
@@ -147,15 +148,17 @@ class SceneKeyingSetsPanel:
                 propname = prop
 
         row = layout.row(align=True)
-        row.prop(item, toggle_prop, text="", icon='STYLUS_PRESSURE', toggle=True)  # XXX: needs dedicated icon
 
-        subrow = row.row()
+        subrow = row.row(align=True)
         subrow.active = getattr(item, toggle_prop)
+
         if subrow.active:
   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list