[Bf-blender-cvs] [b19b708728d] blender2.8: Physics Soft Body: Use Single Column and Grid Flow layout

Vuk Gardaáević noreply at git.blender.org
Fri Aug 17 12:05:55 CEST 2018


Commit: b19b708728d6b7ddd6d4a5c656a7fb1da2311195
Author: Vuk Gardašević
Date:   Fri Aug 17 12:04:26 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb19b708728d6b7ddd6d4a5c656a7fb1da2311195

Physics Soft Body: Use Single Column and Grid Flow layout

See D3612

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

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

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py
index 77440bdc628..761eb56ca5b 100644
--- a/release/scripts/startup/bl_ui/properties_physics_softbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py
@@ -17,15 +17,16 @@
 # ##### END GPL LICENSE BLOCK #####
 
 # <pep8 compliant>
-import bpy
-from bpy.types import Panel
 
+import bpy
+from bpy.types import (
+    Panel,
+)
 from .properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
 )
 
-
 COMPAT_OB_TYPES = {'MESH', 'LATTICE', 'CURVE', 'SURFACE', 'FONT'}
 
 
@@ -50,27 +51,61 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.soft_body
-        ob = context.object
+        softbody = md.settings
+
+        layout.prop(softbody, "collision_group")
+
 
+class PHYSICS_PT_softbody_object(PhysicButtonsPanel, Panel):
+    bl_label = "Object"
+    bl_parent_id = 'PHYSICS_PT_softbody'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        md = context.soft_body
         softbody = md.settings
+        ob = context.object
 
-        # General
-        split = layout.split()
-        split.enabled = softbody_panel_enabled(md)
+        layout.enabled = softbody_panel_enabled(md)
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
 
-        col = split.column()
-        col.label(text="Object:")
+        col = flow.column()
         col.prop(softbody, "friction")
+
+        col.separator()
+
+        col = flow.column()
         col.prop(softbody, "mass")
-        col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass")
 
-        col = split.column()
-        col.label(text="Simulation:")
-        col.prop(softbody, "speed")
+        # Note: TODO prop_search doesn't align on the right.
+        row = col.row(align=True)
+        row.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Control Point")
+        row.label(text="", icon='BLANK1')
 
-        layout.prop(softbody, "collision_group")
+
+class PHYSICS_PT_softbody_simulation(PhysicButtonsPanel, Panel):
+    bl_label = "Simulation"
+    bl_parent_id = 'PHYSICS_PT_softbody'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        md = context.soft_body
+        softbody = md.settings
+
+        layout.enabled = softbody_panel_enabled(md)
+
+        layout.prop(softbody, "speed")
 
 
 class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, Panel):
@@ -98,6 +133,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.soft_body
         softbody = md.settings
@@ -105,24 +141,59 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, Panel):
 
         layout.active = softbody.use_goal and softbody_panel_enabled(md)
 
-        split = layout.split()
+        # Note: TODO prop_search doesn't align on the right.
+        row = layout.row(align=True)
+        row.prop_search(softbody, "vertex_group_goal", ob, "vertex_groups", text="Vertex Group")
+        row.label(text="", icon='BLANK1')
 
-        # Goal
-        split = layout.split()
 
-        col = split.column()
-        col.label(text="Goal Strengths:")
+class PHYSICS_PT_softbody_goal_strenghts(PhysicButtonsPanel, Panel):
+    bl_label = "Strengths"
+    bl_parent_id = 'PHYSICS_PT_softbody_goal'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        md = context.soft_body
+        softbody = md.settings
+
+        layout.active = softbody.use_goal and softbody_panel_enabled(md)
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+
+        col = flow.column()
         col.prop(softbody, "goal_default", text="Default")
-        sub = col.column(align=True)
-        sub.prop(softbody, "goal_min", text="Minimum")
-        sub.prop(softbody, "goal_max", text="Maximum")
 
