4 class DataButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "modifier"
9 def poll(self, context):
11 return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
13 class DATA_PT_modifiers(DataButtonsPanel):
14 __idname__ = "DATA_PT_modifiers"
15 __label__ = "Modifiers"
17 def draw(self, context):
22 row.item_menu_enumO("OBJECT_OT_modifier_add", "type")
25 for md in ob.modifiers:
26 box = layout.template_modifier(md)
29 if md.type == 'ARMATURE':
30 self.armature(box, md)
31 if md.type == 'ARRAY':
33 if md.type == 'BEVEL':
35 if md.type == 'BOOLEAN':
37 if md.type == 'BUILD':
41 if md.type == 'CLOTH':
43 if md.type == 'COLLISION':
44 self.collision(box, md)
45 if md.type == 'CURVE':
47 if md.type == 'DECIMATE':
48 self.decimate(box, md)
49 if md.type == 'DISPLACE':
50 self.displace(box, md)
51 if md.type == 'EDGE_SPLIT':
52 self.edgesplit(box, md)
53 if md.type == 'EXPLODE':
55 if md.type == 'FLUID_SIMULATION':
59 if md.type == 'LATTICE':
63 if md.type == 'MESH_DEFORM':
64 self.mesh_deform(box, md)
65 if md.type == 'MIRROR':
67 if md.type == 'MULTIRES':
68 self.multires(box, md)
69 if md.type == 'PARTICLE_INSTANCE':
70 self.particleinstance(box, md)
71 if md.type == 'PARTICLE_SYSTEM':
72 self.particlesystem(box, md)
73 if md.type == 'SHRINKWRAP':
74 self.shrinkwrap(box, md)
75 if md.type == 'SIMPLE_DEFORM':
76 self.simpledeform(box, md)
77 if md.type == 'SMOOTH':
79 if md.type == 'SOFTBODY':
80 self.softbody(box, md)
81 if md.type == 'SUBSURF':
83 if md.type == 'UV_PROJECT':
84 self.uvproject(box, md)
88 def armature(self, layout, md):
89 layout.itemR(md, "object")
91 row.itemR(md, "vertex_group")
92 row.itemR(md, "invert")
93 flow = layout.column_flow()
94 flow.itemR(md, "use_vertex_groups", text="Vertex Groups")
95 flow.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
96 flow.itemR(md, "quaternion")
97 flow.itemR(md, "multi_modifier")
99 def array(self, layout, md):
100 layout.itemR(md, "fit_type")
101 if md.fit_type == 'FIXED_COUNT':
102 layout.itemR(md, "count")
103 if md.fit_type == 'FIT_LENGTH':
104 layout.itemR(md, "length")
105 if md.fit_type == 'FIT_CURVE':
106 layout.itemR(md, "curve")
110 split = layout.split()
114 col.itemR(md, "constant_offset")
115 colsub = col.column()
116 colsub.active = md.constant_offset
117 colsub.itemR(md, "constant_offset_displacement", text="")
121 sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
122 colsub = col.column()
123 colsub.active = md.merge_adjacent_vertices
124 colsub.itemR(md, "merge_end_vertices", text="First Last")
125 colsub.itemR(md, "merge_distance", text="Distance")
129 col.itemR(md, "relative_offset")
130 colsub = col.column()
131 colsub.active = md.relative_offset
132 colsub.itemR(md, "relative_offset_displacement", text="")
137 col.itemR(md, "add_offset_object")
138 colsub = col.column()
139 colsub.active = md.add_offset_object
140 colsub.itemR(md, "offset_object", text="")
144 col = layout.column()
145 col.itemR(md, "start_cap")
146 col.itemR(md, "end_cap")
148 def bevel(self, layout, md):
150 row.itemR(md, "width")
151 row.itemR(md, "only_vertices")
153 layout.itemL(text="Limit Method:")
155 row.itemR(md, "limit_method", expand=True)
156 if md.limit_method == 'ANGLE':
158 row.itemR(md, "angle")
159 if md.limit_method == 'WEIGHT':
161 row.itemR(md, "edge_weight_method", expand=True)
163 def boolean(self, layout, md):
164 layout.itemR(md, "operation")
165 layout.itemR(md, "object")
167 def build(self, layout, md):
168 split = layout.split()
171 col.itemR(md, "start")
172 col.itemR(md, "length")
175 col.itemR(md, "randomize")
176 colsub = col.column()
177 colsub.active = md.randomize
178 colsub.itemR(md, "seed")
182 def cast(self, layout, md):
183 layout.itemR(md, "cast_type")
184 col = layout.column_flow()
188 col.itemR(md, "factor")
189 col.itemR(md, "radius")
190 col.itemR(md, "size")
191 layout.itemR(md, "vertex_group")
192 #Missing: "OB" and "From Radius"
194 def cloth(self, layout, md):
195 layout.itemL(text="See Cloth panel.")
197 def collision(self, layout, md):
198 layout.itemL(text="See Collision panel.")
200 def curve(self, layout, md):
201 layout.itemR(md, "object")
202 layout.itemR(md, "vertex_group")
203 layout.itemR(md, "deform_axis")
205 def decimate(self, layout, md):
206 layout.itemR(md, "ratio")
207 layout.itemR(md, "face_count")
209 def displace(self, layout, md):
210 layout.itemR(md, "vertex_group")
211 layout.itemR(md, "texture")
212 layout.itemR(md, "midlevel")
213 layout.itemR(md, "strength")
214 layout.itemR(md, "texture_coordinates")
215 if md.texture_coordinates == 'OBJECT':
216 layout.itemR(md, "texture_coordinate_object", text="Object")
217 if md.texture_coordinates == 'UV':
218 layout.itemR(md, "uv_layer")
220 def edgesplit(self, layout, md):
221 split = layout.split()
224 col.itemR(md, "use_edge_angle", text="Edge Angle")
225 colsub = col.column()
226 colsub.active = md.use_edge_angle
227 colsub.itemR(md, "split_angle")
229 col.itemR(md, "use_sharp", text="Sharp Edges")
231 def explode(self, layout, md):
232 layout.itemR(md, "vertex_group")
233 layout.itemR(md, "protect")
234 layout.itemR(md, "split_edges")
235 layout.itemR(md, "unborn")
236 layout.itemR(md, "alive")
237 layout.itemR(md, "dead")
238 # Missing: "Refresh" and "Clear Vertex Group" ?
240 def fluid(self, layout, md):
241 layout.itemL(text="See Fluidsim panel.")
243 def hook(self, layout, md):
244 layout.itemR(md, "falloff")
245 layout.itemR(md, "force", slider=True)
246 layout.itemR(md, "object")
247 layout.itemR(md, "vertex_group")
248 # Missing: "Reset" and "Recenter"
250 def lattice(self, layout, md):
251 layout.itemR(md, "object")
252 layout.itemR(md, "vertex_group")
254 def mask(self, layout, md):
255 layout.itemR(md, "mode")
256 if md.mode == 'ARMATURE':
257 layout.itemR(md, "armature")
258 if md.mode == 'VERTEX_GROUP':
259 layout.itemR(md, "vertex_group")
260 layout.itemR(md, "inverse")
262 def mesh_deform(self, layout, md):
263 layout.itemR(md, "object")
264 layout.itemR(md, "vertex_group")
265 layout.itemR(md, "invert")
268 layout.itemO("OBJECT_OT_modifier_mdef_bind", text="Bind")
270 row.itemR(md, "precision")
271 row.itemR(md, "dynamic")
273 def mirror(self, layout, md):
274 layout.itemR(md, "merge_limit")
275 split = layout.split()
282 sub.itemL(text="Textures:")
283 sub.itemR(md, "mirror_u")
284 sub.itemR(md, "mirror_v")
286 sub.itemR(md, "clip", text="Do Clipping")
287 sub.itemR(md, "mirror_vertex_groups", text="Vertex Group")
289 layout.itemR(md, "mirror_object")
291 def multires(self, layout, md):
292 layout.itemR(md, "subdivision_type")
293 layout.itemO("OBJECT_OT_multires_subdivide", text="Subdivide")
294 layout.itemR(md, "level")
296 def particleinstance(self, layout, md):
297 layout.itemR(md, "object")
298 layout.itemR(md, "particle_system_number")
300 col = layout.column_flow()
301 col.itemR(md, "normal")
302 col.itemR(md, "children")
303 col.itemR(md, "path")
304 col.itemR(md, "unborn")
305 col.itemR(md, "alive")
306 col.itemR(md, "dead")
308 def particlesystem(self, layout, md):
309 layout.itemL(text="See Particle panel.")
311 def shrinkwrap(self, layout, md):
312 layout.itemR(md, "target")
313 layout.itemR(md, "vertex_group")
314 layout.itemR(md, "offset")
315 layout.itemR(md, "subsurf_levels")
316 layout.itemR(md, "mode")
317 if md.mode == 'PROJECT':
318 layout.itemR(md, "subsurf_levels")
319 layout.itemR(md, "auxiliary_target")
326 col = layout.column_flow()
327 col.itemR(md, "negative")
328 col.itemR(md, "positive")
329 col.itemR(md, "cull_front_faces")
330 col.itemR(md, "cull_back_faces")
331 if md.mode == 'NEAREST_SURFACEPOINT':
332 layout.itemR(md, "keep_above_surface")
333 # To-Do: Validate if structs
335 def simpledeform(self, layout, md):
336 layout.itemR(md, "mode")
337 layout.itemR(md, "vertex_group")
338 layout.itemR(md, "origin")
339 layout.itemR(md, "relative")
340 layout.itemR(md, "factor")
341 layout.itemR(md, "limits")
342 if md.mode in ('TAPER', 'STRETCH'):
343 layout.itemR(md, "lock_x_axis")
344 layout.itemR(md, "lock_y_axis")
346 def smooth(self, layout, md):
347 split = layout.split()
353 sub.itemR(md, "factor")
354 sub.itemR(md, "repeat")
356 layout.itemR(md, "vertex_group")
358 def softbody(self, layout, md):
359 layout.itemL(text="See Softbody panel.")
361 def subsurf(self, layout, md):
362 layout.itemR(md, "subdivision_type")
363 col = layout.column_flow()
364 col.itemR(md, "levels", text="Preview")
365 col.itemR(md, "render_levels", text="Render")
366 col.itemR(md, "optimal_draw", text="Optimal Display")
367 col.itemR(md, "subsurf_uv")
369 def uvproject(self, layout, md):
370 layout.itemR(md, "uv_layer")
371 layout.itemR(md, "projectors")
372 layout.itemR(md, "image")
373 layout.itemR(md, "horizontal_aspect_ratio")
374 layout.itemR(md, "vertical_aspect_ratio")
375 layout.itemR(md, "override_image")
376 #"Projectors" don't work.
378 def wave(self, layout, md):
379 split = layout.split()
382 sub.itemL(text="Motion:")
385 sub.itemR(md, "cyclic")
388 sub.itemR(md, "normals")
389 row = sub.row(align=True)
390 row.active = md.normals
391 row.itemR(md, "x_normal", text="X", toggle=True)
392 row.itemR(md, "y_normal", text="Y", toggle=True)
393 row.itemR(md, "z_normal", text="Z", toggle=True)
395 col = layout.column_flow()
396 col.itemR(md, "time_offset")
397 col.itemR(md, "lifetime")
398 col.itemR(md, "damping_time")
399 col.itemR(md, "falloff_radius")
400 col.itemR(md, "start_position_x")
401 col.itemR(md, "start_position_y")
403 layout.itemR(md, "start_position_object")
404 layout.itemR(md, "vertex_group")
405 layout.itemR(md, "texture")
406 layout.itemR(md, "texture_coordinates")
407 if md.texture_coordinates == 'MAP_UV':
408 layout.itemR(md, "uv_layer")
409 if md.texture_coordinates == 'OBJECT':
410 layout.itemR(md, "texture_coordinates_object")
412 col = layout.column_flow()
413 col.itemR(md, "speed", slider=True)
414 col.itemR(md, "height", slider=True)
415 col.itemR(md, "width", slider=True)
416 col.itemR(md, "narrowness", slider=True)
418 bpy.types.register(DATA_PT_modifiers)