2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-11-01 15:21:20 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
2009-10-31 20:16:59 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
# <pep8 compliant>
|
2009-08-06 14:23:48 +00:00
|
|
|
import bpy
|
|
|
|
|
2009-11-19 12:58:19 +00:00
|
|
|
narrowui = 180
|
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-10-31 19:57:59 +00:00
|
|
|
from properties_physics_common import point_cache_ui
|
|
|
|
from properties_physics_common import effector_weights_ui
|
2009-08-29 15:20:36 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-06 14:23:48 +00:00
|
|
|
class PhysicButtonsPanel(bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "physics"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
ob = context.object
|
2010-02-23 12:48:35 +00:00
|
|
|
rd = context.scene.render
|
2009-10-31 19:31:45 +00:00
|
|
|
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-06 14:23:48 +00:00
|
|
|
class PHYSICS_PT_smoke(PhysicButtonsPanel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Smoke"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
md = context.smoke
|
|
|
|
ob = context.object
|
2009-11-19 13:26:51 +00:00
|
|
|
wide_ui = context.region.width > narrowui
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
split.operator_context = 'EXEC_DEFAULT'
|
|
|
|
|
|
|
|
if md:
|
|
|
|
# remove modifier + settings
|
|
|
|
split.set_context_pointer("modifier", md)
|
2009-11-23 00:27:30 +00:00
|
|
|
split.operator("object.modifier_remove", text="Remove")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
row = split.row(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
row.prop(md, "render", text="")
|
|
|
|
row.prop(md, "realtime", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
else:
|
|
|
|
# add modifier
|
2009-11-23 11:43:38 +00:00
|
|
|
split.operator("object.modifier_add", text="Add").type = 'SMOKE'
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-23 00:27:30 +00:00
|
|
|
split.label()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if md:
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(md, "smoke_type", expand=True)
|
2009-11-19 12:58:19 +00:00
|
|
|
else:
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.prop(md, "smoke_type", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if md.smoke_type == 'TYPE_DOMAIN':
|
|
|
|
|
|
|
|
domain = md.domain_settings
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Resolution:")
|
|
|
|
col.prop(domain, "maxres", text="Divisions")
|
2010-01-25 15:24:48 +00:00
|
|
|
col.label(text="Particle:")
|
|
|
|
col.prop(domain, "initial_velocity", text="Initial Velocity")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-19 23:59:37 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Behavior:")
|
|
|
|
col.prop(domain, "alpha")
|
|
|
|
col.prop(domain, "beta")
|
|
|
|
col.prop(domain, "dissolve_smoke", text="Dissolve")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = domain.dissolve_smoke
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(domain, "dissolve_speed", text="Time")
|
|
|
|
sub.prop(domain, "dissolve_smoke_log", text="Slow")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif md.smoke_type == 'TYPE_FLOW':
|
|
|
|
|
|
|
|
flow = md.flow_settings
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(flow, "outflow")
|
|
|
|
col.label(text="Particle System:")
|
2009-11-23 11:43:38 +00:00
|
|
|
col.prop_object(flow, "psys", ob, "particle_systems", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if md.flow_settings.outflow:
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-19 12:58:19 +00:00
|
|
|
col = split.column()
|
2009-10-31 19:31:45 +00:00
|
|
|
else:
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-19 23:59:37 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Behavior:")
|
|
|
|
col.prop(flow, "temperature")
|
|
|
|
col.prop(flow, "density")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
#elif md.smoke_type == 'TYPE_COLL':
|
2009-11-23 00:27:30 +00:00
|
|
|
# layout.separator()
|
2009-09-09 18:39:40 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-20 00:33:59 +00:00
|
|
|
class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Smoke Groups"
|
|
|
|
bl_default_closed = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
md = context.smoke
|
|
|
|
return md and (md.smoke_type == 'TYPE_DOMAIN')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
group = context.smoke.domain_settings
|
2009-11-19 13:26:51 +00:00
|
|
|
wide_ui = context.region.width > narrowui
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Flow Group:")
|
|
|
|
col.prop(group, "fluid_group", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
#col.label(text="Effector Group:")
|
|
|
|
#col.prop(group, "eff_group", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-19 12:58:19 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Collision Group:")
|
|
|
|
col.prop(group, "coll_group", text="")
|
2009-09-09 18:39:40 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-20 00:33:59 +00:00
|
|
|
class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Smoke Cache"
|
|
|
|
bl_default_closed = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
md = context.smoke
|
|
|
|
return md and (md.smoke_type == 'TYPE_DOMAIN')
|
2009-08-20 00:33:59 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
2010-01-25 15:24:48 +00:00
|
|
|
layout = self.layout
|
2010-01-25 15:10:14 +00:00
|
|
|
|
|
|
|
domain = context.smoke.domain_settings
|
|
|
|
|
2010-01-25 15:24:48 +00:00
|
|
|
layout.label(text="Compression:")
|
|
|
|
layout.prop(domain, "smoke_cache_comp", expand=True)
|
2010-01-25 15:10:14 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
md = context.smoke.domain_settings
|
|
|
|
cache = md.point_cache_low
|
|
|
|
|
2009-11-22 17:41:35 +00:00
|
|
|
point_cache_ui(self, context, cache, (cache.baked is False), 0, 1)
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-20 00:33:59 +00:00
|
|
|
|
|
|
|
class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Smoke High Resolution"
|
|
|
|
bl_default_closed = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
md = context.smoke
|
|
|
|
return md and (md.smoke_type == 'TYPE_DOMAIN')
|
|
|
|
|
|
|
|
def draw_header(self, context):
|
|
|
|
high = context.smoke.domain_settings
|
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
self.layout.prop(high, "highres", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
md = context.smoke.domain_settings
|
2009-11-19 13:26:51 +00:00
|
|
|
wide_ui = context.region.width > narrowui
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Resolution:")
|
|
|
|
col.prop(md, "amplify", text="Divisions")
|
|
|
|
col.prop(md, "viewhighres")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-19 13:26:51 +00:00
|
|
|
if wide_ui:
|
2009-11-19 12:58:19 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Noise Method:")
|
|
|
|
col.row().prop(md, "noise_type", text="")
|
|
|
|
col.prop(md, "strength")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-20 00:33:59 +00:00
|
|
|
class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Smoke High Resolution Cache"
|
|
|
|
bl_default_closed = True
|
2009-08-20 00:33:59 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def poll(self, context):
|
|
|
|
md = context.smoke
|
|
|
|
return md and (md.smoke_type == 'TYPE_DOMAIN') and md.domain_settings.highres
|
2009-08-20 00:33:59 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
def draw(self, context):
|
2010-01-25 15:24:48 +00:00
|
|
|
layout = self.layout
|
2010-01-25 15:10:14 +00:00
|
|
|
|
|
|
|
domain = context.smoke.domain_settings
|
|
|
|
|
2010-01-25 15:24:48 +00:00
|
|
|
layout.label(text="Compression:")
|
|
|
|
layout.prop(domain, "smoke_cache_high_comp", expand=True)
|
2010-01-25 15:10:14 +00:00
|
|
|
|
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
md = context.smoke.domain_settings
|
|
|
|
cache = md.point_cache_high
|
|
|
|
|
2009-11-22 17:41:35 +00:00
|
|
|
point_cache_ui(self, context, cache, (cache.baked is False), 0, 1)
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2009-08-20 00:33:59 +00:00
|
|
|
|
2009-10-08 10:18:14 +00:00
|
|
|
class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Smoke Field Weights"
|
|
|
|
bl_default_closed = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
smoke = context.smoke
|
|
|
|
return (smoke and smoke.smoke_type == 'TYPE_DOMAIN')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
domain = context.smoke.domain_settings
|
2009-11-18 21:57:13 +00:00
|
|
|
effector_weights_ui(self, context, domain.effector_weights)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-02-14 11:21:21 +00:00
|
|
|
|
|
|
|
classes = [
|
|
|
|
PHYSICS_PT_smoke,
|
|
|
|
PHYSICS_PT_smoke_field_weights,
|
|
|
|
PHYSICS_PT_smoke_cache,
|
|
|
|
PHYSICS_PT_smoke_highres,
|
|
|
|
PHYSICS_PT_smoke_groups,
|
|
|
|
PHYSICS_PT_smoke_cache_highres]
|
|
|
|
|
|
|
|
|
|
|
|
def register():
|
|
|
|
register = bpy.types.register
|
|
|
|
for cls in classes:
|
|
|
|
register(cls)
|
|
|
|
|
2010-02-22 23:32:58 +00:00
|
|
|
|
2010-02-14 11:21:21 +00:00
|
|
|
def unregister():
|
|
|
|
unregister = bpy.types.unregister
|
|
|
|
for cls in classes:
|
|
|
|
unregister(cls)
|
2010-02-16 09:55:07 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
register()
|