-        col = split.column()
-        col.label(text="Goal Settings:")
+        col.separator()
+
+        col = flow.column(align=True)
+        col.prop(softbody, "goal_min", text="Min")
+        col.prop(softbody, "goal_max", text="Max")
+
+
+class PHYSICS_PT_softbody_goal_settings(PhysicButtonsPanel, Panel):
+    bl_label = "Settings"
+    bl_parent_id = 'PHYSICS_PT_softbody_goal'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        md = context.soft_body
+        softbody = md.settings
+
+        layout.active = softbody.use_goal and softbody_panel_enabled(md)
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+
+        col = flow.column()
         col.prop(softbody, "goal_spring", text="Stiffness")
-        col.prop(softbody, "goal_friction", text="Damping")
 
-        layout.prop_search(softbody, "vertex_group_goal", ob, "vertex_groups", text="Vertex Group")
+        col = flow.column()
+        col.prop(softbody, "goal_friction", text="Damping")
 
 
 class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, Panel):
@@ -139,41 +210,87 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.soft_body
         softbody = md.settings
         ob = context.object
 
         layout.active = softbody.use_edges and softbody_panel_enabled(md)
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+
+        col = flow.column()
 
-        split = layout.split()
+        # Note: TODO prop_search doesn't align on the right.
+        row = col.row(align=True)
+        row.prop_search(softbody, "vertex_group_spring", ob, "vertex_groups", text="Springs")
+        row.label(text="", icon='BLANK1')
+
+        col.separator()
 
-        col = split.column()
-        col.label(text="Springs:")
         col.prop(softbody, "pull")
         col.prop(softbody, "push")
+
+        col.separator()
+
+        col = flow.column()
         col.prop(softbody, "damping")
         col.prop(softbody, "plastic")
         col.prop(softbody, "bend")
+
+        col.separator()
+
+        col = flow.column()
         col.prop(softbody, "spring_length", text="Length")
-        col.prop_search(softbody, "vertex_group_spring", ob, "vertex_groups", text="Springs")
+        col.prop(softbody, "use_edge_collision", text="Collision Edge")
+        col.prop(softbody, "use_face_collision", text="Face")
+
+
+class PHYSICS_PT_softbody_edge_aerodynamics(PhysicButtonsPanel, Panel):
+    bl_label = "Aerodynamics"
+    bl_parent_id = 'PHYSICS_PT_softbody_edge'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+
+        md = context.soft_body
+        softbody = md.settings
 
-        col = split.column()
-        col.prop(softbody, "use_stiff_quads")
-        sub = col.column()
-        sub.active = softbody.use_stiff_quads
-        sub.prop(softbody, "shear")
+        flow.active = softbody.use_edges and softbody_panel_enabled(md)
 
-        col.label(text="Aerodynamics:")
-        col.row().prop(softbody, "aerodynamics_type", expand=True)
+        col = flow.column()
+        col.prop(softbody, "aerodynamics_type", text="Type")
+
+        col = flow.column()
         col.prop(softbody, "aero", text="Factor")
 
-        #sub = col.column()
-        #sub.enabled = softbody.aero > 0
 
-        col.label(text="Collision:")
-        col.prop(softbody, "use_edge_collision", text="Edge")
-        col.prop(softbody, "use_face_collision", text="Face")
+class PHYSICS_PT_softbody_edge_stiffness(PhysicButtonsPanel, Panel):
+    bl_label = "Stiffness"
+    bl_parent_id = 'PHYSICS_PT_softbody_edge'
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    def draw_header(self, context):
+        softbody = context.soft_body.settings
+
+        self.layout.active = softbody_panel_enabled(context.soft_body)
+        self.layout.prop(softbody, "use_stiff_quads", text="")
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        md = context.soft_body
+        softbody = md.settings
+
+        layout.active = softbody.use_edges and softbody.use_stiff_quads and softbody_panel_enabled(md)
+
+        layout.prop(softbody, "shear")
 
 
 class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, Panel):
@@ -190,18 +307,23 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         md = context.soft_body
         softbody = md.settings
 
         layout.active = softbody.use_self_collision and softbody_panel_enabled(md)
 
-        layout.label(text="Collision Ball Size Calculation:")
-        layout.row().prop(softbody, "collision_type", expand=True)
+        layout.prop(softbody, "collision_type", text="Calculation Type")
+
+        layout.separator()
+
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list