[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21322] branches/blender2.5/blender: 2.5: Physics Buttons

Brecht Van Lommel brecht at blender.org
Thu Jul 2 21:41:31 CEST 2009


Revision: 21322
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21322
Author:   blendix
Date:     2009-07-02 21:41:31 +0200 (Thu, 02 Jul 2009)

Log Message:
-----------
2.5: Physics Buttons

All kinds of changes to get it ready for UI layouts. This means RNA
and operators should be working correct, but most buttons are still
not actually there yet.

* Added near empty soft body, fluid, field and collision panels,
  tweaks to cloth panels.
* Fluid bake works, but without escape or showing any progress.
* Fluid/Softbody/Cloth/Collision can now be both added as modifiers
  or in the physics panels.
* Missing: fields & soft body for particles.
* Missing: proper updating softbodies, guess this code still needs
  updates after pointcache refactor?

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_modifier.py
    branches/blender2.5/blender/release/ui/buttons_physic_cloth.py
    branches/blender2.5/blender/source/blender/blenkernel/BKE_effect.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_fluidsim.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_modifier.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/context.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/effect.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/fluidsim.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_markers.c
    branches/blender2.5/blender/source/blender/editors/include/ED_fluidsim.h
    branches/blender2.5/blender/source/blender/editors/include/ED_markers.h
    branches/blender2.5/blender/source/blender/editors/include/ED_object.h
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c
    branches/blender2.5/blender/source/blender/editors/object/object_intern.h
    branches/blender2.5/blender/source/blender/editors/object/object_modifier.c
    branches/blender2.5/blender/source/blender/editors/object/object_ops.c
    branches/blender2.5/blender/source/blender/editors/physics/ed_fluidsim.c
    branches/blender2.5/blender/source/blender/editors/physics/ed_pointcache.c
    branches/blender2.5/blender/source/blender/editors/space_api/spacetypes.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_context.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_ops.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_object_fluidsim.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_object_force.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_fluidsim.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_modifier.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object_force.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_ui_api.c

Added Paths:
-----------
    branches/blender2.5/blender/release/ui/buttons_physics_field.py
    branches/blender2.5/blender/release/ui/buttons_physics_fluid.py
    branches/blender2.5/blender/release/ui/buttons_physics_softbody.py
    branches/blender2.5/blender/source/blender/editors/include/ED_physics.h

Removed Paths:
-------------
    branches/blender2.5/blender/source/blender/editors/include/ED_pointcache.h

Property Changed:
----------------
    branches/blender2.5/blender/release/ui/space_view3d_toolbar.py

Modified: branches/blender2.5/blender/release/ui/buttons_data_modifier.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-07-02 18:12:46 UTC (rev 21321)
+++ branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-07-02 19:41:31 UTC (rev 21322)
@@ -24,61 +24,63 @@
 			if box:
 				if md.type == 'ARMATURE':
 					self.armature(box, ob, md)
-				if md.type == 'ARRAY':
+				elif md.type == 'ARRAY':
 					self.array(box, ob, md)
-				if md.type == 'BEVEL':
+				elif md.type == 'BEVEL':
 					self.bevel(box, ob, md)
-				if md.type == 'BOOLEAN':
+				elif md.type == 'BOOLEAN':
 					self.boolean(box, ob, md)
-				if md.type == 'BUILD':
+				elif md.type == 'BUILD':
 					self.build(box, ob, md)
-				if md.type == 'CAST':
+				elif md.type == 'CAST':
 					self.cast(box, ob, md)
-				if md.type == 'CLOTH':
+				elif md.type == 'CLOTH':
 					self.cloth(box, ob, md)
-				if md.type == 'COLLISION':
+				elif md.type == 'COLLISION':
 					self.collision(box, ob, md)
-				if md.type == 'CURVE':
+				elif md.type == 'CURVE':
 					self.curve(box, ob, md)
-				if md.type == 'DECIMATE':
+				elif md.type == 'DECIMATE':
 					self.decimate(box, ob, md)
-				if md.type == 'DISPLACE':
+				elif md.type == 'DISPLACE':
 					self.displace(box, ob, md)
-				if md.type == 'EDGE_SPLIT':
+				elif md.type == 'EDGE_SPLIT':
 					self.edgesplit(box, ob, md)
-				if md.type == 'EXPLODE':
+				elif md.type == 'EXPLODE':
 					self.explode(box, ob, md)
-				if md.type == 'FLUID_SIMULATION':
+				elif md.type == 'FLUID_SIMULATION':
 					self.fluid(box, ob, md)
-				if md.type == 'HOOK':
+				elif md.type == 'HOOK':
 					self.hook(box, ob, md)
-				if md.type == 'LATTICE':
+				elif md.type == 'LATTICE':
 					self.lattice(box, ob, md)
-				if md.type == 'MASK':
+				elif md.type == 'MASK':
 					self.mask(box, ob, md)
-				if md.type == 'MESH_DEFORM':
+				elif md.type == 'MESH_DEFORM':
 					self.mesh_deform(box, ob, md)
-				if md.type == 'MIRROR':
+				elif md.type == 'MIRROR':
 					self.mirror(box, ob, md)
