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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-02 23:41:31 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-02 23:41:31 +0400
commit093ff8202ced6391a2ef657abe42615672146954 (patch)
tree8b65da58becc4ac56bf81ae7d3adab7c86730d15 /release
parent5a0896e1a3c7f17abd37e3d818585fde8e80ff6d (diff)
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?
Diffstat (limited to 'release')
-rw-r--r--release/ui/buttons_data_modifier.py79
-rw-r--r--release/ui/buttons_physic_cloth.py117
-rw-r--r--release/ui/buttons_physics_field.py48
-rw-r--r--release/ui/buttons_physics_fluid.py62
-rw-r--r--release/ui/buttons_physics_softbody.py43
5 files changed, 270 insertions, 79 deletions
diff --git a/release/ui/buttons_data_modifier.py b/release/ui/buttons_data_modifier.py
index 953fc1f0974..2400461b623 100644
--- a/release/ui/buttons_data_modifier.py
+++ b/release/ui/buttons_data_modifier.py
@@ -24,61 +24,63 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
# 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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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 @@ class DATA_PT_modifiers(DataButtonsPanel):
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()
diff --git a/release/ui/buttons_physic_cloth.py b/release/ui/buttons_physic_cloth.py
index a06c644322a..ecb5e48569a 100644
--- a/release/ui/buttons_physic_cloth.py
+++ b/release/ui/buttons_physic_cloth.py
@@ -7,48 +7,73 @@ class PhysicButtonsPanel(bpy.types.Panel):
__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")
-
- 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")
- """
+ split.operator_context = "EXEC_DEFAULT"
+
+ 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 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
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 @@ class Physic_PT_cloth_collision(PhysicButtonsPanel):
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 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
def draw(self, context):
layout = self.layout
+ ob = context.object
cloth = context.cloth.settings
layout.active = cloth.stiffness_scaling
split = layout.split()
- sub = split.column()
+ sub = split.column(align=True)
sub.itemL(text="Structural Stiffness:")
- sub.column().itemR(cloth, "structural_stiffness_vertex_group", text="VGroup")
+ sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
sub.itemR(cloth, "structural_stiffness_max", text="Max")
- sub = split.column()
+ sub = split.column(align=True)
sub.itemL(text="Bending Stiffness:")
- sub.column().itemR(cloth, "bending_vertex_group", text="VGroup")
+ sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
sub.itemR(cloth, "bending_stiffness_max", text="Max")
-bpy.types.register(Physic_PT_cloth)
+bpy.types.register(PHYSICS_PT_cloth)
bpy.types.register(PHYSICS_PT_cloth_cache)
-bpy.types.register(Physic_PT_cloth_collision)
-bpy.types.register(Physic_PT_cloth_stiffness)
+bpy.types.register(PHYSICS_PT_cloth_collision)
+bpy.types.register(PHYSICS_PT_cloth_stiffness)
+
diff --git a/release/ui/buttons_physics_field.py b/release/ui/buttons_physics_field.py
new file mode 100644
index 00000000000..3204ab4709d
--- /dev/null
+++ b/release/ui/buttons_physics_field.py
@@ -0,0 +1,48 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+ __space_type__ = "BUTTONS_WINDOW"
+ __region_type__ = "WINDOW"
+ __context__ = "physics"
+
+ def poll(self, context):
+ return (context.object != None)
+
+class PHYSICS_PT_field(PhysicButtonsPanel):
+ __idname__ = "PHYSICS_PT_field"
+ __label__ = "Field"
+
+ def draw(self, context):
+ layout = self.layout
+ ob = context.object
+ field = ob.field
+
+ layout.itemR(field, "type")
+
+ if field.type != "NONE":
+ layout.itemR(field, "strength")
+
+ if field.type in ("HARMONIC", "SPHERICAL", "CHARGE", "LENNARDj"):
+ if ob.type in ("MESH", "SURFACE", "FONT", "CURVE"):
+ layout.itemR(field, "surface")
+
+class PHYSICS_PT_collision(PhysicButtonsPanel):
+ __idname__ = "PHYSICS_PT_collision"
+ __label__ = "Collision"
+
+ def draw_header(self, context):
+ settings = context.object.collision
+ self.layout.itemR(settings, "enabled", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ md = context.collision
+ settings = context.object.collision
+
+ if settings.enabled:
+ pass
+
+bpy.types.register(PHYSICS_PT_field)
+bpy.types.register(PHYSICS_PT_collision)
+
diff --git a/release/ui/buttons_physics_fluid.py b/release/ui/buttons_physics_fluid.py
new file mode 100644
index 00000000000..57e3d910f30
--- /dev/null
+++ b/release/ui/buttons_physics_fluid.py
@@ -0,0 +1,62 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+ __space_type__ = "BUTTONS_WINDOW"
+ __region_type__ = "WINDOW"
+ __context__ = "physics"
+
+ def poll(self, context):
+ ob = context.object
+ return (ob and ob.type == 'MESH')
+
+class PHYSICS_PT_fluid(PhysicButtonsPanel):
+ __idname__ = "PHYSICS_PT_fluid"
+ __label__ = "Fluid"
+
+ def draw(self, context):
+ layout = self.layout
+ md = context.fluid
+ ob = context.object
+
+ split = layout.split()
+ split.operator_context = "EXEC_DEFAULT"
+
+ 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", "FLUID_SIMULATION", text="Add")
+ split.itemL()
+
+ if md:
+ fluid = md.settings
+
+ col = layout.column(align=True)
+ row = col.row()
+ row.item_enumR(fluid, "type", "DOMAIN")
+ row.item_enumR(fluid, "type", "FLUID")
+ row.item_enumR(fluid, "type", "OBSTACLE")
+ row = col.row()
+ row.item_enumR(fluid, "type", "INFLOW")
+ row.item_enumR(fluid, "type", "OUTFLOW")
+ row.item_enumR(fluid, "type", "PARTICLE")
+ row.item_enumR(fluid, "type", "CONTROL")
+
+ if fluid.type == "DOMAIN":
+ layout.itemO("FLUID_OT_bake", text="BAKE")
+
+ col = layout.column(align=True)
+
+ col.itemL(text="Req. Mem.: " + fluid.memory_estimate)
+ col.itemR(fluid, "resolution")
+ col.itemR(fluid, "preview_resolution")
+
+bpy.types.register(PHYSICS_PT_fluid)
+
diff --git a/release/ui/buttons_physics_softbody.py b/release/ui/buttons_physics_softbody.py
new file mode 100644
index 00000000000..389d91bafa7
--- /dev/null
+++ b/release/ui/buttons_physics_softbody.py
@@ -0,0 +1,43 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+ __space_type__ = "BUTTONS_WINDOW"
+ __region_type__ = "WINDOW"
+ __context__ = "physics"
+
+ def poll(self, context):
+ return (context.object != None)
+
+class PHYSICS_PT_softbody(PhysicButtonsPanel):
+ __idname__ = "PHYSICS_PT_softbody"
+ __label__ = "Soft Body"
+
+ def draw(self, context):
+ layout = self.layout
+ md = context.soft_body
+ ob = context.object
+
+ split = layout.split()
+ split.operator_context = "EXEC_DEFAULT"
+
+ 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", "SOFTBODY", text="Add")
+ split.itemL()
+
+ if md:
+ softbody = md.settings
+
+ split = layout.split()
+
+bpy.types.register(PHYSICS_PT_softbody)
+