* projection paint options in the toolbar
[blender.git] / release / ui / space_view3d_toolbar.py
1
2 import bpy
3
4 # ********** default tools for objectmode ****************
5
6 class View3DPanel(bpy.types.Panel):
7         __space_type__ = "VIEW_3D"
8         __region_type__ = "TOOLS"
9         __context__ = "objectmode"
10
11 class VIEW3D_PT_tools_objectmode(View3DPanel):
12         __label__ = "Object Tools"
13
14         def draw(self, context):
15                 layout = self.layout
16                 
17                 layout.itemL(text="Transform:")
18                 
19                 col = layout.column(align=True)
20                 col.itemO("tfm.translate")
21                 col.itemO("tfm.rotate")
22                 col.itemO("tfm.resize", text="Scale")
23                 
24                 layout.itemL(text="Object:")
25                 
26                 col = layout.column(align=True)
27                 col.itemO("object.duplicate")
28                 col.itemO("object.delete")
29                 
30                 if context.active_object.type == 'MESH':
31                         layout.itemL(text="Shading:")
32                 
33                         col = layout.column(align=True)
34                         col.itemO("object.shade_smooth", text="Smooth")
35                         col.itemO("object.shade_flat", text="Flat")
36                 
37                 layout.itemL(text="Keyframes:")
38                 
39                 col = layout.column(align=True)
40                 col.itemO("anim.insert_keyframe_menu", text="Insert")
41                 col.itemO("anim.delete_keyframe_v3d", text="Remove")
42
43 # ********** default tools for editmode_mesh ****************
44
45 class View3DPanel(bpy.types.Panel):
46         __space_type__ = "VIEW_3D"
47         __region_type__ = "TOOLS"
48         __context__ = "editmode_mesh"
49
50 class VIEW3D_PT_tools_editmode_mesh(View3DPanel):
51         __label__ = "Mesh Tools"
52
53         def draw(self, context):
54                 layout = self.layout
55                 
56                 layout.itemL(text="Transform:")
57                 
58                 col = layout.column(align=True)
59                 col.itemO("tfm.translate")
60                 col.itemO("tfm.rotate")
61                 col.itemO("tfm.resize", text="Scale")
62                 
63                 layout.itemL(text="Mesh:")
64                 
65                 col = layout.column(align=True)
66                 col.itemO("mesh.duplicate")
67                 col.itemO("mesh.delete")
68                 
69                 layout.itemL(text="Modeling:")
70                 
71                 col = layout.column(align=True)
72                 col.itemO("mesh.extrude")
73                 col.itemO("mesh.subdivide")
74                 col.itemO("mesh.spin")
75                 col.itemO("mesh.screw")
76                 
77                 layout.itemL(text="Shading:")
78                 
79                 col = layout.column(align=True)
80                 col.itemO("mesh.faces_shade_smooth", text="Smooth")
81                 col.itemO("mesh.faces_shade_flat", text="Flat")
82                 
83                 layout.itemL(text="UV Mapping:")
84                 
85                 col = layout.column(align=True)
86                 col.itemO("uv.mapping_menu", text="Unwrap")
87                 col.itemO("mesh.uvs_rotate")
88                 col.itemO("mesh.uvs_mirror")
89
90 # ********** default tools for editmode_curve ****************
91
92 class View3DPanel(bpy.types.Panel):
93         __space_type__ = "VIEW_3D"
94         __region_type__ = "TOOLS"
95         __context__ = "editmode_curve"
96
97 class VIEW3D_PT_tools_editmode_curve(View3DPanel):
98         __label__ = "Curve Tools"
99
100         def draw(self, context):
101                 layout = self.layout
102                 
103                 layout.itemL(text="Transform:")
104                 
105                 col = layout.column(align=True)
106                 col.itemO("tfm.translate")
107                 col.itemO("tfm.rotate")
108                 col.itemO("tfm.resize", text="Scale")
109                 
110                 layout.itemL(text="Curve:")
111
112                 col = layout.column(align=True)
113                 col.itemO("curve.duplicate")
114                 col.itemO("curve.delete")
115                 col.itemO("curve.cyclic_toggle")
116                 col.itemO("curve.switch_direction")
117                 
118                 layout.itemL(text="Modeling:")
119
120                 col = layout.column(align=True)
121                 col.itemO("curve.extrude")
122                 col.itemO("curve.subdivide")
123
124 # ********** default tools for editmode_surface ****************
125
126 class View3DPanel(bpy.types.Panel):
127         __space_type__ = "VIEW_3D"
128         __region_type__ = "TOOLS"
129         __context__ = "editmode_surface"
130
131 class VIEW3D_PT_tools_editmode_surface(View3DPanel):
132         __label__ = "Surface Tools"
133
134         def draw(self, context):
135                 layout = self.layout
136                 
137                 layout.itemL(text="Transform:")
138
139                 col = layout.column(align=True)
140                 col.itemO("tfm.translate")
141                 col.itemO("tfm.rotate")
142                 col.itemO("tfm.resize", text="Scale")
143                 
144                 layout.itemL(text="Curve:")
145
146                 col = layout.column(align=True)
147                 col.itemO("curve.duplicate")
148                 col.itemO("curve.delete")
149                 col.itemO("curve.cyclic_toggle")
150                 col.itemO("curve.switch_direction")
151                 
152                 layout.itemL(text="Modeling:")
153
154                 col = layout.column(align=True)
155                 col.itemO("curve.extrude")
156                 col.itemO("curve.subdivide")
157
158 # ********** default tools for editmode_text ****************
159
160 class View3DPanel(bpy.types.Panel):
161         __space_type__ = "VIEW_3D"
162         __region_type__ = "TOOLS"
163         __context__ = "editmode_text"
164
165 class VIEW3D_PT_tools_editmode_text(View3DPanel):
166         __label__ = "Text Tools"
167
168         def draw(self, context):
169                 layout = self.layout
170
171                 col = layout.column(align=True)
172                 col.itemO("font.text_copy", text="Copy")
173                 col.itemO("font.text_paste", text="Paste")
174                 
175                 col = layout.column()
176                 col.itemO("font.case_set")
177                 col.itemO("font.style_toggle")
178
179 # ********** default tools for editmode_armature ****************
180
181 class View3DPanel(bpy.types.Panel):
182         __space_type__ = "VIEW_3D"
183         __region_type__ = "TOOLS"
184         __context__ = "editmode_armature"
185
186 class VIEW3D_PT_tools_editmode_armature(View3DPanel):
187         __label__ = "Armature Tools"
188
189         def draw(self, context):
190                 layout = self.layout
191                 
192                 layout.itemL(text="Transform:")
193                 
194                 col = layout.column(align=True)
195                 col.itemO("tfm.translate")
196                 col.itemO("tfm.rotate")
197                 col.itemO("tfm.resize", text="Scale")
198                 
199                 layout.itemL(text="Bones:")
200
201                 col = layout.column(align=True)
202                 col.itemO("armature.bone_primitive_add", text="Add")
203                 col.itemO("armature.duplicate", text="Duplicate")
204                 col.itemO("armature.delete", text="Delete")
205                 
206                 layout.itemL(text="Modeling:")
207                 layout.itemO("armature.extrude")
208
209 # ********** default tools for editmode_mball ****************
210
211 class View3DPanel(bpy.types.Panel):
212         __space_type__ = "VIEW_3D"
213         __region_type__ = "TOOLS"
214         __context__ = "editmode_mball"
215
216 class VIEW3D_PT_tools_editmode_mball(View3DPanel):
217         __label__ = "Meta Tools"
218
219         def draw(self, context):
220                 layout = self.layout
221                 
222                 layout.itemL(text="Transform:")
223                 
224                 col = layout.column(align=True)
225                 col.itemO("tfm.translate")
226                 col.itemO("tfm.rotate")
227                 col.itemO("tfm.resize", text="Scale")
228
229 # ********** default tools for editmode_lattice ****************
230
231 class View3DPanel(bpy.types.Panel):
232         __space_type__ = "VIEW_3D"
233         __region_type__ = "TOOLS"
234         __context__ = "editmode_lattice"
235
236 class VIEW3D_PT_tools_editmode_lattice(View3DPanel):
237         __label__ = "Lattice Tools"
238
239         def draw(self, context):
240                 layout = self.layout
241                 
242                 layout.itemL(text="Transform:")
243
244                 col = layout.column(align=True)
245                 col.itemO("tfm.translate")
246                 col.itemO("tfm.rotate")
247                 col.itemO("tfm.resize", text="Scale")
248
249 # ********** default tools for posemode ****************
250
251 class View3DPanel(bpy.types.Panel):
252         __space_type__ = "VIEW_3D"
253         __region_type__ = "TOOLS"
254         __context__ = "posemode"
255
256 class VIEW3D_PT_tools_posemode(View3DPanel):
257         __label__ = "Pose Tools"
258
259         def draw(self, context):
260                 layout = self.layout
261                 
262                 layout.itemL(text="Transform:")
263
264                 col = layout.column(align=True)
265                 col.itemO("tfm.translate")
266                 col.itemO("tfm.rotate")
267                 col.itemO("tfm.resize", text="Scale")
268                 
269                 layout.itemL(text="Bones:")
270
271                 col = layout.column(align=True)
272                 col.itemO("pose.hide", text="Hide")
273                 col.itemO("pose.reveal", text="Reveal")
274                 
275                 layout.itemL(text="Keyframes:")
276                 
277                 col = layout.column(align=True)
278                 col.itemO("anim.insert_keyframe_menu", text="Insert")
279                 col.itemO("anim.delete_keyframe_v3d", text="Remove")
280                 
281                 layout.itemL(text="Pose:")
282                 
283                 col = layout.column(align=True)
284                 col.itemO("pose.copy", text="Copy")
285                 col.itemO("pose.paste", text="Paste")
286                 
287                 layout.itemL(text="Library:")
288                 
289                 col = layout.column(align=True)
290                 col.itemO("poselib.pose_add", text="Add")
291                 col.itemO("poselib.pose_remove", text="Remove")
292
293 # ********** default tools for paint modes ****************
294
295 class PaintPanel(bpy.types.Panel):
296         __space_type__ = "VIEW_3D"
297         __region_type__ = "TOOLS"
298
299         def paint_settings(self, context):
300                 ts = context.tool_settings
301
302                 if context.sculpt_object:
303                         return ts.sculpt
304                 elif context.vertex_paint_object:
305                         return ts.vertex_paint
306                 elif context.weight_paint_object:
307                         return ts.weight_paint
308                 elif context.texture_paint_object:
309                         return ts.image_paint
310                 elif context.particle_edit_object:
311                         return ts.particle_edit
312
313                 return False
314
315 class VIEW3D_PT_tools_brush(PaintPanel):
316         __label__ = "Brush"
317
318         def poll(self, context):
319                 return self.paint_settings(context)
320
321         def draw(self, context):
322                 settings = self.paint_settings(context)
323                 brush = settings.brush
324                 layout = self.layout
325
326                 if context.particle_edit_object:
327                         layout.column().itemR(settings, "tool", expand=True)
328                 else:
329                         layout.split().row().template_ID(settings, "brush")
330
331                 if brush and not context.particle_edit_object:
332                         if context.sculpt_object:
333                                 layout.column().itemR(brush, "sculpt_tool", expand=True)
334
335                         elif context.texture_paint_object:
336                                 col = layout.column(align=True)
337                                 col.item_enumR(settings, "tool", "DRAW")
338                                 col.item_enumR(settings, "tool", "SOFTEN")
339                                 if settings.use_projection:
340                                         col.item_enumR(settings, "tool", "CLONE")
341                                 else:
342                                         col.item_enumR(settings, "tool", "SMEAR")
343
344                         split = layout.split()
345                         
346                         col = split.column()
347                         row = col.row(align=True)
348                         row.itemR(brush, "size", slider=True)
349                         row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
350                         if context.weight_paint_object:
351                                 col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
352                                 
353                         col.itemR(brush, "strength", slider=True)
354                         row = col.row(align=True)
355                         row.itemR(brush, "falloff", slider=True)
356                         row.itemR(brush, "falloff_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
357                         if context.vertex_paint_object:
358                                 col.itemR(brush, "color", text="")
359                         if context.texture_paint_object:
360                                 row = col.row(align=True)
361                                 row.itemR(brush, "clone_opacity", slider=True, text="Opacity")
362                                 row.itemR(brush, "opacity_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
363                         
364                         row = col.row(align=True)
365                         row.itemR(brush, "space", text="")
366                         rowsub = row.row(align=True)
367                         rowsub.active = brush.space
368                         rowsub.itemR(brush, "spacing", text="Spacing", slider=True)
369                         rowsub.itemR(brush, "spacing_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
370
371                         split = layout.split()
372                         col = split.column()
373                         col.itemR(brush, "airbrush")
374                         col.itemR(brush, "anchored")
375                         col.itemR(brush, "rake")
376
377 class VIEW3D_PT_tools_brush_curve(PaintPanel):
378         __label__ = "Curve"
379
380         def poll(self, context):
381                 settings = self.paint_settings(context)
382                 return (settings and settings.brush and settings.brush.curve)
383
384         def draw(self, context):
385                 settings = self.paint_settings(context)
386                 brush = settings.brush
387                 layout = self.layout
388
389                 split = layout.split()
390                 split.template_curve_mapping(brush.curve)
391                 
392 class VIEW3D_PT_sculpt_options(PaintPanel):
393         __label__ = "Options"
394
395         def poll(self, context):
396                 return context.sculpt_object
397
398         def draw(self, context):
399                 layout = self.layout
400                 sculpt = context.tool_settings.sculpt
401
402                 col = layout.column()
403                 col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
404                 col.itemR(sculpt, "show_brush")
405
406                 split = self.layout.split()
407                 
408                 col = split.column()
409                 col.itemL(text="Symmetry:")
410                 col.itemR(sculpt, "symmetry_x", text="X")
411                 col.itemR(sculpt, "symmetry_y", text="Y")
412                 col.itemR(sculpt, "symmetry_z", text="Z")
413                 
414                 col = split.column()
415                 col.itemL(text="Lock:")
416                 col.itemR(sculpt, "lock_x", text="X")
417                 col.itemR(sculpt, "lock_y", text="Y")
418                 col.itemR(sculpt, "lock_z", text="Z")
419
420 # ********** default tools for weightpaint ****************
421
422 class View3DPanel(bpy.types.Panel):
423         __space_type__ = "VIEW_3D"
424         __region_type__ = "TOOLS"
425         __context__ = "weight_paint"
426
427 class VIEW3D_PT_weight_paint_options(View3DPanel):
428         __label__ = "Options"
429
430         def draw(self, context):
431                 layout = self.layout
432                 wpaint = context.tool_settings.weight_paint
433
434                 col = layout.column()
435                 col.itemL(text="Blend:")
436                 col.itemR(wpaint, "mode", text="")
437                 col.itemR(wpaint, "all_faces")
438                 col.itemR(wpaint, "normals")
439                 col.itemR(wpaint, "spray")
440                 col.itemR(wpaint, "vertex_dist", text="Distance")
441
442 # Commented out because the Apply button isn't an operator yet, making these settings useless
443 #               col.itemL(text="Gamma:")
444 #               col.itemR(wpaint, "gamma", text="")
445 #               col.itemL(text="Multiply:")
446 #               col.itemR(wpaint, "mul", text="")
447
448
449 # ********** default tools for vertexpaint ****************
450
451 class View3DPanel(bpy.types.Panel):
452         __space_type__ = "VIEW_3D"
453         __region_type__ = "TOOLS"
454
455 class VIEW3D_PT_vertex_paint_options(View3DPanel):
456         __context__ = "vertex_paint"
457         __label__ = "Options"
458
459         def draw(self, context):
460                 layout = self.layout
461                 vpaint = context.tool_settings.vertex_paint
462
463                 col = layout.column()
464                 col.itemL(text="Blend:")
465                 col.itemR(vpaint, "mode", text="")
466                 col.itemR(vpaint, "all_faces")
467                 col.itemR(vpaint, "normals")
468                 col.itemR(vpaint, "spray")
469                 col.itemR(vpaint, "vertex_dist", text="Distance")
470 # Commented out because the Apply button isn't an operator yet, making these settings useless
471 #               col.itemL(text="Gamma:")
472 #               col.itemR(vpaint, "gamma", text="")
473 #               col.itemL(text="Multiply:")
474 #               col.itemR(vpaint, "mul", text="")
475
476
477 # ********** default tools for texturepaint ****************
478
479 class View3DPanel(bpy.types.Panel):
480         __space_type__ = "VIEW_3D"
481         __region_type__ = "TOOLS"
482         __context__ = "texture_paint"
483
484 class VIEW3D_PT_tools_texture_paint(View3DPanel):
485         __label__ = "Options"
486
487         def draw(self, context):
488                 layout = self.layout
489                 ipaint = context.tool_settings.image_paint
490                 
491                 col = layout.column()
492                 col.itemR(ipaint, "use_projection")
493                 col.itemR(ipaint, "use_occlude")
494                 col.itemR(ipaint, "use_backface_cull")
495                 col.itemR(ipaint, "use_normal_falloff")
496                 col.itemR(ipaint, "invert_stencil")
497                 col.itemR(ipaint, "use_clone_layer")
498                 col.itemR(ipaint, "use_stencil_layer")
499                 
500                 col.itemR(ipaint, "seam_bleed")
501                 col.itemR(ipaint, "normal_angle")
502                 
503 # ********** default tools for particle mode ****************
504
505 class View3DPanel(bpy.types.Panel):
506         __space_type__ = "VIEW_3D"
507         __region_type__ = "TOOLS"
508         __context__ = "particle_mode"
509
510 class VIEW3D_PT_tools_particle_edit(View3DPanel):
511         __label__ = "Options"
512
513         def draw(self, context):
514                 layout = self.layout
515                 pe = context.tool_settings.particle_edit
516
517                 col = layout.column(align=True)
518
519                 col.itemR(pe, "emitter_deflect", text="Deflect")
520                 sub = col.row()
521                 sub.itemR(pe, "emitter_distance", text="Distance")
522                 sub.active = pe.emitter_deflect
523
524 bpy.types.register(VIEW3D_PT_tools_objectmode)
525 bpy.types.register(VIEW3D_PT_tools_editmode_mesh)
526 bpy.types.register(VIEW3D_PT_tools_editmode_curve)
527 bpy.types.register(VIEW3D_PT_tools_editmode_surface)
528 bpy.types.register(VIEW3D_PT_tools_editmode_text)
529 bpy.types.register(VIEW3D_PT_tools_editmode_armature)
530 bpy.types.register(VIEW3D_PT_tools_editmode_mball)
531 bpy.types.register(VIEW3D_PT_tools_editmode_lattice)
532 bpy.types.register(VIEW3D_PT_tools_posemode)
533 bpy.types.register(VIEW3D_PT_tools_brush)
534 bpy.types.register(VIEW3D_PT_tools_brush_curve)
535 bpy.types.register(VIEW3D_PT_sculpt_options)
536 bpy.types.register(VIEW3D_PT_vertex_paint_options)
537 bpy.types.register(VIEW3D_PT_weight_paint_options)
538 bpy.types.register(VIEW3D_PT_tools_texture_paint)
539 bpy.types.register(VIEW3D_PT_tools_particle_edit)
540