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