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