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:
authorJanne Karhu <jhkarh@gmail.com>2011-01-23 17:04:31 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-01-23 17:04:31 +0300
commitfa38da021cd08409f1bda4722a6cf8a607f86838 (patch)
tree08d2b4ed4ea17436ef6176efadaac4d910c8c4fb /release
parenteafbb9221e483010bda5e336f935005006f78e89 (diff)
Some ui reorganization of the physics tab:
* Before the different simulations all had a panel with an "add this" button making the whole tab look really messy. It also rarely makes sense to have more than one or two physics things enabled for a single object, so having all the panels in the tab just added a great deal of visual clutter. * Now there is a single "enable physics for" panel at the top that allows for enable/disable of any simulation. All actual physics panels are hidden until a simulation is enabled. * There was no "add" button for force fields before, but I added a toggle between "none" and "force" to unify the ui even further.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/ui/properties_physics_cloth.py17
-rw-r--r--release/scripts/ui/properties_physics_common.py53
-rw-r--r--release/scripts/ui/properties_physics_field.py27
-rw-r--r--release/scripts/ui/properties_physics_fluid.py20
-rw-r--r--release/scripts/ui/properties_physics_smoke.py18
-rw-r--r--release/scripts/ui/properties_physics_softbody.py17
6 files changed, 65 insertions, 87 deletions
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py
index 26670438b3f..f33804c4c6d 100644
--- a/release/scripts/ui/properties_physics_cloth.py
+++ b/release/scripts/ui/properties_physics_cloth.py
@@ -47,7 +47,7 @@ class PhysicButtonsPanel():
def poll(cls, context):
ob = context.object
rd = context.scene.render
- return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.cloth)
class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
@@ -59,21 +59,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
md = context.cloth
ob = context.object
- split = layout.split()
-
- if md:
- # remove modifier + settings
- split.context_pointer_set("modifier", md)
- split.operator("object.modifier_remove", text="Remove")
-
- row = split.row(align=True)
- row.prop(md, "show_render", text="")
- row.prop(md, "show_viewport", text="")
- else:
- # add modifier
- split.operator("object.modifier_add", text="Add").type = 'CLOTH'
- split.label()
-
if md:
cloth = md.settings
diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py
index 71bf8ae9590..30b9061e982 100644
--- a/release/scripts/ui/properties_physics_common.py
+++ b/release/scripts/ui/properties_physics_common.py
@@ -20,9 +20,60 @@
import bpy
-#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.object) and (not rd.use_game_engine)
+
+def physics_add(self, layout, md, name, type, typeicon, toggles):
+ sub = layout.row(align=True)
+ if md:
+ sub.context_pointer_set("modifier", md)
+ sub.operator("object.modifier_remove", text=name, icon='X')
+ if(toggles):
+ sub.prop(md, "show_render", text="")
+ sub.prop(md, "show_viewport", text="")
+ else:
+ sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
+
+class PHYSICS_PT_add(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ ob = context.object
+
+ layout = self.layout
+ layout.label("Enable physics for:")
+ split = layout.split()
+ col = split.column()
+
+ if(context.object.field.type == 'NONE'):
+ col.operator("object.forcefield_toggle", text="Force Field", icon='FORCE_FORCE')
+ else:
+ col.operator("object.forcefield_toggle", text="Force Field", icon='X')
+
+ if(ob.type == 'MESH'):
+ physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False);
+ physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True);
+
+ col = split.column()
+
+ if(ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE'):
+ physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True);
+
+ if(ob.type == 'MESH'):
+ physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True);
+ physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True);
+#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
+
def point_cache_ui(self, context, cache, enabled, cachetype):
layout = self.layout
diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py
index b5005a78c01..584cdaad108 100644
--- a/release/scripts/ui/properties_physics_field.py
+++ b/release/scripts/ui/properties_physics_field.py
@@ -37,6 +37,12 @@ class PhysicButtonsPanel():
class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Force Fields"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+ return (not rd.use_game_engine) and (ob.field) and (ob.field.type != 'NONE')
def draw(self, context):
layout = self.layout
@@ -164,7 +170,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
def poll(cls, context):
ob = context.object
rd = context.scene.render
- return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.collision)
def draw(self, context):
layout = self.layout
@@ -173,24 +179,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
split = layout.split()
- if md:
- # remove modifier + settings
- split.context_pointer_set("modifier", md)
- split.operator("object.modifier_remove", text="Remove")
- col = split.column()
-
- #row = split.row(align=True)
- #row.prop(md, "show_render", text="")
- #row.prop(md, "show_viewport", text="")
-
- coll = md.settings
-
- else:
- # add modifier
- split.operator("object.modifier_add", text="Add").type = 'COLLISION'
- split.label()
-
- coll = None
+ coll = md.settings
if coll:
settings = context.object.collision
diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py
index 177d1c54746..88eb926dfa0 100644
--- a/release/scripts/ui/properties_physics_fluid.py
+++ b/release/scripts/ui/properties_physics_fluid.py
@@ -29,7 +29,7 @@ class PhysicButtonsPanel():
def poll(cls, context):
ob = context.object
rd = context.scene.render
- return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.fluid)
class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
@@ -40,25 +40,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
md = context.fluid
- split = layout.split()
-
if md:
- # remove modifier + settings
- split.context_pointer_set("modifier", md)
- split.operator("object.modifier_remove", text="Remove")
-
- row = split.row(align=True)
- row.prop(md, "show_render", text="")
- row.prop(md, "show_viewport", text="")
-
fluid = md.settings
-
- else:
- # add modifier
- split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
- split.label()
-
- if md:
+
row = layout.row()
if fluid is None:
row.label("built without fluids")
diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py
index 71dd47fe524..0ca5f03f832 100644
--- a/release/scripts/ui/properties_physics_smoke.py
+++ b/release/scripts/ui/properties_physics_smoke.py
@@ -33,7 +33,7 @@ class PhysicButtonsPanel():
def poll(cls, context):
ob = context.object
rd = context.scene.render
- return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.smoke)
class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
@@ -45,22 +45,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
md = context.smoke
ob = context.object
- split = layout.split()
-
- if md:
- # remove modifier + settings
- split.context_pointer_set("modifier", md)
- split.operator("object.modifier_remove", text="Remove")
-
- row = split.row(align=True)
- row.prop(md, "show_render", text="")
- row.prop(md, "show_viewport", text="")
-
- else:
- # add modifier
- split.operator("object.modifier_add", text="Add").type = 'SMOKE'
- split.label()
-
if md:
layout.prop(md, "smoke_type", expand=True)
diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py
index a07c6a8e43b..343b198fa84 100644
--- a/release/scripts/ui/properties_physics_softbody.py
+++ b/release/scripts/ui/properties_physics_softbody.py
@@ -39,7 +39,7 @@ class PhysicButtonsPanel():
rd = context.scene.render
# return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
# i really hate touching things i do not understand completely .. but i think this should read (bjornmose)
- return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine)
+ return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body)
class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
@@ -51,21 +51,6 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
md = context.soft_body
ob = context.object
- split = layout.split()
-
- if md:
- # remove modifier + settings
- split.context_pointer_set("modifier", md)
- split.operator("object.modifier_remove", text="Remove")
-
- row = split.row(align=True)
- row.prop(md, "show_render", text="")
- row.prop(md, "show_viewport", text="")
- else:
- # add modifier
- split.operator("object.modifier_add", text="Add").type = 'SOFT_BODY'
- split.column()
-
if md:
softbody = md.settings