[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22899] branches/blender2.5/blender/ release/ui: 2.5 Physic Buttons:

Thomas Dinges dingto at gmx.de
Sun Aug 30 23:00:27 CEST 2009


Revision: 22899
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22899
Author:   dingto
Date:     2009-08-30 23:00:26 +0200 (Sun, 30 Aug 2009)

Log Message:
-----------
2.5 Physic Buttons:
* Some Panels missed the "md" context declaration for the new cloth_panel_enabled(md) check. 
* Code Cleanup. 

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
    branches/blender2.5/blender/release/ui/buttons_physics_fluid.py
    branches/blender2.5/blender/release/ui/buttons_physics_softbody.py

Modified: branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_cloth.py	2009-08-30 20:03:47 UTC (rev 22898)
+++ branches/blender2.5/blender/release/ui/buttons_physics_cloth.py	2009-08-30 21:00:26 UTC (rev 22899)
@@ -43,11 +43,11 @@
 
 		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 @@
 	__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 @@
 	__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 @@
 
 	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 @@
 		
 		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 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
+		md = context.cloth
 		ob = context.object
 		cloth = context.cloth.settings
 		

Modified: branches/blender2.5/blender/release/ui/buttons_physics_fluid.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_fluid.py	2009-08-30 20:03:47 UTC (rev 22898)
+++ branches/blender2.5/blender/release/ui/buttons_physics_fluid.py	2009-08-30 21:00:26 UTC (rev 22899)
@@ -175,11 +175,7 @@
 	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 @@
 	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 @@
 	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
 		

Modified: branches/blender2.5/blender/release/ui/buttons_physics_softbody.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_softbody.py	2009-08-30 20:03:47 UTC (rev 22898)
+++ branches/blender2.5/blender/release/ui/buttons_physics_softbody.py	2009-08-30 21:00:26 UTC (rev 22899)
@@ -71,6 +71,7 @@
 			
 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 @@
 		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 @@
 		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
+		split = layout.split()
 			
-			layout.active = softbody.use_edges and softbody_panel_enabled(md)
+		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")
 			
-			split = layout.split()
+		col = split.column()
+		col.itemR(softbody, "stiff_quads")
+		sub = col.column()
+		sub.active = softbody.stiff_quads
+		sub.itemR(softbody, "shear")
 			
-			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.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.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 @@
 		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 @@
 		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)





More information about the Bf-blender-cvs mailing list