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