- removing the last particle system now exits particle edit mode.
[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         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 == 'LAYER':
528                     col.itemR(brush, "use_persistent")
529                     col.itemO("sculpt.set_persistent_base")
530
531         # Texture Paint Mode #
532
533         elif context.texture_paint_object and brush:
534             col = layout.column(align=True)
535             col.item_enumR(settings, "tool", 'DRAW')
536             col.item_enumR(settings, "tool", 'SOFTEN')
537             col.item_enumR(settings, "tool", 'CLONE')
538             col.item_enumR(settings, "tool", 'SMEAR')
539
540             col = layout.column()
541             col.itemR(brush, "color", text="")
542
543             row = col.row(align=True)
544             row.itemR(brush, "size", slider=True)
545             row.itemR(brush, "use_size_pressure", toggle=True, text="")
546
547             row = col.row(align=True)
548             row.itemR(brush, "strength", slider=True)
549             row.itemR(brush, "use_strength_pressure", toggle=True, text="")
550
551             row = col.row(align=True)
552             row.itemR(brush, "jitter", slider=True)
553             row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
554
555             col.itemR(brush, "blend", text="Blend")
556
557         # Weight Paint Mode #
558
559         elif context.weight_paint_object and brush:
560             layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
561             layout.itemR(context.tool_settings, "auto_normalize", text="Auto Normalize")
562
563             col = layout.column()
564             row = col.row(align=True)
565             row.itemR(brush, "size", slider=True)
566             row.itemR(brush, "use_size_pressure", toggle=True, text="")
567
568             row = col.row(align=True)
569             row.itemR(brush, "strength", slider=True)
570             row.itemR(brush, "use_strength_pressure", toggle=True, text="")
571
572             row = col.row(align=True)
573             row.itemR(brush, "jitter", slider=True)
574             row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
575
576         # Vertex Paint Mode #
577
578         elif context.vertex_paint_object and brush:
579             col = layout.column()
580             col.itemR(brush, "color", text="")
581
582             row = col.row(align=True)
583             row.itemR(brush, "size", slider=True)
584             row.itemR(brush, "use_size_pressure", toggle=True, text="")
585
586             row = col.row(align=True)
587             row.itemR(brush, "strength", slider=True)
588             row.itemR(brush, "use_strength_pressure", toggle=True, text="")
589
590             ''' # XXX - TODO
591             row = col.row(align=True)
592             row.itemR(brush, "jitter", slider=True)
593             row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
594             '''
595
596
597 class VIEW3D_PT_tools_brush_stroke(PaintPanel):
598     bl_label = "Stroke"
599     bl_default_closed = True
600
601     def poll(self, context):
602         settings = self.paint_settings(context)
603         return (settings and settings.brush and (context.sculpt_object or
604                              context.vertex_paint_object or
605                              context.weight_paint_object or
606                              context.texture_paint_object))
607
608     def draw(self, context):
609         layout = self.layout
610
611         settings = self.paint_settings(context)
612         brush = settings.brush
613         texture_paint = context.texture_paint_object
614
615         if context.sculpt_object:
616             if brush.sculpt_tool != 'LAYER':
617                 layout.itemR(brush, "use_anchor")
618             layout.itemR(brush, "use_rake")
619
620         layout.itemR(brush, "use_airbrush")
621         col = layout.column()
622         col.active = brush.use_airbrush
623         col.itemR(brush, "rate", slider=True)
624
625         if not texture_paint:
626             layout.itemR(brush, "use_smooth_stroke")
627             col = layout.column()
628             col.active = brush.use_smooth_stroke
629             col.itemR(brush, "smooth_stroke_radius", text="Radius", slider=True)
630             col.itemR(brush, "smooth_stroke_factor", text="Factor", slider=True)
631
632         layout.itemR(brush, "use_space")
633         row = layout.row(align=True)
634         row.active = brush.use_space
635         row.itemR(brush, "spacing", text="Distance", slider=True)
636         if texture_paint:
637             row.itemR(brush, "use_spacing_pressure", toggle=True, text="")
638
639
640 class VIEW3D_PT_tools_brush_curve(PaintPanel):
641     bl_label = "Curve"
642     bl_default_closed = True
643
644     def poll(self, context):
645         settings = self.paint_settings(context)
646         return (settings and settings.brush and settings.brush.curve)
647
648     def draw(self, context):
649         layout = self.layout
650
651         settings = self.paint_settings(context)
652         brush = settings.brush
653
654         layout.template_curve_mapping(brush, "curve")
655         layout.item_menu_enumO("brush.curve_preset", property="shape")
656
657
658 class VIEW3D_PT_sculpt_options(PaintPanel):
659     bl_label = "Options"
660
661     def poll(self, context):
662         return context.sculpt_object
663
664     def draw(self, context):
665         layout = self.layout
666
667         sculpt = context.tool_settings.sculpt
668
669         col = layout.column()
670         col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
671         col.itemR(sculpt, "show_brush")
672
673         split = self.layout.split()
674
675         col = split.column()
676         col.itemL(text="Symmetry:")
677         col.itemR(sculpt, "symmetry_x", text="X")
678         col.itemR(sculpt, "symmetry_y", text="Y")
679         col.itemR(sculpt, "symmetry_z", text="Z")
680
681         col = split.column()
682         col.itemL(text="Lock:")
683         col.itemR(sculpt, "lock_x", text="X")
684         col.itemR(sculpt, "lock_y", text="Y")
685         col.itemR(sculpt, "lock_z", text="Z")
686
687 # ********** default tools for weightpaint ****************
688
689
690 class VIEW3D_PT_tools_weightpaint(View3DPanel):
691     bl_context = "weightpaint"
692     bl_label = "Weight Tools"
693
694     def draw(self, context):
695         layout = self.layout
696
697         wpaint = context.tool_settings.weight_paint
698
699         col = layout.column()
700         # col.itemL(text="Blend:")
701         col.itemO("object.vertex_group_normalize_all", text="Normalize All")
702         col.itemO("object.vertex_group_normalize", text="Normalize")
703         col.itemO("object.vertex_group_invert", text="Invert")
704         col.itemO("object.vertex_group_clean", text="Clean")
705
706
707 class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
708     bl_context = "weightpaint"
709     bl_label = "Options"
710
711     def draw(self, context):
712         layout = self.layout
713
714         wpaint = context.tool_settings.weight_paint
715
716         col = layout.column()
717         col.itemL(text="Blend:")
718         col.itemR(wpaint, "mode", text="")
719         col.itemR(wpaint, "all_faces")
720         col.itemR(wpaint, "normals")
721         col.itemR(wpaint, "spray")
722         col.itemR(wpaint, "vertex_dist", text="Distance")
723
724
725         data = context.weight_paint_object.data
726         if type(data) == bpy.types.Mesh:
727             col.itemR(data, "use_mirror_x")
728
729 # Commented out because the Apply button isn't an operator yet, making these settings useless
730 #               col.itemL(text="Gamma:")
731 #               col.itemR(wpaint, "gamma", text="")
732 #               col.itemL(text="Multiply:")
733 #               col.itemR(wpaint, "mul", text="")
734
735 # Also missing now:
736 # Soft, Vgroup, X-Mirror and "Clear" Operator.
737
738 # ********** default tools for vertexpaint ****************
739
740
741 class VIEW3D_PT_tools_vertexpaint(View3DPanel):
742     bl_context = "vertexpaint"
743     bl_label = "Options"
744
745     def draw(self, context):
746         layout = self.layout
747
748         vpaint = context.tool_settings.vertex_paint
749
750         col = layout.column()
751         col.itemL(text="Blend:")
752         col.itemR(vpaint, "mode", text="")
753         col.itemR(vpaint, "all_faces")
754         col.itemR(vpaint, "normals")
755         col.itemR(vpaint, "spray")
756         col.itemR(vpaint, "vertex_dist", text="Distance")
757 # Commented out because the Apply button isn't an operator yet, making these settings useless
758 #               col.itemL(text="Gamma:")
759 #               col.itemR(vpaint, "gamma", text="")
760 #               col.itemL(text="Multiply:")
761 #               col.itemR(vpaint, "mul", text="")
762
763 # ********** default tools for texturepaint ****************
764
765
766 class VIEW3D_PT_tools_projectpaint(View3DPanel):
767     bl_context = "texturepaint"
768     bl_label = "Project Paint"
769
770     def poll(self, context):
771         return context.tool_settings.image_paint.tool != 'SMEAR'
772
773     def draw_header(self, context):
774         ipaint = context.tool_settings.image_paint
775
776         self.layout.itemR(ipaint, "use_projection", text="")
777
778     def draw(self, context):
779         layout = self.layout
780
781         ipaint = context.tool_settings.image_paint
782         settings = context.tool_settings.image_paint
783         use_projection = ipaint.use_projection
784
785         col = layout.column()
786         sub = col.column()
787         sub.active = use_projection
788         sub.itemR(ipaint, "use_occlude")
789         sub.itemR(ipaint, "use_backface_cull")
790
791         split = layout.split()
792
793         col = split.column()
794         col.active = (use_projection)
795         col.itemR(ipaint, "use_normal_falloff")
796
797         col = split.column()
798         col.active = (ipaint.use_normal_falloff and use_projection)
799         col.itemR(ipaint, "normal_angle", text="")
800
801         split = layout.split(percentage=0.7)
802
803         col = split.column(align=False)
804         col.active = (use_projection)
805         col.itemR(ipaint, "use_stencil_layer")
806
807         col = split.column(align=False)
808         col.active = (use_projection and ipaint.use_stencil_layer)
809         col.itemR(ipaint, "invert_stencil", text="Inv")
810
811         col = layout.column()
812         sub = col.column()
813         sub.active = (settings.tool == 'CLONE')
814         sub.itemR(ipaint, "use_clone_layer")
815
816         sub = col.column()
817         sub.itemR(ipaint, "seam_bleed")
818
819
820 class VIEW3D_PT_tools_particlemode(View3DPanel):
821     '''default tools for particle mode'''
822     bl_context = "particlemode"
823     bl_label = "Options"
824
825     def draw(self, context):
826         layout = self.layout
827
828         pe = context.tool_settings.particle_edit
829         ob = pe.object
830
831         layout.itemR(pe, "type", text="")
832
833         ptcache = None
834
835         if pe.type == 'PARTICLES':
836             if ob.particle_systems:
837                 if len(ob.particle_systems) > 1:
838                     layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS')
839
840                 ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache
841         else:
842             for md in ob.modifiers:
843                 if md.type == pe.type:
844                     ptcache = md.point_cache
845
846         if ptcache and len(ptcache.point_cache_list) > 1:
847             layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS')
848
849
850         if not pe.editable:
851             layout.itemL(text="Point cache must be baked")
852             layout.itemL(text="to enable editing!")
853
854         col = layout.column(align=True)
855         if pe.hair:
856             col.active = pe.editable
857             col.itemR(pe, "emitter_deflect", text="Deflect emitter")
858             sub = col.row()
859             sub.active = pe.emitter_deflect
860             sub.itemR(pe, "emitter_distance", text="Distance")
861
862         col = layout.column(align=True)
863         col.active = pe.editable
864         col.itemL(text="Keep:")
865         col.itemR(pe, "keep_lengths", text="Lenghts")
866         col.itemR(pe, "keep_root", text="Root")
867         if not pe.hair:
868             col.itemL(text="Correct:")
869             col.itemR(pe, "auto_velocity", text="Velocity")
870
871         col = layout.column(align=True)
872         col.active = pe.editable
873         col.itemL(text="Draw:")
874         col.itemR(pe, "draw_step", text="Path Steps")
875         if pe.type == 'PARTICLES':
876             col.itemR(pe, "draw_particles", text="Particles")
877         col.itemR(pe, "fade_time")
878         sub = col.row()
879         sub.active = pe.fade_time
880         sub.itemR(pe, "fade_frames", slider=True)
881
882
883 bpy.types.register(VIEW3D_PT_tools_weightpaint)
884 bpy.types.register(VIEW3D_PT_tools_objectmode)
885 bpy.types.register(VIEW3D_PT_tools_meshedit)
886 bpy.types.register(VIEW3D_PT_tools_meshedit_options)
887 bpy.types.register(VIEW3D_PT_tools_curveedit)
888 bpy.types.register(VIEW3D_PT_tools_surfaceedit)
889 bpy.types.register(VIEW3D_PT_tools_textedit)
890 bpy.types.register(VIEW3D_PT_tools_armatureedit)
891 bpy.types.register(VIEW3D_PT_tools_armatureedit_options)
892 bpy.types.register(VIEW3D_PT_tools_mballedit)
893 bpy.types.register(VIEW3D_PT_tools_latticeedit)
894 bpy.types.register(VIEW3D_PT_tools_posemode)
895 bpy.types.register(VIEW3D_PT_tools_posemode_options)
896 bpy.types.register(VIEW3D_PT_tools_brush)
897 bpy.types.register(VIEW3D_PT_tools_brush_stroke)
898 bpy.types.register(VIEW3D_PT_tools_brush_curve)
899 bpy.types.register(VIEW3D_PT_sculpt_options)
900 bpy.types.register(VIEW3D_PT_tools_vertexpaint)
901 bpy.types.register(VIEW3D_PT_tools_weightpaint_options)
902 bpy.types.register(VIEW3D_PT_tools_projectpaint)
903 bpy.types.register(VIEW3D_PT_tools_particlemode)