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