2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
import bpy
|
|
|
|
|
|
|
|
class PhysicButtonsPanel(bpy.types.Panel):
|
2009-08-22 08:48:01 +00:00
|
|
|
__space_type__ = 'PROPERTIES'
|
|
|
|
__region_type__ = 'WINDOW'
|
2009-07-02 19:41:31 +00:00
|
|
|
__context__ = "physics"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
ob = context.object
|
2.5: Render/Game Engine
An engine to use for output can now be selected an influences what
shows in the buttons window, only showing relevant data. The idea
behind this is to make it more clear what is supported where, make
the system more pluggable for external render/game engines, and save
space hiding stuff that is not relevant anyway.
* Top header now has an engine menu, to choose between the blender
render engine, game engine, and other future external engines.
* If the game engine is enabled, the buttons window should show
only properties that work in the game engine, and similarly for
the render engine.
* Moved panels from the logic space and game tabs to the physics,
scene and world tabs instead, and removed the game tab.
* Materials and textures tabs should eventually become game
specific too, to better show what is supported.
2009-07-23 21:50:40 +00:00
|
|
|
rd = context.scene.render_data
|
|
|
|
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
class PHYSICS_PT_fluid(PhysicButtonsPanel):
|
|
|
|
__label__ = "Fluid"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
md = context.fluid
|
|
|
|
ob = context.object
|
|
|
|
|
|
|
|
split = layout.split()
|
2009-08-06 13:15:23 +00:00
|
|
|
split.operator_context = 'EXEC_DEFAULT'
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
if md:
|
|
|
|
# remove modifier + settings
|
|
|
|
split.set_context_pointer("modifier", md)
|
2009-07-17 12:26:40 +00:00
|
|
|
split.itemO("object.modifier_remove", text="Remove")
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
row = split.row(align=True)
|
|
|
|
row.itemR(md, "render", text="")
|
|
|
|
row.itemR(md, "realtime", text="")
|
2009-07-17 02:31:28 +00:00
|
|
|
|
|
|
|
fluid = md.settings
|
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
else:
|
|
|
|
# add modifier
|
2009-08-06 13:15:23 +00:00
|
|
|
split.item_enumO("object.modifier_add", "type", 'FLUID_SIMULATION', text="Add")
|
2009-07-02 19:41:31 +00:00
|
|
|
split.itemL()
|
2009-07-17 02:31:28 +00:00
|
|
|
|
|
|
|
fluid = None
|
|
|
|
|
|
|
|
|
|
|
|
if fluid:
|
2009-07-30 10:11:19 +00:00
|
|
|
layout.itemR(fluid, "type")
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
if fluid.type == 'DOMAIN':
|
2009-08-29 10:34:31 +00:00
|
|
|
layout.itemO("fluid.bake", text="Bake Fluid Simulation", icon='ICON_MOD_FLUIDSIM')
|
2009-07-03 19:12:59 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemL(text="Resolution:")
|
2009-08-15 14:16:50 +00:00
|
|
|
col.itemR(fluid, "resolution", text="Final")
|
|
|
|
col.itemL(text="Render Display:")
|
|
|
|
col.itemR(fluid, "render_display_mode", text="")
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemL(text="Time:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "start_time", text="Start")
|
|
|
|
sub.itemR(fluid, "end_time", text="End")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2009-07-30 10:11:19 +00:00
|
|
|
col.itemL(text="Required Memory: " + fluid.memory_estimate)
|
|
|
|
col.itemR(fluid, "preview_resolution", text="Preview")
|
|
|
|
col.itemL(text="Viewport Display:")
|
|
|
|
col.itemR(fluid, "viewport_display_mode", text="")
|
|
|
|
col.itemL()
|
|
|
|
col.itemR(fluid, "generate_speed_vectors")
|
2009-08-15 14:16:50 +00:00
|
|
|
col.itemR(fluid, "reverse_frames")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
layout.itemR(fluid, "path", text="")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
elif fluid.type == 'FLUID':
|
2009-07-16 14:31:32 +00:00
|
|
|
split = layout.split()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Volume Initialization:")
|
|
|
|
col.itemR(fluid, "volume_initialization", text="")
|
|
|
|
col.itemR(fluid, "export_animated_mesh")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Initial Velocity:")
|
|
|
|
col.itemR(fluid, "initial_velocity", text="")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
elif fluid.type == 'OBSTACLE':
|
2009-07-16 14:31:32 +00:00
|
|
|
split = layout.split()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Volume Initialization:")
|
|
|
|
col.itemR(fluid, "volume_initialization", text="")
|
|
|
|
col.itemR(fluid, "export_animated_mesh")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Slip Type:")
|
2009-08-15 14:16:50 +00:00
|
|
|
col.itemR(fluid, "slip_type", text="")
|
2009-07-03 19:12:59 +00:00
|
|
|
if fluid.slip_type == 'PARTIALSLIP':
|
2009-08-31 16:36:02 +00:00
|
|
|
col.itemR(fluid, "partial_slip_factor", slider=True, text="Amount")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-08-15 14:16:50 +00:00
|
|
|
col.itemL(text="Impact:")
|
|
|
|
col.itemR(fluid, "impact_factor", text="Factor")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
elif fluid.type == 'INFLOW':
|
2009-07-16 14:31:32 +00:00
|
|
|
split = layout.split()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Volume Initialization:")
|
|
|
|
col.itemR(fluid, "volume_initialization", text="")
|
|
|
|
col.itemR(fluid, "export_animated_mesh")
|
|
|
|
col.itemR(fluid, "local_coordinates")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Inflow Velocity:")
|
|
|
|
col.itemR(fluid, "inflow_velocity", text="")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
elif fluid.type == 'OUTFLOW':
|
2009-07-16 14:31:32 +00:00
|
|
|
split = layout.split()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Volume Initialization:")
|
|
|
|
col.itemR(fluid, "volume_initialization", text="")
|
|
|
|
col.itemR(fluid, "export_animated_mesh")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
split.column()
|
|
|
|
|
|
|
|
elif fluid.type == 'PARTICLE':
|
2009-08-15 14:16:50 +00:00
|
|
|
split = layout.split(percentage=0.5)
|
2009-07-03 19:12:59 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Influence:")
|
2009-08-15 14:16:50 +00:00
|
|
|
col.itemR(fluid, "particle_influence", text="Size")
|
|
|
|
col.itemR(fluid, "alpha_influence", text="Alpha")
|
2009-07-16 14:31:32 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Type:")
|
|
|
|
col.itemR(fluid, "drops")
|
|
|
|
col.itemR(fluid, "floats")
|
2009-08-15 14:16:50 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL()
|
2009-07-03 19:12:59 +00:00
|
|
|
col.itemR(fluid, "tracer")
|
|
|
|
|
2009-08-15 14:16:50 +00:00
|
|
|
layout.itemR(fluid, "path", text="")
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
elif fluid.type == 'CONTROL':
|
2009-07-03 19:12:59 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="")
|
|
|
|
col.itemR(fluid, "quality", slider=True)
|
|
|
|
col.itemR(fluid, "reverse_frames")
|
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Time:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "start_time", text="Start")
|
|
|
|
sub.itemR(fluid, "end_time", text="End")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemL(text="Attraction Force:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "attraction_strength", text="Strength")
|
|
|
|
sub.itemR(fluid, "attraction_radius", text="Radius")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemL(text="Velocity Force:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "velocity_strength", text="Strength")
|
|
|
|
sub.itemR(fluid, "velocity_radius", text="Radius")
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
|
2009-07-16 14:31:32 +00:00
|
|
|
__label__ = "Domain World"
|
2009-07-03 19:12:59 +00:00
|
|
|
__default_closed__ = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
md = context.fluid
|
|
|
|
if md:
|
2009-08-30 21:00:26 +00:00
|
|
|
return (md.settings.type == 'DOMAIN')
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
fluid = context.fluid.settings
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemL(text="Gravity:")
|
|
|
|
col.itemR(fluid, "gravity", text="")
|
2009-07-20 17:15:41 +00:00
|
|
|
col.itemL(text="Real World Size:")
|
|
|
|
col.itemR(fluid, "real_world_size", text="Metres")
|
2009-07-16 14:31:32 +00:00
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Viscosity Presets:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "viscosity_preset", text="")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
if fluid.viscosity_preset == 'MANUAL':
|
2009-07-30 10:11:19 +00:00
|
|
|
sub.itemR(fluid, "viscosity_base", text="Base")
|
|
|
|
sub.itemR(fluid, "viscosity_exponent", text="Exponent", slider=True)
|
2009-07-16 14:31:32 +00:00
|
|
|
else:
|
2009-07-30 10:11:19 +00:00
|
|
|
sub.itemL()
|
|
|
|
sub.itemL()
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemL(text="Optimization:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "grid_levels", slider=True)
|
|
|
|
sub.itemR(fluid, "compressibility", slider=True)
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
|
|
|
|
__label__ = "Domain Boundary"
|
|
|
|
__default_closed__ = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
md = context.fluid
|
|
|
|
if md:
|
2009-08-30 21:00:26 +00:00
|
|
|
return (md.settings.type == 'DOMAIN')
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
fluid = context.fluid.settings
|
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
split = layout.split()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Slip Type:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "slip_type", text="")
|
2009-07-03 19:12:59 +00:00
|
|
|
if fluid.slip_type == 'PARTIALSLIP':
|
2009-08-31 16:36:02 +00:00
|
|
|
sub.itemR(fluid, "partial_slip_factor", slider=True, text="Amount")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-16 14:31:32 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Surface:")
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(fluid, "surface_smoothing", text="Smoothing")
|
|
|
|
sub.itemR(fluid, "surface_subdivisions", text="Subdivisions")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
|
|
|
|
__label__ = "Domain Particles"
|
|
|
|
__default_closed__ = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
md = context.fluid
|
|
|
|
if md:
|
2009-08-30 21:00:26 +00:00
|
|
|
return (md.settings.type == 'DOMAIN')
|
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-03 19:12:59 +00:00
|
|
|
fluid = context.fluid.settings
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = layout.column(align=True)
|
2009-07-16 14:31:32 +00:00
|
|
|
col.itemR(fluid, "tracer_particles")
|
|
|
|
col.itemR(fluid, "generate_particles")
|
2009-07-03 19:12:59 +00:00
|
|
|
|
|
|
|
bpy.types.register(PHYSICS_PT_fluid)
|
|
|
|
bpy.types.register(PHYSICS_PT_domain_gravity)
|
|
|
|
bpy.types.register(PHYSICS_PT_domain_boundary)
|
2.5: Render/Game Engine
An engine to use for output can now be selected an influences what
shows in the buttons window, only showing relevant data. The idea
behind this is to make it more clear what is supported where, make
the system more pluggable for external render/game engines, and save
space hiding stuff that is not relevant anyway.
* Top header now has an engine menu, to choose between the blender
render engine, game engine, and other future external engines.
* If the game engine is enabled, the buttons window should show
only properties that work in the game engine, and similarly for
the render engine.
* Moved panels from the logic space and game tabs to the physics,
scene and world tabs instead, and removed the game tab.
* Materials and textures tabs should eventually become game
specific too, to better show what is supported.
2009-07-23 21:50:40 +00:00
|
|
|
bpy.types.register(PHYSICS_PT_domain_particles)
|