2.5 Physic Buttons:

* Some Panels missed the "md" context declaration for the new cloth_panel_enabled(md) check. 
* Code Cleanup.
This commit is contained in:
Thomas Dinges
2009-08-30 21:00:26 +00:00
parent 6422d335ca
commit a7689e9b60
3 changed files with 93 additions and 103 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
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")
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")
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")
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)