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