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