6ba45ac1cacce637f0ff7d3a7f2e8819cd0a5c4f
[blender.git] / release / scripts / ui / space_view3d_toolbar.py
1
2 import bpy
3
4 class View3DPanel(bpy.types.Panel):
5         __space_type__ = 'VIEW_3D'
6         __region_type__ = 'TOOLS'
7
8 # ********** default tools for objectmode ****************
9
10 class VIEW3D_PT_tools_objectmode(View3DPanel):
11         __context__ = "objectmode"
12         __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         __context__ = "mesh_edit"
57         __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         __context__ = "mesh_edit"
108         __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         __context__ = "curve_edit"
122         __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         __context__ = "surface_edit"
169         __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         __context__ = "text_edit"
208         __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         __context__ = "armature_edit"
234         __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         __context__ = "armature_edit"
269         __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         __context__ = "mball_edit"
283         __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         __context__ = "lattice_edit"
310         __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         __context__ = "posemode"
337         __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         __context__ = "posemode"
385         __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         __space_type__ = 'VIEW_3D'
400         __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         __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                         
523                         col = layout.column()
524                         row = col.row(align=True)
525                         row.itemR(brush, "size", slider=True)
526                         row.itemR(brush, "use_size_pressure", toggle=True, text="")
527                         
528                         row = col.row(align=True)
529                         row.itemR(brush, "strength", slider=True)
530                         row.itemR(brush, "use_strength_pressure", toggle=True, text="")
531                         
532                         row = col.row(align=True)
533                         row.itemR(brush, "jitter", slider=True)
534                         row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
535                 
536                 # Vertex Paint Mode #
537                 
538                 elif context.vertex_paint_object and brush:
539                         col = layout.column()
540                         col.itemR(brush, "color", text="")
541                         
542                         row = col.row(align=True)
543                         row.itemR(brush, "size", slider=True)
544                         row.itemR(brush, "use_size_pressure", toggle=True, text="")
545                         
546                         row = col.row(align=True)
547                         row.itemR(brush, "strength", slider=True)
548                         row.itemR(brush, "use_strength_pressure", toggle=True, text="")
549                         
550                         ''' # XXX - TODO
551                         row = col.row(align=True)
552                         row.itemR(brush, "jitter", slider=True)
553                         row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
554                         '''
555
556 class VIEW3D_PT_tools_brush_stroke(PaintPanel):
557         __label__ = "Stroke"
558         __default_closed__ = True
559
560         def poll(self, context):
561                 settings = self.paint_settings(context)
562                 return (settings and settings.brush and (context.sculpt_object or
563                                                          context.vertex_paint_object or
564                                                          context.weight_paint_object or
565                                                          context.texture_paint_object))
566
567         def draw(self, context):
568                 layout = self.layout
569                 
570                 settings = self.paint_settings(context)
571                 brush = settings.brush
572                 texture_paint = context.texture_paint_object
573
574                 if context.sculpt_object:
575                         if brush.sculpt_tool != 'LAYER':
576                                 layout.itemR(brush, "use_anchor")
577                         layout.itemR(brush, "use_rake")
578
579                 layout.itemR(brush, "use_airbrush")
580                 col = layout.column()
581                 col.active = brush.use_airbrush
582                 col.itemR(brush, "rate", slider=True)
583
584                 if not texture_paint:
585                         layout.itemR(brush, "use_smooth_stroke")
586                         col = layout.column()
587                         col.active = brush.use_smooth_stroke
588                         col.itemR(brush, "smooth_stroke_radius", text="Radius", slider=True)
589                         col.itemR(brush, "smooth_stroke_factor", text="Factor", slider=True)
590
591                 layout.itemR(brush, "use_space")
592                 row = layout.row(align=True)
593                 row.active = brush.use_space
594                 row.itemR(brush, "spacing", text="Distance", slider=True)
595                 if texture_paint:
596                         row.itemR(brush, "use_spacing_pressure", toggle=True, text="")  
597
598 class VIEW3D_PT_tools_brush_curve(PaintPanel):
599         __label__ = "Curve"
600         __default_closed__ = True
601
602         def poll(self, context):
603                 settings = self.paint_settings(context)
604                 return (settings and settings.brush and settings.brush.curve)
605
606         def draw(self, context):
607                 layout = self.layout
608                 
609                 settings = self.paint_settings(context)
610                 brush = settings.brush
611
612                 layout.template_curve_mapping(brush, "curve")
613                 layout.item_menu_enumO("brush.curve_preset", property="shape")
614                 
615 class VIEW3D_PT_sculpt_options(PaintPanel):
616         __label__ = "Options"
617
618         def poll(self, context):
619                 return context.sculpt_object
620
621         def draw(self, context):
622                 layout = self.layout
623                 
624                 sculpt = context.tool_settings.sculpt
625
626                 col = layout.column()
627                 col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
628                 col.itemR(sculpt, "show_brush")
629
630                 split = self.layout.split()
631                 
632                 col = split.column()
633                 col.itemL(text="Symmetry:")
634                 col.itemR(sculpt, "symmetry_x", text="X")
635                 col.itemR(sculpt, "symmetry_y", text="Y")
636                 col.itemR(sculpt, "symmetry_z", text="Z")
637                 
638                 col = split.column()
639                 col.itemL(text="Lock:")
640                 col.itemR(sculpt, "lock_x", text="X")
641                 col.itemR(sculpt, "lock_y", text="Y")
642                 col.itemR(sculpt, "lock_z", text="Z")
643
644 # ********** default tools for weightpaint ****************
645
646 class VIEW3D_PT_tools_weightpaint(View3DPanel):
647         __context__ = "weightpaint"
648         __label__ = "Weight Tools"
649
650         def draw(self, context):
651                 layout = self.layout
652                 
653                 wpaint = context.tool_settings.weight_paint
654
655                 col = layout.column()
656                 # col.itemL(text="Blend:")
657                 col.itemO("object.vertex_group_normalize_all", text="Normalize All")
658                 col.itemO("object.vertex_group_normalize", text="Normalize")
659                 col.itemO("object.vertex_group_invert", text="Invert")
660                 col.itemO("object.vertex_group_clean", text="Clean")
661
662 class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
663         __context__ = "weightpaint"
664         __label__ = "Options"
665
666         def draw(self, context):
667                 layout = self.layout
668                 
669                 wpaint = context.tool_settings.weight_paint
670
671                 col = layout.column()
672                 col.itemL(text="Blend:")
673                 col.itemR(wpaint, "mode", text="")
674                 col.itemR(wpaint, "all_faces")
675                 col.itemR(wpaint, "normals")
676                 col.itemR(wpaint, "spray")
677                 col.itemR(wpaint, "vertex_dist", text="Distance")
678                 
679                 
680                 data = context.weight_paint_object.data
681                 if type(data) == bpy.types.Mesh:
682                         col.itemR(data, "use_mirror_x")
683
684 # Commented out because the Apply button isn't an operator yet, making these settings useless
685 #               col.itemL(text="Gamma:")
686 #               col.itemR(wpaint, "gamma", text="")
687 #               col.itemL(text="Multiply:")
688 #               col.itemR(wpaint, "mul", text="")
689
690 # Also missing now:
691 # Soft, Vgroup, X-Mirror and "Clear" Operator.
692
693 # ********** default tools for vertexpaint ****************
694
695 class VIEW3D_PT_tools_vertexpaint(View3DPanel):
696         __context__ = "vertexpaint"
697         __label__ = "Options"
698
699         def draw(self, context):
700                 layout = self.layout
701                 
702                 vpaint = context.tool_settings.vertex_paint
703
704                 col = layout.column()
705                 col.itemL(text="Blend:")
706                 col.itemR(vpaint, "mode", text="")
707                 col.itemR(vpaint, "all_faces")
708                 col.itemR(vpaint, "normals")
709                 col.itemR(vpaint, "spray")
710                 col.itemR(vpaint, "vertex_dist", text="Distance")
711 # Commented out because the Apply button isn't an operator yet, making these settings useless
712 #               col.itemL(text="Gamma:")
713 #               col.itemR(vpaint, "gamma", text="")
714 #               col.itemL(text="Multiply:")
715 #               col.itemR(vpaint, "mul", text="")
716
717
718 # ********** default tools for texturepaint ****************
719
720 class VIEW3D_PT_tools_projectpaint(View3DPanel):
721         __context__ = "texturepaint"
722         __label__ = "Project Paint"
723
724         def poll(self, context):         
725                 return context.tool_settings.image_paint.tool != 'SMEAR'         
726
727         def draw_header(self, context):           
728                 ipaint = context.tool_settings.image_paint
729                 
730                 self.layout.itemR(ipaint, "use_projection", text="")
731
732         def draw(self, context):
733                 layout = self.layout
734                 
735                 ipaint = context.tool_settings.image_paint
736                 settings = context.tool_settings.image_paint
737                 use_projection= ipaint.use_projection
738                 
739                 col = layout.column()
740                 sub = col.column()
741                 sub.active = use_projection
742                 sub.itemR(ipaint, "use_occlude")
743                 sub.itemR(ipaint, "use_backface_cull")
744                 
745                 split = layout.split()
746                 
747                 col = split.column()
748                 col.active = (use_projection)
749                 col.itemR(ipaint, "use_normal_falloff")
750                 
751                 col = split.column()
752                 col.active = (ipaint.use_normal_falloff and use_projection)
753                 col.itemR(ipaint, "normal_angle", text="")
754
755                 split = layout.split(percentage=0.7)
756                 
757                 col = split.column(align=False)
758                 col.active = (use_projection)
759                 col.itemR(ipaint, "use_stencil_layer")
760                 
761                 col = split.column(align=False)
762                 col.active = (use_projection and ipaint.use_stencil_layer)
763                 col.itemR(ipaint, "invert_stencil", text="Inv")
764
765                 col = layout.column()
766                 sub = col.column()
767                 sub.active = (settings.tool == 'CLONE')
768                 sub.itemR(ipaint, "use_clone_layer")
769                 
770                 sub = col.column()
771                 sub.itemR(ipaint, "seam_bleed")
772                 
773 # ********** default tools for particle mode ****************
774
775 class VIEW3D_PT_tools_particlemode(View3DPanel):
776         __context__ = "particlemode"
777         __label__ = "Options"
778
779         def draw(self, context):
780                 layout = self.layout
781
782                 pe = context.tool_settings.particle_edit
783                 ob = pe.object
784
785                 layout.itemR(pe, "type", text="")
786                 
787                 if pe.type == 'PARTICLES':
788                         if ob.particle_systems:
789                                 if len(ob.particle_systems) > 1:
790                                         layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS')
791                                 
792                                 ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache
793                 else:
794                         for md in ob.modifiers:
795                                 if md.type==pe.type:
796                                         ptcache = md.point_cache
797                                         
798                 if ptcache and len(ptcache.point_cache_list) > 1:
799                         layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS')
800                         
801                 
802                 if not pe.editable:
803                         layout.itemL(text="Point cache must be baked")
804                         layout.itemL(text="to enable editing!")
805                 
806                 col = layout.column(align=True)
807                 if pe.hair:
808                         col.active = pe.editable
809                         col.itemR(pe, "emitter_deflect", text="Deflect emitter")
810                         sub = col.row()
811                         sub.active = pe.emitter_deflect
812                         sub.itemR(pe, "emitter_distance", text="Distance")
813                 
814                 col = layout.column(align=True)
815                 col.active = pe.editable
816                 col.itemL(text="Keep:")
817                 col.itemR(pe, "keep_lengths", text="Lenghts")
818                 col.itemR(pe, "keep_root", text="Root")
819                 if not pe.hair:
820                         col.itemL(text="Correct:")
821                         col.itemR(pe, "auto_velocity", text="Velocity")
822                 
823                 col = layout.column(align=True)
824                 col.active = pe.editable
825                 col.itemL(text="Draw:")
826                 col.itemR(pe, "draw_step", text="Path Steps")
827                 if pe.type == 'PARTICLES':
828                         col.itemR(pe, "draw_particles", text="Particles")
829                 col.itemR(pe, "fade_time")
830                 sub = col.row()
831                 sub.active = pe.fade_time
832                 sub.itemR(pe, "fade_frames", slider=True)
833
834 bpy.types.register(VIEW3D_PT_tools_weightpaint)
835 bpy.types.register(VIEW3D_PT_tools_objectmode)
836 bpy.types.register(VIEW3D_PT_tools_meshedit)
837 bpy.types.register(VIEW3D_PT_tools_meshedit_options)
838 bpy.types.register(VIEW3D_PT_tools_curveedit)
839 bpy.types.register(VIEW3D_PT_tools_surfaceedit)
840 bpy.types.register(VIEW3D_PT_tools_textedit)
841 bpy.types.register(VIEW3D_PT_tools_armatureedit)
842 bpy.types.register(VIEW3D_PT_tools_armatureedit_options)
843 bpy.types.register(VIEW3D_PT_tools_mballedit)
844 bpy.types.register(VIEW3D_PT_tools_latticeedit)
845 bpy.types.register(VIEW3D_PT_tools_posemode)
846 bpy.types.register(VIEW3D_PT_tools_posemode_options)
847 bpy.types.register(VIEW3D_PT_tools_brush)
848 bpy.types.register(VIEW3D_PT_tools_brush_stroke)
849 bpy.types.register(VIEW3D_PT_tools_brush_curve)
850 bpy.types.register(VIEW3D_PT_sculpt_options)
851 bpy.types.register(VIEW3D_PT_tools_vertexpaint)
852 bpy.types.register(VIEW3D_PT_tools_weightpaint_options)
853 bpy.types.register(VIEW3D_PT_tools_projectpaint)
854 bpy.types.register(VIEW3D_PT_tools_particlemode)