diff options
author | Thomas Dinges <blender@dingto.org> | 2009-08-31 01:00:26 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2009-08-31 01:00:26 +0400 |
commit | a7689e9b60ef6dbe720a13abddb47f5137fc222d (patch) | |
tree | 03f15512ceb17bb68792e071b023b1cb16f4ef43 /release | |
parent | 6422d335cab87242aa2bf34290817ca96d11e464 (diff) |
2.5 Physic Buttons:
* Some Panels missed the "md" context declaration for the new cloth_panel_enabled(md) check.
* Code Cleanup.
Diffstat (limited to 'release')
-rw-r--r-- | release/ui/buttons_physics_cloth.py | 23 | ||||
-rw-r--r-- | release/ui/buttons_physics_fluid.py | 20 | ||||
-rw-r--r-- | release/ui/buttons_physics_softbody.py | 151 |
3 files changed, 92 insertions, 102 deletions
diff --git a/release/ui/buttons_physics_cloth.py b/release/ui/buttons_physics_cloth.py index 9399d557a51..a1978f44c18 100644 --- a/release/ui/buttons_physics_cloth.py +++ b/release/ui/buttons_physics_cloth.py @@ -43,11 +43,11 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): if md: cloth = md.settings + + layout.active = cloth_panel_enabled(md) split = layout.split() - split.active = cloth_panel_enabled(md) - col = split.column() col.itemL(text="Quality:") col.itemR(cloth, "quality", text="Steps",slider=True) @@ -89,7 +89,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): __default_closed__ = True def poll(self, context): - return (context.cloth != None) + return (context.cloth) def draw(self, context): md = context.cloth @@ -100,7 +100,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): __default_closed__ = True def poll(self, context): - return (context.cloth != None) + return (context.cloth) def draw_header(self, context): layout = self.layout @@ -111,11 +111,14 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): def draw(self, context): layout = self.layout + cloth = context.cloth.collision_settings - split = layout.split() + md = context.cloth layout.active = cloth.enable_collision and cloth_panel_enabled(md) + split = layout.split() + col = split.column() col.itemR(cloth, "collision_quality", slider=True, text="Quality") col.itemR(cloth, "min_distance", slider=True, text="Distance") @@ -123,10 +126,10 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): col = split.column() col.itemR(cloth, "enable_self_collision", text="Self Collision") - col = col.column() - col.active = cloth.enable_self_collision - col.itemR(cloth, "self_collision_quality", slider=True, text="Quality") - col.itemR(cloth, "self_min_distance", slider=True, text="Distance") + sub = col.column() + sub.active = cloth.enable_self_collision + sub.itemR(cloth, "self_collision_quality", slider=True, text="Quality") + sub.itemR(cloth, "self_min_distance", slider=True, text="Distance") class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): __label__ = "Cloth Stiffness Scaling" @@ -144,6 +147,8 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): def draw(self, context): layout = self.layout + + md = context.cloth ob = context.object cloth = context.cloth.settings diff --git a/release/ui/buttons_physics_fluid.py b/release/ui/buttons_physics_fluid.py index 5af63bdc3ba..fe15e22f0b9 100644 --- a/release/ui/buttons_physics_fluid.py +++ b/release/ui/buttons_physics_fluid.py @@ -175,11 +175,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel): def poll(self, context): md = context.fluid if md: - settings = md.settings - if settings: - return (settings.type == 'DOMAIN') - - return False + return (md.settings.type == 'DOMAIN') def draw(self, context): layout = self.layout @@ -218,11 +214,7 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel): def poll(self, context): md = context.fluid if md: - settings = md.settings - if settings: - return (settings.type == 'DOMAIN') - - return False + return (md.settings.type == 'DOMAIN') def draw(self, context): layout = self.layout @@ -251,12 +243,8 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel): def poll(self, context): md = context.fluid if md: - settings = md.settings - if settings: - return (settings.type == 'DOMAIN') - - return False - + return (md.settings.type == 'DOMAIN') + def draw(self, context): layout = self.layout diff --git a/release/ui/buttons_physics_softbody.py b/release/ui/buttons_physics_softbody.py index 3d3c3c23faf..73eb15d2212 100644 --- a/release/ui/buttons_physics_softbody.py +++ b/release/ui/buttons_physics_softbody.py @@ -71,6 +71,7 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel): class PHYSICS_PT_softbody_goal(PhysicButtonsPanel): __label__ = "Soft Body Goal" + __default_closed__ = True def poll(self, context): return (context.soft_body) @@ -87,39 +88,39 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel): layout = self.layout md = context.soft_body + softbody = md.settings ob = context.object + + layout.active = softbody.use_goal and softbody_panel_enabled(md) split = layout.split() - - if md: - softbody = md.settings - layout.active = softbody.use_goal and softbody_panel_enabled(md) - # Goal - split = layout.split() + # Goal + split = layout.split() - col = split.column() - col.itemL(text="Goal Strengths:") - col.itemR(softbody, "goal_default", text="Default") - sub = col.column(align=True) - sub.itemR(softbody, "goal_min", text="Minimum") - sub.itemR(softbody, "goal_max", text="Maximum") + col = split.column() + col.itemL(text="Goal Strengths:") + col.itemR(softbody, "goal_default", text="Default") + sub = col.column(align=True) + sub.itemR(softbody, "goal_min", text="Minimum") + sub.itemR(softbody, "goal_max", text="Maximum") - col = split.column() - col.itemL(text="Goal Settings:") - col.itemR(softbody, "goal_spring", text="Stiffness") - col.itemR(softbody, "goal_friction", text="Damping") + col = split.column() + col.itemL(text="Goal Settings:") + col.itemR(softbody, "goal_spring", text="Stiffness") + col.itemR(softbody, "goal_friction", text="Damping") - layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group") + layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group") class PHYSICS_PT_softbody_edge(PhysicButtonsPanel): __label__ = "Soft Body Edges" + __default_closed__ = True def poll(self, context): return (context.soft_body) def draw_header(self, context): - layout = self.layout + #layout = self.layout softbody = context.soft_body.settings @@ -130,41 +131,40 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel): layout = self.layout md = context.soft_body + softbody = md.settings ob = context.object + + layout.active = softbody.use_edges and softbody_panel_enabled(md) - if md: - softbody = md.settings - - layout.active = softbody.use_edges and softbody_panel_enabled(md) - - split = layout.split() - - col = split.column() - col.itemL(text="Springs:") - col.itemR(softbody, "pull") - col.itemR(softbody, "push") - col.itemR(softbody, "damp") - col.itemR(softbody, "plastic") - col.itemR(softbody, "bending") - col.itemR(softbody, "spring_length", text="Length") - - col = split.column() - col.itemR(softbody, "stiff_quads") - sub = col.column() - sub.active = softbody.stiff_quads - sub.itemR(softbody, "shear") + split = layout.split() - col.itemR(softbody, "new_aero", text="Aero") - sub = col.column() - sub.enabled = softbody.new_aero - sub.itemR(softbody, "aero", text="Factor") - - col.itemL(text="Collision:") - col.itemR(softbody, "edge_collision", text="Edge") - col.itemR(softbody, "face_collision", text="Face") + col = split.column() + col.itemL(text="Springs:") + col.itemR(softbody, "pull") + col.itemR(softbody, "push") + col.itemR(softbody, "damp") + col.itemR(softbody, "plastic") + col.itemR(softbody, "bending") + col.itemR(softbody, "spring_length", text="Length") + + col = split.column() + col.itemR(softbody, "stiff_quads") + sub = col.column() + sub.active = softbody.stiff_quads + sub.itemR(softbody, "shear") + + col.itemR(softbody, "new_aero", text="Aero") + sub = col.column() + sub.enabled = softbody.new_aero + sub.itemR(softbody, "aero", text="Factor") + + col.itemL(text="Collision:") + col.itemR(softbody, "edge_collision", text="Edge") + col.itemR(softbody, "face_collision", text="Face") class PHYSICS_PT_softbody_collision(PhysicButtonsPanel): __label__ = "Soft Body Collision" + __default_closed__ = True def poll(self, context): return (context.soft_body) @@ -181,24 +181,23 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel): layout = self.layout md = context.soft_body + softbody = md.settings ob = context.object - - if md: - softbody = md.settings - layout.active = softbody.self_collision and softbody_panel_enabled(md) + layout.active = softbody.self_collision and softbody_panel_enabled(md) - layout.itemL(text="Collision Type:") - layout.itemR(softbody, "collision_type", expand=True) + layout.itemL(text="Collision Type:") + layout.itemR(softbody, "collision_type", expand=True) - col = layout.column(align=True) - col.itemL(text="Ball:") - col.itemR(softbody, "ball_size", text="Size") - col.itemR(softbody, "ball_stiff", text="Stiffness") - col.itemR(softbody, "ball_damp", text="Dampening") + col = layout.column(align=True) + col.itemL(text="Ball:") + col.itemR(softbody, "ball_size", text="Size") + col.itemR(softbody, "ball_stiff", text="Stiffness") + col.itemR(softbody, "ball_damp", text="Dampening") class PHYSICS_PT_softbody_solver(PhysicButtonsPanel): __label__ = "Soft Body Solver" + __default_closed__ = True def poll(self, context): return (context.soft_body) @@ -207,30 +206,28 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel): layout = self.layout md = context.soft_body + softbody = md.settings ob = context.object - - if md: - softbody = md.settings - - layout.active = softbody_panel_enabled(md) - # Solver - split = layout.split() + layout.active = softbody_panel_enabled(md) + + # Solver + split = layout.split() - col = split.column(align=True) - col.itemL(text="Step Size:") - col.itemR(softbody, "minstep") - col.itemR(softbody, "maxstep") - col.itemR(softbody, "auto_step", text="Auto-Step") + col = split.column(align=True) + col.itemL(text="Step Size:") + col.itemR(softbody, "minstep") + col.itemR(softbody, "maxstep") + col.itemR(softbody, "auto_step", text="Auto-Step") - col = split.column() - col.itemR(softbody, "error_limit") - col.itemL(text="Helpers:") - col.itemR(softbody, "choke") - col.itemR(softbody, "fuzzy") + col = split.column() + col.itemR(softbody, "error_limit") + col.itemL(text="Helpers:") + col.itemR(softbody, "choke") + col.itemR(softbody, "fuzzy") - layout.itemL(text="Diagnostics:") - layout.itemR(softbody, "diagnose") + layout.itemL(text="Diagnostics:") + layout.itemR(softbody, "diagnose") bpy.types.register(PHYSICS_PT_softbody) bpy.types.register(PHYSICS_PT_softbody_cache) |