4 class DataButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "modifier"
9 def poll(self, context):
10 ob = context.active_object
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):
18 ob = context.active_object
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.meshdeform(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")
108 split = layout.split()
112 sub.itemR(md, "constant_offset")
113 sub.itemR(md, "constant_offset_displacement", text="Displacement")
115 sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
116 sub = col.row().itemR(md, "merge_end_vertices", text="First Last")
117 sub = col.itemR(md, "merge_distance", text="Distance")
121 sub.itemR(md, "relative_offset")
122 sub.itemR(md, "relative_offset_displacement", text="Displacement")
124 sub.itemR(md, "add_offset_object")
125 sub.itemR(md, "offset_object")
127 col = layout.column()
128 col.itemR(md, "start_cap")
129 col.itemR(md, "end_cap")
131 def bevel(self, layout, md):
133 row.itemR(md, "width")
134 row.itemR(md, "only_vertices")
136 layout.itemL(text="Limit Method:")
138 row.itemR(md, "limit_method", expand=True)
139 if md.limit_method == 'ANGLE':
141 row.itemR(md, "angle")
142 if md.limit_method == 'WEIGHT':
144 row.itemR(md, "edge_weight_method", expand=True)
146 def boolean(self, layout, md):
147 layout.itemR(md, "operation")
148 layout.itemR(md, "object")
150 def build(self, layout, md):
151 layout.itemR(md, "start")
152 layout.itemR(md, "length")
155 row.itemR(md, "randomize")
157 row.itemR(md, "seed")
159 def cast(self, layout, md):
160 layout.itemR(md, "cast_type")
161 col = layout.column_flow()
165 col.itemR(md, "factor")
166 col.itemR(md, "radius")
167 col.itemR(md, "size")
168 layout.itemR(md, "vertex_group")
169 #Missing: "OB" and "From Radius"
171 def cloth(self, layout, md):
172 layout.itemL(text="See Cloth panel.")
174 def collision(self, layout, md):
175 layout.itemL(text="See Collision panel.")
177 def curve(self, layout, md):
178 layout.itemR(md, "object")
179 layout.itemR(md, "vertex_group")
180 layout.itemR(md, "deform_axis")
182 def decimate(self, layout, md):
183 layout.itemR(md, "ratio")
184 layout.itemR(md, "face_count")
186 def displace(self, layout, md):
187 layout.itemR(md, "vertex_group")
188 layout.itemR(md, "texture")
189 layout.itemR(md, "midlevel")
190 layout.itemR(md, "strength")
191 layout.itemR(md, "texture_coordinates")
192 if md.texture_coordinates == 'OBJECT':
193 layout.itemR(md, "texture_coordinate_object", text="Object")
194 if md.texture_coordinates == 'UV':
195 layout.itemR(md, "uv_layer")
197 def edgesplit(self, layout, md):
198 layout.itemR(md, "use_edge_angle", text="Edge Angle")
199 if (md.use_edge_angle):
200 layout.itemR(md, "split_angle")
201 layout.itemR(md, "use_sharp", text="Sharp Edges")
203 def explode(self, layout, md):
204 layout.itemR(md, "vertex_group")
205 layout.itemR(md, "protect")
206 layout.itemR(md, "split_edges")
207 layout.itemR(md, "unborn")
208 layout.itemR(md, "alive")
209 layout.itemR(md, "dead")
210 # Missing: "Refresh" and "Clear Vertex Group" ?
212 def fluid(self, layout, md):
213 layout.itemL(text="See Fluidsim panel.")
215 def hook(self, layout, md):
216 layout.itemR(md, "falloff")
217 layout.itemR(md, "force", slider=True)
218 layout.itemR(md, "object")
219 layout.itemR(md, "vertex_group")
220 # Missing: "Reset" and "Recenter"
222 def lattice(self, layout, md):
223 layout.itemR(md, "object")
224 layout.itemR(md, "vertex_group")
226 def mask(self, layout, md):
227 layout.itemR(md, "mode")
228 if md.mode == 'ARMATURE':
229 layout.itemR(md, "armature")
230 if md.mode == 'VERTEX_GROUP':
231 layout.itemR(md, "vertex_group")
232 layout.itemR(md, "inverse")
234 def meshdeform(self, layout, md):
235 layout.itemR(md, "object")
236 layout.itemR(md, "vertex_group")
237 layout.itemR(md, "invert")
238 layout.itemR(md, "precision")
239 layout.itemR(md, "dynamic")
242 def mirror(self, layout, md):
243 layout.itemR(md, "merge_limit")
244 split = layout.split()
251 sub.itemR(md, "mirror_u")
252 sub.itemR(md, "mirror_v")
254 sub.itemR(md, "clip", text="Do Clipping")
255 sub.itemR(md, "mirror_vertex_groups", text="Vertex Group")
257 layout.itemR(md, "mirror_object")
259 def multires(self, layout, md):
260 layout.itemR(md, "subdivision_type")
261 layout.itemO("OBJECT_OT_multires_subdivide", text="Subdivide")
262 layout.itemR(md, "level")
264 def particleinstance(self, layout, md):
265 layout.itemR(md, "object")
266 layout.itemR(md, "particle_system_number")
268 col = layout.column_flow()
269 col.itemR(md, "normal")
270 col.itemR(md, "children")
271 col.itemR(md, "path")
272 col.itemR(md, "unborn")
273 col.itemR(md, "alive")
274 col.itemR(md, "dead")
276 def particlesystem(self, layout, md):
277 layout.itemL(text="See Particle panel.")
279 def shrinkwrap(self, layout, md):
280 layout.itemR(md, "target")
281 layout.itemR(md, "vertex_group")
282 layout.itemR(md, "offset")
283 layout.itemR(md, "subsurf_levels")
284 layout.itemR(md, "mode")
285 if md.mode == 'PROJECT':
286 layout.itemR(md, "subsurf_levels")
287 layout.itemR(md, "auxiliary_target")
294 col = layout.column_flow()
295 col.itemR(md, "negative")
296 col.itemR(md, "positive")
297 col.itemR(md, "cull_front_faces")
298 col.itemR(md, "cull_back_faces")
299 if md.mode == 'NEAREST_SURFACEPOINT':
300 layout.itemR(md, "keep_above_surface")
301 # To-Do: Validate if structs
303 def simpledeform(self, layout, md):
304 layout.itemR(md, "mode")
305 layout.itemR(md, "vertex_group")
306 layout.itemR(md, "origin")
307 layout.itemR(md, "relative")
308 layout.itemR(md, "factor")
309 layout.itemR(md, "limits")
310 if md.mode in ('TAPER', 'STRETCH'):
311 layout.itemR(md, "lock_x_axis")
312 layout.itemR(md, "lock_y_axis")
314 def smooth(self, layout, md):
315 split = layout.split()
317 row = sub.row(align=True)
318 row.itemR(md, "x", toggle=True)
319 row.itemR(md, "y", toggle=True)
320 row.itemR(md, "z", toggle=True)
322 sub.itemR(md, "factor")
323 sub.itemR(md, "repeat")
325 layout.itemR(md, "vertex_group")
327 def softbody(self, layout, md):
328 layout.itemL(text="See Softbody panel.")
330 def subsurf(self, layout, md):
331 layout.itemR(md, "subdivision_type")
332 col = layout.column_flow()
333 col.itemR(md, "levels")
334 col.itemR(md, "render_levels")
335 col.itemR(md, "optimal_draw")
336 col.itemR(md, "subsurf_uv")
338 def uvproject(self, layout, md):
339 layout.itemR(md, "uv_layer")
340 layout.itemR(md, "projectors")
341 layout.itemR(md, "image")
342 layout.itemR(md, "horizontal_aspect_ratio")
343 layout.itemR(md, "vertical_aspect_ratio")
344 layout.itemR(md, "override_image")
345 #"Projectors" don't work.
347 def wave(self, layout, md):
348 split = layout.split()
351 sub.itemL(text="Motion:")
354 sub.itemR(md, "cyclic")
357 sub.itemR(md, "normals")
359 row = sub.row(align=True)
360 row.itemR(md, "x_normal", text="X", toggle=True)
361 row.itemR(md, "y_normal", text="Y", toggle=True)
362 row.itemR(md, "z_normal", text="Z", toggle=True)
364 col = layout.column_flow()
365 col.itemR(md, "time_offset")
366 col.itemR(md, "lifetime")
367 col.itemR(md, "damping_time")
368 col.itemR(md, "falloff_radius")
369 col.itemR(md, "start_position_x")
370 col.itemR(md, "start_position_y")
372 layout.itemR(md, "start_position_object")
373 layout.itemR(md, "vertex_group")
374 layout.itemR(md, "texture")
375 layout.itemR(md, "texture_coordinates")
376 if md.texture_coordinates == 'MAP_UV':
377 layout.itemR(md, "uv_layer")
378 if md.texture_coordinates == 'OBJECT':
379 layout.itemR(md, "texture_coordinates_object")
381 col = layout.column_flow()
382 col.itemR(md, "speed", slider=True)
383 col.itemR(md, "height", slider=True)
384 col.itemR(md, "width", slider=True)
385 col.itemR(md, "narrowness", slider=True)
387 bpy.types.register(DATA_PT_modifiers)