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