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):
|
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
|
2009-09-01 00:33:39 +00:00
|
|
|
return (context.object) and (not rd.use_game_engine)
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
class PHYSICS_PT_field(PhysicButtonsPanel):
|
2009-07-19 11:28:43 +00:00
|
|
|
__label__ = "Force Fields"
|
|
|
|
__default_closed__ = True
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
ob = context.object
|
|
|
|
field = ob.field
|
|
|
|
|
2009-07-19 11:28:43 +00:00
|
|
|
#layout.active = field.enabled
|
|
|
|
|
2009-07-31 15:36:14 +00:00
|
|
|
split = layout.split(percentage=0.2)
|
2009-07-31 14:38:42 +00:00
|
|
|
|
2009-07-31 15:36:14 +00:00
|
|
|
split.itemL(text="Type:")
|
|
|
|
split.itemR(field, "type",text="")
|
2009-07-31 14:38:42 +00:00
|
|
|
|
2009-07-31 15:36:14 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
if field.type == 'GUIDE':
|
|
|
|
layout.itemR(field, "guide_path_add")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type == 'WIND':
|
2009-07-31 15:36:14 +00:00
|
|
|
split.itemR(field, "strength")
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(field, "noise")
|
|
|
|
col.itemR(field, "seed")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type == 'VORTEX':
|
2009-07-31 15:36:14 +00:00
|
|
|
split.itemR(field, "strength")
|
|
|
|
split.itemL()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type in ('SPHERICAL', 'CHARGE', 'LENNARDJ'):
|
2009-07-31 15:36:14 +00:00
|
|
|
split.itemR(field, "strength")
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(field, "planar")
|
|
|
|
col.itemR(field, "surface")
|
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type == 'BOID':
|
2009-07-31 15:36:14 +00:00
|
|
|
split.itemR(field, "strength")
|
|
|
|
split.itemR(field, "surface")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type == 'MAGNET':
|
2009-07-31 15:36:14 +00:00
|
|
|
split.itemR(field, "strength")
|
|
|
|
split.itemR(field, "planar")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type == 'HARMONIC':
|
2009-07-31 15:36:14 +00:00
|
|
|
col = split.column()
|
2009-07-30 10:11:19 +00:00
|
|
|
col.itemR(field, "strength")
|
|
|
|
col.itemR(field, "harmonic_damping", text="Damping")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(field, "planar")
|
2009-07-31 15:36:14 +00:00
|
|
|
col.itemR(field, "surface")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.type == 'TEXTURE':
|
2009-07-31 15:36:14 +00:00
|
|
|
col = split.column()
|
2009-07-30 10:11:19 +00:00
|
|
|
col.itemR(field, "strength")
|
|
|
|
col.itemR(field, "texture", text="")
|
2009-07-31 14:38:42 +00:00
|
|
|
col.itemR(field, "texture_mode", text="")
|
|
|
|
col.itemR(field, "texture_nabla")
|
2009-07-31 15:36:14 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2009-07-30 10:11:19 +00:00
|
|
|
col.itemR(field, "use_coordinates")
|
|
|
|
col.itemR(field, "root_coordinates")
|
2009-07-31 15:36:14 +00:00
|
|
|
col.itemR(field, "force_2d")
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
if field.type in ('HARMONIC', 'SPHERICAL', 'CHARGE', 'WIND', 'VORTEX', 'TEXTURE', 'MAGNET', 'BOID'):
|
|
|
|
|
2009-07-20 16:39:16 +00:00
|
|
|
layout.itemL(text="Falloff:")
|
|
|
|
layout.itemR(field, "falloff_type", expand=True)
|
2009-07-31 14:38:42 +00:00
|
|
|
|
|
|
|
split = layout.split(percentage=0.35)
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
2009-07-31 14:38:42 +00:00
|
|
|
col.itemR(field, "positive_z", text="Positive Z")
|
|
|
|
col.itemR(field, "use_min_distance", text="Use Minimum")
|
|
|
|
col.itemR(field, "use_max_distance", text="Use Maximum")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemR(field, "falloff_power", text="Power")
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = field.use_min_distance
|
|
|
|
sub.itemR(field, "minimum_distance", text="Distance")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = field.use_max_distance
|
|
|
|
sub.itemR(field, "maximum_distance", text="Distance")
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
if field.falloff_type == 'CONE':
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
layout.itemS()
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
split = layout.split(percentage=0.35)
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
2009-07-31 14:38:42 +00:00
|
|
|
col.itemL(text="Angular:")
|
|
|
|
col.itemR(field, "use_radial_min", text="Use Minimum")
|
|
|
|
col.itemR(field, "use_radial_max", text="Use Maximum")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemR(field, "radial_falloff", text="Power")
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = field.use_radial_min
|
|
|
|
sub.itemR(field, "radial_minimum", text="Angle")
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = field.use_radial_max
|
|
|
|
sub.itemR(field, "radial_maximum", text="Angle")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
elif field.falloff_type == 'TUBE':
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
layout.itemS()
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-31 14:38:42 +00:00
|
|
|
split = layout.split(percentage=0.35)
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Radial:")
|
|
|
|
col.itemR(field, "use_radial_min", text="Use Minimum")
|
|
|
|
col.itemR(field, "use_radial_max", text="Use Maximum")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
2009-07-31 14:38:42 +00:00
|
|
|
col.itemR(field, "radial_falloff", text="Power")
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = field.use_radial_min
|
|
|
|
sub.itemR(field, "radial_minimum", text="Distance")
|
2009-07-20 16:39:16 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = field.use_radial_max
|
|
|
|
sub.itemR(field, "radial_maximum", text="Distance")
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-08-22 08:48:01 +00:00
|
|
|
#if ob.type in 'CURVE':
|
|
|
|
#if field.type == 'GUIDE':
|
2009-07-19 11:28:43 +00:00
|
|
|
#colsub = col.column(align=True)
|
|
|
|
|
2009-08-22 08:48:01 +00:00
|
|
|
#if field.type != 'NONE':
|
2009-07-19 11:28:43 +00:00
|
|
|
#layout.itemR(field, "strength")
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2009-08-22 08:48:01 +00:00
|
|
|
#if field.type in ('HARMONIC', 'SPHERICAL', 'CHARGE', "LENNARDj"):
|
|
|
|
#if ob.type in ('MESH', 'SURFACE', 'FONT', 'CURVE'):
|
2009-07-19 11:28:43 +00:00
|
|
|
#layout.itemR(field, "surface")
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
class PHYSICS_PT_collision(PhysicButtonsPanel):
|
|
|
|
__label__ = "Collision"
|
2009-07-04 08:50:41 +00:00
|
|
|
__default_closed__ = True
|
2009-07-03 14:11:00 +00:00
|
|
|
|
|
|
|
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-08-15 14:16:50 +00:00
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
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.collision
|
|
|
|
|
2009-07-04 08:50:41 +00:00
|
|
|
split = layout.split()
|
2009-08-15 14:16:50 +00:00
|
|
|
split.operator_context = 'EXEC_DEFAULT'
|
|
|
|
|
|
|
|
if md:
|
|
|
|
# remove modifier + settings
|
|
|
|
split.set_context_pointer("modifier", md)
|
|
|
|
split.itemO("object.modifier_remove", text="Remove")
|
|
|
|
col = split.column()
|
|
|
|
|
|
|
|
#row = split.row(align=True)
|
|
|
|
#row.itemR(md, "render", text="")
|
|
|
|
#row.itemR(md, "realtime", text="")
|
|
|
|
|
2009-09-14 12:16:35 +00:00
|
|
|
settings = md.settings
|
2009-08-15 14:16:50 +00:00
|
|
|
|
|
|
|
else:
|
|
|
|
# add modifier
|
|
|
|
split.item_enumO("object.modifier_add", "type", 'COLLISION', text="Add")
|
|
|
|
split.itemL()
|
|
|
|
|
2009-09-14 12:16:35 +00:00
|
|
|
settings = None
|
2009-08-15 14:16:50 +00:00
|
|
|
|
2009-09-14 12:16:35 +00:00
|
|
|
if settings:
|
2009-08-15 14:16:50 +00:00
|
|
|
layout.active = settings.enabled
|
|
|
|
|
|
|
|
split = layout.split()
|
2009-07-04 08:50:41 +00:00
|
|
|
|
2009-08-15 14:16:50 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Particle:")
|
|
|
|
col.itemR(settings, "permeability", slider=True)
|
|
|
|
col.itemL(text="Particle Damping:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(settings, "damping_factor", text="Factor", slider=True)
|
|
|
|
sub.itemR(settings, "random_damping", text="Random", slider=True)
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-08-15 14:16:50 +00:00
|
|
|
col.itemL(text="Soft Body and Cloth:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(settings, "outer_thickness", text="Outer", slider=True)
|
|
|
|
sub.itemR(settings, "inner_thickness", text="Inner", slider=True)
|
2009-07-19 11:28:43 +00:00
|
|
|
|
2009-08-15 14:16:50 +00:00
|
|
|
layout.itemL(text="Force Fields:")
|
2009-09-21 21:19:58 +00:00
|
|
|
layout.itemR(settings, "absorption", text="Absorption")
|
2009-07-03 20:03:24 +00:00
|
|
|
|
2009-08-15 14:16:50 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="")
|
|
|
|
col.itemR(settings, "kill_particles")
|
|
|
|
col.itemL(text="Particle Friction:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.itemR(settings, "friction_factor", text="Factor", slider=True)
|
|
|
|
sub.itemR(settings, "random_friction", text="Random", slider=True)
|
|
|
|
col.itemL(text="Soft Body Damping:")
|
|
|
|
col.itemR(settings, "damping", text="Factor", slider=True)
|
2009-07-03 20:03:24 +00:00
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
bpy.types.register(PHYSICS_PT_field)
|
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_collision)
|