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")
444 col.enabled = ob.mode != 'EDIT'
445 col.operator("object.multires_subdivide", text="Subdivide")
446 col.operator("object.multires_higher_levels_delete", text="Delete Higher")
447 col.operator("object.multires_reshape", text="Reshape")
448 col.prop(md, "optimal_display")
452 col = layout.column()
455 row.operator("object.multires_external_pack", text="Pack External")
458 row.prop(md, "filepath", text="")
460 row.operator("object.multires_external_save", text="Save External...")
463 def NAVMESH(self, layout, ob, md, wide_ui):
464 layout.label(text="Rasterization:")
465 split = layout.split()
468 col.prop(md, "cellsize")
471 col.prop(md, "cellheight")
475 layout.label(text="Agent:")
476 split = layout.split()
479 row.prop(md, "agentheight")
481 row.prop(md, "agentradius")
485 row.prop(md, "agentmaxslope")
487 row.prop(md, "agentmaxclimb")
491 layout.label(text="Region:")
492 split = layout.split()
494 col.prop(md, "regionminsize")
497 col.prop(md, "regionmergesize")
501 layout.label(text="Polygonization:")
502 split = layout.split()
505 row.prop(md, "edgemaxlen")
507 row.prop(md, "edgemaxerror")
511 row.prop(md, "vertsperpoly")
515 layout.label(text="Detail Mesh:")
516 split = layout.split()
518 col.prop(md, "detailsampledist")
521 col.prop(md, "detailsamplemaxerror")
524 def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):
525 layout.prop(md, "object")
526 layout.prop(md, "particle_system_number", text="Particle System")
528 split = layout.split()
530 col.label(text="Create From:")
531 col.prop(md, "normal")
532 col.prop(md, "children")
537 col.label(text="Show Particles When:")
538 col.prop(md, "alive")
539 col.prop(md, "unborn")
544 layout.prop(md, "use_path", text="Create Along Paths")
546 split = layout.split()
547 split.active = md.use_path
549 col.row().prop(md, "axis", expand=True)
550 col.prop(md, "keep_shape")
554 col.prop(md, "position", slider=True)
555 col.prop(md, "random_position", text="Random", slider=True)
557 def PARTICLE_SYSTEM(self, layout, ob, md, wide_ui):
558 layout.label(text="See Particle panel.")
560 def SCREW(self, layout, ob, md, wide_ui):
561 split = layout.split()
565 col.prop(md, "object", text="AxisOb")
566 col.prop(md, "angle")
567 col.prop(md, "steps")
568 col.prop(md, "render_steps")
573 row.active = (md.object is None or md.use_object_screw_offset == False)
574 row.prop(md, "screw_offset")
576 row.active = (md.object is not None)
577 row.prop(md, "use_object_screw_offset")
578 col.prop(md, "use_normal_calculate")
579 col.prop(md, "use_normal_flip")
580 col.prop(md, "iterations")
582 def SHRINKWRAP(self, layout, ob, md, wide_ui):
583 split = layout.split()
585 col.label(text="Target:")
586 col.prop(md, "target", text="")
589 col.label(text="Vertex Group:")
590 col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
592 split = layout.split()
595 col.prop(md, "offset")
596 col.prop(md, "subsurf_levels")
600 col.label(text="Mode:")
601 col.prop(md, "mode", text="")
604 split = layout.split(percentage=0.25)
606 split = layout.split(percentage=0.35)
609 if md.mode == 'PROJECT':
610 col.label(text="Axis:")
616 col.label(text="Direction:")
617 col.prop(md, "negative")
618 col.prop(md, "positive")
623 subsplit = layout.split()
624 col = subsplit.column()
625 col.label(text="Cull Faces:")
626 col.prop(md, "cull_front_faces", text="Front")
627 col.prop(md, "cull_back_faces", text="Back")
629 layout.label(text="Auxiliary Target:")
630 layout.prop(md, "auxiliary_target", text="")
632 elif md.mode == 'NEAREST_SURFACEPOINT':
633 layout.prop(md, "keep_above_surface")
635 def SIMPLE_DEFORM(self, layout, ob, md, wide_ui):
636 split = layout.split()
639 col.label(text="Mode:")
640 col.prop(md, "mode", text="")
644 col.label(text="Vertex Group:")
645 col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
647 split = layout.split()
650 col.label(text="Origin:")
651 col.prop(md, "origin", text="")
653 sub.active = (md.origin != "")
654 sub.prop(md, "relative")
658 col.label(text="Deform:")
659 col.prop(md, "factor")
660 col.prop(md, "limits", slider=True)
661 if md.mode in ('TAPER', 'STRETCH'):
662 col.prop(md, "lock_x_axis")
663 col.prop(md, "lock_y_axis")
665 def SMOKE(self, layout, ob, md, wide_ui):
666 layout.label(text="See Smoke panel.")
668 def SMOOTH(self, layout, ob, md, wide_ui):
669 split = layout.split(percentage=0.25)
672 col.label(text="Axis:")
678 col.prop(md, "factor")
679 col.prop(md, "repeat")
680 col.label(text="Vertex Group:")
681 col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
683 def SOFT_BODY(self, layout, ob, md, wide_ui):
684 layout.label(text="See Soft Body panel.")
686 def SOLIDIFY(self, layout, ob, md, wide_ui):
688 split = layout.split()
691 col.prop(md, "thickness")
692 col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
694 col.label(text="Crease:")
695 col.prop(md, "edge_crease_inner", text="Inner")
696 col.prop(md, "edge_crease_outer", text="Outer")
697 col.prop(md, "edge_crease_rim", text="Rim")
702 col.prop(md, "offset")
703 colsub = col.column()
704 colsub.active = (md.vertex_group is not "")
705 colsub.prop(md, "invert", text="Invert")
707 col.prop(md, "use_even_offset")
708 col.prop(md, "use_quality_normals")
710 col.prop(md, "use_rim")
711 colsub = col.column()
712 colsub.active = md.use_rim
713 colsub.prop(md, "use_rim_material")
715 # col = layout.column()
716 # col.label(text="Vertex Group:")
717 # col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
719 def SUBSURF(self, layout, ob, md, wide_ui):
721 layout.row().prop(md, "subdivision_type", expand=True)
723 layout.row().prop(md, "subdivision_type", text="")
725 split = layout.split()
727 col.label(text="Subdivisions:")
728 col.prop(md, "levels", text="View")
729 col.prop(md, "render_levels", text="Render")
733 col.label(text="Options:")
734 col.prop(md, "subsurf_uv")
735 col.prop(md, "optimal_display")
737 def SURFACE(self, layout, ob, md, wide_ui):
738 layout.label(text="See Fields panel.")
740 def UV_PROJECT(self, layout, ob, md, wide_ui):
741 if ob.type == 'MESH':
742 split = layout.split()
745 col.label(text="Image:")
746 col.prop(md, "image", text="")
750 col.label(text="UV Layer:")
751 col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="")
753 split = layout.split()
755 col.prop(md, "override_image")
756 col.prop(md, "num_projectors", text="Projectors")
757 for proj in md.projectors:
758 col.prop(proj, "object", text="")
762 sub = col.column(align=True)
763 sub.prop(md, "aspect_x", text="Aspect X")
764 sub.prop(md, "aspect_y", text="Aspect Y")
766 sub = col.column(align=True)
767 sub.prop(md, "scale_x", text="Scale X")
768 sub.prop(md, "scale_y", text="Scale Y")
770 def WAVE(self, layout, ob, md, wide_ui):
771 split = layout.split()
774 col.label(text="Motion:")
777 col.prop(md, "cyclic")
781 col.prop(md, "normals")
783 sub.active = md.normals
784 sub.prop(md, "x_normal", text="X")
785 sub.prop(md, "y_normal", text="Y")
786 sub.prop(md, "z_normal", text="Z")
788 split = layout.split()
791 col.label(text="Time:")
792 sub = col.column(align=True)
793 sub.prop(md, "time_offset", text="Offset")
794 sub.prop(md, "lifetime", text="Life")
795 col.prop(md, "damping_time", text="Damping")
799 col.label(text="Position:")
800 sub = col.column(align=True)
801 sub.prop(md, "start_position_x", text="X")
802 sub.prop(md, "start_position_y", text="Y")
803 col.prop(md, "falloff_radius", text="Falloff")
807 layout.prop(md, "start_position_object")
808 layout.prop_object(md, "vertex_group", ob, "vertex_groups")
809 layout.prop(md, "texture")
810 layout.prop(md, "texture_coordinates")
811 if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
812 layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
813 elif md.texture_coordinates == 'OBJECT':
814 layout.prop(md, "texture_coordinates_object")
818 split = layout.split()
821 col.prop(md, "speed", slider=True)
822 col.prop(md, "height", slider=True)
826 col.prop(md, "width", slider=True)
827 col.prop(md, "narrowness", slider=True)
835 register = bpy.types.register
841 unregister = bpy.types.unregister
845 if __name__ == "__main__":