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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -20,8 +20,59 @@
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user