-				if md.type == 'MULTIRES':
+				elif md.type == 'MULTIRES':
 					self.multires(box, ob, md)
-				if md.type == 'PARTICLE_INSTANCE':
+				elif md.type == 'PARTICLE_INSTANCE':
 					self.particleinstance(box, ob, md)
-				if md.type == 'PARTICLE_SYSTEM':
+				elif md.type == 'PARTICLE_SYSTEM':
 					self.particlesystem(box, ob, md)
-				if md.type == 'SHRINKWRAP':
+				elif md.type == 'SHRINKWRAP':
 					self.shrinkwrap(box, ob, md)
-				if md.type == 'SIMPLE_DEFORM':
+				elif md.type == 'SIMPLE_DEFORM':
 					self.simpledeform(box, ob, md)
-				if md.type == 'SMOOTH':
+				elif md.type == 'SMOOTH':
 					self.smooth(box, ob, md)
-				if md.type == 'SOFTBODY':
+				elif md.type == 'SOFTBODY':
 					self.softbody(box, ob, md)
-				if md.type == 'SUBSURF':
+				elif md.type == 'SUBSURF':
 					self.subsurf(box, ob, md)
-				if md.type == 'UV_PROJECT':
+				elif md.type == 'SURFACE':
+					self.surface(box, ob, md)
+				elif md.type == 'UV_PROJECT':
 					self.uvproject(box, ob, md)
-				if md.type == 'WAVE':
+				elif md.type == 'WAVE':
 					self.wave(box, ob, md)
 							
 	def armature(self, layout, ob, md):
@@ -96,9 +98,9 @@
 		layout.itemR(md, "fit_type")
 		if md.fit_type == 'FIXED_COUNT':
 			layout.itemR(md, "count")
-		if md.fit_type == 'FIT_LENGTH':
+		elif md.fit_type == 'FIT_LENGTH':
 			layout.itemR(md, "length")
-		if md.fit_type == 'FIT_CURVE':
+		elif md.fit_type == 'FIT_CURVE':
 			layout.itemR(md, "curve")
 
 		layout.itemS()
@@ -152,7 +154,7 @@
 		if md.limit_method == 'ANGLE':
 			row = layout.row()
 			row.itemR(md, "angle")
-		if md.limit_method == 'WEIGHT':
+		elif md.limit_method == 'WEIGHT':
 			row = layout.row()
 			row.itemR(md, "edge_weight_method", expand=True)
 			
@@ -211,7 +213,7 @@
 		layout.itemR(md, "texture_coordinates")
 		if md.texture_coordinates == 'OBJECT':
 			layout.itemR(md, "texture_coordinate_object", text="Object")
-		if md.texture_coordinates == 'UV' and ob.type == 'MESH':
+		elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
 			layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
 	
 	def edgesplit(self, layout, ob, md):
@@ -235,7 +237,7 @@
 		# Missing: "Refresh" and "Clear Vertex Group" ?
 		
 	def fluid(self, layout, ob, md):
-		layout.itemL(text="See Fluidsim panel.")
+		layout.itemL(text="See Fluid panel.")
 		
 	def hook(self, layout, ob, md):
 		layout.itemR(md, "falloff")
@@ -252,7 +254,7 @@
 		layout.itemR(md, "mode")
 		if md.mode == 'ARMATURE':
 			layout.itemR(md, "armature")
-		if md.mode == 'VERTEX_GROUP':
+		elif md.mode == 'VERTEX_GROUP':
 			layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
 		layout.itemR(md, "inverse")
 		
@@ -325,7 +327,7 @@
 			col.itemR(md, "positive")
 			col.itemR(md, "cull_front_faces")
 			col.itemR(md, "cull_back_faces")
-		if md.mode == 'NEAREST_SURFACEPOINT':
+		elif md.mode == 'NEAREST_SURFACEPOINT':
 			layout.itemR(md, "keep_above_surface")
 		# To-Do: Validate if structs
 		
@@ -353,7 +355,7 @@
 		layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
 		
 	def softbody(self, layout, ob, md):
-		layout.itemL(text="See Softbody panel.")
+		layout.itemL(text="See Soft Body panel.")
 	
 	def subsurf(self, layout, ob, md):
 		layout.itemR(md, "subdivision_type")
@@ -362,6 +364,9 @@
 		col.itemR(md, "render_levels", text="Render")
 		col.itemR(md, "optimal_draw", text="Optimal Display")
 		col.itemR(md, "subsurf_uv")
+
+	def surface(self, layout, ob, md):
+		layout.itemL(text="See Fields panel.")
 	
 	def uvproject(self, layout, ob, md):
 		if ob.type == 'MESH':
@@ -404,7 +409,7 @@
 		layout.itemR(md, "texture_coordinates")
 		if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
 			layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
-		if md.texture_coordinates == 'OBJECT':
+		elif md.texture_coordinates == 'OBJECT':
 			layout.itemR(md, "texture_coordinates_object")
 		
 		col = layout.column_flow()

