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