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 #####
22
narrowui = bpy.context.user_preferences.view.properties_width_check
26
class DataButtonsPanel(bpy.types.Panel):
27
bl_space_type = 'PROPERTIES'
28
bl_region_type = 'WINDOW'
29
bl_context = "modifier"
32
class DATA_PT_modifiers(DataButtonsPanel):
33
bl_label = "Modifiers"
35
def draw(self, context):
39
wide_ui = context.region.width > narrowui
40
compact_mod = context.region.width < narrowmod
42
layout.operator_menu_enum("object.modifier_add", "type")
44
for md in ob.modifiers:
45
box = layout.template_modifier(md, compact=compact_mod)
47
# match enum type to our functions, avoids a lookup table.
48
getattr(self, md.type)(box, ob, md, wide_ui)
50
# the mt.type enum is (ab)used for a lookup on function names
51
# ...to avoid lengthy if statements
52
# so each type must have a function here.
54
def ARMATURE(self, layout, ob, md, wide_ui):
55
split = layout.split()
58
col.label(text="Object:")
59
col.prop(md, "object", text="")
63
col.label(text="Vertex Group::")
64
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
66
sub.active = bool(md.vertex_group)
67
sub.prop(md, "invert")
69
split = layout.split()
72
col.label(text="Bind To:")
73
col.prop(md, "use_vertex_groups", text="Vertex Groups")
74
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
78
col.label(text="Deformation:")
79
col.prop(md, "quaternion")
80
col.prop(md, "multi_modifier")
82
def ARRAY(self, layout, ob, md, wide_ui):
84
layout.prop(md, "fit_type")
86
layout.prop(md, "fit_type", text="")
89
if md.fit_type == 'FIXED_COUNT':
90
layout.prop(md, "count")
91
elif md.fit_type == 'FIT_LENGTH':
92
layout.prop(md, "length")
93
elif md.fit_type == 'FIT_CURVE':
94
layout.prop(md, "curve")
98
split = layout.split()
101
col.prop(md, "constant_offset")
103
sub.active = md.constant_offset
104
sub.prop(md, "constant_offset_displacement", text="")
108
col.prop(md, "merge_adjacent_vertices", text="Merge")
110
sub.active = md.merge_adjacent_vertices
111
sub.prop(md, "merge_end_vertices", text="First Last")
112
sub.prop(md, "merge_distance", text="Distance")
116
col.prop(md, "relative_offset")
118
sub.active = md.relative_offset
119
sub.prop(md, "relative_offset_displacement", text="")
123
col.prop(md, "add_offset_object")
125
sub.active = md.add_offset_object
126
sub.prop(md, "offset_object", text="")
130
col = layout.column()
131
col.prop(md, "start_cap")
132
col.prop(md, "end_cap")
134
def BEVEL(self, layout, ob, md, wide_ui):
135
split = layout.split()
138
col.prop(md, "width")
142
col.prop(md, "only_vertices")
144
layout.label(text="Limit Method:")
145
layout.row().prop(md, "limit_method", expand=True)
146
if md.limit_method == 'ANGLE':
147
layout.prop(md, "angle")
148
elif md.limit_method == 'WEIGHT':
149
layout.row().prop(md, "edge_weight_method", expand=True)
151
def BOOLEAN(self, layout, ob, md, wide_ui):
152
split = layout.split()
155
col.label(text="Operation:")
156
col.prop(md, "operation", text="")
160
col.label(text="Object:")
161
col.prop(md, "object", text="")
163
def BUILD(self, layout, ob, md, wide_ui):
164
split = layout.split()
167
col.prop(md, "frame_start")
168
col.prop(md, "length")
172
col.prop(md, "randomize")
174
sub.active = md.randomize
177
def CAST(self, layout, ob, md, wide_ui):
178
split = layout.split(percentage=0.25)
181
split.label(text="Cast Type:")
182
split.prop(md, "cast_type", text="")
184
layout.prop(md, "cast_type", text="")
186
split = layout.split(percentage=0.25)
194
col.prop(md, "factor")
195
col.prop(md, "radius")
197
col.prop(md, "from_radius")
199
split = layout.split()
202
col.label(text="Vertex Group:")
203
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
206
col.label(text="Control Object:")
207
col.prop(md, "object", text="")
209
col.prop(md, "use_transform")
211
def CLOTH(self, layout, ob, md, wide_ui):
212
layout.label(text="See Cloth panel.")
214
def COLLISION(self, layout, ob, md, wide_ui):
215
layout.label(text="See Collision panel.")
217
def CURVE(self, layout, ob, md, wide_ui):
218
split = layout.split()
221
col.label(text="Object:")
222
col.prop(md, "object", text="")
225
col.label(text="Vertex Group:")
226
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
227
layout.label(text="Deformation Axis:")
228
layout.row().prop(md, "deform_axis", expand=True)
230
def DECIMATE(self, layout, ob, md, wide_ui):
231
layout.prop(md, "ratio")
232
layout.label(text="Face Count: %s" % str(md.face_count))
234
def DISPLACE(self, layout, ob, md, wide_ui):
235
split = layout.split()
238
col.label(text="Texture:")
239
col.prop(md, "texture", text="")
240
col.label(text="Vertex Group:")
241
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
245
col.label(text="Direction:")
246
col.prop(md, "direction", text="")
247
col.label(text="Texture Coordinates:")
248
col.prop(md, "texture_coordinates", text="")
249
if md.texture_coordinates == 'OBJECT':
250
layout.prop(md, "texture_coordinate_object", text="Object")
251
elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
252
layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
256
split = layout.split()
259
col.prop(md, "midlevel")
263
col.prop(md, "strength")
265
def EDGE_SPLIT(self, layout, ob, md, wide_ui):
266
split = layout.split()
269
col.prop(md, "use_edge_angle", text="Edge Angle")
271
sub.active = md.use_edge_angle
272
sub.prop(md, "split_angle")
276
col.prop(md, "use_sharp", text="Sharp Edges")
278
def EXPLODE(self, layout, ob, md, wide_ui):
279
split = layout.split()
282
col.label(text="Vertex group:")
283
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
285
sub.active = bool(md.vertex_group)
286
sub.prop(md, "protect")
290
col.prop(md, "split_edges")
291
col.prop(md, "unborn")
292
col.prop(md, "alive")
296
layout.operator("object.explode_refresh", text="Refresh")
298
def FLUID_SIMULATION(self, layout, ob, md, wide_ui):
299
layout.label(text="See Fluid panel.")
301
def HOOK(self, layout, ob, md, wide_ui):
302
split = layout.split()
305
col.label(text="Object:")
306
col.prop(md, "object", text="")
307
if md.object and md.object.type == 'ARMATURE':
308
col.label(text="Bone:")
309
col.prop_object(md, "subtarget", md.object.data, "bones", text="")
312
col.label(text="Vertex Group:")
313
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
317
split = layout.split()
320
col.prop(md, "falloff")
321
col.prop(md, "force", slider=True)
326
col.operator("object.hook_reset", text="Reset")
327
col.operator("object.hook_recenter", text="Recenter")
329
if ob.mode == 'EDIT':
332
row.operator("object.hook_select", text="Select")
333
row.operator("object.hook_assign", text="Assign")
335
def LATTICE(self, layout, ob, md, wide_ui):
336
split = layout.split()
339
col.label(text="Object:")
340
col.prop(md, "object", text="")
344
col.label(text="Vertex Group:")
345
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
347
def MASK(self, layout, ob, md, wide_ui):
348
split = layout.split()
351
col.label(text="Mode:")
352
col.prop(md, "mode", text="")
355
if md.mode == 'ARMATURE':
356
col.label(text="Armature:")
357
col.prop(md, "armature", text="")
358
elif md.mode == 'VERTEX_GROUP':
359
col.label(text="Vertex Group:")
360
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
363
sub.active = bool(md.vertex_group)
364
sub.prop(md, "invert")
366
def MESH_DEFORM(self, layout, ob, md, wide_ui):
367
split = layout.split()
370
sub.label(text="Object:")
371
sub.prop(md, "object", text="")
372
sub.active = not md.is_bound
375
col.label(text="Vertex Group:")
376
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
379
sub.active = bool(md.vertex_group)
380
sub.prop(md, "invert")
385
layout.operator("object.meshdeform_bind", text="Unbind")
387
layout.operator("object.meshdeform_bind", text="Bind")
389
split = layout.split()
392
col.prop(md, "precision")
396
col.prop(md, "dynamic")
398
def MIRROR(self, layout, ob, md, wide_ui):
399
layout.prop(md, "merge_limit")
401
split = layout.split(percentage=0.25)
403
split = layout.split(percentage=0.4)
406
col.label(text="Axis:")
414
subsplit = layout.split()
415
col = subsplit.column()
416
col.label(text="Options:")
417
col.prop(md, "clip", text="Clipping")
418
col.prop(md, "mirror_vertex_groups", text="Vertex Groups")
421
col.label(text="Textures:")
422
col.prop(md, "mirror_u", text="U")
423
col.prop(md, "mirror_v", text="V")
425
col = layout.column()
426
col.label(text="Mirror Object:")
427
col.prop(md, "mirror_object", text="")
429
def MULTIRES(self, layout, ob, md, wide_ui):
431
layout.row().prop(md, "subdivision_type", expand=True)
433
layout.row().prop(md, "subdivision_type", text="")
435
split = layout.split()
437
col.prop(md, "levels", text="Preview")
438
col.prop(md, "sculpt_levels", text="Sculpt")
439
col.prop(md, "render_levels", text="Render")
440
col.prop(bpy.context.tool_settings.sculpt, "fast_navigate")
445
col.enabled = ob.mode != 'EDIT'
446
col.operator("object.multires_subdivide", text="Subdivide")
447
col.operator("object.multires_higher_levels_delete", text="Delete Higher")
448
col.operator("object.multires_reshape", text="Reshape")
449
col.prop(md, "optimal_display")
453
col = layout.column()
456
row.operator("object.multires_external_pack", text="Pack External")
459
row.prop(md, "filepath", text="")
461
row.operator("object.multires_external_save", text="Save External...")
464
def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):
465
layout.prop(md, "object")
466
layout.prop(md, "particle_system_number", text="Particle System")
468
split = layout.split()
470
col.label(text="Create From:")
471
col.prop(md, "normal")
472
col.prop(md, "children")
477
col.label(text="Show Particles When:")
478
col.prop(md, "alive")
479
col.prop(md, "unborn")
484
layout.prop(md, "use_path", text="Create Along Paths")
486
split = layout.split()
487
split.active = md.use_path
489
col.row().prop(md, "axis", expand=True)
490
col.prop(md, "keep_shape")
494
col.prop(md, "position", slider=True)
495
col.prop(md, "random_position", text="Random", slider=True)
497
def PARTICLE_SYSTEM(self, layout, ob, md, wide_ui):
498
layout.label(text="See Particle panel.")
500
def SCREW(self, layout, ob, md, wide_ui):
501
split = layout.split()
505
col.prop(md, "object", text="AxisOb")
506
col.prop(md, "angle")
507
col.prop(md, "steps")
508
col.prop(md, "render_steps")
513
row.active = (md.object is None or md.use_object_screw_offset == False)
514
row.prop(md, "screw_offset")
516
row.active = (md.object is not None)
517
row.prop(md, "use_object_screw_offset")
518
col.prop(md, "use_normal_calculate")
519
col.prop(md, "use_normal_flip")
520
col.prop(md, "iterations")
522
def SHRINKWRAP(self, layout, ob, md, wide_ui):
523
split = layout.split()
525
col.label(text="Target:")
526
col.prop(md, "target", text="")
529
col.label(text="Vertex Group:")
530
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
532
split = layout.split()
535
col.prop(md, "offset")
536
col.prop(md, "subsurf_levels")
540
col.label(text="Mode:")
541
col.prop(md, "mode", text="")
544
split = layout.split(percentage=0.25)
546
split = layout.split(percentage=0.35)
549
if md.mode == 'PROJECT':
550
col.label(text="Axis:")
556
col.label(text="Direction:")
557
col.prop(md, "negative")
558
col.prop(md, "positive")
563
subsplit = layout.split()
564
col = subsplit.column()
565
col.label(text="Cull Faces:")
566
col.prop(md, "cull_front_faces", text="Front")
567
col.prop(md, "cull_back_faces", text="Back")
569
layout.label(text="Auxiliary Target:")
570
layout.prop(md, "auxiliary_target", text="")
572
elif md.mode == 'NEAREST_SURFACEPOINT':
573
layout.prop(md, "keep_above_surface")
575
def SIMPLE_DEFORM(self, layout, ob, md, wide_ui):
576
split = layout.split()
579
col.label(text="Mode:")
580
col.prop(md, "mode", text="")
584
col.label(text="Vertex Group:")
585
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
587
split = layout.split()
590
col.label(text="Origin:")
591
col.prop(md, "origin", text="")
593
sub.active = (md.origin != "")
594
sub.prop(md, "relative")
598
col.label(text="Deform:")
599
col.prop(md, "factor")
600
col.prop(md, "limits", slider=True)
601
if md.mode in ('TAPER', 'STRETCH'):
602
col.prop(md, "lock_x_axis")
603
col.prop(md, "lock_y_axis")
605
def SMOKE(self, layout, ob, md, wide_ui):
606
layout.label(text="See Smoke panel.")
608
def SMOOTH(self, layout, ob, md, wide_ui):
609
split = layout.split(percentage=0.25)
612
col.label(text="Axis:")
618
col.prop(md, "factor")
619
col.prop(md, "repeat")
620
col.label(text="Vertex Group:")
621
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
623
def SOFT_BODY(self, layout, ob, md, wide_ui):
624
layout.label(text="See Soft Body panel.")
626
def SOLIDIFY(self, layout, ob, md, wide_ui):
628
split = layout.split()
631
col.prop(md, "thickness")
632
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
634
col.label(text="Crease:")
635
col.prop(md, "edge_crease_inner", text="Inner")
636
col.prop(md, "edge_crease_outer", text="Outer")
637
col.prop(md, "edge_crease_rim", text="Rim")
642
col.prop(md, "offset")
643
colsub = col.column()
644
colsub.active = (md.vertex_group is not "")
645
colsub.prop(md, "invert", text="Invert")
647
col.prop(md, "use_even_offset")
648
col.prop(md, "use_quality_normals")
650
col.prop(md, "use_rim")
651
colsub = col.column()
652
colsub.active = md.use_rim
653
colsub.prop(md, "use_rim_material")
655
# col = layout.column()
656
# col.label(text="Vertex Group:")
657
# col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
659
def SUBSURF(self, layout, ob, md, wide_ui):
661
layout.row().prop(md, "subdivision_type", expand=True)
663
layout.row().prop(md, "subdivision_type", text="")
665
split = layout.split()
667
col.label(text="Subdivisions:")
668
col.prop(md, "levels", text="View")
669
col.prop(md, "render_levels", text="Render")
673
col.label(text="Options:")
674
col.prop(md, "subsurf_uv")
675
col.prop(md, "optimal_display")
677
def SURFACE(self, layout, ob, md, wide_ui):
678
layout.label(text="See Fields panel.")
680
def UV_PROJECT(self, layout, ob, md, wide_ui):
681
if ob.type == 'MESH':
682
split = layout.split()
685
col.label(text="Image:")
686
col.prop(md, "image", text="")
690
col.label(text="UV Layer:")
691
col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="")
693
split = layout.split()
695
col.prop(md, "override_image")
696
col.prop(md, "num_projectors", text="Projectors")
697
for proj in md.projectors:
698
col.prop(proj, "object", text="")
702
sub = col.column(align=True)
703
sub.prop(md, "aspect_x", text="Aspect X")
704
sub.prop(md, "aspect_y", text="Aspect Y")
706
sub = col.column(align=True)
707
sub.prop(md, "scale_x", text="Scale X")
708
sub.prop(md, "scale_y", text="Scale Y")
710
def WAVE(self, layout, ob, md, wide_ui):
711
split = layout.split()
714
col.label(text="Motion:")
717
col.prop(md, "cyclic")
721
col.prop(md, "normals")
723
sub.active = md.normals
724
sub.prop(md, "x_normal", text="X")
725
sub.prop(md, "y_normal", text="Y")
726
sub.prop(md, "z_normal", text="Z")
728
split = layout.split()
731
col.label(text="Time:")
732
sub = col.column(align=True)
733
sub.prop(md, "time_offset", text="Offset")
734
sub.prop(md, "lifetime", text="Life")
735
col.prop(md, "damping_time", text="Damping")
739
col.label(text="Position:")
740
sub = col.column(align=True)
741
sub.prop(md, "start_position_x", text="X")
742
sub.prop(md, "start_position_y", text="Y")
743
col.prop(md, "falloff_radius", text="Falloff")
747
layout.prop(md, "start_position_object")
748
layout.prop_object(md, "vertex_group", ob, "vertex_groups")
749
layout.prop(md, "texture")
750
layout.prop(md, "texture_coordinates")
751
if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
752
layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
753
elif md.texture_coordinates == 'OBJECT':
754
layout.prop(md, "texture_coordinates_object")
758
split = layout.split()
761
col.prop(md, "speed", slider=True)
762
col.prop(md, "height", slider=True)
766
col.prop(md, "width", slider=True)
767
col.prop(md, "narrowness", slider=True)
775
register = bpy.types.register
781
unregister = bpy.types.unregister
785
if __name__ == "__main__":