[Bf-blender-cvs] [bc6e6a758fa] blender2.8: UI: Use Single Column and Grid Flow layout for Physics Cloth

Vuk Gardašević noreply at git.blender.org
Thu Jul 26 12:35:05 CEST 2018


Commit: bc6e6a758fa25dcee55842b17f8da254fa507531
Author: Vuk Gardašević
Date:   Thu Jul 26 12:33:31 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBbc6e6a758fa25dcee55842b17f8da254fa507531

UI: Use Single Column and Grid Flow layout for Physics Cloth

See D3559

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

M	release/scripts/startup/bl_ui/properties_physics_cloth.py

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index 7775722784b..0a7318864a3 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -17,8 +17,11 @@
 # ##### END GPL LICENSE BLOCK #####
 
 # <pep8 compliant>
+
 import bpy
-from bpy.types import Menu, Panel
+from bpy.types import (
+    Panel,
+)
 from bl_operators.presets import PresetMenu
 
 from .properties_physics_common import (
@@ -58,6 +61,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.cloth
         ob = context.object
@@ -65,64 +69,82 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
 
         layout.active = cloth_panel_enabled(md)
 
-        split = layout.split(percentage=0.25)
-
-        split.label(text="Quality:")
-        split.prop(cloth, "quality", text="Steps")
-
-        split = layout.split(percentage=0.25)
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
 
-        split.label(text="Speed:")
-        split.prop(cloth, "time_scale", text="Multiplier")
+        col = flow.column()
+        col.prop(cloth, "quality", text="Quality Steps")
+        col.prop(cloth, "time_scale", text="Speed Multiplier")
 
-        split = layout.split()
+        col.separator()
 
-        col = split.column()
-
-        col.label(text="Material:")
-        col.prop(cloth, "mass")
+        col = flow.column()
+        col.prop(cloth, "mass", text="Material Mass")
         col.prop(cloth, "structural_stiffness", text="Structural")
         col.prop(cloth, "bending_stiffness", text="Bending")
 
-        col = split.column()
+        col.separator()
 
-        col.label(text="Damping:")
-        col.prop(cloth, "spring_damping", text="Spring")
+        col = flow.column()
+        col.prop(cloth, "spring_damping", text="Damping Spring")
         col.prop(cloth, "air_damping", text="Air")
         col.prop(cloth, "vel_damping", text="Velocity")
 
-        split = layout.split()
+        col = flow.column()
+        col.prop(cloth, "use_dynamic_mesh", text="Dynamic Mesh")
 
-        col = split.column()
+        key = ob.data.shape_keys
 
-        col.prop(cloth, "use_pin_cloth", text="Pinning:")
-        sub = col.column()
-        sub.active = cloth.use_pin_cloth
-        sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="")
-        sub.prop(cloth, "pin_stiffness", text="Stiffness")
+        if key:
+            # Note: TODO prop_search doesn't align on the right.
+            row = col.row(align=True)
+            row.active = not cloth.use_dynamic_mesh
+            row.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="Rest Shape Key")
+            row.label(text="", icon='BLANK1')
 
-        # Disabled for now
-        """
-        if cloth.vertex_group_mass:
-            layout.label(text="Goal:")
 
-            col = layout.column_flow()
-            col.prop(cloth, "goal_default", text="Default")
-            col.prop(cloth, "goal_spring", text="Stiffness")
-            col.prop(cloth, "goal_friction", text="Friction")
-        """
+class PHYSICS_PT_cloth_pinning(PhysicButtonsPanel, Panel):
+    bl_label = "Pinning"
+    bl_parent_id = 'PHYSICS_PT_cloth'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
 
-        col = split.column()
+    def draw_header(self, context):
+        md = context.cloth
+        cloth = md.settings
 
-        col.prop(cloth, "use_dynamic_mesh", text="Dynamic Mesh")
+        self.layout.active = cloth_panel_enabled(md) and cloth.use_pin_cloth
+        self.layout.prop(cloth, "use_pin_cloth", text="")
 
-        key = ob.data.shape_keys
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
 
