1
# ##### BEGIN GPL LICENSE BLOCK #####
3
# This program is free software; you can redistribute it and/or
4
# modify it under the terms of the GNU General Public License
5
# as published by the Free Software Foundation; either version 2
6
# of the License, or (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software Foundation,
15
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
# ##### END GPL LICENSE BLOCK #####
21
from bpy.types import Panel
23
from bl_ui.properties_physics_common import (
24
basic_force_field_settings_ui,
25
basic_force_field_falloff_ui,
29
class PhysicButtonsPanel():
30
bl_space_type = 'PROPERTIES'
31
bl_region_type = 'WINDOW'
32
bl_context = "physics"
35
def poll(cls, context):
36
rd = context.scene.render
37
return (context.object) and (not rd.use_game_engine)
40
class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
41
bl_label = "Force Fields"
44
def poll(cls, context):
46
rd = context.scene.render
47
return (not rd.use_game_engine) and (ob.field) and (ob.field.type != 'NONE')
49
def draw(self, context):
55
split = layout.split(percentage=0.2)
56
split.label(text="Type:")
58
split.prop(field, "type", text="")
60
if field.type not in {'NONE', 'GUIDE', 'TEXTURE'}:
61
split = layout.split(percentage=0.2)
62
split.label(text="Shape:")
63
split.prop(field, "shape", text="")
64
elif field.type == 'TEXTURE':
65
split = layout.split(percentage=0.2)
66
split.label(text="Texture:")
67
split.row().template_ID(field, "texture", new="texture.new")
69
split = layout.split()
71
if field.type == 'NONE':
72
return # nothing to draw
73
elif field.type == 'GUIDE':
75
col.prop(field, "guide_minimum")
76
col.prop(field, "guide_free")
77
col.prop(field, "falloff_power")
78
col.prop(field, "use_guide_path_add")
79
col.prop(field, "use_guide_path_weight")
82
col.label(text="Clumping:")
83
col.prop(field, "guide_clump_amount")
84
col.prop(field, "guide_clump_shape")
87
row.prop(field, "use_max_distance")
89
sub.active = field.use_max_distance
90
sub.prop(field, "distance_max")
94
layout.prop(field, "guide_kink_type")
95
if (field.guide_kink_type != 'NONE'):
96
layout.prop(field, "guide_kink_axis")
98
split = layout.split()
101
col.prop(field, "guide_kink_frequency")
102
col.prop(field, "guide_kink_shape")
105
col.prop(field, "guide_kink_amplitude")
107
elif field.type == 'TEXTURE':
109
col.prop(field, "strength")
110
col.prop(field, "texture_mode", text="")
111
col.prop(field, "texture_nabla")
114
col.prop(field, "use_object_coords")
115
col.prop(field, "use_root_coords")
116
col.prop(field, "use_2d_force")
118
basic_force_field_settings_ui(self, context, field)
120
if field.type not in {'NONE', 'GUIDE'}:
122
layout.label(text="Falloff:")
123
layout.prop(field, "falloff_type", expand=True)
125
basic_force_field_falloff_ui(self, context, field)
127
if field.falloff_type == 'CONE':
130
split = layout.split(percentage=0.35)
133
col.label(text="Angular:")
134
col.prop(field, "use_radial_min", text="Use Minimum")
135
col.prop(field, "use_radial_max", text="Use Maximum")
138
col.prop(field, "radial_falloff", text="Power")
141
sub.active = field.use_radial_min
142
sub.prop(field, "radial_min", text="Angle")
145
sub.active = field.use_radial_max
146
sub.prop(field, "radial_max", text="Angle")
148
elif field.falloff_type == 'TUBE':
151
split = layout.split(percentage=0.35)
154
col.label(text="Radial:")
155
col.prop(field, "use_radial_min", text="Use Minimum")
156
col.prop(field, "use_radial_max", text="Use Maximum")
159
col.prop(field, "radial_falloff", text="Power")
162
sub.active = field.use_radial_min
163
sub.prop(field, "radial_min", text="Distance")
166
sub.active = field.use_radial_max
167
sub.prop(field, "radial_max", text="Distance")
170
class PHYSICS_PT_collision(PhysicButtonsPanel, Panel):
171
bl_label = "Collision"
172
#bl_options = {'DEFAULT_CLOSED'}
175
def poll(cls, context):
177
rd = context.scene.render
178
return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.collision)
180
def draw(self, context):
183
md = context.collision
185
split = layout.split()
190
settings = context.object.collision
192
layout.active = settings.use
194
split = layout.split()
197
col.label(text="Particle:")
198
col.prop(settings, "permeability", slider=True)
199
col.prop(settings, "stickness")
200
col.prop(settings, "use_particle_kill")
201
col.label(text="Particle Damping:")
202
sub = col.column(align=True)
203
sub.prop(settings, "damping_factor", text="Factor", slider=True)
204
sub.prop(settings, "damping_random", text="Random", slider=True)
206
col.label(text="Particle Friction:")
207
sub = col.column(align=True)
208
sub.prop(settings, "friction_factor", text="Factor", slider=True)
209
sub.prop(settings, "friction_random", text="Random", slider=True)
212
col.label(text="Soft Body and Cloth:")
213
sub = col.column(align=True)
214
sub.prop(settings, "thickness_outer", text="Outer", slider=True)
215
sub.prop(settings, "thickness_inner", text="Inner", slider=True)
217
col.label(text="Soft Body Damping:")
218
col.prop(settings, "damping", text="Factor", slider=True)
220
col.label(text="Force Fields:")
221
col.prop(settings, "absorption", text="Absorption")
223
if __name__ == "__main__": # only for live edit.
224
bpy.utils.register_module(__name__)