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