GP Interpolate Sequence: Tool settings for controlling the shape of interpolation
[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                 col.template_ID(toolsettings, "canvas")
921                 col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS'
922
923         if toolsettings.missing_stencil:
924             col.separator()
925             col.label("Missing Stencil", icon='INFO')
926             col.label("Add or assign a stencil image below")
927             col.label("Stencil Image")
928             col.template_ID(toolsettings, "stencil_image")
929             col.operator("image.new", text="New").gen_context = 'PAINT_STENCIL'
930
931
932 class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
933     bl_category = "Tools"
934     bl_label = "Brush"
935
936     @classmethod
937     def poll(cls, context):
938         return cls.paint_settings(context)
939
940     def draw(self, context):
941         layout = self.layout
942
943         toolsettings = context.tool_settings
944         settings = self.paint_settings(context)
945         brush = settings.brush
946
947         if not context.particle_edit_object:
948             col = layout.split().column()
949             col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
950
951         # Particle Mode #
952         if context.particle_edit_object:
953             tool = settings.tool
954
955             layout.column().prop(settings, "tool", expand=True)
956
957             if tool != 'NONE':
958                 col = layout.column()
959                 col.prop(brush, "size", slider=True)
960                 if tool != 'ADD':
961                     col.prop(brush, "strength", slider=True)
962
963             if tool == 'ADD':
964                 col.prop(brush, "count")
965                 col = layout.column()
966                 col.prop(settings, "use_default_interpolate")
967                 col.prop(brush, "steps", slider=True)
968                 col.prop(settings, "default_key_count", slider=True)
969             elif tool == 'LENGTH':
970                 layout.prop(brush, "length_mode", expand=True)
971             elif tool == 'PUFF':
972                 layout.prop(brush, "puff_mode", expand=True)
973                 layout.prop(brush, "use_puff_volume")
974
975         # Sculpt Mode #
976
977         elif context.sculpt_object and brush:
978             capabilities = brush.sculpt_capabilities
979
980             col = layout.column()
981
982             col.separator()
983
984             row = col.row(align=True)
985
986             ups = toolsettings.unified_paint_settings
987             if ((ups.use_unified_size and ups.use_locked_size) or
988                     ((not ups.use_unified_size) and brush.use_locked_size)):
989                 self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
990                 self.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
991             else:
992                 self.prop_unified_size(row, context, brush, "use_locked_size", icon='UNLOCKED')
993                 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
994
995             self.prop_unified_size(row, context, brush, "use_pressure_size")
996
997             # strength, use_strength_pressure, and use_strength_attenuation
998             col.separator()
999             row = col.row(align=True)
1000
1001             if capabilities.has_space_attenuation:
1002                 row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
1003
1004             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
1005
1006             if capabilities.has_strength_pressure:
1007                 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
1008
1009             # auto_smooth_factor and use_inverse_smooth_pressure
1010             if capabilities.has_auto_smooth:
1011                 col.separator()
1012
1013                 row = col.row(align=True)
1014                 row.prop(brush, "auto_smooth_factor", slider=True)
1015                 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
1016
1017             # normal_weight
1018             if capabilities.has_normal_weight:
1019                 col.separator()
1020                 row = col.row(align=True)
1021                 row.prop(brush, "normal_weight", slider=True)
1022
1023             # crease_pinch_factor
1024             if capabilities.has_pinch_factor:
1025                 col.separator()
1026                 row = col.row(align=True)
1027                 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
1028
1029             # rake_factor
1030             if capabilities.has_rake_factor:
1031                 col.separator()
1032                 row = col.row(align=True)
1033                 row.prop(brush, "rake_factor", slider=True)
1034
1035             # use_original_normal and sculpt_plane
1036             if capabilities.has_sculpt_plane:
1037                 col.separator()
1038                 row = col.row(align=True)
1039
1040                 row.prop(brush, "use_original_normal", toggle=True, icon_only=True)
1041
1042                 row.prop(brush, "sculpt_plane", text="")
1043
1044             if brush.sculpt_tool == 'MASK':
1045                 col.prop(brush, "mask_tool", text="")
1046
1047             # plane_offset, use_offset_pressure, use_plane_trim, plane_trim
1048             if capabilities.has_plane_offset:
1049                 row = col.row(align=True)
1050                 row.prop(brush, "plane_offset", slider=True)
1051                 row.prop(brush, "use_offset_pressure", text="")
1052
1053                 col.separator()
1054
1055                 row = col.row()
1056                 row.prop(brush, "use_plane_trim", text="Trim")
1057                 row = col.row()
1058                 row.active = brush.use_plane_trim
1059                 row.prop(brush, "plane_trim", slider=True, text="Distance")
1060
1061             # height
1062             if capabilities.has_height:
1063                 row = col.row()
1064                 row.prop(brush, "height", slider=True, text="Height")
1065
1066             # use_frontface
1067             col.separator()
1068             row = col.row()
1069             row.prop(brush, "use_frontface", text="Front Faces Only")
1070
1071             # direction
1072             col.separator()
1073             col.row().prop(brush, "direction", expand=True)
1074
1075             # use_accumulate
1076             if capabilities.has_accumulate:
1077                 col.separator()
1078
1079                 col.prop(brush, "use_accumulate")
1080
1081             # use_persistent, set_persistent_base
1082             if capabilities.has_persistence:
1083                 col.separator()
1084
1085                 ob = context.sculpt_object
1086                 do_persistent = True
1087
1088                 # not supported yet for this case
1089                 for md in ob.modifiers:
1090                     if md.type == 'MULTIRES':
1091                         do_persistent = False
1092                         break
1093
1094                 if do_persistent:
1095                     col.prop(brush, "use_persistent")
1096                     col.operator("sculpt.set_persistent_base")
1097
1098         # Texture Paint Mode #
1099
1100         elif context.image_paint_object and brush:
1101             brush_texpaint_common(self, context, layout, brush, settings, True)
1102
1103         # Weight Paint Mode #
1104         elif context.weight_paint_object and brush:
1105
1106             col = layout.column()
1107
1108             row = col.row(align=True)
1109             self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
1110
1111             row = col.row(align=True)
1112             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
1113             self.prop_unified_size(row, context, brush, "use_pressure_size")
1114
1115             row = col.row(align=True)
1116             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
1117             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
1118
1119             col.prop(brush, "vertex_tool", text="Blend")
1120
1121             if brush.vertex_tool == 'BLUR':
1122                 col.prop(brush, "use_accumulate")
1123                 col.separator()
1124
1125             col = layout.column()
1126             col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
1127             col.prop(toolsettings, "use_multipaint", text="Multi-Paint")
1128
1129         # Vertex Paint Mode #
1130         elif context.vertex_paint_object and brush:
1131             col = layout.column()
1132             self.prop_unified_color_picker(col, context, brush, "color", value_slider=True)
1133             if settings.palette:
1134                 col.template_palette(settings, "palette", color=True)
1135             self.prop_unified_color(col, context, brush, "color", text="")
1136
1137             col.separator()
1138             row = col.row(align=True)
1139             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
1140             self.prop_unified_size(row, context, brush, "use_pressure_size")
1141
1142             row = col.row(align=True)
1143             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
1144             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
1145
1146             # XXX - TODO
1147             # row = col.row(align=True)
1148             # row.prop(brush, "jitter", slider=True)
1149             # row.prop(brush, "use_pressure_jitter", toggle=True, text="")
1150             col.separator()
1151             col.prop(brush, "vertex_tool", text="Blend")
1152
1153             col.separator()
1154             col.template_ID(settings, "palette", new="palette.new")
1155
1156
1157 class TEXTURE_UL_texpaintslots(UIList):
1158     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
1159         mat = data
1160
1161         if self.layout_type in {'DEFAULT', 'COMPACT'}:
1162             layout.prop(item, "name", text="", emboss=False, icon_value=icon)
1163             if (not mat.use_nodes) and context.scene.render.engine in {'BLENDER_RENDER', 'BLENDER_GAME'}:
1164                 mtex_index = mat.texture_paint_slots[index].index
1165                 layout.prop(mat, "use_textures", text="", index=mtex_index)
1166         elif self.layout_type == 'GRID':
1167             layout.alignment = 'CENTER'
1168             layout.label(text="")
1169
1170
1171 class VIEW3D_MT_tools_projectpaint_uvlayer(Menu):
1172     bl_label = "Clone Layer"
1173
1174     def draw(self, context):
1175         layout = self.layout
1176
1177         for i, tex in enumerate(context.active_object.data.uv_textures):
1178             props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
1179             props.data_path = "active_object.data.uv_textures.active_index"
1180             props.value = i
1181
1182
1183 class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel):
1184     bl_context = "imagepaint"
1185     bl_label = "Slots"
1186     bl_category = "Slots"
1187
1188     @classmethod
1189     def poll(cls, context):
1190         brush = context.tool_settings.image_paint.brush
1191         ob = context.active_object
1192         return (brush is not None and ob is not None)
1193
1194     def draw(self, context):
1195         layout = self.layout
1196
1197         settings = context.tool_settings.image_paint
1198         # brush = settings.brush
1199
1200         ob = context.active_object
1201         col = layout.column()
1202
1203         col.label("Painting Mode")
1204         col.prop(settings, "mode", text="")
1205         col.separator()
1206
1207         if settings.mode == 'MATERIAL':
1208             if len(ob.material_slots) > 1:
1209                 col.label("Materials")
1210                 col.template_list("MATERIAL_UL_matslots", "layers",
1211                                   ob, "material_slots",
1212                                   ob, "active_material_index", rows=2)
1213
1214             mat = ob.active_material
1215             if mat:
1216                 col.label("Available Paint Slots")
1217                 col.template_list("TEXTURE_UL_texpaintslots", "",
1218                                   mat, "texture_paint_images",
1219                                   mat, "paint_active_slot", rows=2)
1220
1221                 if mat.texture_paint_slots:
1222                     slot = mat.texture_paint_slots[mat.paint_active_slot]
1223                 else:
1224                     slot = None
1225
1226                 if (not mat.use_nodes) and context.scene.render.engine in {'BLENDER_RENDER', 'BLENDER_GAME'}:
1227                     row = col.row(align=True)
1228                     row.operator_menu_enum("paint.add_texture_paint_slot", "type")
1229                     row.operator("paint.delete_texture_paint_slot", text="", icon='X')
1230
1231                     if slot:
1232                         col.prop(mat.texture_slots[slot.index], "blend_type")
1233                         col.separator()
1234
1235                 if slot and slot.index != -1:
1236                     col.label("UV Map")
1237                     col.prop_search(slot, "uv_layer", ob.data, "uv_textures", text="")
1238
1239         elif settings.mode == 'IMAGE':
1240             mesh = ob.data
1241             uv_text = mesh.uv_textures.active.name if mesh.uv_textures.active else ""
1242             col.label("Canvas Image")
1243             col.template_ID(settings, "canvas")
1244             col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS'
1245             col.label("UV Map")
1246             col.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
1247
1248         col.separator()
1249         col.operator("image.save_dirty", text="Save All Images")
1250
1251
1252 class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel):
1253     bl_context = "imagepaint"
1254     bl_label = "Mask"
1255     bl_category = "Slots"
1256
1257     @classmethod
1258     def poll(cls, context):
1259         brush = context.tool_settings.image_paint.brush
1260         ob = context.active_object
1261         return (brush is not None and ob is not None)
1262
1263     def draw_header(self, context):
1264         ipaint = context.tool_settings.image_paint
1265         self.layout.prop(ipaint, "use_stencil_layer", text="")
1266
1267     def draw(self, context):
1268         layout = self.layout
1269
1270         toolsettings = context.tool_settings
1271         ipaint = toolsettings.image_paint
1272         ob = context.active_object
1273         mesh = ob.data
1274
1275         col = layout.column()
1276         col.active = ipaint.use_stencil_layer
1277
1278         stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
1279         col.label("UV Map")
1280         col.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text, translate=False)
1281
1282         col.label("Stencil Image")
1283         col.template_ID(ipaint, "stencil_image")
1284         col.operator("image.new", text="New").gen_context = 'PAINT_STENCIL'
1285
1286         col.label("Visualization")
1287         row = col.row(align=True)
1288         row.prop(ipaint, "stencil_color", text="")
1289         row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1290
1291
1292 class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
1293     bl_category = "Options"
1294     bl_label = "Overlay"
1295
1296     @classmethod
1297     def poll(cls, context):
1298         settings = cls.paint_settings(context)
1299         return (settings and
1300                 settings.brush and
1301                 (context.sculpt_object or
1302                  context.vertex_paint_object or
1303                  context.weight_paint_object or
1304                  context.image_paint_object))
1305
1306     def draw(self, context):
1307         layout = self.layout
1308
1309         settings = self.paint_settings(context)
1310         brush = settings.brush
1311         tex_slot = brush.texture_slot
1312         tex_slot_mask = brush.mask_texture_slot
1313
1314         col = layout.column()
1315
1316         col.label(text="Curve:")
1317
1318         row = col.row(align=True)
1319         if brush.use_cursor_overlay:
1320             row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
1321         else:
1322             row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
1323
1324         sub = row.row(align=True)
1325         sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
1326         sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
1327
1328         col.active = brush.brush_capabilities.has_overlay
1329
1330         if context.image_paint_object or context.sculpt_object or context.vertex_paint_object:
1331             col.label(text="Texture:")
1332             row = col.row(align=True)
1333             if tex_slot.map_mode != 'STENCIL':
1334                 if brush.use_primary_overlay:
1335                     row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
1336                 else:
1337                     row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
1338
1339             sub = row.row(align=True)
1340             sub.prop(brush, "texture_overlay_alpha", text="Alpha")
1341             sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
1342
1343         if context.image_paint_object:
1344             col.label(text="Mask Texture:")
1345
1346             row = col.row(align=True)
1347             if tex_slot_mask.map_mode != 'STENCIL':
1348                 if brush.use_secondary_overlay:
1349                     row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
1350                 else:
1351                     row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
1352
1353             sub = row.row(align=True)
1354             sub.prop(brush, "mask_overlay_alpha", text="Alpha")
1355             sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
1356
1357
1358 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
1359     bl_category = "Tools"
1360     bl_label = "Texture"
1361     bl_options = {'DEFAULT_CLOSED'}
1362
1363     @classmethod
1364     def poll(cls, context):
1365         settings = cls.paint_settings(context)
1366         return (settings and settings.brush and
1367                 (context.sculpt_object or context.image_paint_object or context.vertex_paint_object))
1368
1369     def draw(self, context):
1370         layout = self.layout
1371
1372         settings = self.paint_settings(context)
1373         brush = settings.brush
1374
1375         col = layout.column()
1376
1377         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
1378
1379         brush_texture_settings(col, brush, context.sculpt_object)
1380
1381
1382 class VIEW3D_PT_tools_mask_texture(Panel, View3DPaintPanel):
1383     bl_category = "Tools"
1384     bl_context = "imagepaint"
1385     bl_label = "Texture Mask"
1386     bl_options = {'DEFAULT_CLOSED'}
1387
1388     @classmethod
1389     def poll(cls, context):
1390         settings = cls.paint_settings(context)
1391         return (settings and settings.brush and context.image_paint_object)
1392
1393     def draw(self, context):
1394         layout = self.layout
1395
1396         brush = context.tool_settings.image_paint.brush
1397
1398         col = layout.column()
1399
1400         col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8)
1401
1402         brush_mask_texture_settings(col, brush)
1403
1404
1405 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
1406     bl_category = "Tools"
1407     bl_label = "Stroke"
1408     bl_options = {'DEFAULT_CLOSED'}
1409
1410     @classmethod
1411     def poll(cls, context):
1412         settings = cls.paint_settings(context)
1413         return (settings and
1414                 settings.brush and
1415                 (context.sculpt_object or
1416                  context.vertex_paint_object or
1417                  context.weight_paint_object or
1418                  context.image_paint_object))
1419
1420     def draw(self, context):
1421         layout = self.layout
1422
1423         settings = self.paint_settings(context)
1424         brush = settings.brush
1425
1426         col = layout.column()
1427
1428         col.label(text="Stroke Method:")
1429
1430         col.prop(brush, "stroke_method", text="")
1431
1432         if brush.use_anchor:
1433             col.separator()
1434             col.prop(brush, "use_edge_to_edge", "Edge To Edge")
1435
1436         if brush.use_airbrush:
1437             col.separator()
1438             col.prop(brush, "rate", text="Rate", slider=True)
1439
1440         if brush.use_space:
1441             col.separator()
1442             row = col.row(align=True)
1443             row.prop(brush, "spacing", text="Spacing")
1444             row.prop(brush, "use_pressure_spacing", toggle=True, text="")
1445
1446         if brush.use_line or brush.use_curve:
1447             col.separator()
1448             row = col.row(align=True)
1449             row.prop(brush, "spacing", text="Spacing")
1450
1451         if brush.use_curve:
1452             col.separator()
1453             col.template_ID(brush, "paint_curve", new="paintcurve.new")
1454             col.operator("paintcurve.draw")
1455
1456         if context.sculpt_object:
1457             if brush.sculpt_capabilities.has_jitter:
1458                 col.separator()
1459
1460                 row = col.row(align=True)
1461                 row.prop(brush, "use_relative_jitter", icon_only=True)
1462                 if brush.use_relative_jitter:
1463                     row.prop(brush, "jitter", slider=True)
1464                 else:
1465                     row.prop(brush, "jitter_absolute")
1466                 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
1467
1468             if brush.sculpt_capabilities.has_smooth_stroke:
1469                 col = layout.column()
1470                 col.separator()
1471
1472                 col.prop(brush, "use_smooth_stroke")
1473
1474                 sub = col.column()
1475                 sub.active = brush.use_smooth_stroke
1476                 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
1477                 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
1478         else:
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             col = layout.column()
1490             col.separator()
1491
1492             if brush.brush_capabilities.has_smooth_stroke:
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
1500         layout.prop(settings, "input_samples")
1501
1502
1503 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
1504     bl_category = "Tools"
1505     bl_label = "Curve"
1506     bl_options = {'DEFAULT_CLOSED'}
1507
1508     @classmethod
1509     def poll(cls, context):
1510         settings = cls.paint_settings(context)
1511         return (settings and settings.brush and settings.brush.curve)
1512
1513     def draw(self, context):
1514         layout = self.layout
1515
1516         settings = self.paint_settings(context)
1517
1518         brush = settings.brush
1519
1520         layout.template_curve_mapping(brush, "curve", brush=True)
1521
1522         col = layout.column(align=True)
1523         row = col.row(align=True)
1524         row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
1525         row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
1526         row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
1527         row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
1528         row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
1529         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
1530
1531
1532 class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
1533     bl_category = "Tools"
1534     bl_label = "Dyntopo"
1535     bl_options = {'DEFAULT_CLOSED'}
1536
1537     @classmethod
1538     def poll(cls, context):
1539         return (context.sculpt_object and context.tool_settings.sculpt)
1540
1541     def draw_header(self, context):
1542         layout = self.layout
1543         layout.operator(
1544                 "sculpt.dynamic_topology_toggle",
1545                 icon='CHECKBOX_HLT' if context.sculpt_object.use_dynamic_topology_sculpting else 'CHECKBOX_DEHLT',
1546                 text="",
1547                 emboss=False,
1548                 )
1549
1550     def draw(self, context):
1551         layout = self.layout
1552
1553         toolsettings = context.tool_settings
1554         sculpt = toolsettings.sculpt
1555         settings = self.paint_settings(context)
1556         brush = settings.brush
1557
1558         col = layout.column()
1559         col.active = context.sculpt_object.use_dynamic_topology_sculpting
1560         sub = col.column(align=True)
1561         sub.active = (brush and brush.sculpt_tool != 'MASK')
1562         if (sculpt.detail_type_method == 'CONSTANT'):
1563             row = sub.row(align=True)
1564             row.prop(sculpt, "constant_detail_resolution")
1565             row.operator("sculpt.sample_detail_size", text="", icon='EYEDROPPER')
1566         elif (sculpt.detail_type_method == 'BRUSH'):
1567             sub.prop(sculpt, "detail_percent")
1568         else:
1569             sub.prop(sculpt, "detail_size")
1570         sub.prop(sculpt, "detail_refine_method", text="")
1571         sub.prop(sculpt, "detail_type_method", text="")
1572         col.separator()
1573         col.prop(sculpt, "use_smooth_shading")
1574         col.operator("sculpt.optimize")
1575         if (sculpt.detail_type_method == 'CONSTANT'):
1576             col.operator("sculpt.detail_flood_fill")
1577         col.separator()
1578         col.prop(sculpt, "symmetrize_direction")
1579         col.operator("sculpt.symmetrize")
1580
1581
1582 class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
1583     bl_category = "Options"
1584     bl_label = "Options"
1585     bl_options = {'DEFAULT_CLOSED'}
1586
1587     @classmethod
1588     def poll(cls, context):
1589         return (context.sculpt_object and context.tool_settings.sculpt)
1590
1591     def draw(self, context):
1592         layout = self.layout
1593         # scene = context.scene
1594
1595         toolsettings = context.tool_settings
1596         sculpt = toolsettings.sculpt
1597         capabilities = sculpt.brush.sculpt_capabilities
1598
1599         col = layout.column(align=True)
1600         col.active = capabilities.has_gravity
1601         col.label(text="Gravity:")
1602         col.prop(sculpt, "gravity", slider=True, text="Factor")
1603         col.prop(sculpt, "gravity_object")
1604         col.separator()
1605
1606         layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1607         layout.prop(sculpt, "show_low_resolution")
1608         layout.prop(sculpt, "use_deform_only")
1609         layout.prop(sculpt, "show_diffuse_color")
1610
1611         self.unified_paint_settings(layout, context)
1612
1613
1614 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
1615     bl_category = "Tools"
1616     bl_label = "Symmetry/Lock"
1617     bl_options = {'DEFAULT_CLOSED'}
1618
1619     @classmethod
1620     def poll(cls, context):
1621         return (context.sculpt_object and context.tool_settings.sculpt)
1622
1623     def draw(self, context):
1624         layout = self.layout
1625
1626         sculpt = context.tool_settings.sculpt
1627
1628         col = layout.column(align=True)
1629         col.label(text="Mirror:")
1630         row = col.row(align=True)
1631         row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
1632         row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
1633         row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
1634
1635         layout.column().prop(sculpt, "radial_symmetry", text="Radial")
1636         layout.prop(sculpt, "use_symmetry_feather", text="Feather")
1637
1638         layout.label(text="Lock:")
1639
1640         row = layout.row(align=True)
1641         row.prop(sculpt, "lock_x", text="X", toggle=True)
1642         row.prop(sculpt, "lock_y", text="Y", toggle=True)
1643         row.prop(sculpt, "lock_z", text="Z", toggle=True)
1644
1645         layout.label(text="Tiling:")
1646
1647         row = layout.row(align=True)
1648         row.prop(sculpt, "tile_x", text="X", toggle=True)
1649         row.prop(sculpt, "tile_y", text="Y", toggle=True)
1650         row.prop(sculpt, "tile_z", text="Z", toggle=True)
1651
1652         layout.column().prop(sculpt, "tile_offset", text="Tile Offset")
1653
1654
1655 class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
1656     bl_category = "Options"
1657     bl_label = "Appearance"
1658
1659     @classmethod
1660     def poll(cls, context):
1661         settings = cls.paint_settings(context)
1662         return (settings is not None) and (not isinstance(settings, bpy.types.ParticleEdit))
1663
1664     def draw(self, context):
1665         layout = self.layout
1666
1667         settings = self.paint_settings(context)
1668         brush = settings.brush
1669
1670         if brush is None:  # unlikely but can happen
1671             layout.label(text="Brush Unset")
1672             return
1673
1674         col = layout.column()
1675         col.prop(settings, "show_brush")
1676
1677         sub = col.column()
1678         sub.active = settings.show_brush
1679
1680         if context.sculpt_object and context.tool_settings.sculpt:
1681             if brush.sculpt_capabilities.has_secondary_color:
1682                 sub.row().prop(brush, "cursor_color_add", text="Add")
1683                 sub.row().prop(brush, "cursor_color_subtract", text="Subtract")
1684             else:
1685                 sub.prop(brush, "cursor_color_add", text="")
1686         else:
1687             sub.prop(brush, "cursor_color_add", text="")
1688
1689         col.separator()
1690
1691         col = col.column(align=True)
1692         col.prop(brush, "use_custom_icon")
1693         sub = col.column()
1694         sub.active = brush.use_custom_icon
1695         sub.prop(brush, "icon_filepath", text="")
1696
1697 # ********** default tools for weight-paint ****************
1698
1699
1700 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
1701     bl_category = "Tools"
1702     bl_context = "weightpaint"
1703     bl_label = "Weight Tools"
1704
1705     def draw(self, context):
1706         layout = self.layout
1707         VIEW3D_PT_tools_meshweight.draw_generic(layout)
1708
1709         col = layout.column()
1710         col.operator("paint.weight_gradient")
1711         props = col.operator("object.data_transfer", text="Transfer Weights")
1712         props.use_reverse_transfer = True
1713         props.data_type = 'VGROUP_WEIGHTS'
1714
1715
1716 class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
1717     bl_category = "Options"
1718     bl_context = "weightpaint"
1719     bl_label = "Options"
1720
1721     def draw(self, context):
1722         layout = self.layout
1723
1724         tool_settings = context.tool_settings
1725         wpaint = tool_settings.weight_paint
1726
1727         col = layout.column()
1728         row = col.row()
1729
1730         row.prop(wpaint, "use_normal")
1731         col = layout.column()
1732         row = col.row()
1733         row.prop(wpaint, "use_spray")
1734         row.prop(wpaint, "use_group_restrict")
1735
1736         obj = context.weight_paint_object
1737         if obj.type == 'MESH':
1738             mesh = obj.data
1739             col.prop(mesh, "use_mirror_x")
1740             row = col.row()
1741             row.active = mesh.use_mirror_x
1742             row.prop(mesh, "use_mirror_topology")
1743
1744         col.label("Show Zero Weights:")
1745         sub = col.row()
1746         sub.prop(tool_settings, "vertex_group_user", expand=True)
1747
1748         self.unified_paint_settings(col, context)
1749
1750 # ********** default tools for vertex-paint ****************
1751
1752
1753 class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
1754     bl_category = "Options"
1755     bl_context = "vertexpaint"
1756     bl_label = "Options"
1757
1758     def draw(self, context):
1759         layout = self.layout
1760
1761         toolsettings = context.tool_settings
1762         vpaint = toolsettings.vertex_paint
1763
1764         col = layout.column()
1765         row = col.row()
1766         # col.prop(vpaint, "mode", text="")
1767         row.prop(vpaint, "use_normal")
1768         col.prop(vpaint, "use_spray")
1769
1770         self.unified_paint_settings(col, context)
1771
1772 # Commented out because the Apply button isn't an operator yet, making these settings useless
1773 #~         col.label(text="Gamma:")
1774 #~         col.prop(vpaint, "gamma", text="")
1775 #~         col.label(text="Multiply:")
1776 #~         col.prop(vpaint, "mul", text="")
1777
1778 # ********** default tools for texture-paint ****************
1779
1780
1781 class VIEW3D_PT_tools_imagepaint_external(Panel, View3DPaintPanel):
1782     bl_category = "Tools"
1783     bl_context = "imagepaint"
1784     bl_label = "External"
1785     bl_options = {'DEFAULT_CLOSED'}
1786
1787     def draw(self, context):
1788         layout = self.layout
1789
1790         toolsettings = context.tool_settings
1791         ipaint = toolsettings.image_paint
1792
1793         col = layout.column()
1794         row = col.split(align=True, percentage=0.55)
1795         row.operator("image.project_edit", text="Quick Edit")
1796         row.operator("image.project_apply", text="Apply")
1797
1798         col.row().prop(ipaint, "screen_grab_size", text="")
1799
1800         col.operator("paint.project_image", text="Apply Camera Image")
1801
1802
1803 class VIEW3D_PT_tools_imagepaint_symmetry(Panel, View3DPaintPanel):
1804     bl_category = "Tools"
1805     bl_context = "imagepaint"
1806     bl_label = "Symmetry"
1807     bl_options = {'DEFAULT_CLOSED'}
1808
1809     def draw(self, context):
1810         layout = self.layout
1811
1812         toolsettings = context.tool_settings
1813         ipaint = toolsettings.image_paint
1814
1815         col = layout.column(align=True)
1816         row = col.row(align=True)
1817         row.prop(ipaint, "use_symmetry_x", text="X", toggle=True)
1818         row.prop(ipaint, "use_symmetry_y", text="Y", toggle=True)
1819         row.prop(ipaint, "use_symmetry_z", text="Z", toggle=True)
1820
1821
1822 class VIEW3D_PT_tools_projectpaint(View3DPaintPanel, Panel):
1823     bl_category = "Options"
1824     bl_context = "imagepaint"
1825     bl_label = "Project Paint"
1826
1827     @classmethod
1828     def poll(cls, context):
1829         brush = context.tool_settings.image_paint.brush
1830         return (brush is not None)
1831
1832     def draw(self, context):
1833         layout = self.layout
1834
1835         toolsettings = context.tool_settings
1836         ipaint = toolsettings.image_paint
1837
1838         col = layout.column()
1839
1840         col.prop(ipaint, "use_occlude")
1841         col.prop(ipaint, "use_backface_culling")
1842
1843         row = layout.row()
1844         row.prop(ipaint, "use_normal_falloff")
1845
1846         sub = row.row()
1847         sub.active = (ipaint.use_normal_falloff)
1848         sub.prop(ipaint, "normal_angle", text="")
1849
1850         layout.prop(ipaint, "use_cavity")
1851         if ipaint.use_cavity:
1852             layout.template_curve_mapping(ipaint, "cavity_curve", brush=True)
1853
1854         layout.prop(ipaint, "seam_bleed")
1855         layout.prop(ipaint, "dither")
1856         self.unified_paint_settings(layout, context)
1857
1858
1859 class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
1860     bl_category = "Options"
1861     bl_label = "Options"
1862
1863     @classmethod
1864     def poll(cls, context):
1865         return (context.image_paint_object and context.tool_settings.image_paint)
1866
1867     def draw(self, context):
1868         layout = self.layout
1869
1870         col = layout.column()
1871         self.unified_paint_settings(col, context)
1872
1873
1874 class VIEW3D_MT_tools_projectpaint_stencil(Menu):
1875     bl_label = "Mask Layer"
1876
1877     def draw(self, context):
1878         layout = self.layout
1879         for i, tex in enumerate(context.active_object.data.uv_textures):
1880             props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
1881             props.data_path = "active_object.data.uv_texture_stencil_index"
1882             props.value = i
1883
1884
1885 class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
1886     """Default tools for particle mode"""
1887     bl_context = "particlemode"
1888     bl_label = "Options"
1889     bl_category = "Tools"
1890
1891     def draw(self, context):
1892         layout = self.layout
1893
1894         pe = context.tool_settings.particle_edit
1895         ob = pe.object
1896
1897         layout.prop(pe, "type", text="")
1898
1899         ptcache = None
1900
1901         if pe.type == 'PARTICLES':
1902             if ob.particle_systems:
1903                 if len(ob.particle_systems) > 1:
1904                     layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
1905                                          ob.particle_systems, "active_index", rows=2, maxrows=3)
1906
1907                 ptcache = ob.particle_systems.active.point_cache
1908         else:
1909             for md in ob.modifiers:
1910                 if md.type == pe.type:
1911                     ptcache = md.point_cache
1912
1913         if ptcache and len(ptcache.point_caches) > 1:
1914             layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches",
1915                                  ptcache.point_caches, "active_index", rows=2, maxrows=3)
1916
1917         if not pe.is_editable:
1918             layout.label(text="Point cache must be baked")
1919             layout.label(text="in memory to enable editing!")
1920
1921         col = layout.column(align=True)
1922         if pe.is_hair:
1923             col.active = pe.is_editable
1924             col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1925             sub = col.row(align=True)
1926             sub.active = pe.use_emitter_deflect
1927             sub.prop(pe, "emitter_distance", text="Distance")
1928
1929         col = layout.column(align=True)
1930         col.active = pe.is_editable
1931         col.label(text="Keep:")
1932         col.prop(pe, "use_preserve_length", text="Lengths")
1933         col.prop(pe, "use_preserve_root", text="Root")
1934         if not pe.is_hair:
1935             col.label(text="Correct:")
1936             col.prop(pe, "use_auto_velocity", text="Velocity")
1937         col.prop(ob.data, "use_mirror_x")
1938
1939         col.prop(pe, "shape_object")
1940         col.operator("particle.shape_cut")
1941
1942         col = layout.column(align=True)
1943         col.active = pe.is_editable
1944         col.label(text="Draw:")
1945         col.prop(pe, "draw_step", text="Path Steps")
1946         if pe.is_hair:
1947             col.prop(pe, "show_particles", text="Children")
1948         else:
1949             if pe.type == 'PARTICLES':
1950                 col.prop(pe, "show_particles", text="Particles")
1951             col.prop(pe, "use_fade_time")
1952             sub = col.row(align=True)
1953             sub.active = pe.use_fade_time
1954             sub.prop(pe, "fade_frames", slider=True)
1955
1956
1957 # Grease Pencil drawing tools
1958 class VIEW3D_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
1959     bl_space_type = 'VIEW_3D'
1960
1961
1962 # Grease Pencil stroke editing tools
1963 class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
1964     bl_space_type = 'VIEW_3D'
1965
1966
1967 # Grease Pencil stroke interpolation tools
1968 class VIEW3D_PT_tools_grease_pencil_interpolate(GreasePencilInterpolatePanel, Panel):
1969     bl_space_type = 'VIEW_3D'
1970
1971
1972 # Grease Pencil stroke sculpting tools
1973 class VIEW3D_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel):
1974     bl_space_type = 'VIEW_3D'
1975
1976
1977 # Grease Pencil drawing brushes
1978 class VIEW3D_PT_tools_grease_pencil_brush(GreasePencilBrushPanel, Panel):
1979     bl_space_type = 'VIEW_3D'
1980
1981 # Grease Pencil drawingcurves
1982 class VIEW3D_PT_tools_grease_pencil_brushcurves(GreasePencilBrushCurvesPanel, Panel):
1983     bl_space_type = 'VIEW_3D'
1984
1985
1986 # Note: moved here so that it's always in last position in 'Tools' panels!
1987 class VIEW3D_PT_tools_history(View3DPanel, Panel):
1988     bl_category = "Tools"
1989     # No bl_context, we are always available!
1990     bl_label = "History"
1991     bl_options = {'DEFAULT_CLOSED'}
1992
1993     def draw(self, context):
1994         layout = self.layout
1995         obj = context.object
1996
1997         col = layout.column(align=True)
1998         row = col.row(align=True)
1999         row.operator("ed.undo")
2000         row.operator("ed.redo")
2001         if obj is None or obj.mode != 'SCULPT':
2002             # Sculpt mode does not generate an undo menu it seems...
2003             col.operator("ed.undo_history")
2004
2005         col = layout.column(align=True)
2006         col.label(text="Repeat:")
2007         col.operator("screen.repeat_last")
2008         col.operator("screen.repeat_history", text="History...")
2009
2010
2011 if __name__ == "__main__":  # only for live edit.
2012     bpy.utils.register_module(__name__)