Vertex/Weight Paint: Use PBVH for painting
[blender.git] / release / scripts / startup / bl_ui / space_view3d_toolbar.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Menu, Panel, UIList
22 from bl_ui.properties_grease_pencil_common import (
23         GreasePencilDrawingToolsPanel,
24         GreasePencilStrokeEditPanel,
25         GreasePencilInterpolatePanel,
26         GreasePencilStrokeSculptPanel,
27         GreasePencilBrushPanel,
28         GreasePencilBrushCurvesPanel
29         )
30 from bl_ui.properties_paint_common import (
31         UnifiedPaintPanel,
32         brush_texture_settings,
33         brush_texpaint_common,
34         brush_mask_texture_settings,
35         )
36
37
38 class View3DPanel:
39     bl_space_type = 'VIEW_3D'
40     bl_region_type = 'TOOLS'
41
42
43 # **************** standard tool clusters ******************
44
45 # Keyframing tools
46 def draw_keyframing_tools(context, layout):
47     col = layout.column(align=True)
48     col.label(text="Keyframes:")
49     row = col.row(align=True)
50     row.operator("anim.keyframe_insert_menu", text="Insert")
51     row.operator("anim.keyframe_delete_v3d", text="Remove")
52
53
54 # Used by vertex & weight paint
55 def draw_vpaint_symmetry(layout, vpaint):
56     col = layout.column(align=True)
57     col.label(text="Mirror:")
58     row = col.row(align=True)
59
60     row.prop(vpaint, "use_symmetry_x", text="X", toggle=True)
61     row.prop(vpaint, "use_symmetry_y", text="Y", toggle=True)
62     row.prop(vpaint, "use_symmetry_z", text="Z", toggle=True)
63
64     col = layout.column()
65     col.prop(vpaint, "radial_symmetry", text="Radial")
66
67 # ********** default tools for object-mode ****************
68
69
70 class VIEW3D_PT_tools_transform(View3DPanel, Panel):
71     bl_category = "Tools"
72     bl_context = "objectmode"
73     bl_label = "Transform"
74
75     def draw(self, context):
76         layout = self.layout
77
78         col = layout.column(align=True)
79         col.operator("transform.translate")
80         col.operator("transform.rotate")
81         col.operator("transform.resize", text="Scale")
82
83         col = layout.column(align=True)
84         col.operator("transform.mirror", text="Mirror")
85
86
87 class VIEW3D_PT_tools_object(View3DPanel, Panel):
88     bl_category = "Tools"
89     bl_context = "objectmode"
90     bl_label = "Edit"
91
92     def draw(self, context):
93         layout = self.layout
94
95         col = layout.column(align=True)
96         col.operator("object.duplicate_move", text="Duplicate")
97         col.operator("object.duplicate_move_linked", text="Duplicate Linked")
98
99         col.operator("object.delete")
100
101         obj = context.active_object
102         if obj:
103             obj_type = obj.type
104
105             if obj_type in {'MESH', 'CURVE', 'SURFACE', 'ARMATURE'}:
106                 col = layout.column(align=True)
107                 col.operator("object.join")
108
109             if obj_type in {'MESH', 'CURVE', 'SURFACE', 'ARMATURE', 'FONT', 'LATTICE'}:
110                 col = layout.column(align=True)
111                 col.operator_menu_enum("object.origin_set", "type", text="Set Origin")
112
113             if obj_type in {'MESH', 'CURVE', 'SURFACE'}:
114                 col = layout.column(align=True)
115                 col.label(text="Shading:")
116                 row = col.row(align=True)
117                 row.operator("object.shade_smooth", text="Smooth")
118                 row.operator("object.shade_flat", text="Flat")
119
120             if obj_type == 'MESH':
121                 col = layout.column(align=True)
122                 col.label(text="Data Transfer:")
123                 row = col.row(align=True)
124                 row.operator("object.data_transfer", text="Data")
125                 row.operator("object.datalayout_transfer", text="Data Layout")
126
127
128 class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
129     bl_category = "Create"
130     bl_context = "objectmode"
131     bl_label = "Add Primitive"
132
133     @staticmethod
134     def draw_add_mesh(layout, label=False):
135         if label:
136             layout.label(text="Primitives:")
137         layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
138         layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
139         layout.operator("mesh.primitive_circle_add", text="Circle", icon='MESH_CIRCLE')
140         layout.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon='MESH_UVSPHERE')
141         layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
142         layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
143         layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
144         layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
145
146         if label:
147             layout.label(text="Special:")
148         else:
149             layout.separator()
150         layout.operator("mesh.primitive_grid_add", text="Grid", icon='MESH_GRID')
151         layout.operator("mesh.primitive_monkey_add", text="Monkey", icon='MESH_MONKEY')
152
153     @staticmethod
154     def draw_add_curve(layout, label=False):
155
156         if label:
157             layout.label(text="Bezier:")
158         layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
159         layout.operator("curve.primitive_bezier_circle_add", text="Circle", icon='CURVE_BEZCIRCLE')
160
161         if label:
162             layout.label(text="Nurbs:")
163         else:
164             layout.separator()
165         layout.operator("curve.primitive_nurbs_curve_add", text="Nurbs Curve", icon='CURVE_NCURVE')
166         layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
167         layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
168
169         layout.separator()
170
171         layout.operator("curve.draw", icon='LINE_DATA')
172
173     @staticmethod
174     def draw_add_surface(layout):
175         layout.operator("surface.primitive_nurbs_surface_curve_add", text="Nurbs Curve", icon='SURFACE_NCURVE')
176         layout.operator("surface.primitive_nurbs_surface_circle_add", text="Nurbs Circle", icon='SURFACE_NCIRCLE')
177         layout.operator("surface.primitive_nurbs_surface_surface_add", text="Nurbs Surface", icon='SURFACE_NSURFACE')
178         layout.operator("surface.primitive_nurbs_surface_cylinder_add", text="Nurbs Cylinder", icon='SURFACE_NCYLINDER')
179         layout.operator("surface.primitive_nurbs_surface_sphere_add", text="Nurbs Sphere", icon='SURFACE_NSPHERE')
180         layout.operator("surface.primitive_nurbs_surface_torus_add", text="Nurbs Torus", icon='SURFACE_NTORUS')
181
182     @staticmethod
183     def draw_add_mball(layout):
184         layout.operator_enum("object.metaball_add", "type")
185
186     @staticmethod
187     def draw_add_lamp(layout):
188         layout.operator_enum("object.lamp_add", "type")
189
190     @staticmethod
191     def draw_add_other(layout):
192         layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
193         layout.operator("object.armature_add", text="Armature", icon='OUTLINER_OB_ARMATURE')
194         layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
195         layout.operator("object.empty_add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'PLAIN_AXES'
196         layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
197         layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
198
199     def draw(self, context):
200         layout = self.layout
201
202         col = layout.column(align=True)
203         col.label(text="Mesh:")
204         self.draw_add_mesh(col)
205
206         col = layout.column(align=True)
207         col.label(text="Curve:")
208         self.draw_add_curve(col)
209
210         # not used here:
211         # draw_add_surface
212         # draw_add_mball
213
214         col = layout.column(align=True)
215         col.label(text="Lamp:")
216         self.draw_add_lamp(col)
217
218         col = layout.column(align=True)
219         col.label(text="Other:")
220         self.draw_add_other(col)
221
222
223 class VIEW3D_PT_tools_relations(View3DPanel, Panel):
224     bl_category = "Relations"
225     bl_context = "objectmode"
226     bl_label = "Relations"
227
228     def draw(self, context):
229         layout = self.layout
230
231         col = layout.column(align=True)
232
233         col.label(text="Group:")
234         col.operator("group.create", text="New Group")
235         col.operator("group.objects_add_active", text="Add to Active")
236         col.operator("group.objects_remove", text="Remove from Group")
237
238         col.separator()
239
240         col.label(text="Parent:")
241         row = col.row(align=True)
242         row.operator("object.parent_set", text="Set")
243         row.operator("object.parent_clear", text="Clear")
244
245         col.separator()
246
247         col.label(text="Object Data:")
248         col.operator("object.make_links_data")
249         col.operator("object.make_single_user")
250
251         col.separator()
252
253         col.label(text="Linked Objects:")
254         col.operator("object.make_local")
255         col.operator("object.proxy_make")
256
257
258 class VIEW3D_PT_tools_animation(View3DPanel, Panel):
259     bl_category = "Animation"
260     bl_context = "objectmode"
261     bl_label = "Animation"
262
263     def draw(self, context):
264         layout = self.layout
265
266         ob = context.active_object
267         mpath = ob.motion_path if ob else None
268
269         draw_keyframing_tools(context, layout)
270
271         col = layout.column(align=True)
272         col.label(text="Motion Paths:")
273         if mpath:
274             row = col.row(align=True)
275             row.operator("object.paths_update", text="Update")
276             row.operator("object.paths_clear", text="", icon='X')
277         else:
278             col.operator("object.paths_calculate", text="Calculate")
279
280         col.separator()
281
282         col.label(text="Action:")
283         col.operator("nla.bake", text="Bake Action")
284
285
286 class VIEW3D_PT_tools_rigid_body(View3DPanel, Panel):
287     bl_category = "Physics"
288     bl_context = "objectmode"
289     bl_label = "Rigid Body Tools"
290
291     def draw(self, context):
292         layout = self.layout
293
294         col = layout.column(align=True)
295         col.label(text="Add/Remove:")
296         row = col.row(align=True)
297         row.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE'
298         row.operator("rigidbody.objects_add", text="Add Passive").type = 'PASSIVE'
299         row = col.row(align=True)
300         row.operator("rigidbody.objects_remove", text="Remove")
301
302         col = layout.column(align=True)
303         col.label(text="Object Tools:")
304         col.operator("rigidbody.shape_change", text="Change Shape")
305         col.operator("rigidbody.mass_calculate", text="Calculate Mass")
306         col.operator("rigidbody.object_settings_copy", text="Copy from Active")
307         col.operator("object.visual_transform_apply", text="Apply Transformation")
308         col.operator("rigidbody.bake_to_keyframes", text="Bake To Keyframes")
309         col.label(text="Constraints:")
310         col.operator("rigidbody.connect", text="Connect")
311
312
313 # ********** default tools for editmode_mesh ****************
314
315 class VIEW3D_PT_tools_transform_mesh(View3DPanel, Panel):
316     bl_category = "Tools"
317     bl_context = "mesh_edit"
318     bl_label = "Transform"
319
320     def draw(self, context):
321         layout = self.layout
322
323         col = layout.column(align=True)
324         col.operator("transform.translate")
325         col.operator("transform.rotate")
326         col.operator("transform.resize", text="Scale")
327         col.operator("transform.shrink_fatten", text="Shrink/Fatten")
328         col.operator("transform.push_pull", text="Push/Pull")
329
330
331 class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
332     bl_category = "Tools"
333     bl_context = "mesh_edit"
334     bl_label = "Mesh Tools"
335
336     def draw(self, context):
337         layout = self.layout
338
339         col = layout.column(align=True)
340         col.label(text="Deform:")
341         row = col.row(align=True)
342         row.operator("transform.edge_slide", text="Slide Edge")
343         row.operator("transform.vert_slide", text="Vertex")
344         col.operator("mesh.noise")
345         col.operator("mesh.vertices_smooth")
346         col.operator("transform.vertex_random")
347
348         col = layout.column(align=True)
349         col.label(text="Add:")
350
351         col.menu("VIEW3D_MT_edit_mesh_extrude")
352         col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
353         col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
354         col.operator("mesh.inset", text="Inset Faces")
355         col.operator("mesh.edge_face_add")
356         col.operator("mesh.subdivide")
357         col.operator("mesh.loopcut_slide")
358         col.operator("mesh.offset_edge_loops_slide")
359         col.operator("mesh.duplicate_move", text="Duplicate")
360         row = col.row(align=True)
361         row.operator("mesh.spin")
362         row.operator("mesh.screw")
363
364         row = col.row(align=True)
365         props = row.operator("mesh.knife_tool", text="Knife")
366         props.use_occlude_geometry = True
367         props.only_selected = False
368         props = row.operator("mesh.knife_tool", text="Select")
369         props.use_occlude_geometry = False
370         props.only_selected = True
371         col.operator("mesh.knife_project")
372         col.operator("mesh.bisect")
373
374         col = layout.column(align=True)
375         col.label(text="Remove:")
376         col.menu("VIEW3D_MT_edit_mesh_delete")
377         col.operator_menu_enum("mesh.merge", "type")
378         col.operator("mesh.remove_doubles")
379
380
381 class VIEW3D_PT_tools_meshweight(View3DPanel, Panel):
382     bl_category = "Tools"
383     bl_context = "mesh_edit"
384     bl_label = "Weight Tools"
385     bl_options = {'DEFAULT_CLOSED'}
386
387     # Used for Weight-Paint mode and Edit-Mode
388     @staticmethod
389     def draw_generic(layout):
390         col = layout.column()
391         col.operator("object.vertex_group_normalize_all", text="Normalize All")
392         col.operator("object.vertex_group_normalize", text="Normalize")
393         col.operator("object.vertex_group_mirror", text="Mirror")
394         col.operator("object.vertex_group_invert", text="Invert")
395         col.operator("object.vertex_group_clean", text="Clean")
396         col.operator("object.vertex_group_quantize", text="Quantize")
397         col.operator("object.vertex_group_levels", text="Levels")
398         col.operator("object.vertex_group_smooth", text="Smooth")
399         col.operator("object.vertex_group_limit_total", text="Limit Total")
400         col.operator("object.vertex_group_fix", text="Fix Deforms")
401
402     def draw(self, context):
403         layout = self.layout
404         self.draw_generic(layout)
405
406
407 class VIEW3D_PT_tools_add_mesh_edit(View3DPanel, Panel):
408     bl_category = "Create"
409     bl_context = "mesh_edit"
410     bl_label = "Add Meshes"
411
412     def draw(self, context):
413         layout = self.layout
414
415         col = layout.column(align=True)
416
417         VIEW3D_PT_tools_add_object.draw_add_mesh(col, label=True)
418
419
420 class VIEW3D_PT_tools_shading(View3DPanel, Panel):
421     bl_category = "Shading / UVs"
422     bl_context = "mesh_edit"
423     bl_label = "Shading"
424
425     def draw(self, context):
426         layout = self.layout
427
428         col = layout.column(align=True)
429         col.label(text="Faces:")
430         row = col.row(align=True)
431         row.operator("mesh.faces_shade_smooth", text="Smooth")
432         row.operator("mesh.faces_shade_flat", text="Flat")
433         col.label(text="Edges:")
434         row = col.row(align=True)
435         row.operator("mesh.mark_sharp", text="Smooth").clear = True
436         row.operator("mesh.mark_sharp", text="Sharp")
437         col.label(text="Vertices:")
438         row = col.row(align=True)
439         props = row.operator("mesh.mark_sharp", text="Smooth")
440         props.use_verts = True
441         props.clear = True
442         row.operator("mesh.mark_sharp", text="Sharp").use_verts = True
443
444         col = layout.column(align=True)
445         col.label(text="Normals:")
446         col.operator("mesh.normals_make_consistent", text="Recalculate")
447         col.operator("mesh.flip_normals", text="Flip Direction")
448         col.operator("mesh.set_normals_from_faces", text="Set From Faces")
449
450
451 class VIEW3D_PT_tools_uvs(View3DPanel, Panel):
452     bl_category = "Shading / UVs"
453     bl_context = "mesh_edit"
454     bl_label = "UVs"
455
456     def draw(self, context):
457         layout = self.layout
458
459         col = layout.column(align=True)
460         col.label(text="UV Mapping:")
461         col.menu("VIEW3D_MT_uv_map", text="Unwrap")
462         col.operator("mesh.mark_seam").clear = False
463         col.operator("mesh.mark_seam", text="Clear Seam").clear = True
464
465
466 class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
467     bl_category = "Options"
468     bl_context = "mesh_edit"
469     bl_label = "Mesh Options"
470
471     @classmethod
472     def poll(cls, context):
473         return context.active_object
474
475     def draw(self, context):
476         layout = self.layout
477
478         ob = context.active_object
479
480         tool_settings = context.tool_settings
481         mesh = ob.data
482
483         col = layout.column(align=True)
484         col.prop(mesh, "use_mirror_x")
485
486         row = col.row(align=True)
487         row.active = ob.data.use_mirror_x
488         row.prop(mesh, "use_mirror_topology")
489
490         col = layout.column(align=True)
491         col.label("Edge Select Mode:")
492         col.prop(tool_settings, "edge_path_mode", text="")
493         col.prop(tool_settings, "edge_path_live_unwrap")
494         col.label("Double Threshold:")
495         col.prop(tool_settings, "double_threshold", text="")
496
497         if mesh.show_weight:
498             col.label("Show Zero Weights:")
499             col.row().prop(tool_settings, "vertex_group_user", expand=True)
500
501 # ********** default tools for editmode_curve ****************
502
503
504 class VIEW3D_PT_tools_transform_curve(View3DPanel, Panel):
505     bl_category = "Tools"
506     bl_context = "curve_edit"
507     bl_label = "Transform"
508
509     def draw(self, context):
510         layout = self.layout
511
512         col = layout.column(align=True)
513         col.operator("transform.translate")
514         col.operator("transform.rotate")
515         col.operator("transform.resize", text="Scale")
516
517         col = layout.column(align=True)
518         col.operator("transform.tilt", text="Tilt")
519         col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
520
521
522 class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
523     bl_category = "Tools"
524     bl_context = "curve_edit"
525     bl_label = "Curve Tools"
526
527     def draw(self, context):
528         layout = self.layout
529
530         col = layout.column(align=True)
531         col.label(text="Curve:")
532         col.operator("curve.duplicate_move", text="Duplicate")
533         col.operator("curve.delete")
534         col.operator("curve.cyclic_toggle")
535         col.operator("curve.switch_direction")
536         col.operator("curve.spline_type_set")
537         col.operator("curve.radius_set")
538
539         col = layout.column(align=True)
540         col.label(text="Handles:")
541         row = col.row(align=True)
542         row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
543         row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
544         row = col.row(align=True)
545         row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
546         row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
547
548         col = layout.column(align=True)
549         col.operator("curve.normals_make_consistent")
550
551         col = layout.column(align=True)
552         col.label(text="Modeling:")
553         col.operator("curve.extrude_move", text="Extrude")
554         col.operator("curve.subdivide")
555         col.operator("curve.smooth")
556         col.operator("transform.vertex_random")
557
558
559 class VIEW3D_PT_tools_add_curve_edit(View3DPanel, Panel):
560     bl_category = "Create"
561     bl_context = "curve_edit"
562     bl_label = "Add Curves"
563
564     def draw(self, context):
565         layout = self.layout
566
567         col = layout.column(align=True)
568
569         VIEW3D_PT_tools_add_object.draw_add_curve(col, label=True)
570
571
572 class VIEW3D_PT_tools_curveedit_options_stroke(View3DPanel, Panel):
573     bl_category = "Options"
574     bl_context = "curve_edit"
575     bl_label = "Curve Stroke"
576
577     def draw(self, context):
578         layout = self.layout
579
580         tool_settings = context.tool_settings
581         cps = tool_settings.curve_paint_settings
582
583         col = layout.column()
584
585         col.prop(cps, "curve_type")
586
587         if cps.curve_type == 'BEZIER':
588             col.label("Bezier Options:")
589             col.prop(cps, "error_threshold")
590             col.prop(cps, "fit_method")
591             col.prop(cps, "use_corners_detect")
592
593             col = layout.column()
594             col.active = cps.use_corners_detect
595             col.prop(cps, "corner_angle")
596
597         col.label("Pressure Radius:")
598         row = layout.row(align=True)
599         rowsub = row.row(align=True)
600         rowsub.prop(cps, "radius_min", text="Min")
601         rowsub.prop(cps, "radius_max", text="Max")
602
603         row.prop(cps, "use_pressure_radius", text="", icon_only=True)
604
605         col = layout.column()
606         col.label("Taper Radius:")
607         row = layout.row(align=True)
608         row.prop(cps, "radius_taper_start", text="Start")
609         row.prop(cps, "radius_taper_end", text="End")
610
611         col = layout.column()
612         col.label("Projection Depth:")
613         row = layout.row(align=True)
614         row.prop(cps, "depth_mode", expand=True)
615
616         col = layout.column()
617         if cps.depth_mode == 'SURFACE':
618             col.prop(cps, "surface_offset")
619             col.prop(cps, "use_offset_absolute")
620             col.prop(cps, "use_stroke_endpoints")
621             if cps.use_stroke_endpoints:
622                 colsub = layout.column(align=True)
623                 colsub.prop(cps, "surface_plane", expand=True)
624
625
626 # ********** default tools for editmode_surface ****************
627
628 class VIEW3D_PT_tools_transform_surface(View3DPanel, Panel):
629     bl_category = "Tools"
630     bl_context = "surface_edit"
631     bl_label = "Transform"
632
633     def draw(self, context):
634         layout = self.layout
635
636         col = layout.column(align=True)
637         col.operator("transform.translate")
638         col.operator("transform.rotate")
639         col.operator("transform.resize", text="Scale")
640
641
642 class VIEW3D_PT_tools_surfaceedit(View3DPanel, Panel):
643     bl_category = "Tools"
644     bl_context = "surface_edit"
645     bl_label = "Surface Tools"
646
647     def draw(self, context):
648         layout = self.layout
649
650         col = layout.column(align=True)
651         col.label(text="Curve:")
652         col.operator("curve.duplicate_move", text="Duplicate")
653         col.operator("curve.delete")
654         col.operator("curve.cyclic_toggle")
655         col.operator("curve.switch_direction")
656
657         col = layout.column(align=True)
658         col.label(text="Modeling:")
659         col.operator("curve.extrude", text="Extrude")
660         col.operator("curve.spin")
661         col.operator("curve.subdivide")
662
663         col = layout.column(align=True)
664         col.label(text="Deform:")
665         col.operator("transform.vertex_random")
666
667
668 class VIEW3D_PT_tools_add_surface_edit(View3DPanel, Panel):
669     bl_category = "Create"
670     bl_context = "surface_edit"
671     bl_label = "Add Surfaces"
672
673     def draw(self, context):
674         layout = self.layout
675
676         col = layout.column(align=True)
677
678         VIEW3D_PT_tools_add_object.draw_add_surface(col)
679
680
681 # ********** default tools for editmode_text ****************
682
683
684 class VIEW3D_PT_tools_textedit(View3DPanel, Panel):
685     bl_category = "Tools"
686     bl_context = "text_edit"
687     bl_label = "Text Tools"
688
689     def draw(self, context):
690         layout = self.layout
691
692         col = layout.column(align=True)
693         col.label(text="Set Case:")
694         col.operator("font.case_set", text="To Upper").case = 'UPPER'
695         col.operator("font.case_set", text="To Lower").case = 'LOWER'
696
697         col = layout.column(align=True)
698         col.label(text="Style:")
699         col.operator("font.style_toggle", text="Bold").style = 'BOLD'
700         col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
701         col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
702
703
704 # ********** default tools for editmode_armature ****************
705
706
707 class VIEW3D_PT_tools_armatureedit_transform(View3DPanel, Panel):
708     bl_category = "Tools"
709     bl_context = "armature_edit"
710     bl_label = "Transform"
711
712     def draw(self, context):
713         layout = self.layout
714
715         col = layout.column(align=True)
716         col.operator("transform.translate")
717         col.operator("transform.rotate")
718         col.operator("transform.resize", text="Scale")
719
720
721 class VIEW3D_PT_tools_armatureedit(View3DPanel, Panel):
722     bl_category = "Tools"
723     bl_context = "armature_edit"
724     bl_label = "Armature Tools"
725
726     def draw(self, context):
727         layout = self.layout
728
729         col = layout.column(align=True)
730         col.label(text="Bones:")
731         col.operator("armature.bone_primitive_add", text="Add")
732         col.operator("armature.duplicate_move", text="Duplicate")
733         col.operator("armature.delete", text="Delete")
734
735         col = layout.column(align=True)
736         col.label(text="Modeling:")
737         col.operator("armature.extrude_move")
738         col.operator("armature.subdivide", text="Subdivide")
739
740         col = layout.column(align=True)
741         col.label(text="Deform:")
742         col.operator("transform.vertex_random")
743
744
745 class VIEW3D_PT_tools_armatureedit_options(View3DPanel, Panel):
746     bl_category = "Options"
747     bl_context = "armature_edit"
748     bl_label = "Armature Options"
749
750     def draw(self, context):
751         arm = context.active_object.data
752
753         self.layout.prop(arm, "use_mirror_x")
754
755
756 # ********** default tools for editmode_mball ****************
757
758
759 class VIEW3D_PT_tools_mballedit(View3DPanel, Panel):
760     bl_category = "Tools"
761     bl_context = "mball_edit"
762     bl_label = "Meta Tools"
763
764     def draw(self, context):
765         layout = self.layout
766
767         col = layout.column(align=True)
768         col.label(text="Transform:")
769         col.operator("transform.translate")
770         col.operator("transform.rotate")
771         col.operator("transform.resize", text="Scale")
772
773         col = layout.column(align=True)
774         col.label(text="Deform:")
775         col.operator("transform.vertex_random")
776
777
778 class VIEW3D_PT_tools_add_mball_edit(View3DPanel, Panel):
779     bl_category = "Create"
780     bl_context = "mball_edit"
781     bl_label = "Add Metaball"
782
783     def draw(self, context):
784         layout = self.layout
785
786         col = layout.column(align=True)
787
788         VIEW3D_PT_tools_add_object.draw_add_mball(col)
789
790
791 # ********** default tools for editmode_lattice ****************
792
793
794 class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel):
795     bl_category = "Tools"
796     bl_context = "lattice_edit"
797     bl_label = "Lattice Tools"
798
799     def draw(self, context):
800         layout = self.layout
801
802         col = layout.column(align=True)
803         col.label(text="Transform:")
804         col.operator("transform.translate")
805         col.operator("transform.rotate")
806         col.operator("transform.resize", text="Scale")
807
808         col = layout.column(align=True)
809         col.operator("lattice.make_regular")
810
811         col = layout.column(align=True)
812         col.label(text="Deform:")
813         col.operator("transform.vertex_random")
814
815
816 # ********** default tools for pose-mode ****************
817
818
819 class VIEW3D_PT_tools_posemode(View3DPanel, Panel):
820     bl_category = "Tools"
821     bl_context = "posemode"
822     bl_label = "Pose Tools"
823
824     def draw(self, context):
825         layout = self.layout
826
827         col = layout.column(align=True)
828         col.label(text="Transform:")
829         col.operator("transform.translate")
830         col.operator("transform.rotate")
831         col.operator("transform.resize", text="Scale")
832
833         col = layout.column(align=True)
834         col.label(text="In-Between:")
835         row = col.row(align=True)
836         row.operator("pose.push", text="Push")
837         row.operator("pose.relax", text="Relax")
838         col.operator("pose.breakdown", text="Breakdowner")
839
840         col = layout.column(align=True)
841         col.label(text="Pose:")
842         row = col.row(align=True)
843         row.operator("pose.copy", text="Copy")
844         row.operator("pose.paste", text="Paste")
845
846         row = layout.row(align=True)
847         row.operator("pose.propagate", text="Propagate")
848         row.menu("VIEW3D_MT_pose_propagate", icon='TRIA_RIGHT', text="")
849
850         col = layout.column(align=True)
851         col.operator("poselib.pose_add", text="Add To Library")
852
853         draw_keyframing_tools(context, layout)
854
855         pchan = context.active_pose_bone
856         mpath = pchan.motion_path if pchan else None
857
858         col = layout.column(align=True)
859         col.label(text="Motion Paths:")
860         if mpath:
861             row = col.row(align=True)
862             row.operator("pose.paths_update", text="Update")
863             row.operator("pose.paths_clear", text="", icon='X')
864         else:
865             col.operator("pose.paths_calculate", text="Calculate")
866
867
868 class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
869     bl_category = "Options"
870     bl_context = "posemode"
871     bl_label = "Pose Options"
872
873     def draw(self, context):
874         arm = context.active_object.data
875
876         self.layout.prop(arm, "use_auto_ik")
877
878 # ********** default tools for paint modes ****************
879
880
881 class View3DPaintPanel(UnifiedPaintPanel):
882     bl_space_type = 'VIEW_3D'
883     bl_region_type = 'TOOLS'
884
885
886 class VIEW3D_PT_imapaint_tools_missing(Panel, View3DPaintPanel):
887     bl_category = "Tools"
888     bl_label = "Missing Data"
889
890     @classmethod
891     def poll(cls, context):
892         toolsettings = context.tool_settings.image_paint
893         return context.image_paint_object and not toolsettings.detect_data()
894
895     def draw(self, context):
896         layout = self.layout
897         toolsettings = context.tool_settings.image_paint
898
899         col = layout.column()
900         col.label("Missing Data", icon='ERROR')
901         if toolsettings.missing_uvs:
902             col.separator()
903             col.label("Missing UVs", icon='INFO')
904             col.label("Unwrap the mesh in edit mode or generate a simple UV layer")
905             col.operator("paint.add_simple_uvs")
906
907         if toolsettings.mode == 'MATERIAL':
908             if toolsettings.missing_materials:
909                 col.separator()
910                 col.label("Missing Materials", icon='INFO')
911                 col.label("Add a material and paint slot below")
912                 col.operator_menu_enum("paint.add_texture_paint_slot", "type", text="Add Paint Slot")
913             elif toolsettings.missing_texture:
914                 ob = context.active_object
915                 mat = ob.active_material
916
917                 col.separator()
918                 if mat:
919                     col.label("Missing Texture Slots", icon='INFO')
920                     col.label("Add a paint slot below")
921                     col.operator_menu_enum("paint.add_texture_paint_slot", "type", text="Add Paint Slot")
922                 else:
923                     col.label("Missing Materials", icon='INFO')
924                     col.label("Add a material and paint slot below")
925                     col.operator_menu_enum("paint.add_texture_paint_slot", "type", text="Add Paint Slot")
926
927         elif toolsettings.mode == 'IMAGE':
928             if toolsettings.missing_texture:
929                 col.separator()
930                 col.label("Missing Canvas", icon='INFO')
931                 col.label("Add or assign a canvas image below")
932                 col.label("Canvas Image:")
933                 # todo this should be combinded into a single row
934                 col.template_ID(toolsettings, "canvas", open="image.open")
935                 col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS'
936
937         if toolsettings.missing_stencil:
938             col.separator()
939             col.label("Missing Stencil", icon='INFO')
940             col.label("Add or assign a stencil image below")
941             col.label("Stencil Image:")
942             # todo this should be combinded into a single row
943             col.template_ID(toolsettings, "stencil_image", open="image.open")
944             col.operator("image.new", text="New").gen_context = 'PAINT_STENCIL'
945
946
947 class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
948     bl_category = "Tools"
949     bl_label = "Brush"
950
951     @classmethod
952     def poll(cls, context):
953         return cls.paint_settings(context)
954
955     def draw(self, context):
956         layout = self.layout
957
958         toolsettings = context.tool_settings
959         settings = self.paint_settings(context)
960         brush = settings.brush
961
962         if not context.particle_edit_object:
963             col = layout.split().column()
964             col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
965
966         # Particle Mode #
967         if context.particle_edit_object:
968             tool = settings.tool
969
970             layout.column().prop(settings, "tool", expand=True)
971
972             if tool != 'NONE':
973                 col = layout.column()
974                 col.prop(brush, "size", slider=True)
975                 if tool != 'ADD':
976                     col.prop(brush, "strength", slider=True)
977
978             if tool == 'ADD':
979                 col.prop(brush, "count")
980                 col = layout.column()
981                 col.prop(settings, "use_default_interpolate")
982                 col.prop(brush, "steps", slider=True)
983                 col.prop(settings, "default_key_count", slider=True)
984             elif tool == 'LENGTH':
985                 layout.row().prop(brush, "length_mode", expand=True)
986             elif tool == 'PUFF':
987                 layout.row().prop(brush, "puff_mode", expand=True)
988                 layout.prop(brush, "use_puff_volume")
989
990         # Sculpt Mode #
991
992         elif context.sculpt_object and brush:
993             capabilities = brush.sculpt_capabilities
994
995             col = layout.column()
996
997             col.separator()
998
999             row = col.row(align=True)
1000
1001             ups = toolsettings.unified_paint_settings
1002             if ((ups.use_unified_size and ups.use_locked_size) or
1003                     ((not ups.use_unified_size) and brush.use_locked_size)):
1004                 self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
1005                 self.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
1006             else:
1007                 self.prop_unified_size(row, context, brush, "use_locked_size", icon='UNLOCKED')
1008                 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
1009
1010             self.prop_unified_size(row, context, brush, "use_pressure_size")
1011
1012             # strength, use_strength_pressure, and use_strength_attenuation
1013             col.separator()
1014             row = col.row(align=True)
1015
1016             if capabilities.has_space_attenuation:
1017                 row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
1018
1019             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
1020
1021             if capabilities.has_strength_pressure:
1022                 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
1023
1024             # auto_smooth_factor and use_inverse_smooth_pressure
1025             if capabilities.has_auto_smooth:
1026                 col.separator()
1027
1028                 row = col.row(align=True)
1029                 row.prop(brush, "auto_smooth_factor", slider=True)
1030                 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
1031
1032             # normal_weight
1033             if capabilities.has_normal_weight:
1034                 col.separator()
1035                 row = col.row(align=True)
1036                 row.prop(brush, "normal_weight", slider=True)
1037
1038             # crease_pinch_factor
1039             if capabilities.has_pinch_factor:
1040                 col.separator()
1041                 row = col.row(align=True)
1042                 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
1043
1044             # rake_factor
1045             if capabilities.has_rake_factor:
1046                 col.separator()
1047                 row = col.row(align=True)
1048                 row.prop(brush, "rake_factor", slider=True)
1049
1050             # use_original_normal and sculpt_plane
1051             if capabilities.has_sculpt_plane:
1052                 col.separator()
1053                 row = col.row(align=True)
1054
1055                 row.prop(brush, "use_original_normal", toggle=True, icon_only=True)
1056
1057                 row.prop(brush, "sculpt_plane", text="")
1058
1059             if brush.sculpt_tool == 'MASK':
1060                 col.prop(brush, "mask_tool", text="")
1061
1062             # plane_offset, use_offset_pressure, use_plane_trim, plane_trim
1063             if capabilities.has_plane_offset:
1064                 row = col.row(align=True)
1065                 row.prop(brush, "plane_offset", slider=True)
1066                 row.prop(brush, "use_offset_pressure", text="")
1067
1068                 col.separator()
1069
1070                 row = col.row()
1071                 row.prop(brush, "use_plane_trim", text="Trim")
1072                 row = col.row()
1073                 row.active = brush.use_plane_trim
1074                 row.prop(brush, "plane_trim", slider=True, text="Distance")
1075
1076             # height
1077             if capabilities.has_height:
1078                 row = col.row()
1079                 row.prop(brush, "height", slider=True, text="Height")
1080
1081             # use_frontface
1082             col.separator()
1083             row = col.row()
1084             row.prop(brush, "use_frontface", text="Front Faces Only")
1085
1086             # direction
1087             col.separator()
1088             col.row().prop(brush, "direction", expand=True)
1089
1090             # use_accumulate
1091             if capabilities.has_accumulate:
1092                 col.separator()
1093
1094                 col.prop(brush, "use_accumulate")
1095
1096             # use_persistent, set_persistent_base
1097             if capabilities.has_persistence:
1098                 col.separator()
1099
1100                 ob = context.sculpt_object
1101                 do_persistent = True
1102
1103                 # not supported yet for this case
1104                 for md in ob.modifiers:
1105                     if md.type == 'MULTIRES':
1106                         do_persistent = False
1107                         break
1108
1109                 if do_persistent:
1110                     col.prop(brush, "use_persistent")
1111                     col.operator("sculpt.set_persistent_base")
1112
1113         # Texture Paint Mode #
1114
1115         elif context.image_paint_object and brush:
1116             brush_texpaint_common(self, context, layout, brush, settings, True)
1117
1118         # Weight Paint Mode #
1119         elif context.weight_paint_object and brush:
1120
1121             col = layout.column()
1122
1123             row = col.row(align=True)
1124             self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
1125
1126             row = col.row(align=True)
1127             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
1128             self.prop_unified_size(row, context, brush, "use_pressure_size")
1129
1130             row = col.row(align=True)
1131             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
1132             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
1133
1134             col.prop(brush, "vertex_tool", text="Blend")
1135
1136             if brush.vertex_tool == 'BLUR':
1137                 col.prop(brush, "use_accumulate")
1138                 col.separator()
1139
1140             col = layout.column()
1141             col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
1142             col.prop(toolsettings, "use_multipaint", text="Multi-Paint")
1143
1144         # Vertex Paint Mode #
1145         elif context.vertex_paint_object and brush:
1146             col = layout.column()
1147             self.prop_unified_color_picker(col, context, brush, "color", value_slider=True)
1148             if settings.palette:
1149                 col.template_palette(settings, "palette", color=True)
1150             row = col.row(align=True)
1151             self.prop_unified_color(row, context, brush, "color", text="")
1152             self.prop_unified_color(row, context, brush, "secondary_color", text="")
1153             row.separator()
1154             row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
1155
1156             col.separator()
1157             row = col.row(align=True)
1158             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
1159             self.prop_unified_size(row, context, brush, "use_pressure_size")
1160
1161             row = col.row(align=True)
1162             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
1163             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
1164
1165             # XXX - TODO
1166             # row = col.row(align=True)
1167             # row.prop(brush, "jitter", slider=True)
1168             # row.prop(brush, "use_pressure_jitter", toggle=True, text="")
1169             col.separator()
1170             col.prop(brush, "vertex_tool", text="Blend")
1171
1172             col.separator()
1173             col.template_ID(settings, "palette", new="palette.new")
1174
1175
1176 class TEXTURE_UL_texpaintslots(UIList):
1177     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
1178         mat = data
1179
1180         if self.layout_type in {'DEFAULT', 'COMPACT'}:
1181             layout.prop(item, "name", text="", emboss=False, icon_value=icon)
1182             if (not mat.use_nodes) and context.scene.render.engine in {'BLENDER_RENDER', 'BLENDER_GAME'}:
1183                 mtex_index = mat.texture_paint_slots[index].index
1184                 layout.prop(mat, "use_textures", text="", index=mtex_index)
1185         elif self.layout_type == 'GRID':
1186             layout.alignment = 'CENTER'
1187             layout.label(text="")
1188
1189
1190 class VIEW3D_MT_tools_projectpaint_uvlayer(Menu):
1191     bl_label = "Clone Layer"
1192
1193     def draw(self, context):
1194         layout = self.layout
1195
1196         for i, tex in enumerate(context.active_object.data.uv_textures):
1197             props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
1198             props.data_path = "active_object.data.uv_textures.active_index"
1199             props.value = i
1200
1201
1202 class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel):
1203     bl_context = "imagepaint"
1204     bl_label = "Slots"
1205     bl_category = "Slots"
1206
1207     @classmethod
1208     def poll(cls, context):
1209         brush = context.tool_settings.image_paint.brush
1210         ob = context.active_object
1211         return (brush is not None and ob is not None)
1212
1213     def draw(self, context):
1214         layout = self.layout
1215
1216         settings = context.tool_settings.image_paint
1217         # brush = settings.brush
1218
1219         ob = context.active_object
1220         col = layout.column()
1221
1222         col.label("Painting Mode:")
1223         col.prop(settings, "mode", text="")
1224         col.separator()
1225
1226         if settings.mode == 'MATERIAL':
1227             if len(ob.material_slots) > 1:
1228                 col.label("Materials:")
1229                 col.template_list("MATERIAL_UL_matslots", "layers",
1230                                   ob, "material_slots",
1231                                   ob, "active_material_index", rows=2)
1232
1233             mat = ob.active_material
1234             if mat:
1235                 col.label("Available Paint Slots:")
1236                 col.template_list("TEXTURE_UL_texpaintslots", "",
1237                                   mat, "texture_paint_images",
1238                                   mat, "paint_active_slot", rows=2)
1239
1240                 if mat.texture_paint_slots:
1241                     slot = mat.texture_paint_slots[mat.paint_active_slot]
1242                 else:
1243                     slot = None
1244
1245                 if (not mat.use_nodes) and context.scene.render.engine in {'BLENDER_RENDER', 'BLENDER_GAME'}:
1246                     row = col.row(align=True)
1247                     row.operator_menu_enum("paint.add_texture_paint_slot", "type")
1248                     row.operator("paint.delete_texture_paint_slot", text="", icon='X')
1249
1250                     if slot:
1251                         col.prop(mat.texture_slots[slot.index], "blend_type")
1252                         col.separator()
1253
1254                 if slot and slot.index != -1:
1255                     col.label("UV Map:")
1256                     col.prop_search(slot, "uv_layer", ob.data, "uv_textures", text="")
1257
1258         elif settings.mode == 'IMAGE':
1259             mesh = ob.data
1260             uv_text = mesh.uv_textures.active.name if mesh.uv_textures.active else ""
1261             col.label("Canvas Image:")
1262             # todo this should be combinded into a single row
1263             col.template_ID(settings, "canvas", open="image.open")
1264             col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS'
1265             col.label("UV Map:")
1266             col.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
1267
1268         col.separator()
1269         col.operator("image.save_dirty", text="Save All Images")
1270
1271
1272 class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel):
1273     bl_context = "imagepaint"
1274     bl_label = "Mask"
1275     bl_category = "Slots"
1276
1277     @classmethod
1278     def poll(cls, context):
1279         brush = context.tool_settings.image_paint.brush
1280         ob = context.active_object
1281         return (brush is not None and ob is not None)
1282
1283     def draw_header(self, context):
1284         ipaint = context.tool_settings.image_paint
1285         self.layout.prop(ipaint, "use_stencil_layer", text="")
1286
1287     def draw(self, context):
1288         layout = self.layout
1289
1290         toolsettings = context.tool_settings
1291         ipaint = toolsettings.image_paint
1292         ob = context.active_object
1293         mesh = ob.data
1294
1295         col = layout.column()
1296         col.active = ipaint.use_stencil_layer
1297
1298         stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
1299         col.label("UV Map:")
1300         col.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text, translate=False)
1301
1302         col.label("Stencil Image:")
1303         # todo this should be combinded into a single row
1304         col.template_ID(ipaint, "stencil_image", open="image.open")
1305         col.operator("image.new", text="New").gen_context = 'PAINT_STENCIL'
1306
1307         col.label("Visualization:")
1308         row = col.row(align=True)
1309         row.prop(ipaint, "stencil_color", text="")
1310         row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1311
1312
1313 class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
1314     bl_category = "Options"
1315     bl_label = "Overlay"
1316
1317     @classmethod
1318     def poll(cls, context):
1319         settings = cls.paint_settings(context)
1320         return (settings and
1321                 settings.brush and
1322                 (context.sculpt_object or
1323                  context.vertex_paint_object or
1324                  context.weight_paint_object or
1325                  context.image_paint_object))
1326
1327     def draw(self, context):
1328         layout = self.layout
1329
1330         settings = self.paint_settings(context)
1331         brush = settings.brush
1332         tex_slot = brush.texture_slot
1333         tex_slot_mask = brush.mask_texture_slot
1334
1335         col = layout.column()
1336
1337         col.label(text="Curve:")
1338
1339         row = col.row(align=True)
1340         if brush.use_cursor_overlay:
1341             row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
1342         else:
1343             row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
1344
1345         sub = row.row(align=True)
1346         sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
1347         sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
1348
1349         col.active = brush.brush_capabilities.has_overlay
1350
1351         if context.image_paint_object or context.sculpt_object or context.vertex_paint_object:
1352             col.label(text="Texture:")
1353             row = col.row(align=True)
1354             if tex_slot.map_mode != 'STENCIL':
1355                 if brush.use_primary_overlay:
1356                     row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
1357                 else:
1358                     row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
1359
1360             sub = row.row(align=True)
1361             sub.prop(brush, "texture_overlay_alpha", text="Alpha")
1362             sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
1363
1364         if context.image_paint_object:
1365             col.label(text="Mask Texture:")
1366
1367             row = col.row(align=True)
1368             if tex_slot_mask.map_mode != 'STENCIL':
1369                 if brush.use_secondary_overlay:
1370                     row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
1371                 else:
1372                     row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
1373
1374             sub = row.row(align=True)
1375             sub.prop(brush, "mask_overlay_alpha", text="Alpha")
1376             sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
1377
1378
1379 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
1380     bl_category = "Tools"
1381     bl_label = "Texture"
1382     bl_options = {'DEFAULT_CLOSED'}
1383
1384     @classmethod
1385     def poll(cls, context):
1386         settings = cls.paint_settings(context)
1387         return (settings and settings.brush and
1388                 (context.sculpt_object or context.image_paint_object or context.vertex_paint_object))
1389
1390     def draw(self, context):
1391         layout = self.layout
1392
1393         settings = self.paint_settings(context)
1394         brush = settings.brush
1395
1396         col = layout.column()
1397
1398         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
1399
1400         brush_texture_settings(col, brush, context.sculpt_object)
1401
1402
1403 class VIEW3D_PT_tools_mask_texture(Panel, View3DPaintPanel):
1404     bl_category = "Tools"
1405     bl_context = "imagepaint"
1406     bl_label = "Texture Mask"
1407     bl_options = {'DEFAULT_CLOSED'}
1408
1409     @classmethod
1410     def poll(cls, context):
1411         settings = cls.paint_settings(context)
1412         return (settings and settings.brush and context.image_paint_object)
1413
1414     def draw(self, context):
1415         layout = self.layout
1416
1417         brush = context.tool_settings.image_paint.brush
1418
1419         col = layout.column()
1420
1421         col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8)
1422
1423         brush_mask_texture_settings(col, brush)
1424
1425
1426 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
1427     bl_category = "Tools"
1428     bl_label = "Stroke"
1429     bl_options = {'DEFAULT_CLOSED'}
1430
1431     @classmethod
1432     def poll(cls, context):
1433         settings = cls.paint_settings(context)
1434         return (settings and
1435                 settings.brush and
1436                 (context.sculpt_object or
1437                  context.vertex_paint_object or
1438                  context.weight_paint_object or
1439                  context.image_paint_object))
1440
1441     def draw(self, context):
1442         layout = self.layout
1443
1444         settings = self.paint_settings(context)
1445         brush = settings.brush
1446
1447         col = layout.column()
1448
1449         col.label(text="Stroke Method:")
1450
1451         col.prop(brush, "stroke_method", text="")
1452
1453         if brush.use_anchor:
1454             col.separator()
1455             col.prop(brush, "use_edge_to_edge", "Edge To Edge")
1456
1457         if brush.use_airbrush:
1458             col.separator()
1459             col.prop(brush, "rate", text="Rate", slider=True)
1460
1461         if brush.use_space:
1462             col.separator()
1463             row = col.row(align=True)
1464             row.prop(brush, "spacing", text="Spacing")
1465             row.prop(brush, "use_pressure_spacing", toggle=True, text="")
1466
1467         if brush.use_line or brush.use_curve:
1468             col.separator()
1469             row = col.row(align=True)
1470             row.prop(brush, "spacing", text="Spacing")
1471
1472         if brush.use_curve:
1473             col.separator()
1474             col.template_ID(brush, "paint_curve", new="paintcurve.new")
1475             col.operator("paintcurve.draw")
1476
1477         if context.sculpt_object:
1478             if brush.sculpt_capabilities.has_jitter:
1479                 col.separator()
1480
1481                 row = col.row(align=True)
1482                 row.prop(brush, "use_relative_jitter", icon_only=True)
1483                 if brush.use_relative_jitter:
1484                     row.prop(brush, "jitter", slider=True)
1485                 else:
1486                     row.prop(brush, "jitter_absolute")
1487                 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
1488
1489             if brush.sculpt_capabilities.has_smooth_stroke:
1490                 col = layout.column()
1491                 col.separator()
1492
1493                 col.prop(brush, "use_smooth_stroke")
1494
1495                 sub = col.column()
1496                 sub.active = brush.use_smooth_stroke
1497                 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
1498                 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
1499         else:
1500             col.separator()
1501
1502             row = col.row(align=True)
1503             row.prop(brush, "use_relative_jitter", icon_only=True)
1504             if brush.use_relative_jitter:
1505                 row.prop(brush, "jitter", slider=True)
1506             else:
1507                 row.prop(brush, "jitter_absolute")
1508             row.prop(brush, "use_pressure_jitter", toggle=True, text="")
1509
1510             col = layout.column()
1511             col.separator()
1512
1513             if brush.brush_capabilities.has_smooth_stroke:
1514                 col.prop(brush, "use_smooth_stroke")
1515
1516                 sub = col.column()
1517                 sub.active = brush.use_smooth_stroke
1518                 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
1519                 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
1520
1521         layout.prop(settings, "input_samples")
1522
1523
1524 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
1525     bl_category = "Tools"
1526     bl_label = "Curve"
1527     bl_options = {'DEFAULT_CLOSED'}
1528
1529     @classmethod
1530     def poll(cls, context):
1531         settings = cls.paint_settings(context)
1532         return (settings and settings.brush and settings.brush.curve)
1533
1534     def draw(self, context):
1535         layout = self.layout
1536
1537         settings = self.paint_settings(context)
1538
1539         brush = settings.brush
1540
1541         layout.template_curve_mapping(brush, "curve", brush=True)
1542
1543         col = layout.column(align=True)
1544         row = col.row(align=True)
1545         row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
1546         row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
1547         row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
1548         row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
1549         row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
1550         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
1551
1552
1553 class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
1554     bl_category = "Tools"
1555     bl_label = "Dyntopo"
1556     bl_options = {'DEFAULT_CLOSED'}
1557
1558     @classmethod
1559     def poll(cls, context):
1560         return (context.sculpt_object and context.tool_settings.sculpt)
1561
1562     def draw_header(self, context):
1563         layout = self.layout
1564         layout.operator(
1565                 "sculpt.dynamic_topology_toggle",
1566                 icon='CHECKBOX_HLT' if context.sculpt_object.use_dynamic_topology_sculpting else 'CHECKBOX_DEHLT',
1567                 text="",
1568                 emboss=False,
1569                 )
1570
1571     def draw(self, context):
1572         layout = self.layout
1573
1574         toolsettings = context.tool_settings
1575         sculpt = toolsettings.sculpt
1576         settings = self.paint_settings(context)
1577         brush = settings.brush
1578
1579         col = layout.column()
1580         col.active = context.sculpt_object.use_dynamic_topology_sculpting
1581         sub = col.column(align=True)
1582         sub.active = (brush and brush.sculpt_tool != 'MASK')
1583         if (sculpt.detail_type_method == 'CONSTANT'):
1584             row = sub.row(align=True)
1585             row.prop(sculpt, "constant_detail_resolution")
1586             row.operator("sculpt.sample_detail_size", text="", icon='EYEDROPPER')
1587         elif (sculpt.detail_type_method == 'BRUSH'):
1588             sub.prop(sculpt, "detail_percent")
1589         else:
1590             sub.prop(sculpt, "detail_size")
1591         sub.prop(sculpt, "detail_refine_method", text="")
1592         sub.prop(sculpt, "detail_type_method", text="")
1593         col.separator()
1594         col.prop(sculpt, "use_smooth_shading")
1595         col.operator("sculpt.optimize")
1596         if (sculpt.detail_type_method == 'CONSTANT'):
1597             col.operator("sculpt.detail_flood_fill")
1598         col.separator()
1599         col.prop(sculpt, "symmetrize_direction")
1600         col.operator("sculpt.symmetrize")
1601
1602
1603 class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
1604     bl_category = "Options"
1605     bl_label = "Options"
1606     bl_options = {'DEFAULT_CLOSED'}
1607
1608     @classmethod
1609     def poll(cls, context):
1610         return (context.sculpt_object and context.tool_settings.sculpt)
1611
1612     def draw(self, context):
1613         layout = self.layout
1614         # scene = context.scene
1615
1616         toolsettings = context.tool_settings
1617         sculpt = toolsettings.sculpt
1618         capabilities = sculpt.brush.sculpt_capabilities
1619
1620         col = layout.column(align=True)
1621         col.active = capabilities.has_gravity
1622         col.label(text="Gravity:")
1623         col.prop(sculpt, "gravity", slider=True, text="Factor")
1624         col.prop(sculpt, "gravity_object")
1625         col.separator()
1626
1627         layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1628         layout.prop(sculpt, "show_low_resolution")
1629         layout.prop(sculpt, "use_deform_only")
1630         layout.prop(sculpt, "show_diffuse_color")
1631
1632         self.unified_paint_settings(layout, context)
1633
1634
1635 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
1636     bl_category = "Tools"
1637     bl_label = "Symmetry/Lock"
1638     bl_options = {'DEFAULT_CLOSED'}
1639
1640     @classmethod
1641     def poll(cls, context):
1642         return (context.sculpt_object and context.tool_settings.sculpt)
1643
1644     def draw(self, context):
1645         layout = self.layout
1646
1647         sculpt = context.tool_settings.sculpt
1648
1649         col = layout.column(align=True)
1650         col.label(text="Mirror:")
1651         row = col.row(align=True)
1652         row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
1653         row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
1654         row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
1655
1656         layout.column().prop(sculpt, "radial_symmetry", text="Radial")
1657         layout.prop(sculpt, "use_symmetry_feather", text="Feather")
1658
1659         layout.label(text="Lock:")
1660
1661         row = layout.row(align=True)
1662         row.prop(sculpt, "lock_x", text="X", toggle=True)
1663         row.prop(sculpt, "lock_y", text="Y", toggle=True)
1664         row.prop(sculpt, "lock_z", text="Z", toggle=True)
1665
1666         layout.label(text="Tiling:")
1667
1668         row = layout.row(align=True)
1669         row.prop(sculpt, "tile_x", text="X", toggle=True)
1670         row.prop(sculpt, "tile_y", text="Y", toggle=True)
1671         row.prop(sculpt, "tile_z", text="Z", toggle=True)
1672
1673         layout.column().prop(sculpt, "tile_offset", text="Tile Offset")
1674
1675
1676 class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
1677     bl_category = "Options"
1678     bl_label = "Appearance"
1679
1680     @classmethod
1681     def poll(cls, context):
1682         settings = cls.paint_settings(context)
1683         return (settings is not None) and (not isinstance(settings, bpy.types.ParticleEdit))
1684
1685     def draw(self, context):
1686         layout = self.layout
1687
1688         settings = self.paint_settings(context)
1689         brush = settings.brush
1690
1691         if brush is None:  # unlikely but can happen
1692             layout.label(text="Brush Unset")
1693             return
1694
1695         col = layout.column()
1696         col.prop(settings, "show_brush")
1697
1698         sub = col.column()
1699         sub.active = settings.show_brush
1700
1701         if context.sculpt_object and context.tool_settings.sculpt:
1702             if brush.sculpt_capabilities.has_secondary_color:
1703                 sub.row().prop(brush, "cursor_color_add", text="Add")
1704                 sub.row().prop(brush, "cursor_color_subtract", text="Subtract")
1705             else:
1706                 sub.prop(brush, "cursor_color_add", text="")
1707         else:
1708             sub.prop(brush, "cursor_color_add", text="")
1709
1710         col.separator()
1711
1712         col = col.column(align=True)
1713         col.prop(brush, "use_custom_icon")
1714         sub = col.column()
1715         sub.active = brush.use_custom_icon
1716         sub.prop(brush, "icon_filepath", text="")
1717
1718 # ********** default tools for weight-paint ****************
1719
1720
1721 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
1722     bl_category = "Tools"
1723     bl_context = "weightpaint"
1724     bl_label = "Weight Tools"
1725
1726     def draw(self, context):
1727         layout = self.layout
1728         VIEW3D_PT_tools_meshweight.draw_generic(layout)
1729
1730         col = layout.column()
1731         col.operator("paint.weight_gradient")
1732         props = col.operator("object.data_transfer", text="Transfer Weights")
1733         props.use_reverse_transfer = True
1734         props.data_type = 'VGROUP_WEIGHTS'
1735
1736
1737 class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel):
1738     bl_category = "Tools"
1739     bl_context = "weightpaint"
1740     bl_options = {'DEFAULT_CLOSED'}
1741     bl_label = "Symmetry"
1742
1743     def draw(self, context):
1744         layout = self.layout
1745         toolsettings = context.tool_settings
1746         wpaint = toolsettings.weight_paint
1747         draw_vpaint_symmetry(layout, wpaint)
1748
1749
1750 class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
1751     bl_category = "Options"
1752     bl_context = "weightpaint"
1753     bl_label = "Options"
1754
1755     def draw(self, context):
1756         layout = self.layout
1757
1758         tool_settings = context.tool_settings
1759         wpaint = tool_settings.weight_paint
1760
1761         col = layout.column()
1762         row = col.row()
1763
1764         row.prop(wpaint, "use_normal")
1765         col = layout.column()
1766         row = col.row()
1767         row.prop(wpaint, "use_spray")
1768         row.prop(wpaint, "use_group_restrict")
1769
1770         obj = context.weight_paint_object
1771         if obj.type == 'MESH':
1772             mesh = obj.data
1773             col.prop(mesh, "use_mirror_x")
1774             row = col.row()
1775             row.active = mesh.use_mirror_x
1776             row.prop(mesh, "use_mirror_topology")
1777
1778         col.label("Show Zero Weights:")
1779         sub = col.row()
1780         sub.prop(tool_settings, "vertex_group_user", expand=True)
1781
1782         self.unified_paint_settings(col, context)
1783
1784 # ********** default tools for vertex-paint ****************
1785
1786
1787 class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
1788     bl_category = "Options"
1789     bl_context = "vertexpaint"
1790     bl_label = "Options"
1791
1792     def draw(self, context):
1793         layout = self.layout
1794
1795         toolsettings = context.tool_settings
1796         vpaint = toolsettings.vertex_paint
1797
1798         col = layout.column()
1799         row = col.row()
1800         # col.prop(vpaint, "mode", text="")
1801         row.prop(vpaint, "use_normal")
1802         col.prop(vpaint, "use_spray")
1803
1804         self.unified_paint_settings(col, context)
1805
1806 # Commented out because the Apply button isn't an operator yet, making these settings useless
1807 #~         col.label(text="Gamma:")
1808 #~         col.prop(vpaint, "gamma", text="")
1809 #~         col.label(text="Multiply:")
1810 #~         col.prop(vpaint, "mul", text="")
1811
1812
1813 class VIEW3D_PT_tools_vertexpaint_symmetry(Panel, View3DPaintPanel):
1814     bl_category = "Tools"
1815     bl_context = "vertexpaint"
1816     bl_options = {'DEFAULT_CLOSED'}
1817     bl_label = "Symmetry"
1818
1819     def draw(self, context):
1820         layout = self.layout
1821         toolsettings = context.tool_settings
1822         vpaint = toolsettings.vertex_paint
1823         draw_vpaint_symmetry(layout, vpaint)
1824
1825
1826 # ********** default tools for texture-paint ****************
1827
1828
1829 class VIEW3D_PT_tools_imagepaint_external(Panel, View3DPaintPanel):
1830     bl_category = "Tools"
1831     bl_context = "imagepaint"
1832     bl_label = "External"
1833     bl_options = {'DEFAULT_CLOSED'}
1834
1835     def draw(self, context):
1836         layout = self.layout
1837
1838         toolsettings = context.tool_settings
1839         ipaint = toolsettings.image_paint
1840
1841         col = layout.column()
1842         row = col.split(align=True, percentage=0.55)
1843         row.operator("image.project_edit", text="Quick Edit")
1844         row.operator("image.project_apply", text="Apply")
1845
1846         col.row().prop(ipaint, "screen_grab_size", text="")
1847
1848         col.operator("paint.project_image", text="Apply Camera Image")
1849
1850
1851 class VIEW3D_PT_tools_imagepaint_symmetry(Panel, View3DPaintPanel):
1852     bl_category = "Tools"
1853     bl_context = "imagepaint"
1854     bl_label = "Symmetry"
1855     bl_options = {'DEFAULT_CLOSED'}
1856
1857     def draw(self, context):
1858         layout = self.layout
1859
1860         toolsettings = context.tool_settings
1861         ipaint = toolsettings.image_paint
1862
1863         col = layout.column(align=True)
1864         row = col.row(align=True)
1865         row.prop(ipaint, "use_symmetry_x", text="X", toggle=True)
1866         row.prop(ipaint, "use_symmetry_y", text="Y", toggle=True)
1867         row.prop(ipaint, "use_symmetry_z", text="Z", toggle=True)
1868
1869
1870 class VIEW3D_PT_tools_projectpaint(View3DPaintPanel, Panel):
1871     bl_category = "Options"
1872     bl_context = "imagepaint"
1873     bl_label = "Project Paint"
1874
1875     @classmethod
1876     def poll(cls, context):
1877         brush = context.tool_settings.image_paint.brush
1878         return (brush is not None)
1879
1880     def draw(self, context):
1881         layout = self.layout
1882
1883         toolsettings = context.tool_settings
1884         ipaint = toolsettings.image_paint
1885
1886         col = layout.column()
1887
1888         col.prop(ipaint, "use_occlude")
1889         col.prop(ipaint, "use_backface_culling")
1890
1891         row = layout.row()
1892         row.prop(ipaint, "use_normal_falloff")
1893
1894         sub = row.row()
1895         sub.active = (ipaint.use_normal_falloff)
1896         sub.prop(ipaint, "normal_angle", text="")
1897
1898         layout.prop(ipaint, "use_cavity")
1899         if ipaint.use_cavity:
1900             layout.template_curve_mapping(ipaint, "cavity_curve", brush=True)
1901
1902         layout.prop(ipaint, "seam_bleed")
1903         layout.prop(ipaint, "dither")
1904         self.unified_paint_settings(layout, context)
1905
1906
1907 class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
1908     bl_category = "Options"
1909     bl_label = "Options"
1910
1911     @classmethod
1912     def poll(cls, context):
1913         return (context.image_paint_object and context.tool_settings.image_paint)
1914
1915     def draw(self, context):
1916         layout = self.layout
1917
1918         col = layout.column()
1919         self.unified_paint_settings(col, context)
1920
1921
1922 class VIEW3D_MT_tools_projectpaint_stencil(Menu):
1923     bl_label = "Mask Layer"
1924
1925     def draw(self, context):
1926         layout = self.layout
1927         for i, tex in enumerate(context.active_object.data.uv_textures):
1928             props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
1929             props.data_path = "active_object.data.uv_texture_stencil_index"
1930             props.value = i
1931
1932
1933 class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
1934     """Default tools for particle mode"""
1935     bl_context = "particlemode"
1936     bl_label = "Options"
1937     bl_category = "Tools"
1938
1939     def draw(self, context):
1940         layout = self.layout
1941
1942         pe = context.tool_settings.particle_edit
1943         ob = pe.object
1944
1945         layout.prop(pe, "type", text="")
1946
1947         ptcache = None
1948
1949         if pe.type == 'PARTICLES':
1950             if ob.particle_systems:
1951                 if len(ob.particle_systems) > 1:
1952                     layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
1953                                          ob.particle_systems, "active_index", rows=2, maxrows=3)
1954
1955                 ptcache = ob.particle_systems.active.point_cache
1956         else:
1957             for md in ob.modifiers:
1958                 if md.type == pe.type:
1959                     ptcache = md.point_cache
1960
1961         if ptcache and len(ptcache.point_caches) > 1:
1962             layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches",
1963                                  ptcache.point_caches, "active_index", rows=2, maxrows=3)
1964
1965         if not pe.is_editable:
1966             layout.label(text="Point cache must be baked")
1967             layout.label(text="in memory to enable editing!")
1968
1969         col = layout.column(align=True)
1970         if pe.is_hair:
1971             col.active = pe.is_editable
1972             col.prop(pe, "use_emitter_deflect", text="Deflect Emitter")
1973             sub = col.row(align=True)
1974             sub.active = pe.use_emitter_deflect
1975             sub.prop(pe, "emitter_distance", text="Distance")
1976
1977         col = layout.column(align=True)
1978         col.active = pe.is_editable
1979         col.label(text="Keep:")
1980         col.prop(pe, "use_preserve_length", text="Lengths")
1981         col.prop(pe, "use_preserve_root", text="Root")
1982         if not pe.is_hair:
1983             col.label(text="Correct:")
1984             col.prop(pe, "use_auto_velocity", text="Velocity")
1985         col.prop(ob.data, "use_mirror_x")
1986
1987         col.prop(pe, "shape_object")
1988         col.operator("particle.shape_cut")
1989
1990         col = layout.column(align=True)
1991         col.active = pe.is_editable
1992         col.label(text="Draw:")
1993         col.prop(pe, "draw_step", text="Path Steps")
1994         if pe.is_hair:
1995             col.prop(pe, "show_particles", text="Children")
1996         else:
1997             if pe.type == 'PARTICLES':
1998                 col.prop(pe, "show_particles", text="Particles")
1999             col.prop(pe, "use_fade_time")
2000             sub = col.row(align=True)
2001             sub.active = pe.use_fade_time
2002             sub.prop(pe, "fade_frames", slider=True)
2003
2004
2005 # Grease Pencil drawing tools
2006 class VIEW3D_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
2007     bl_space_type = 'VIEW_3D'
2008
2009
2010 # Grease Pencil stroke editing tools
2011 class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
2012     bl_space_type = 'VIEW_3D'
2013
2014
2015 # Grease Pencil stroke interpolation tools
2016 class VIEW3D_PT_tools_grease_pencil_interpolate(GreasePencilInterpolatePanel, Panel):
2017     bl_space_type = 'VIEW_3D'
2018
2019
2020 # Grease Pencil stroke sculpting tools
2021 class VIEW3D_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel):
2022     bl_space_type = 'VIEW_3D'
2023
2024
2025 # Grease Pencil drawing brushes
2026 class VIEW3D_PT_tools_grease_pencil_brush(GreasePencilBrushPanel, Panel):
2027     bl_space_type = 'VIEW_3D'
2028
2029 # Grease Pencil drawingcurves
2030 class VIEW3D_PT_tools_grease_pencil_brushcurves(GreasePencilBrushCurvesPanel, Panel):
2031     bl_space_type = 'VIEW_3D'
2032
2033
2034 # Note: moved here so that it's always in last position in 'Tools' panels!
2035 class VIEW3D_PT_tools_history(View3DPanel, Panel):
2036     bl_category = "Tools"
2037     # No bl_context, we are always available!
2038     bl_label = "History"
2039     bl_options = {'DEFAULT_CLOSED'}
2040
2041     def draw(self, context):
2042         layout = self.layout
2043         obj = context.object
2044
2045         col = layout.column(align=True)
2046         row = col.row(align=True)
2047         row.operator("ed.undo")
2048         row.operator("ed.redo")
2049         if obj is None or obj.mode != 'SCULPT':
2050             # Sculpt mode does not generate an undo menu it seems...
2051             col.operator("ed.undo_history")
2052
2053         col = layout.column(align=True)
2054         col.label(text="Repeat:")
2055         col.operator("screen.repeat_last")
2056         col.operator("screen.repeat_history", text="History...")
2057
2058
2059 classes = (
2060     VIEW3D_PT_tools_transform,
2061     VIEW3D_PT_tools_object,
2062     VIEW3D_PT_tools_add_object,
2063     VIEW3D_PT_tools_relations,
2064     VIEW3D_PT_tools_animation,
2065     VIEW3D_PT_tools_rigid_body,
2066     VIEW3D_PT_tools_transform_mesh,
2067     VIEW3D_PT_tools_meshedit,
2068     VIEW3D_PT_tools_meshweight,
2069     VIEW3D_PT_tools_add_mesh_edit,
2070     VIEW3D_PT_tools_shading,
2071     VIEW3D_PT_tools_uvs,
2072     VIEW3D_PT_tools_meshedit_options,
2073     VIEW3D_PT_tools_transform_curve,
2074     VIEW3D_PT_tools_curveedit,
2075     VIEW3D_PT_tools_add_curve_edit,
2076     VIEW3D_PT_tools_curveedit_options_stroke,
2077     VIEW3D_PT_tools_transform_surface,
2078     VIEW3D_PT_tools_surfaceedit,
2079     VIEW3D_PT_tools_add_surface_edit,
2080     VIEW3D_PT_tools_textedit,
2081     VIEW3D_PT_tools_armatureedit,
2082     VIEW3D_PT_tools_armatureedit_transform,
2083     VIEW3D_PT_tools_armatureedit_options,
2084     VIEW3D_PT_tools_mballedit,
2085     VIEW3D_PT_tools_add_mball_edit,
2086     VIEW3D_PT_tools_latticeedit,
2087     VIEW3D_PT_tools_posemode,
2088     VIEW3D_PT_tools_posemode_options,
2089     VIEW3D_PT_imapaint_tools_missing,
2090     VIEW3D_PT_tools_brush,
2091     TEXTURE_UL_texpaintslots,
2092     VIEW3D_MT_tools_projectpaint_uvlayer,
2093     VIEW3D_PT_slots_projectpaint,
2094     VIEW3D_PT_stencil_projectpaint,
2095     VIEW3D_PT_tools_brush_overlay,
2096     VIEW3D_PT_tools_brush_texture,
2097     VIEW3D_PT_tools_mask_texture,
2098     VIEW3D_PT_tools_brush_stroke,
2099     VIEW3D_PT_tools_brush_curve,
2100     VIEW3D_PT_sculpt_dyntopo,
2101     VIEW3D_PT_sculpt_options,
2102     VIEW3D_PT_sculpt_symmetry,
2103     VIEW3D_PT_tools_brush_appearance,
2104     VIEW3D_PT_tools_weightpaint,
2105     VIEW3D_PT_tools_weightpaint_symmetry,
2106     VIEW3D_PT_tools_weightpaint_options,
2107     VIEW3D_PT_tools_vertexpaint,
2108     VIEW3D_PT_tools_vertexpaint_symmetry,
2109     VIEW3D_PT_tools_imagepaint_external,
2110     VIEW3D_PT_tools_imagepaint_symmetry,
2111     VIEW3D_PT_tools_projectpaint,
2112     VIEW3D_MT_tools_projectpaint_stencil,
2113     VIEW3D_PT_tools_particlemode,
2114     VIEW3D_PT_tools_grease_pencil_draw,
2115     VIEW3D_PT_tools_grease_pencil_edit,
2116     VIEW3D_PT_tools_grease_pencil_interpolate,
2117     VIEW3D_PT_tools_grease_pencil_sculpt,
2118     VIEW3D_PT_tools_grease_pencil_brush,
2119     VIEW3D_PT_tools_grease_pencil_brushcurves,
2120     VIEW3D_PT_tools_history,
2121 )
2122
2123 if __name__ == "__main__":  # only for live edit.
2124     from bpy.utils import register_class
2125     for cls in classes:
2126         register_class(cls)