-        if key:
-            sub = col.column()
-            sub.active = not cloth.use_dynamic_mesh
-            sub.label(text="Rest Shape Key:")
-            sub.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="")
+        md = context.cloth
+        ob = context.object
+        cloth = md.settings
+
+        layout.active = cloth_panel_enabled(md) and cloth.use_pin_cloth
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+
+        col = flow.column()
+
+        # Note: TODO prop_search doesn't align on the right.
+        row = col.row(align=True)
+        row.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="Mass Group")
+        row.label(text="", icon='BLANK1')
+
+        col = flow.column()
+        col.prop(cloth, "pin_stiffness", text="Stiffness")
+
+        # Disabled for now.
+        """
+        if cloth.vertex_group_mass:
+            col = flow.column()
+            col.prop(cloth, "goal_default", text="Goal Default")
+            col.prop(cloth, "goal_spring", text="Stiffness")
+            col.prop(cloth, "goal_friction", text="Friction")
+        """
 
 
 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
@@ -150,31 +172,59 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         cloth = context.cloth.collision_settings
         md = context.cloth
-        ob = context.object
 
         layout.active = cloth.use_collision and cloth_panel_enabled(md)
 
-        split = layout.split()
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
 
-        col = split.column()
+        col = flow.column()
         col.prop(cloth, "collision_quality", text="Quality")
         col.prop(cloth, "distance_min", slider=True, text="Distance")
         col.prop(cloth, "repel_force", slider=True, text="Repel")
+
+        col = flow.column()
         col.prop(cloth, "distance_repel", slider=True, text="Repel Distance")
         col.prop(cloth, "friction")
+        col.prop(cloth, "group")
 
-        col = split.column()
-        col.prop(cloth, "use_self_collision", text="Self Collision")
-        sub = col.column()
-        sub.active = cloth.use_self_collision
-        sub.prop(cloth, "self_collision_quality", text="Quality")
-        sub.prop(cloth, "self_distance_min", slider=True, text="Distance")
-        sub.prop_search(cloth, "vertex_group_self_collisions", ob, "vertex_groups", text="")
 
-        layout.prop(cloth, "group")
+class PHYSICS_PT_cloth_self_collision(PhysicButtonsPanel, Panel):
+    bl_label = "Self Collision"
+    bl_parent_id = 'PHYSICS_PT_cloth_collision'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw_header(self, context):
+        cloth = context.cloth.collision_settings
+
+        self.layout.active = cloth_panel_enabled(context.cloth) and cloth.use_self_collision
+        self.layout.prop(cloth, "use_self_collision", text="")
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        cloth = context.cloth.collision_settings
+        md = context.cloth
+        ob = context.object
+
+        layout.active = cloth.use_collision and cloth_panel_enabled(md) and cloth.use_self_collision
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+
+        col = flow.column()
+        col.prop(cloth, "self_collision_quality", text="Quality")
+        col.prop(cloth, "self_distance_min", slider=True, text="Distance")
+
+        col = flow.column()
+        # Note: TODO prop_search doesn't align on the right.
+        row = col.row(align=True)
+        row.prop_search(cloth, "vertex_group_self_collisions", ob, "vertex_groups", text="Vertex Group")
+        row.label(text="", icon='BLANK1')
 
 
 class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
@@ -191,6 +241,7 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.cloth
         ob = context.object
@@ -198,16 +249,27 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
 
         layout.active = (cloth.use_stiffness_scale and cloth_panel_enabled(md))
 
-        split = layout.split()
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
 
-        col = split.column()
-        col.label(text="Structural Stiffness:")
-        col.prop_search(cloth, "vertex_group_structural_stiffness", ob, "vertex_groups", text="")
+        col = flow.column()
+        # Note: TODO prop_search doesn't align on the right.
+        row = col.row(align=True)
+        row.prop_search(
+            cloth, "vertex_group_structural_stiffness", ob, "vertex_groups",
+            text="Structural Group"
+        )
+        row.label(text="", icon='BLANK1')
         col.prop(cloth, "structural_stiffness_max", text="Max")
 
-        col = split.column()
-        col.label(text="Bending Stiffness:")
-        col.prop_search(cloth, "vertex_group_bending", ob, "vertex_groups", text="")
+        col.separator()
+
+        col = flow.column()
+        row = col.row(align=True)
+        row.prop_search(
+            cloth, "vertex_group_bending", ob, "vertex_groups",
+            text="Bending Group"
+        )
+        row.label(text="", icon='BLANK1')
         col.prop(cloth, "bending_stiffness_max", text="Max")
 
 
@@ -225,23 +287,27 @@ class PHYSICS_PT_cloth_sewing(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.cloth
         ob = context.object
         cloth = context.cloth.settings
 
         layout.active = (cloth.use_sewing_springs and cloth_panel_enabled(md))
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list