73f613177b8b6ac41ac7dbd8162f8995d6faeb46
[blender-staging.git] / release / scripts / ui / space_view3d_toolbar.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
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.
7
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.
12
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21
22
23 class View3DPanel(bpy.types.Panel):
24     bl_space_type = 'VIEW_3D'
25     bl_region_type = 'TOOLS'
26
27
28 # ********** default tools for objectmode ****************
29
30
31 class VIEW3D_PT_tools_objectmode(View3DPanel):
32     bl_context = "objectmode"
33     bl_label = "Object Tools"
34
35     def draw(self, context):
36         layout = self.layout
37
38         col = layout.column(align=True)
39         col.itemL(text="Transform:")
40         col.itemO("tfm.translate")
41         col.itemO("tfm.rotate")
42         col.itemO("tfm.resize", text="Scale")
43
44         col = layout.column(align=True)
45         col.itemL(text="Object:")
46         col.itemO("object.duplicate_move")
47         col.itemO("object.delete")
48
49         active_object = context.active_object
50         if active_object and active_object.type == 'MESH':
51
52             col = layout.column(align=True)
53             col.itemL(text="Shading:")
54             col.itemO("object.shade_smooth", text="Smooth")
55             col.itemO("object.shade_flat", text="Flat")
56
57         col = layout.column(align=True)
58         col.itemL(text="Keyframes:")
59         col.itemO("anim.insert_keyframe_menu", text="Insert")
60         col.itemO("anim.delete_keyframe_v3d", text="Remove")
61
62         col = layout.column(align=True)
63         col.itemL(text="Grease Pencil:")
64         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
65         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
66         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
67
68         col = layout.column(align=True)
69         col.itemL(text="Repeat:")
70         col.itemO("screen.repeat_last")
71         col.itemO("screen.repeat_history", text="History...")
72         col.itemO("screen.redo_last", text="Tweak...")
73
74 # ********** default tools for editmode_mesh ****************
75
76
77 class VIEW3D_PT_tools_meshedit(View3DPanel):
78     bl_context = "mesh_edit"
79     bl_label = "Mesh Tools"
80
81     def draw(self, context):
82         layout = self.layout
83
84         col = layout.column(align=True)
85         col.itemL(text="Transform:")
86         col.itemO("tfm.translate")
87         col.itemO("tfm.rotate")
88         col.itemO("tfm.resize", text="Scale")
89
90         col = layout.column(align=True)
91         col.itemL(text="Mesh:")
92         col.itemO("mesh.duplicate_move")
93         col.itemO("mesh.delete")
94
95         col = layout.column(align=True)
96         col.itemL(text="Modeling:")
97         col.itemO("mesh.extrude_move")
98         col.itemO("mesh.subdivide")
99         col.itemO("mesh.loopcut")
100         col.itemO("mesh.spin")
101         col.itemO("mesh.screw")
102         col.itemO("mesh.merge")
103         col.itemO("mesh.rip_move")
104
105         col = layout.column(align=True)
106         col.itemL(text="Shading:")
107         col.itemO("mesh.faces_shade_smooth", text="Smooth")
108         col.itemO("mesh.faces_shade_flat", text="Flat")
109
110         col = layout.column(align=True)
111         col.itemL(text="UV Mapping:")
112         col.itemO("uv.mapping_menu", text="Unwrap")
113         col.itemO("mesh.uvs_rotate")
114         col.itemO("mesh.uvs_mirror")
115
116         col = layout.column(align=True)
117         col.itemL(text="Grease Pencil:")
118         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
119         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
120         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
121
122         col = layout.column(align=True)
123         col.itemL(text="Repeat:")
124         col.itemO("screen.repeat_last")
125         col.itemO("screen.repeat_history", text="History...")
126         col.itemO("screen.redo_last", text="Tweak...")
127
128
129 class VIEW3D_PT_tools_meshedit_options(View3DPanel):
130     bl_context = "mesh_edit"
131     bl_label = "Mesh Options"
132
133     def draw(self, context):
134         layout = self.layout
135
136         mesh = context.active_object.data
137
138         col = layout.column(align=True)
139         col.itemR(mesh, "use_mirror_x")
140
141 # ********** default tools for editmode_curve ****************
142
143
144 class VIEW3D_PT_tools_curveedit(View3DPanel):
145     bl_context = "curve_edit"
146     bl_label = "Curve Tools"
147
148     def draw(self, context):
149         layout = self.layout
150
151         col = layout.column(align=True)
152         col.itemL(text="Transform:")
153         col.itemO("tfm.translate")
154         col.itemO("tfm.rotate")
155         col.itemO("tfm.resize", text="Scale")
156
157         col = layout.column(align=True)
158         col.itemL(text="Curve:")
159         col.itemO("curve.duplicate")
160         col.itemO("curve.delete")
161         col.itemO("curve.cyclic_toggle")
162         col.itemO("curve.switch_direction")
163         col.itemO("curve.spline_type_set")
164
165         col = layout.column(align=True)
166         col.itemL(text="Handles:")
167         col.item_enumO("curve.handle_type_set", "type", 'AUTOMATIC')
168         col.item_enumO("curve.handle_type_set", "type", 'VECTOR')
169         col.item_enumO("curve.handle_type_set", "type", 'ALIGN')
170         col.item_enumO("curve.handle_type_set", "type", 'FREE_ALIGN')
171
172         col = layout.column(align=True)
173         col.itemL(text="Modeling:")
174         col.itemO("curve.extrude")
175         col.itemO("curve.subdivide")
176
177         col = layout.column(align=True)
178         col.itemL(text="Grease Pencil:")
179         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
180         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
181         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
182
183         col = layout.column(align=True)
184         col.itemL(text="Repeat:")
185         col.itemO("screen.repeat_last")
186         col.itemO("screen.repeat_history", text="History...")
187         col.itemO("screen.redo_last", text="Tweak...")
188
189 # ********** default tools for editmode_surface ****************
190
191
192 class VIEW3D_PT_tools_surfaceedit(View3DPanel):
193     bl_context = "surface_edit"
194     bl_label = "Surface Tools"
195
196     def draw(self, context):
197         layout = self.layout
198
199         col = layout.column(align=True)
200         col.itemL(text="Transform:")
201         col.itemO("tfm.translate")
202         col.itemO("tfm.rotate")
203         col.itemO("tfm.resize", text="Scale")
204
205         col = layout.column(align=True)
206         col.itemL(text="Curve:")
207         col.itemO("curve.duplicate")
208         col.itemO("curve.delete")
209         col.itemO("curve.cyclic_toggle")
210         col.itemO("curve.switch_direction")
211
212         col = layout.column(align=True)
213         col.itemL(text="Modeling:")
214         col.itemO("curve.extrude")
215         col.itemO("curve.subdivide")
216
217         col = layout.column(align=True)
218         col.itemL(text="Grease Pencil:")
219         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
220         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
221         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
222
223         col = layout.column(align=True)
224         col.itemL(text="Repeat:")
225         col.itemO("screen.repeat_last")
226         col.itemO("screen.repeat_history", text="History...")
227         col.itemO("screen.redo_last", text="Tweak...")
228
229 # ********** default tools for editmode_text ****************
230
231
232 class VIEW3D_PT_tools_textedit(View3DPanel):
233     bl_context = "text_edit"
234     bl_label = "Text Tools"
235
236     def draw(self, context):
237         layout = self.layout
238
239         col = layout.column(align=True)
240         col.itemL(text="Text Edit:")
241         col.itemO("font.text_copy", text="Copy")
242         col.itemO("font.text_cut", text="Cut")
243         col.itemO("font.text_paste", text="Paste")
244
245         col = layout.column(align=True)
246         col.itemL(text="Style:")
247         col.itemO("font.case_set")
248         col.itemO("font.style_toggle")
249
250         col = layout.column(align=True)
251         col.itemL(text="Repeat:")
252         col.itemO("screen.repeat_last")
253         col.itemO("screen.repeat_history", text="History...")
254         col.itemO("screen.redo_last", text="Tweak...")
255
256 # ********** default tools for editmode_armature ****************
257
258
259 class VIEW3D_PT_tools_armatureedit(View3DPanel):
260     bl_context = "armature_edit"
261     bl_label = "Armature Tools"
262
263     def draw(self, context):
264         layout = self.layout
265
266         col = layout.column(align=True)
267         col.itemL(text="Transform:")
268         col.itemO("tfm.translate")
269         col.itemO("tfm.rotate")
270         col.itemO("tfm.resize", text="Scale")
271
272         col = layout.column(align=True)
273         col.itemL(text="Bones:")
274         col.itemO("armature.bone_primitive_add", text="Add")
275         col.itemO("armature.duplicate_move", text="Duplicate")
276         col.itemO("armature.delete", text="Delete")
277
278         col = layout.column(align=True)
279         col.itemL(text="Modeling:")
280         col.itemO("armature.extrude_move")
281         col.itemO("armature.subdivide_multi", text="Subdivide")
282
283         col = layout.column(align=True)
284         col.itemL(text="Grease Pencil:")
285         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
286         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
287         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
288
289         col = layout.column(align=True)
290         col.itemL(text="Repeat:")
291         col.itemO("screen.repeat_last")
292         col.itemO("screen.repeat_history", text="History...")
293         col.itemO("screen.redo_last", text="Tweak...")
294
295
296 class VIEW3D_PT_tools_armatureedit_options(View3DPanel):
297     bl_context = "armature_edit"
298     bl_label = "Armature Options"
299
300     def draw(self, context):
301         layout = self.layout
302
303         arm = context.active_object.data
304
305         col = layout.column(align=True)
306         col.itemR(arm, "x_axis_mirror")
307
308 # ********** default tools for editmode_mball ****************
309
310
311 class VIEW3D_PT_tools_mballedit(View3DPanel):
312     bl_context = "mball_edit"
313     bl_label = "Meta Tools"
314
315     def draw(self, context):
316         layout = self.layout
317
318         col = layout.column(align=True)
319         col.itemL(text="Transform:")
320         col.itemO("tfm.translate")
321         col.itemO("tfm.rotate")
322         col.itemO("tfm.resize", text="Scale")
323
324         col = layout.column(align=True)
325         col.itemL(text="Grease Pencil:")
326         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
327         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
328         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
329
330         col = layout.column(align=True)
331         col.itemL(text="Repeat:")
332         col.itemO("screen.repeat_last")
333         col.itemO("screen.repeat_history", text="History...")
334         col.itemO("screen.redo_last", text="Tweak...")
335
336 # ********** default tools for editmode_lattice ****************
337
338
339 class VIEW3D_PT_tools_latticeedit(View3DPanel):
340     bl_context = "lattice_edit"
341     bl_label = "Lattice Tools"
342
343     def draw(self, context):
344         layout = self.layout
345
346         col = layout.column(align=True)
347         col.itemL(text="Transform:")
348         col.itemO("tfm.translate")
349         col.itemO("tfm.rotate")
350         col.itemO("tfm.resize", text="Scale")
351
352         col = layout.column(align=True)
353         col.itemL(text="Grease Pencil:")
354         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
355         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
356         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
357
358         col = layout.column(align=True)
359         col.itemL(text="Repeat:")
360         col.itemO("screen.repeat_last")
361         col.itemO("screen.repeat_history", text="History...")
362         col.itemO("screen.redo_last", text="Tweak...")
363
364 # ********** default tools for posemode ****************
365
366
367 class VIEW3D_PT_tools_posemode(View3DPanel):
368     bl_context = "posemode"
369     bl_label = "Pose Tools"
370
371     def draw(self, context):
372         layout = self.layout
373
374         col = layout.column(align=True)
375         col.itemL(text="Transform:")
376         col.itemO("tfm.translate")
377         col.itemO("tfm.rotate")
378         col.itemO("tfm.resize", text="Scale")
379
380         col = layout.column(align=True)
381         col.itemL(text="Bones:")
382         col.itemO("pose.hide", text="Hide")
383         col.itemO("pose.reveal", text="Reveal")
384
385         col = layout.column(align=True)
386         col.itemL(text="Keyframes:")
387         col.itemO("anim.insert_keyframe_menu", text="Insert")
388         col.itemO("anim.delete_keyframe_v3d", text="Remove")
389
390         col = layout.column(align=True)
391         col.itemL(text="Pose:")
392         col.itemO("pose.copy", text="Copy")
393         col.itemO("pose.paste", text="Paste")
394         col.itemO("poselib.pose_add", text="Add To Library")
395         col.itemO("poselib.browse_interactive", text="Browse Library")
396
397         col = layout.column(align=True)
398         col.itemL(text="In-Between:")
399         col.itemO("pose.relax", text="Relax")
400         col.itemO("pose.push", text="Push")
401         col.itemO("pose.breakdown", text="Breakdowner")
402
403         col = layout.column(align=True)
404         col.itemL(text="Grease Pencil:")
405         col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand")
406         col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line")
407         col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser")
408
409         col = layout.column(align=True)
410         col.itemL(text="Repeat:")
411         col.itemO("screen.repeat_last")
412         col.itemO("screen.repeat_history", text="History...")
413         col.itemO("screen.redo_last", text="Tweak...")
414
415
416 class VIEW3D_PT_tools_posemode_options(View3DPanel):
417     bl_context = "posemode"
418     bl_label = "Pose Options"
419
420     def draw(self, context):
421         layout = self.layout
422
423         arm = context.active_object.data
424
425         col = layout.column(align=True)
426         col.itemR(arm, "x_axis_mirror")
427         col.itemR(arm, "auto_ik")
428
429 # ********** default tools for paint modes ****************
430
431
432 class PaintPanel(bpy.types.Panel):
433     bl_space_type = 'VIEW_3D'
434     bl_region_type = 'TOOLS'
435
436     def paint_settings(self, context):
437         ts = context.tool_settings
438
439         if context.sculpt_object:
440             return ts.sculpt
441         elif context.vertex_paint_object:
442             return ts.vertex_paint
443         elif context.weight_paint_object:
444             return ts.weight_paint
445         elif context.texture_paint_object:
446             return ts.image_paint
447         elif context.particle_edit_object:
448             return ts.particle_edit
449
450         return False
451
452
453 class VIEW3D_PT_tools_brush(PaintPanel):
454     bl_label = "Brush"
455
456     def poll(self, context):
457         return self.paint_settings(context)
458
459     def draw(self, context):
460         layout = self.layout
461
462         settings = self.paint_settings(context)
463         brush = settings.brush
464
465         if not context.particle_edit_object:
466             col = layout.split().column()
467             row = col.row()
468             row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
469
470             col.template_ID(settings, "brush", new="brush.add")
471
472         # Particle Mode #
473
474         # XXX This needs a check if psys is editable.
475         if context.particle_edit_object:
476             # XXX Select Particle System
477             layout.column().itemR(settings, "tool", expand=True)
478
479             if settings.tool != 'NONE':
480                 col = layout.column()
481                 col.itemR(brush, "size", slider=True)
482                 col.itemR(brush, "strength", slider=True)
483
484             if settings.tool == 'ADD':
485                 col = layout.column()
486                 col.itemR(settings, "add_interpolate")
487                 sub = col.column(align=True)
488                 sub.active = settings.add_interpolate
489                 sub.itemR(brush, "steps", slider=True)
490                 sub.itemR(settings, "add_keys", slider=True)
491             elif settings.tool == 'LENGTH':
492                 layout.itemR(brush, "length_mode", expand=True)
493             elif settings.tool == 'PUFF':
494                 layout.itemR(brush, "puff_mode", expand=True)
495
496         # Sculpt Mode #
497
498         elif context.sculpt_object and brush:
499             col = layout.column()
500             col.itemS()
501             col.itemR(brush, "sculpt_tool", expand=True)
502             col.itemS()
503
504             row = col.row(align=True)
505             row.itemR(brush, "size", slider=True)
506             row.itemR(brush, "use_size_pressure", toggle=True, text="")
507
508             if brush.sculpt_tool != 'GRAB':
509                 row = col.row(align=True)
510                 row.itemR(brush, "strength", slider=True)
511                 row.itemR(brush, "use_strength_pressure", text="")
512
513                 ''' # XXX - TODO
514                 row = col.row(align=True)
515                 row.itemR(brush, "jitter", slider=True)
516                 row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
517                 '''
518                 col = layout.column()
519
520                 if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
521                     col.row().itemR(brush, "direction", expand=True)
522
523                 if brush.sculpt_tool == 'LAYER':
524                     col.itemR(brush, "persistent")
525                     col.itemO("sculpt.set_persistent_base")
526
527         # Texture Paint Mode #
528
529         elif context.texture_paint_object and brush:
530             col = layout.column(align=True)
531             col.item_enumR(settings, "tool", 'DRAW')
532             col.item_enumR(settings, "tool", 'SOFTEN')
533             col.item_enumR(settings, "tool", 'CLONE')
534             col.item_enumR(settings, "tool", 'SMEAR')
535
536             col = layout.column()
537             col.itemR(brush, "color", text="")
538
539             row = col.row(align=True)
540             row.itemR(brush, "size", slider=True)
541             row.itemR(brush, "use_size_pressure", toggle=True, text="")
542
543             row = col.row(align=True)
544             row.itemR(brush, "strength", slider=True)
545             row.itemR(brush, "use_strength_pressure", toggle=True, text="")
546
547             row = col.row(align=True)
548             row.itemR(brush, "jitter", slider=True)
549             row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
550
551             col.itemR(brush, "blend", text="Blend")
552
553         # Weight Paint Mode #
554
555         elif context.weight_paint_object and brush:
556             layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
557             layout.itemR(context.tool_settings, "auto_normalize", text="Auto Normalize")
558
559             col = layout.column()
560             row = col.row(align=True)
561             row.itemR(brush, "size", slider=True)
562             row.itemR(brush, "use_size_pressure", toggle=True, text="")
563
564             row = col.row(align=True)
565             row.itemR(brush, "strength", slider=True)
566             row.itemR(brush, "use_strength_pressure", toggle=True, text="")
567
568             row = col.row(align=True)
569             row.itemR(brush, "jitter", slider=True)
570             row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
571
572         # Vertex Paint Mode #
573
574         elif context.vertex_paint_object and brush:
575             col = layout.column()
576             col.itemR(brush, "color", text="")
577
578             row = col.row(align=True)
579             row.itemR(brush, "size", slider=True)
580             row.itemR(brush, "use_size_pressure", toggle=True, text="")
581
582             row = col.row(align=True)
583             row.itemR(brush, "strength", slider=True)
584             row.itemR(brush, "use_strength_pressure", toggle=True, text="")
585
586             ''' # XXX - TODO
587             row = col.row(align=True)
588             row.itemR(brush, "jitter", slider=True)
589             row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
590             '''
591
592
593 class VIEW3D_PT_tools_brush_stroke(PaintPanel):
594     bl_label = "Stroke"
595     bl_default_closed = True
596
597     def poll(self, context):
598         settings = self.paint_settings(context)
599         return (settings and settings.brush and (context.sculpt_object or
600                              context.vertex_paint_object or
601                              context.weight_paint_object or
602                              context.texture_paint_object))
603
604     def draw(self, context):
605         layout = self.layout
606
607         settings = self.paint_settings(context)
608         brush = settings.brush
609         texture_paint = context.texture_paint_object
610
611         if context.sculpt_object:
612             if brush.sculpt_tool != 'LAYER':
613                 layout.itemR(brush, "use_anchor")
614             layout.itemR(brush, "use_rake")
615
616         layout.itemR(brush, "use_airbrush")
617         col = layout.column()
618         col.active = brush.use_airbrush
619         col.itemR(brush, "rate", slider=True)
620
621         if not texture_paint:
622             layout.itemR(brush, "use_smooth_stroke")
623             col = layout.column()
624             col.active = brush.use_smooth_stroke
625             col.itemR(brush, "smooth_stroke_radius", text="Radius", slider=True)
626             col.itemR(brush, "smooth_stroke_factor", text="Factor", slider=True)
627
628         layout.itemR(brush, "use_space")
629         row = layout.row(align=True)
630         row.active = brush.use_space
631         row.itemR(brush, "spacing", text="Distance", slider=True)
632         if texture_paint:
633             row.itemR(brush, "use_spacing_pressure", toggle=True, text="")
634
635
636 class VIEW3D_PT_tools_brush_curve(PaintPanel):
637     bl_label = "Curve"
638     bl_default_closed = True
639
640     def poll(self, context):
641         settings = self.paint_settings(context)
642         return (settings and settings.brush and settings.brush.curve)
643
644     def draw(self, context):
645         layout = self.layout
646
647         settings = self.paint_settings(context)
648         brush = settings.brush
649
650         layout.template_curve_mapping(brush, "curve")
651         layout.item_menu_enumO("brush.curve_preset", property="shape")
652
653
654 class VIEW3D_PT_sculpt_options(PaintPanel):
655     bl_label = "Options"
656
657     def poll(self, context):
658         return context.sculpt_object
659
660     def draw(self, context):
661         layout = self.layout
662
663         sculpt = context.tool_settings.sculpt
664
665         col = layout.column()
666         col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
667         col.itemR(sculpt, "show_brush")
668
669         split = self.layout.split()
670
671         col = split.column()
672         col.itemL(text="Symmetry:")
673         col.itemR(sculpt, "symmetry_x", text="X")
674         col.itemR(sculpt, "symmetry_y", text="Y")
675         col.itemR(sculpt, "symmetry_z", text="Z")
676
677         col = split.column()
678         col.itemL(text="Lock:")
679         col.itemR(sculpt, "lock_x", text="X")
680         col.itemR(sculpt, "lock_y", text="Y")
681         col.itemR(sculpt, "lock_z", text="Z")
682
683 # ********** default tools for weightpaint ****************
684
685
686 class VIEW3D_PT_tools_weightpaint(View3DPanel):
687     bl_context = "weightpaint"
688     bl_label = "Weight Tools"
689
690     def draw(self, context):
691         layout = self.layout
692
693         wpaint = context.tool_settings.weight_paint
694
695         col = layout.column()
696         # col.itemL(text="Blend:")
697         col.itemO("object.vertex_group_normalize_all", text="Normalize All")
698         col.itemO("object.vertex_group_normalize", text="Normalize")
699         col.itemO("object.vertex_group_invert", text="Invert")
700         col.itemO("object.vertex_group_clean", text="Clean")
701
702
703 class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
704     bl_context = "weightpaint"
705     bl_label = "Options"
706
707     def draw(self, context):
708         layout = self.layout
709
710         wpaint = context.tool_settings.weight_paint
711
712         col = layout.column()
713         col.itemL(text="Blend:")
714         col.itemR(wpaint, "mode", text="")
715         col.itemR(wpaint, "all_faces")
716         col.itemR(wpaint, "normals")
717         col.itemR(wpaint, "spray")
718         col.itemR(wpaint, "vertex_dist", text="Distance")
719
720
721         data = context.weight_paint_object.data
722         if type(data) == bpy.types.Mesh:
723             col.itemR(data, "use_mirror_x")
724
725 # Commented out because the Apply button isn't an operator yet, making these settings useless
726 #               col.itemL(text="Gamma:")
727 #               col.itemR(wpaint, "gamma", text="")
728 #               col.itemL(text="Multiply:")
729 #               col.itemR(wpaint, "mul", text="")
730
731 # Also missing now:
732 # Soft, Vgroup, X-Mirror and "Clear" Operator.
733
734 # ********** default tools for vertexpaint ****************
735
736
737 class VIEW3D_PT_tools_vertexpaint(View3DPanel):
738     bl_context = "vertexpaint"
739     bl_label = "Options"
740
741     def draw(self, context):
742         layout = self.layout
743
744         vpaint = context.tool_settings.vertex_paint
745
746         col = layout.column()
747         col.itemL(text="Blend:")
748         col.itemR(vpaint, "mode", text="")
749         col.itemR(vpaint, "all_faces")
750         col.itemR(vpaint, "normals")
751         col.itemR(vpaint, "spray")
752         col.itemR(vpaint, "vertex_dist", text="Distance")
753 # Commented out because the Apply button isn't an operator yet, making these settings useless
754 #               col.itemL(text="Gamma:")
755 #               col.itemR(vpaint, "gamma", text="")
756 #               col.itemL(text="Multiply:")
757 #               col.itemR(vpaint, "mul", text="")
758
759 # ********** default tools for texturepaint ****************
760
761
762 class VIEW3D_PT_tools_projectpaint(View3DPanel):
763     bl_context = "texturepaint"
764     bl_label = "Project Paint"
765
766     def poll(self, context):
767         return context.tool_settings.image_paint.tool != 'SMEAR'
768
769     def draw_header(self, context):
770         ipaint = context.tool_settings.image_paint
771
772         self.layout.itemR(ipaint, "use_projection", text="")
773
774     def draw(self, context):
775         layout = self.layout
776
777         ipaint = context.tool_settings.image_paint
778         settings = context.tool_settings.image_paint
779         use_projection = ipaint.use_projection
780
781         col = layout.column()
782         sub = col.column()
783         sub.active = use_projection
784         sub.itemR(ipaint, "use_occlude")
785         sub.itemR(ipaint, "use_backface_cull")
786
787         split = layout.split()
788
789         col = split.column()
790         col.active = (use_projection)
791         col.itemR(ipaint, "use_normal_falloff")
792
793         col = split.column()
794         col.active = (ipaint.use_normal_falloff and use_projection)
795         col.itemR(ipaint, "normal_angle", text="")
796
797         split = layout.split(percentage=0.7)
798
799         col = split.column(align=False)
800         col.active = (use_projection)
801         col.itemR(ipaint, "use_stencil_layer")
802
803         col = split.column(align=False)
804         col.active = (use_projection and ipaint.use_stencil_layer)
805         col.itemR(ipaint, "invert_stencil", text="Inv")
806
807         col = layout.column()
808         sub = col.column()
809         sub.active = (settings.tool == 'CLONE')
810         sub.itemR(ipaint, "use_clone_layer")
811
812         sub = col.column()
813         sub.itemR(ipaint, "seam_bleed")
814
815
816 class VIEW3D_PT_tools_particlemode(View3DPanel):
817     '''default tools for particle mode'''
818     bl_context = "particlemode"
819     bl_label = "Options"
820
821     def draw(self, context):
822         layout = self.layout
823
824         pe = context.tool_settings.particle_edit
825         ob = pe.object
826
827         layout.itemR(pe, "type", text="")
828
829         if pe.type == 'PARTICLES':
830             if ob.particle_systems:
831                 if len(ob.particle_systems) > 1:
832                     layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS')
833
834                 ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache
835         else:
836             for md in ob.modifiers:
837                 if md.type == pe.type:
838                     ptcache = md.point_cache
839
840         if ptcache and len(ptcache.point_cache_list) > 1:
841             layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS')
842
843
844         if not pe.editable:
845             layout.itemL(text="Point cache must be baked")
846             layout.itemL(text="to enable editing!")
847
848         col = layout.column(align=True)
849         if pe.hair:
850             col.active = pe.editable
851             col.itemR(pe, "emitter_deflect", text="Deflect emitter")
852             sub = col.row()
853             sub.active = pe.emitter_deflect
854             sub.itemR(pe, "emitter_distance", text="Distance")
855
856         col = layout.column(align=True)
857         col.active = pe.editable
858         col.itemL(text="Keep:")
859         col.itemR(pe, "keep_lengths", text="Lenghts")
860         col.itemR(pe, "keep_root", text="Root")
861         if not pe.hair:
862             col.itemL(text="Correct:")
863             col.itemR(pe, "auto_velocity", text="Velocity")
864
865         col = layout.column(align=True)
866         col.active = pe.editable
867         col.itemL(text="Draw:")
868         col.itemR(pe, "draw_step", text="Path Steps")
869         if pe.type == 'PARTICLES':
870             col.itemR(pe, "draw_particles", text="Particles")
871         col.itemR(pe, "fade_time")
872         sub = col.row()
873         sub.active = pe.fade_time
874         sub.itemR(pe, "fade_frames", slider=True)
875
876
877 bpy.types.register(VIEW3D_PT_tools_weightpaint)
878 bpy.types.register(VIEW3D_PT_tools_objectmode)
879 bpy.types.register(VIEW3D_PT_tools_meshedit)
880 bpy.types.register(VIEW3D_PT_tools_meshedit_options)
881 bpy.types.register(VIEW3D_PT_tools_curveedit)
882 bpy.types.register(VIEW3D_PT_tools_surfaceedit)
883 bpy.types.register(VIEW3D_PT_tools_textedit)
884 bpy.types.register(VIEW3D_PT_tools_armatureedit)
885 bpy.types.register(VIEW3D_PT_tools_armatureedit_options)
886 bpy.types.register(VIEW3D_PT_tools_mballedit)
887 bpy.types.register(VIEW3D_PT_tools_latticeedit)
888 bpy.types.register(VIEW3D_PT_tools_posemode)
889 bpy.types.register(VIEW3D_PT_tools_posemode_options)
890 bpy.types.register(VIEW3D_PT_tools_brush)
891 bpy.types.register(VIEW3D_PT_tools_brush_stroke)
892 bpy.types.register(VIEW3D_PT_tools_brush_curve)
893 bpy.types.register(VIEW3D_PT_sculpt_options)
894 bpy.types.register(VIEW3D_PT_tools_vertexpaint)
895 bpy.types.register(VIEW3D_PT_tools_weightpaint_options)
896 bpy.types.register(VIEW3D_PT_tools_projectpaint)
897 bpy.types.register(VIEW3D_PT_tools_particlemode)