Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVuk Gardašević <lijenstina>2018-08-17 13:04:26 +0300
committerPablo Vazquez <venomgfx@gmail.com>2018-08-17 13:04:35 +0300
commitb19b708728d6b7ddd6d4a5c656a7fb1da2311195 (patch)
tree76323259396a2d31a62895870e05a302881912be /release/scripts/startup
parent2a3758f305fdbffd40737a5750539da3afcea5f9 (diff)
Physics Soft Body: Use Single Column and Grid Flow layout
See D3612
Diffstat (limited to 'release/scripts/startup')
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_softbody.py282
1 files changed, 223 insertions, 59 deletions
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=False, align=True)
+
+ col = flow.column(align=True)
+ col.prop(softbody, "ball_size", text="Ball Size")
- col = layout.column(align=True)
- col.label(text="Ball:")
- col.prop(softbody, "ball_size", text="Size")
+ col = flow.column(align=True)
col.prop(softbody, "ball_stiff", text="Stiffness")
col.prop(softbody, "ball_damp", text="Dampening")
@@ -214,32 +336,65 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
md = context.soft_body
softbody = md.settings
layout.active = softbody_panel_enabled(md)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
- # Solver
- split = layout.split()
+ col = flow.column(align=True)
+ col.prop(softbody, "step_min", text="Step Size Min")
+ col.prop(softbody, "step_max", text="Max")
- col = split.column(align=True)
- col.label(text="Step Size:")
- col.prop(softbody, "step_min")
- col.prop(softbody, "step_max")
+ col = flow.column()
col.prop(softbody, "use_auto_step", text="Auto-Step")
-
- col = split.column()
col.prop(softbody, "error_threshold")
- col.label(text="Helpers:")
- col.prop(softbody, "choke")
- col.prop(softbody, "fuzzy")
- layout.label(text="Diagnostics:")
+
+class PHYSICS_PT_softbody_solver_diagnostics(PhysicButtonsPanel, Panel):
+ bl_label = "Diagnostics"
+ bl_parent_id = 'PHYSICS_PT_softbody_solver'
+ 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_panel_enabled(md)
+
layout.prop(softbody, "use_diagnose")
layout.prop(softbody, "use_estimate_matrix")
+class PHYSICS_PT_softbody_solver_helpers(PhysicButtonsPanel, Panel):
+ bl_label = "Helpers"
+ bl_parent_id = 'PHYSICS_PT_softbody_solver'
+ 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_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, "choke")
+
+ col = flow.column()
+ col.prop(softbody, "fuzzy")
+
+
class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel):
bl_label = "Field Weights"
bl_parent_id = 'PHYSICS_PT_softbody'
@@ -255,14 +410,23 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel):
classes = (
PHYSICS_PT_softbody,
+ PHYSICS_PT_softbody_object,
+ PHYSICS_PT_softbody_simulation,
PHYSICS_PT_softbody_cache,
PHYSICS_PT_softbody_goal,
+ PHYSICS_PT_softbody_goal_settings,
+ PHYSICS_PT_softbody_goal_strenghts,
PHYSICS_PT_softbody_edge,
+ PHYSICS_PT_softbody_edge_aerodynamics,
+ PHYSICS_PT_softbody_edge_stiffness,
PHYSICS_PT_softbody_collision,
PHYSICS_PT_softbody_solver,
+ PHYSICS_PT_softbody_solver_diagnostics,
+ PHYSICS_PT_softbody_solver_helpers,
PHYSICS_PT_softbody_field_weights,
)
+
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes: