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