Modified: branches/blender2.5/blender/release/ui/buttons_physic_cloth.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physic_cloth.py	2009-07-02 18:12:46 UTC (rev 21321)
+++ branches/blender2.5/blender/release/ui/buttons_physic_cloth.py	2009-07-02 19:41:31 UTC (rev 21322)
@@ -7,48 +7,73 @@
 	__context__ = "physics"
 
 	def poll(self, context):
-		return (context.cloth != None)
+		return (context.object != None)
 		
-class Physic_PT_cloth(PhysicButtonsPanel):
-	__idname__ = "Physic_PT_cloth"
+class PHYSICS_PT_cloth(PhysicButtonsPanel):
+	__idname__ = "PHYSICS_PT_cloth"
 	__label__ = "Cloth"
 
 	def draw(self, context):
 		layout = self.layout
-		cloth = context.cloth.settings
-		
+		md = context.cloth
+		ob = context.object
+
 		split = layout.split()
-		
-		col = split.column()
-		col.itemR(cloth, "quality", slider=True)
-		col.itemR(cloth, "gravity")
-		col.itemR(cloth, "mass")
-		col.itemR(cloth, "mass_vertex_group", text="Vertex Group")
+		split.operator_context = "EXEC_DEFAULT"
 
-		col = split.column()
-		col.itemL(text="Stiffness:")
-		col.itemR(cloth, "structural_stiffness", text="Structural")
-		col.itemR(cloth, "bending_stiffness", text="Bending")
-		col.itemL(text="Damping:")
-		col.itemR(cloth, "spring_damping", text="Spring")
-		col.itemR(cloth, "air_damping", text="Air")
-		
-		# Disabled for now
-		"""
-		if cloth.mass_vertex_group:
-			layout.itemL(text="Goal:")
-		
-			col = layout.column_flow()
-			col.itemR(cloth, "goal_default", text="Default")
-			col.itemR(cloth, "goal_spring", text="Stiffness")
-			col.itemR(cloth, "goal_friction", text="Friction")
-		"""
+		if md:
+			# remove modifier + settings
+			split.set_context_pointer("modifier", md)
+			split.itemO("OBJECT_OT_modifier_remove", text="Remove")
 
+			row = split.row(align=True)
+			row.itemR(md, "render", text="")
+			row.itemR(md, "realtime", text="")
+		else:
+			# add modifier
+			split.item_enumO("OBJECT_OT_modifier_add", "type", "CLOTH", text="Add")
+			split.itemL()
+
+		if md:
+			cloth = md.settings
+
+			split = layout.split()
+			
+			col = split.column()
+			col.itemR(cloth, "quality", slider=True)
+			col.itemR(cloth, "gravity")
+
+			subcol = col.column(align=True)
+			subcol.itemR(cloth, "mass")
+			subcol.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
+
+			col = split.column()
+			col.itemL(text="Stiffness:")
+			col.itemR(cloth, "structural_stiffness", text="Structural")
+			col.itemR(cloth, "bending_stiffness", text="Bending")
+			col.itemL(text="Damping:")
+			col.itemR(cloth, "spring_damping", text="Spring")
+			col.itemR(cloth, "air_damping", text="Air")
+			
+			# Disabled for now
+			"""
+			if cloth.mass_vertex_group:
+				layout.itemL(text="Goal:")
+			
+				col = layout.column_flow()
+				col.itemR(cloth, "goal_default", text="Default")
+				col.itemR(cloth, "goal_spring", text="Stiffness")
+				col.itemR(cloth, "goal_friction", text="Friction")
+			"""
+
 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
 	__idname__= "PHYSICS_PT_cloth_cache"
-	__label__ = "Cache"
+	__label__ = "Cloth Cache"
 	__default_closed__ = True
 
+	def poll(self, context):
+		return (context.cloth != None)
+
 	def draw(self, context):
 		layout = self.layout
 
@@ -91,9 +116,12 @@
 		row.itemO("PTCACHE_OT_free_bake_all", text="Free All Bakes")
 		layout.itemO("PTCACHE_OT_bake_all", text="Update All Dynamics to current frame")
 		
-class Physic_PT_cloth_collision(PhysicButtonsPanel):
-	__idname__ = "Physic_PT_clothcollision"
+class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
+	__idname__ = "PHYSICS_PT_clothcollision"
 	__label__ = "Cloth Collision"
+
+	def poll(self, context):
+		return (context.cloth != None)
 	
 	def draw_header(self, context):
 		layout = self.layout
@@ -120,9 +148,12 @@
 		col.itemR(cloth, "self_collision_quality", slider=True)
 		col.itemR(cloth, "self_min_distance", text="MinDistance")
 
-class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
-	__idname__ = "Physic_PT_stiffness"
+class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
+	__idname__ = "PHYSICS_PT_stiffness"
 	__label__ = "Cloth Stiffness Scaling"
+
+	def poll(self, context):
+		return (context.cloth != None)
 	
 	def draw_header(self, context):
 		layout = self.layout
@@ -132,23 +163,25 @@
 
 	def draw(self, context):
 		layout = self.layout
+		ob = context.object
 		cloth = context.cloth.settings
 		
 		layout.active = cloth.stiffness_scaling	
 		
 		split = layout.split()
 		

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list