FBX exporter conversion almost done.
[blender.git] / release / ui / buttons_data_modifier.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "modifier"
8         
9 class DATA_PT_modifiers(DataButtonsPanel):
10         __idname__ = "DATA_PT_modifiers"
11         __label__ = "Modifiers"
12
13         def draw(self, context):
14                 ob = context.object
15                 layout = self.layout
16
17                 row = layout.row()
18                 row.item_menu_enumO("OBJECT_OT_modifier_add", "type")
19                 row.itemL();
20
21                 for md in ob.modifiers:
22                         box = layout.template_modifier(md)
23
24                         if box:
25                                 if md.type == 'ARMATURE':
26                                         self.armature(box, ob, md)
27                                 elif md.type == 'ARRAY':
28                                         self.array(box, ob, md)
29                                 elif md.type == 'BEVEL':
30                                         self.bevel(box, ob, md)
31                                 elif md.type == 'BOOLEAN':
32                                         self.boolean(box, ob, md)
33                                 elif md.type == 'BUILD':
34                                         self.build(box, ob, md)
35                                 elif md.type == 'CAST':
36                                         self.cast(box, ob, md)
37                                 elif md.type == 'CLOTH':
38                                         self.cloth(box, ob, md)
39                                 elif md.type == 'COLLISION':
40                                         self.collision(box, ob, md)
41                                 elif md.type == 'CURVE':
42                                         self.curve(box, ob, md)
43                                 elif md.type == 'DECIMATE':
44                                         self.decimate(box, ob, md)
45                                 elif md.type == 'DISPLACE':
46                                         self.displace(box, ob, md)
47                                 elif md.type == 'EDGE_SPLIT':
48                                         self.edgesplit(box, ob, md)
49                                 elif md.type == 'EXPLODE':
50                                         self.explode(box, ob, md)
51                                 elif md.type == 'FLUID_SIMULATION':
52                                         self.fluid(box, ob, md)
53                                 elif md.type == 'HOOK':
54                                         self.hook(box, ob, md)
55                                 elif md.type == 'LATTICE':
56                                         self.lattice(box, ob, md)
57                                 elif md.type == 'MASK':
58                                         self.mask(box, ob, md)
59                                 elif md.type == 'MESH_DEFORM':
60                                         self.mesh_deform(box, ob, md)
61                                 elif md.type == 'MIRROR':
62                                         self.mirror(box, ob, md)
63                                 elif md.type == 'MULTIRES':
64                                         self.multires(box, ob, md)
65                                 elif md.type == 'PARTICLE_INSTANCE':
66                                         self.particleinstance(box, ob, md)
67                                 elif md.type == 'PARTICLE_SYSTEM':
68                                         self.particlesystem(box, ob, md)
69                                 elif md.type == 'SHRINKWRAP':
70                                         self.shrinkwrap(box, ob, md)
71                                 elif md.type == 'SIMPLE_DEFORM':
72                                         self.simpledeform(box, ob, md)
73                                 elif md.type == 'SMOOTH':
74                                         self.smooth(box, ob, md)
75                                 elif md.type == 'SOFTBODY':
76                                         self.softbody(box, ob, md)
77                                 elif md.type == 'SUBSURF':
78                                         self.subsurf(box, ob, md)
79                                 elif md.type == 'SURFACE':
80                                         self.surface(box, ob, md)
81                                 elif md.type == 'UV_PROJECT':
82                                         self.uvproject(box, ob, md)
83                                 elif md.type == 'WAVE':
84                                         self.wave(box, ob, md)
85                                                         
86         def armature(self, layout, ob, md):
87                 layout.itemR(md, "object")
88                 row = layout.row()
89                 row.item_pointerR(md, "vertex_group", ob, "vertex_groups")
90                 row.itemR(md, "invert")
91                 flow = layout.column_flow()
92                 flow.itemR(md, "use_vertex_groups", text="Vertex Groups")
93                 flow.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
94                 flow.itemR(md, "quaternion")
95                 flow.itemR(md, "multi_modifier")
96                 
97         def array(self, layout, ob, md):
98                 layout.itemR(md, "fit_type")
99                 if md.fit_type == 'FIXED_COUNT':
100                         layout.itemR(md, "count")
101                 elif md.fit_type == 'FIT_LENGTH':
102                         layout.itemR(md, "length")
103                 elif md.fit_type == 'FIT_CURVE':
104                         layout.itemR(md, "curve")
105
106                 layout.itemS()
107                 
108                 split = layout.split()
109                 
110                 col = split.column()
111                 col = col.column()
112                 col.itemR(md, "constant_offset")
113                 colsub = col.column()
114                 colsub.active = md.constant_offset
115                 colsub.itemR(md, "constant_offset_displacement", text="")
116
117                 col.itemS()
118
119                 sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
120                 colsub = col.column()
121                 colsub.active = md.merge_adjacent_vertices
122                 colsub.itemR(md, "merge_end_vertices", text="First Last")
123                 colsub.itemR(md, "merge_distance", text="Distance")
124                 
125                 col = split.column()
126                 col = col.column()
127                 col.itemR(md, "relative_offset")
128                 colsub = col.column()
129                 colsub.active = md.relative_offset
130                 colsub.itemR(md, "relative_offset_displacement", text="")
131
132                 col.itemS()
133
134                 col = col.column()
135                 col.itemR(md, "add_offset_object")
136                 colsub = col.column()
137                 colsub.active = md.add_offset_object
138                 colsub.itemR(md, "offset_object", text="")
139
140                 layout.itemS()
141                 
142                 col = layout.column()
143                 col.itemR(md, "start_cap")
144                 col.itemR(md, "end_cap")
145         
146         def bevel(self, layout, ob, md):
147                 row = layout.row()
148                 row.itemR(md, "width")
149                 row.itemR(md, "only_vertices")
150                 
151                 layout.itemL(text="Limit Method:")
152                 row = layout.row()
153                 row.itemR(md, "limit_method", expand=True)
154                 if md.limit_method == 'ANGLE':
155                         row = layout.row()
156                         row.itemR(md, "angle")
157                 elif md.limit_method == 'WEIGHT':
158                         row = layout.row()
159                         row.itemR(md, "edge_weight_method", expand=True)
160                         
161         def boolean(self, layout, ob, md):
162                 layout.itemR(md, "operation")
163                 layout.itemR(md, "object")
164                 
165         def build(self, layout, ob, md):
166                 split = layout.split()
167                 
168                 col = split.column()
169                 col.itemR(md, "start")
170                 col.itemR(md, "length")
171
172                 col = split.column()
173                 col.itemR(md, "randomize")
174                 colsub = col.column()
175                 colsub.active = md.randomize
176                 colsub.itemR(md, "seed")
177                         
178                 
179                         
180         def cast(self, layout, ob, md):
181                 layout.itemR(md, "cast_type")
182                 col = layout.column_flow()
183                 col.itemR(md, "x")
184                 col.itemR(md, "y")
185                 col.itemR(md, "z")
186                 col.itemR(md, "factor")
187                 col.itemR(md, "radius")
188                 col.itemR(md, "size")
189                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
190                 #Missing: "OB" and "From Radius"
191                 
192         def cloth(self, layout, ob, md):
193                 layout.itemL(text="See Cloth panel.")
194                 
195         def collision(self, layout, ob, md):
196                 layout.itemL(text="See Collision panel.")
197                 
198         def curve(self, layout, ob, md):
199                 layout.itemR(md, "object")
200                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
201                 layout.itemR(md, "deform_axis")
202                 
203         def decimate(self, layout, ob, md):
204                 layout.itemR(md, "ratio")
205                 layout.itemR(md, "face_count")
206                 
207         def displace(self, layout, ob, md):
208                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
209                 layout.itemR(md, "texture")
210                 layout.itemR(md, "midlevel")
211                 layout.itemR(md, "strength")
212                 layout.itemR(md, "direction")
213                 layout.itemR(md, "texture_coordinates")
214                 if md.texture_coordinates == 'OBJECT':
215                         layout.itemR(md, "texture_coordinate_object", text="Object")
216                 elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
217                         layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
218         
219         def edgesplit(self, layout, ob, md):
220                 split = layout.split()
221                 
222                 col = split.column()
223                 col.itemR(md, "use_edge_angle", text="Edge Angle")
224                 colsub = col.column()
225                 colsub.active = md.use_edge_angle
226                 colsub.itemR(md, "split_angle")
227                 col = split.column()
228                 col.itemR(md, "use_sharp", text="Sharp Edges")
229                 
230         def explode(self, layout, ob, md):
231                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
232                 layout.itemR(md, "protect")
233                 layout.itemR(md, "split_edges")
234                 layout.itemR(md, "unborn")
235                 layout.itemR(md, "alive")
236                 layout.itemR(md, "dead")
237                 # Missing: "Refresh" and "Clear Vertex Group" ?
238                 
239         def fluid(self, layout, ob, md):
240                 layout.itemL(text="See Fluid panel.")
241                 
242         def hook(self, layout, ob, md):
243                 layout.itemR(md, "falloff")
244                 layout.itemR(md, "force", slider=True)
245                 layout.itemR(md, "object")
246                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
247                 # Missing: "Reset" and "Recenter"
248                 
249         def lattice(self, layout, ob, md):
250                 layout.itemR(md, "object")
251                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
252                 
253         def mask(self, layout, ob, md):
254                 layout.itemR(md, "mode")
255                 if md.mode == 'ARMATURE':
256                         layout.itemR(md, "armature")
257                 elif md.mode == 'VERTEX_GROUP':
258                         layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
259                 layout.itemR(md, "inverse")
260                 
261         def mesh_deform(self, layout, ob, md):
262                 layout.itemR(md, "object")
263                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
264                 layout.itemR(md, "invert")
265
266                 layout.itemS()
267                 layout.itemO("OBJECT_OT_modifier_mdef_bind", text="Bind")
268                 row = layout.row()
269                 row.itemR(md, "precision")
270                 row.itemR(md, "dynamic")
271                 
272         def mirror(self, layout, ob, md):
273                 layout.itemR(md, "merge_limit")
274                 split = layout.split()
275                 
276                 sub = split.column()
277                 sub.itemR(md, "x")
278                 sub.itemR(md, "y")
279                 sub.itemR(md, "z")
280                 sub = split.column()
281                 sub.itemL(text="Textures:")
282                 sub.itemR(md, "mirror_u")
283                 sub.itemR(md, "mirror_v")
284                 sub = split.column()
285                 sub.itemR(md, "clip", text="Do Clipping")
286                 sub.itemR(md, "mirror_vertex_groups", text="Vertex Group")
287                 
288                 layout.itemR(md, "mirror_object")
289                 
290         def multires(self, layout, ob, md):
291                 layout.itemR(md, "subdivision_type")
292                 layout.itemO("OBJECT_OT_multires_subdivide", text="Subdivide")
293                 layout.itemR(md, "level")
294         
295         def particleinstance(self, layout, ob, md):
296                 layout.itemR(md, "object")
297                 layout.itemR(md, "particle_system_number")
298                 
299                 col = layout.column_flow()
300                 col.itemR(md, "normal")
301                 col.itemR(md, "children")
302                 col.itemR(md, "size")
303                 col.itemR(md, "path")
304                 if md.path:
305                         col.itemR(md, "keep_shape")
306                 col.itemR(md, "unborn")
307                 col.itemR(md, "alive")
308                 col.itemR(md, "dead")
309                 col.itemL(md, "")
310                 if md.path:
311                         col.itemR(md, "axis", text="")
312                 
313                 if md.path:
314                         row = layout.row()
315                         row.itemR(md, "position", slider=True)
316                         row.itemR(md, "random_position", text = "Random", slider=True)
317                 
318         def particlesystem(self, layout, ob, md):
319                 layout.itemL(text="See Particle panel.")
320                 
321         def shrinkwrap(self, layout, ob, md):
322                 layout.itemR(md, "target")
323                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
324                 layout.itemR(md, "offset")
325                 layout.itemR(md, "subsurf_levels")
326                 layout.itemR(md, "mode")
327                 if md.mode == 'PROJECT':
328                         layout.itemR(md, "subsurf_levels")
329                         layout.itemR(md, "auxiliary_target")
330                 
331                         row = layout.row()
332                         row.itemR(md, "x")
333                         row.itemR(md, "y")
334                         row.itemR(md, "z")
335                 
336                         col = layout.column_flow()
337                         col.itemR(md, "negative")
338                         col.itemR(md, "positive")
339                         col.itemR(md, "cull_front_faces")
340                         col.itemR(md, "cull_back_faces")
341                 elif md.mode == 'NEAREST_SURFACEPOINT':
342                         layout.itemR(md, "keep_above_surface")
343                 # To-Do: Validate if structs
344                 
345         def simpledeform(self, layout, ob, md):
346                 layout.itemR(md, "mode")
347                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
348                 layout.itemR(md, "origin")
349                 layout.itemR(md, "relative")
350                 layout.itemR(md, "factor")
351                 layout.itemR(md, "limits")
352                 if md.mode in ('TAPER', 'STRETCH'):
353                         layout.itemR(md, "lock_x_axis")
354                         layout.itemR(md, "lock_y_axis")
355         
356         def smooth(self, layout, ob, md):
357                 split = layout.split()
358                 sub = split.column()
359                 sub.itemR(md, "x")
360                 sub.itemR(md, "y")
361                 sub.itemR(md, "z")
362                 sub = split.column()
363                 sub.itemR(md, "factor")
364                 sub.itemR(md, "repeat")
365                 
366                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
367                 
368         def softbody(self, layout, ob, md):
369                 layout.itemL(text="See Soft Body panel.")
370         
371         def subsurf(self, layout, ob, md):
372                 layout.itemR(md, "subdivision_type")
373                 col = layout.column_flow()
374                 col.itemR(md, "levels", text="Preview")
375                 col.itemR(md, "render_levels", text="Render")
376                 col.itemR(md, "optimal_draw", text="Optimal Display")
377                 col.itemR(md, "subsurf_uv")
378
379         def surface(self, layout, ob, md):
380                 layout.itemL(text="See Fields panel.")
381         
382         def uvproject(self, layout, ob, md):
383                 if ob.type == 'MESH':
384                         layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
385                         layout.itemR(md, "projectors")
386                         layout.itemR(md, "image")
387                         layout.itemR(md, "horizontal_aspect_ratio")
388                         layout.itemR(md, "vertical_aspect_ratio")
389                         layout.itemR(md, "override_image")
390                         #"Projectors" don't work.
391                 
392         def wave(self, layout, ob, md):
393                 split = layout.split()
394                 
395                 sub = split.column()
396                 sub.itemL(text="Motion:")
397                 sub.itemR(md, "x")
398                 sub.itemR(md, "y")
399                 sub.itemR(md, "cyclic")
400                 
401                 sub = split.column()
402                 sub.itemR(md, "normals")
403                 row = sub.row(align=True)
404                 row.active = md.normals
405                 row.itemR(md, "x_normal", text="X", toggle=True)
406                 row.itemR(md, "y_normal", text="Y", toggle=True)
407                 row.itemR(md, "z_normal", text="Z", toggle=True)
408                 
409                 col = layout.column_flow()
410                 col.itemR(md, "time_offset")
411                 col.itemR(md, "lifetime")
412                 col.itemR(md, "damping_time")
413                 col.itemR(md, "falloff_radius")
414                 col.itemR(md, "start_position_x")
415                 col.itemR(md, "start_position_y")
416                 
417                 layout.itemR(md, "start_position_object")
418                 layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
419                 layout.itemR(md, "texture")
420                 layout.itemR(md, "texture_coordinates")
421                 if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
422                         layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
423                 elif md.texture_coordinates == 'OBJECT':
424                         layout.itemR(md, "texture_coordinates_object")
425                 
426                 col = layout.column_flow()
427                 col.itemR(md, "speed", slider=True)
428                 col.itemR(md, "height", slider=True)
429                 col.itemR(md, "width", slider=True)
430                 col.itemR(md, "narrowness", slider=True)
431
432 bpy.types.register(DATA_PT_modifiers)