Merging r58475 through r58700 from trunk into soc-2013-depsgraph_mt
[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
22 from bl_ui.properties_paint_common import UnifiedPaintPanel
23 from bl_ui.properties_paint_common import brush_texture_settings
24 from bl_ui.properties_paint_common import brush_mask_texture_settings
25
26
27 class View3DPanel():
28     bl_space_type = 'VIEW_3D'
29     bl_region_type = 'TOOLS'
30
31
32 # **************** standard tool clusters ******************
33
34 # History/Repeat tools
35 def draw_repeat_tools(context, layout):
36     col = layout.column(align=True)
37     col.label(text="Repeat:")
38     col.operator("screen.repeat_last")
39     col.operator("screen.repeat_history", text="History...")
40
41
42 # Keyframing tools
43 def draw_keyframing_tools(context, layout):
44     col = layout.column(align=True)
45     col.label(text="Keyframes:")
46     row = col.row()
47     row.operator("anim.keyframe_insert_menu", text="Insert")
48     row.operator("anim.keyframe_delete_v3d", text="Remove")
49
50
51 # Grease Pencil tools
52 def draw_gpencil_tools(context, layout):
53     col = layout.column(align=True)
54
55     col.label(text="Grease Pencil:")
56
57     row = col.row()
58     row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
59     row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
60
61     row = col.row()
62     row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
63     row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
64
65     row = col.row()
66     row.prop(context.tool_settings, "use_grease_pencil_sessions")
67
68     col.operator("view3d.ruler")
69
70
71 # ********** default tools for object-mode ****************
72
73 class VIEW3D_PT_tools_objectmode(View3DPanel, Panel):
74     bl_context = "objectmode"
75     bl_label = "Object Tools"
76
77     def draw(self, context):
78         layout = self.layout
79
80         col = layout.column(align=True)
81         col.label(text="Transform:")
82         col.operator("transform.translate")
83         col.operator("transform.rotate")
84         col.operator("transform.resize", text="Scale")
85
86         col = layout.column(align=True)
87         col.operator("object.origin_set", text="Origin")
88
89         col = layout.column(align=True)
90         col.label(text="Object:")
91         col.operator("object.duplicate_move")
92         col.operator("object.delete")
93         col.operator("object.join")
94
95         active_object = context.active_object
96         if active_object and active_object.type in {'MESH', 'CURVE', 'SURFACE'}:
97
98             col = layout.column(align=True)
99             col.label(text="Shading:")
100             row = col.row(align=True)
101             row.operator("object.shade_smooth", text="Smooth")
102             row.operator("object.shade_flat", text="Flat")
103
104         draw_keyframing_tools(context, layout)
105
106         col = layout.column(align=True)
107         col.label(text="Motion Paths:")
108         row = col.row(align=True)
109         row.operator("object.paths_calculate", text="Calculate")
110         row.operator("object.paths_clear", text="Clear")
111
112         draw_repeat_tools(context, layout)
113
114         draw_gpencil_tools(context, layout)
115         col = layout.column(align=True)
116
117
118 class VIEW3D_PT_tools_rigidbody(View3DPanel, Panel):
119     bl_context = "objectmode"
120     bl_label = "Rigid Body Tools"
121     bl_options = {'DEFAULT_CLOSED'}
122
123     def draw(self, context):
124         layout = self.layout
125
126         col = layout.column(align=True)
127         col.label(text="Add/Remove:")
128         row = col.row()
129         row.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE'
130         row.operator("rigidbody.objects_add", text="Add Passive").type = 'PASSIVE'
131         row = col.row()
132         row.operator("rigidbody.objects_remove", text="Remove")
133
134         col = layout.column(align=True)
135         col.label(text="Object Tools:")
136         col.operator("rigidbody.shape_change", text="Change Shape")
137         col.operator("rigidbody.mass_calculate", text="Calculate Mass")
138         col.operator("rigidbody.object_settings_copy", text="Copy from Active")
139         col.operator("rigidbody.bake_to_keyframes", text="Bake To Keyframes")
140         col.label(text="Constraints:")
141         col.operator("rigidbody.connect", text="Connect")
142
143 # ********** default tools for editmode_mesh ****************
144
145
146 class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
147     bl_context = "mesh_edit"
148     bl_label = "Mesh Tools"
149
150     def draw(self, context):
151         layout = self.layout
152
153         col = layout.column(align=True)
154         col.label(text="Transform:")
155         col.operator("transform.translate")
156         col.operator("transform.rotate")
157         col.operator("transform.resize", text="Scale")
158         col.operator("transform.shrink_fatten", text="Shrink/Fatten")
159         col.operator("transform.push_pull", text="Push/Pull")
160
161         col = layout.column(align=True)
162         col.label(text="Deform:")
163         row = col.row(align=True)
164         row.operator("transform.edge_slide", text="Slide Edge")
165         row.operator("transform.vert_slide", text="Vertex")
166         col.operator("mesh.noise")
167         col.operator("mesh.vertices_smooth")
168
169         col = layout.column(align=True)
170         col.label(text="Add:")
171
172         col.menu("VIEW3D_MT_edit_mesh_extrude")
173         col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
174         col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
175         col.operator("mesh.subdivide")
176         col.operator("mesh.loopcut_slide")
177         col.operator("mesh.duplicate_move", text="Duplicate")
178         col.operator("mesh.spin")
179         col.operator("mesh.screw")
180
181         row = col.row(align=True)
182         props = row.operator("mesh.knife_tool", text="Knife")
183         props.use_occlude_geometry = True
184         props.only_selected = False
185         props = row.operator("mesh.knife_tool", text="Select")
186         props.use_occlude_geometry = False
187         props.only_selected = True
188         col.operator("mesh.knife_project")
189
190         col = layout.column(align=True)
191         col.label(text="Remove:")
192         col.menu("VIEW3D_MT_edit_mesh_delete")
193         col.operator_menu_enum("mesh.merge", "type")
194         col.operator("mesh.remove_doubles")
195
196         col = layout.column(align=True)
197         col.label(text="Normals:")
198         col.operator("mesh.normals_make_consistent", text="Recalculate")
199         col.operator("mesh.flip_normals", text="Flip Direction")
200
201         col = layout.column(align=True)
202         col.label(text="UV Mapping:")
203         col.menu("VIEW3D_MT_uv_map", text="Unwrap")
204         col.operator("mesh.mark_seam").clear = False
205         col.operator("mesh.mark_seam", text="Clear Seam").clear = True
206
207         col = layout.column(align=True)
208         col.label(text="Shading:")
209         row = col.row(align=True)
210         row.operator("mesh.faces_shade_smooth", text="Smooth")
211         row.operator("mesh.faces_shade_flat", text="Flat")
212
213         draw_repeat_tools(context, layout)
214
215         draw_gpencil_tools(context, layout)
216
217
218 class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
219     bl_context = "mesh_edit"
220     bl_label = "Mesh Options"
221
222     @classmethod
223     def poll(cls, context):
224         return context.active_object
225
226     def draw(self, context):
227         layout = self.layout
228
229         ob = context.active_object
230
231         tool_settings = context.tool_settings
232         mesh = ob.data
233
234         col = layout.column(align=True)
235         col.prop(mesh, "use_mirror_x")
236
237         row = col.row()
238         row.active = ob.data.use_mirror_x
239         row.prop(mesh, "use_mirror_topology")
240
241         col = layout.column(align=True)
242         col.label("Edge Select Mode:")
243         col.prop(tool_settings, "edge_path_mode", text="")
244         col.prop(tool_settings, "edge_path_live_unwrap")
245         col.label("Double Threshold:")
246         col.prop(tool_settings, "double_threshold", text="")
247
248         if mesh.show_weight:
249             col.label("Show Zero Weights:")
250             col.row().prop(tool_settings, "vertex_group_user", expand=True)
251
252 # ********** default tools for editmode_curve ****************
253
254
255 class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
256     bl_context = "curve_edit"
257     bl_label = "Curve Tools"
258
259     def draw(self, context):
260         layout = self.layout
261
262         col = layout.column(align=True)
263         col.label(text="Transform:")
264         col.operator("transform.translate")
265         col.operator("transform.rotate")
266         col.operator("transform.resize", text="Scale")
267
268         col = layout.column(align=True)
269         col.operator("transform.tilt", text="Tilt")
270         col.operator("transform.transform", text="Scale Feather").mode = 'CURVE_SHRINKFATTEN'
271
272         col = layout.column(align=True)
273         col.label(text="Curve:")
274         col.operator("curve.duplicate_move", text="Duplicate")
275         col.operator("curve.delete")
276         col.operator("curve.cyclic_toggle")
277         col.operator("curve.switch_direction")
278         col.operator("curve.spline_type_set")
279         col.operator("curve.radius_set")
280
281         col = layout.column(align=True)
282         col.label(text="Handles:")
283         row = col.row()
284         row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
285         row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
286         row = col.row()
287         row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
288         row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
289
290         col = layout.column(align=True)
291         col.label(text="Modeling:")
292         col.operator("curve.extrude_move", text="Extrude")
293         col.operator("curve.subdivide")
294         col.operator("curve.smooth")
295
296         draw_repeat_tools(context, layout)
297
298         draw_gpencil_tools(context, layout)
299
300 # ********** default tools for editmode_surface ****************
301
302
303 class VIEW3D_PT_tools_surfaceedit(View3DPanel, Panel):
304     bl_context = "surface_edit"
305     bl_label = "Surface Tools"
306
307     def draw(self, context):
308         layout = self.layout
309
310         col = layout.column(align=True)
311         col.label(text="Transform:")
312         col.operator("transform.translate")
313         col.operator("transform.rotate")
314         col.operator("transform.resize", text="Scale")
315
316         col = layout.column(align=True)
317         col.label(text="Curve:")
318         col.operator("curve.duplicate_move", text="Duplicate")
319         col.operator("curve.delete")
320         col.operator("curve.cyclic_toggle")
321         col.operator("curve.switch_direction")
322
323         col = layout.column(align=True)
324         col.label(text="Modeling:")
325         col.operator("curve.extrude", text="Extrude")
326         col.operator("curve.subdivide")
327
328         draw_repeat_tools(context, layout)
329
330         draw_gpencil_tools(context, layout)
331
332 # ********** default tools for editmode_text ****************
333
334
335 class VIEW3D_PT_tools_textedit(View3DPanel, Panel):
336     bl_context = "text_edit"
337     bl_label = "Text Tools"
338
339     def draw(self, context):
340         layout = self.layout
341
342         col = layout.column(align=True)
343         col.label(text="Text Edit:")
344         col.operator("font.text_copy", text="Copy")
345         col.operator("font.text_cut", text="Cut")
346         col.operator("font.text_paste", text="Paste")
347
348         col = layout.column(align=True)
349         col.label(text="Set Case:")
350         col.operator("font.case_set", text="To Upper").case = 'UPPER'
351         col.operator("font.case_set", text="To Lower").case = 'LOWER'
352
353         col = layout.column(align=True)
354         col.label(text="Style:")
355         col.operator("font.style_toggle", text="Bold").style = 'BOLD'
356         col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
357         col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
358
359         draw_repeat_tools(context, layout)
360
361
362 # ********** default tools for editmode_armature ****************
363
364
365 class VIEW3D_PT_tools_armatureedit(View3DPanel, Panel):
366     bl_context = "armature_edit"
367     bl_label = "Armature Tools"
368
369     def draw(self, context):
370         layout = self.layout
371
372         col = layout.column(align=True)
373         col.label(text="Transform:")
374         col.operator("transform.translate")
375         col.operator("transform.rotate")
376         col.operator("transform.resize", text="Scale")
377
378         col = layout.column(align=True)
379         col.label(text="Bones:")
380         col.operator("armature.bone_primitive_add", text="Add")
381         col.operator("armature.duplicate_move", text="Duplicate")
382         col.operator("armature.delete", text="Delete")
383
384         col = layout.column(align=True)
385         col.label(text="Modeling:")
386         col.operator("armature.extrude_move")
387         col.operator("armature.subdivide", text="Subdivide")
388
389         draw_repeat_tools(context, layout)
390
391         draw_gpencil_tools(context, layout)
392
393
394 class VIEW3D_PT_tools_armatureedit_options(View3DPanel, Panel):
395     bl_context = "armature_edit"
396     bl_label = "Armature Options"
397
398     def draw(self, context):
399         arm = context.active_object.data
400
401         self.layout.prop(arm, "use_mirror_x")
402
403 # ********** default tools for editmode_mball ****************
404
405
406 class VIEW3D_PT_tools_mballedit(View3DPanel, Panel):
407     bl_context = "mball_edit"
408     bl_label = "Meta Tools"
409
410     def draw(self, context):
411         layout = self.layout
412
413         col = layout.column(align=True)
414         col.label(text="Transform:")
415         col.operator("transform.translate")
416         col.operator("transform.rotate")
417         col.operator("transform.resize", text="Scale")
418
419         draw_repeat_tools(context, layout)
420
421         draw_gpencil_tools(context, layout)
422
423 # ********** default tools for editmode_lattice ****************
424
425
426 class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel):
427     bl_context = "lattice_edit"
428     bl_label = "Lattice Tools"
429
430     def draw(self, context):
431         layout = self.layout
432
433         col = layout.column(align=True)
434         col.label(text="Transform:")
435         col.operator("transform.translate")
436         col.operator("transform.rotate")
437         col.operator("transform.resize", text="Scale")
438
439         col = layout.column(align=True)
440         col.operator("lattice.make_regular")
441
442         draw_repeat_tools(context, layout)
443
444         draw_gpencil_tools(context, layout)
445
446
447 # ********** default tools for pose-mode ****************
448
449
450 class VIEW3D_PT_tools_posemode(View3DPanel, Panel):
451     bl_context = "posemode"
452     bl_label = "Pose Tools"
453
454     def draw(self, context):
455         layout = self.layout
456
457         col = layout.column(align=True)
458         col.label(text="Transform:")
459         col.operator("transform.translate")
460         col.operator("transform.rotate")
461         col.operator("transform.resize", text="Scale")
462
463         col = layout.column(align=True)
464         col.label(text="In-Between:")
465         row = col.row()
466         row.operator("pose.push", text="Push")
467         row.operator("pose.relax", text="Relax")
468         col.operator("pose.breakdown", text="Breakdowner")
469
470         col = layout.column(align=True)
471         col.label(text="Pose:")
472         row = col.row()
473         row.operator("pose.copy", text="Copy")
474         row.operator("pose.paste", text="Paste")
475
476         col = layout.column(align=True)
477         col.operator("poselib.pose_add", text="Add To Library")
478
479         draw_keyframing_tools(context, layout)
480
481         col = layout.column(align=True)
482         col.label(text="Motion Paths:")
483         row = col.row(align=True)
484         row.operator("pose.paths_calculate", text="Calculate")
485         row.operator("pose.paths_clear", text="Clear")
486
487         draw_repeat_tools(context, layout)
488
489         draw_gpencil_tools(context, layout)
490
491
492 class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
493     bl_context = "posemode"
494     bl_label = "Pose Options"
495
496     def draw(self, context):
497         arm = context.active_object.data
498
499         self.layout.prop(arm, "use_auto_ik")
500
501 # ********** default tools for paint modes ****************
502
503
504 class View3DPaintPanel(UnifiedPaintPanel):
505     bl_space_type = 'VIEW_3D'
506     bl_region_type = 'TOOLS'
507
508
509 class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
510     bl_label = "Brush"
511
512     @classmethod
513     def poll(cls, context):
514         return cls.paint_settings(context)
515
516     def draw(self, context):
517         layout = self.layout
518
519         toolsettings = context.tool_settings
520         settings = self.paint_settings(context)
521         brush = settings.brush
522
523         if not context.particle_edit_object:
524             col = layout.split().column()
525             col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
526
527         # Particle Mode #
528         if context.particle_edit_object:
529             tool = settings.tool
530
531             layout.column().prop(settings, "tool", expand=True)
532
533             if tool != 'NONE':
534                 col = layout.column()
535                 col.prop(brush, "size", slider=True)
536                 if tool != 'ADD':
537                     col.prop(brush, "strength", slider=True)
538
539             if tool == 'ADD':
540                 col.prop(brush, "count")
541                 col = layout.column()
542                 col.prop(settings, "use_default_interpolate")
543                 sub = col.column(align=True)
544                 sub.active = settings.use_default_interpolate
545                 sub.prop(brush, "steps", slider=True)
546                 sub.prop(settings, "default_key_count", slider=True)
547             elif tool == 'LENGTH':
548                 layout.prop(brush, "length_mode", expand=True)
549             elif tool == 'PUFF':
550                 layout.prop(brush, "puff_mode", expand=True)
551                 layout.prop(brush, "use_puff_volume")
552
553         # Sculpt Mode #
554
555         elif context.sculpt_object and brush:
556             capabilities = brush.sculpt_capabilities
557
558             col = layout.column()
559
560             col.separator()
561
562             row = col.row(align=True)
563
564             ups = toolsettings.unified_paint_settings
565             if ((ups.use_unified_size and ups.use_locked_size) or
566                     ((not ups.use_unified_size) and brush.use_locked_size)):
567                 self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
568                 self.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
569             else:
570                 self.prop_unified_size(row, context, brush, "use_locked_size", icon='UNLOCKED')
571                 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
572
573             self.prop_unified_size(row, context, brush, "use_pressure_size")
574
575             # strength, use_strength_pressure, and use_strength_attenuation
576             if capabilities.has_strength:
577                 col.separator()
578                 row = col.row(align=True)
579
580                 if capabilities.has_space_attenuation:
581                     if brush.use_space_attenuation:
582                         row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='LOCKED')
583                     else:
584                         row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='UNLOCKED')
585
586                 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
587                 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
588
589             # auto_smooth_factor and use_inverse_smooth_pressure
590             if capabilities.has_auto_smooth:
591                 col.separator()
592
593                 row = col.row(align=True)
594                 row.prop(brush, "auto_smooth_factor", slider=True)
595                 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
596
597             # normal_weight
598             if capabilities.has_normal_weight:
599                 col.separator()
600                 row = col.row(align=True)
601                 row.prop(brush, "normal_weight", slider=True)
602
603             # crease_pinch_factor
604             if capabilities.has_pinch_factor:
605                 col.separator()
606                 row = col.row(align=True)
607                 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
608
609             # use_original_normal and sculpt_plane
610             if capabilities.has_sculpt_plane:
611                 row = col.row(align=True)
612                 col.separator()
613
614                 if brush.use_original_normal:
615                     row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED')
616                 else:
617                     row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED')
618
619                 row.prop(brush, "sculpt_plane", text="")
620
621             if brush.sculpt_tool == 'MASK':
622                 col.prop(brush, "mask_tool", text="")
623
624             # plane_offset, use_offset_pressure, use_plane_trim, plane_trim
625             if capabilities.has_plane_offset:
626                 row = col.row(align=True)
627                 row.prop(brush, "plane_offset", slider=True)
628                 row.prop(brush, "use_offset_pressure", text="")
629
630                 col.separator()
631
632                 row = col.row()
633                 row.prop(brush, "use_plane_trim", text="Trim")
634                 row = col.row()
635                 row.active = brush.use_plane_trim
636                 row.prop(brush, "plane_trim", slider=True, text="Distance")
637
638             # height
639             if capabilities.has_height:
640                 row = col.row()
641                 row.prop(brush, "height", slider=True, text="Height")
642
643             # use_frontface
644             col.separator()
645             row = col.row()
646             row.prop(brush, "use_frontface", text="Front Faces Only")
647
648             # direction
649             col.separator()
650             col.row().prop(brush, "direction", expand=True)
651
652             # use_accumulate
653             if capabilities.has_accumulate:
654                 col.separator()
655
656                 col.prop(brush, "use_accumulate")
657
658             # use_persistent, set_persistent_base
659             if capabilities.has_persistence:
660                 col.separator()
661
662                 ob = context.sculpt_object
663                 do_persistent = True
664
665                 # not supported yet for this case
666                 for md in ob.modifiers:
667                     if md.type == 'MULTIRES':
668                         do_persistent = False
669                         break
670
671                 if do_persistent:
672                     col.prop(brush, "use_persistent")
673                     col.operator("sculpt.set_persistent_base")
674
675             col = layout.column(align=True)
676             col.label(text="Overlay:")
677
678             row = col.row()
679             if brush.use_cursor_overlay:
680                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
681             else:
682                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
683
684             sub = row.row()
685             sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
686             sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
687
688         # Texture Paint Mode #
689
690         elif context.image_paint_object and brush:
691             col = layout.column()
692
693             if brush.image_tool == 'DRAW' and brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'):
694                 col.template_color_picker(brush, "color", value_slider=True)
695                 col.prop(brush, "color", text="")
696
697             row = col.row(align=True)
698             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
699             self.prop_unified_size(row, context, brush, "use_pressure_size")
700
701             row = col.row(align=True)
702             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
703             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
704
705             row = col.row(align=True)
706
707             col.prop(brush, "blend", text="Blend")
708
709             col = layout.column()
710             col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
711             col.prop(brush, "use_alpha")
712
713             col = layout.column(align=True)
714             col.label(text="Overlay:")
715
716             row = col.row()
717             if brush.use_cursor_overlay:
718                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
719             else:
720                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
721
722             sub = row.row()
723             sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
724             sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
725
726         # Weight Paint Mode #
727         elif context.weight_paint_object and brush:
728
729             col = layout.column()
730
731             row = col.row(align=True)
732             self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
733
734             row = col.row(align=True)
735             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
736             self.prop_unified_size(row, context, brush, "use_pressure_size")
737
738             row = col.row(align=True)
739             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
740             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
741
742             row = col.row(align=True)
743
744             col.prop(brush, "vertex_tool", text="Blend")
745
746             col = layout.column()
747             col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
748             col.prop(toolsettings, "use_multipaint", text="Multi-Paint")
749
750         # Vertex Paint Mode #
751         elif context.vertex_paint_object and brush:
752             col = layout.column()
753             col.template_color_picker(brush, "color", value_slider=True)
754             col.prop(brush, "color", text="")
755
756             row = col.row(align=True)
757             self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
758             self.prop_unified_size(row, context, brush, "use_pressure_size")
759
760             row = col.row(align=True)
761             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
762             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
763
764             # XXX - TODO
765             #row = col.row(align=True)
766             #row.prop(brush, "jitter", slider=True)
767             #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
768
769             col.prop(brush, "vertex_tool", text="Blend")
770
771             col = layout.column(align=True)
772             col.label(text="Overlay:")
773
774             row = col.row()
775             if brush.use_cursor_overlay:
776                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
777             else:
778                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
779
780             sub = row.row()
781             sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
782             sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
783
784
785 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
786     bl_label = "Texture"
787     bl_options = {'DEFAULT_CLOSED'}
788
789     @classmethod
790     def poll(cls, context):
791         settings = cls.paint_settings(context)
792         return (settings and settings.brush and
793                 (context.sculpt_object or context.image_paint_object or context.vertex_paint_object))
794
795     def draw(self, context):
796         layout = self.layout
797
798         settings = self.paint_settings(context)
799         brush = settings.brush
800         tex_slot = brush.texture_slot
801
802         col = layout.column()
803
804         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
805
806         brush_texture_settings(col, brush, context.sculpt_object)
807
808         # use_texture_overlay and texture_overlay_alpha
809         col = layout.column(align=True)
810         col.active = brush.brush_capabilities.has_overlay
811         col.label(text="Overlay:")
812
813         row = col.row()
814         if tex_slot.map_mode != 'STENCIL':
815             if brush.use_primary_overlay:
816                 row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
817             else:
818                 row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
819
820         sub = row.row()
821         sub.prop(brush, "texture_overlay_alpha", text="Alpha")
822         sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
823
824
825 class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
826     bl_context = "imagepaint"
827     bl_label = "Texture Mask"
828     bl_options = {'DEFAULT_CLOSED'}
829
830     @classmethod
831     def poll(cls, context):
832         brush = context.tool_settings.image_paint.brush
833         return (context.image_paint_object and brush)
834
835     def draw(self, context):
836         layout = self.layout
837
838         brush = context.tool_settings.image_paint.brush
839         tex_slot_alpha = brush.mask_texture_slot
840
841         col = layout.column()
842
843         col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8)
844
845         brush_mask_texture_settings(col, brush)
846
847         col = layout.column(align=True)
848         col.active = brush.brush_capabilities.has_overlay
849         col.label(text="Overlay:")
850
851         row = col.row()
852         if tex_slot_alpha.map_mode != 'STENCIL':
853             if brush.use_secondary_overlay:
854                 row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
855             else:
856                 row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
857
858         sub = row.row()
859         sub.prop(brush, "mask_overlay_alpha", text="Alpha")
860         sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
861
862
863 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
864     bl_label = "Stroke"
865     bl_options = {'DEFAULT_CLOSED'}
866
867     @classmethod
868     def poll(cls, context):
869         settings = cls.paint_settings(context)
870         return (settings and
871                 settings.brush and
872                 (context.sculpt_object or
873                  context.vertex_paint_object or
874                  context.weight_paint_object or
875                  context.image_paint_object))
876
877     def draw(self, context):
878         layout = self.layout
879
880         settings = self.paint_settings(context)
881         brush = settings.brush
882
883         col = layout.column()
884
885         col.label(text="Stroke Method:")
886
887         if context.sculpt_object:
888             col.prop(brush, "sculpt_stroke_method", text="")
889         else:
890             col.prop(brush, "stroke_method", text="")
891
892         if brush.use_anchor:
893             col.separator()
894             col.prop(brush, "use_edge_to_edge", "Edge To Edge")
895
896         if brush.use_airbrush:
897             col.separator()
898             col.prop(brush, "rate", text="Rate", slider=True)
899
900         if brush.use_space:
901             col.separator()
902             row = col.row(align=True)
903             row.active = brush.use_space
904             row.prop(brush, "spacing", text="Spacing")
905             row.prop(brush, "use_pressure_spacing", toggle=True, text="")
906
907         if context.sculpt_object:
908             if brush.sculpt_capabilities.has_jitter:
909                 col.separator()
910
911                 row = col.row(align=True)
912                 if brush.use_relative_jitter:
913                     row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
914                     row.prop(brush, "jitter", slider=True)
915                 else:
916                     row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
917                     row.prop(brush, "jitter_absolute")
918                 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
919             if brush.sculpt_capabilities.has_smooth_stroke:
920                 col = layout.column()
921                 col.separator()
922
923                 col.prop(brush, "use_smooth_stroke")
924
925                 sub = col.column()
926                 sub.active = brush.use_smooth_stroke
927                 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
928                 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
929         else:
930             col.separator()
931
932             row = col.row(align=True)
933             if brush.use_relative_jitter:
934                 row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
935                 row.prop(brush, "jitter", slider=True)
936             else:
937                 row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
938                 row.prop(brush, "jitter_absolute")
939             row.prop(brush, "use_pressure_jitter", toggle=True, text="")
940
941             col = layout.column()
942             col.separator()
943
944             col.prop(brush, "use_smooth_stroke")
945
946             sub = col.column()
947             sub.active = brush.use_smooth_stroke
948             sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
949             sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
950
951
952 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
953     bl_label = "Curve"
954     bl_options = {'DEFAULT_CLOSED'}
955
956     @classmethod
957     def poll(cls, context):
958         settings = cls.paint_settings(context)
959         return (settings and settings.brush and settings.brush.curve)
960
961     def draw(self, context):
962         layout = self.layout
963
964         settings = self.paint_settings(context)
965
966         brush = settings.brush
967
968         layout.template_curve_mapping(brush, "curve", brush=True)
969
970         row = layout.row(align=True)
971         row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
972         row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
973         row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
974         row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
975         row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
976         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
977
978
979 class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel):
980     bl_label = "Topology"
981     bl_options = {'DEFAULT_CLOSED'}
982
983     @classmethod
984     def poll(cls, context):
985         return (context.sculpt_object and context.tool_settings.sculpt)
986
987     def draw(self, context):
988         layout = self.layout
989
990         toolsettings = context.tool_settings
991         sculpt = toolsettings.sculpt
992
993         if context.sculpt_object.use_dynamic_topology_sculpting:
994             layout.operator("sculpt.dynamic_topology_toggle", icon='X', text="Disable Dynamic")
995         else:
996             layout.operator("sculpt.dynamic_topology_toggle", icon='SCULPT_DYNTOPO', text="Enable Dynamic")
997
998         col = layout.column()
999         col.active = context.sculpt_object.use_dynamic_topology_sculpting
1000         col.prop(sculpt, "detail_size")
1001         col.prop(sculpt, "use_smooth_shading")
1002         col.prop(sculpt, "use_edge_collapse")
1003         col.operator("sculpt.optimize")
1004         col.separator()
1005         col.prop(sculpt, "symmetrize_direction")
1006         col.operator("sculpt.symmetrize")
1007
1008
1009 class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
1010     bl_label = "Options"
1011     bl_options = {'DEFAULT_CLOSED'}
1012
1013     @classmethod
1014     def poll(cls, context):
1015         return (context.sculpt_object and context.tool_settings.sculpt)
1016
1017     def draw(self, context):
1018         layout = self.layout
1019
1020         toolsettings = context.tool_settings
1021         sculpt = toolsettings.sculpt
1022
1023         layout.label(text="Lock:")
1024         row = layout.row(align=True)
1025         row.prop(sculpt, "lock_x", text="X", toggle=True)
1026         row.prop(sculpt, "lock_y", text="Y", toggle=True)
1027         row.prop(sculpt, "lock_z", text="Z", toggle=True)
1028
1029         layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1030         layout.prop(sculpt, "show_low_resolution")
1031         layout.prop(sculpt, "use_deform_only")
1032         layout.prop(sculpt, "show_diffuse_color")
1033
1034         layout.prop(sculpt, "input_samples")
1035
1036         self.unified_paint_settings(layout, context)
1037
1038
1039 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
1040     bl_label = "Symmetry"
1041     bl_options = {'DEFAULT_CLOSED'}
1042
1043     @classmethod
1044     def poll(cls, context):
1045         return (context.sculpt_object and context.tool_settings.sculpt)
1046
1047     def draw(self, context):
1048         layout = self.layout
1049
1050         sculpt = context.tool_settings.sculpt
1051
1052         col = layout.column(align=True)
1053         col.label(text="Mirror:")
1054         row = col.row()
1055         row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
1056         row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
1057         row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
1058
1059         layout.column().prop(sculpt, "radial_symmetry", text="Radial")
1060         layout.prop(sculpt, "use_symmetry_feather", text="Feather")
1061
1062
1063 class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
1064     bl_label = "Appearance"
1065     bl_options = {'DEFAULT_CLOSED'}
1066
1067     @classmethod
1068     def poll(cls, context):
1069         toolsettings = context.tool_settings
1070         return ((context.sculpt_object and toolsettings.sculpt) or
1071                 (context.vertex_paint_object and toolsettings.vertex_paint) or
1072                 (context.weight_paint_object and toolsettings.weight_paint) or
1073                 (context.image_paint_object and toolsettings.image_paint))
1074
1075     def draw(self, context):
1076         layout = self.layout
1077
1078         settings = self.paint_settings(context)
1079         brush = settings.brush
1080
1081         if brush is None:  # unlikely but can happen
1082             layout.label(text="Brush Unset")
1083             return
1084
1085         col = layout.column()
1086         col.prop(settings, "show_brush")
1087
1088         col = col.column()
1089         col.active = settings.show_brush
1090
1091         if context.sculpt_object and context.tool_settings.sculpt:
1092             if brush.sculpt_capabilities.has_secondary_color:
1093                 col.row().prop(brush, "cursor_color_add", text="Add")
1094                 col.row().prop(brush, "cursor_color_subtract", text="Subtract")
1095             else:
1096                 col.prop(brush, "cursor_color_add", text="")
1097         else:
1098             col.prop(brush, "cursor_color_add", text="")
1099
1100         layout.separator()
1101
1102         col = layout.column(align=True)
1103         col.prop(brush, "use_custom_icon")
1104         if brush.use_custom_icon:
1105             col.prop(brush, "icon_filepath", text="")
1106
1107 # ********** default tools for weight-paint ****************
1108
1109
1110 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
1111     bl_context = "weightpaint"
1112     bl_label = "Weight Tools"
1113
1114     def draw(self, context):
1115         layout = self.layout
1116
1117         col = layout.column()
1118         col.operator("object.vertex_group_normalize_all", text="Normalize All")
1119         col.operator("object.vertex_group_normalize", text="Normalize")
1120         col.operator("object.vertex_group_mirror", text="Mirror")
1121         col.operator("object.vertex_group_invert", text="Invert")
1122         col.operator("object.vertex_group_clean", text="Clean")
1123         col.operator("object.vertex_group_levels", text="Levels")
1124         col.operator("object.vertex_group_blend", text="Blend")
1125         col.operator("object.vertex_group_transfer_weight", text="Transfer Weights")
1126         col.operator("object.vertex_group_limit_total", text="Limit Total")
1127         col.operator("object.vertex_group_fix", text="Fix Deforms")
1128         col.operator("paint.weight_gradient")
1129
1130
1131 class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
1132     bl_context = "weightpaint"
1133     bl_label = "Options"
1134
1135     def draw(self, context):
1136         layout = self.layout
1137
1138         tool_settings = context.tool_settings
1139         wpaint = tool_settings.weight_paint
1140
1141         col = layout.column()
1142
1143         col.prop(wpaint, "use_all_faces")
1144         col.prop(wpaint, "use_normal")
1145         col.prop(wpaint, "use_spray")
1146         col.prop(wpaint, "use_group_restrict")
1147
1148         obj = context.weight_paint_object
1149         if obj.type == 'MESH':
1150             mesh = obj.data
1151             col.prop(mesh, "use_mirror_x")
1152             row = col.row()
1153             row.active = mesh.use_mirror_x
1154             row.prop(mesh, "use_mirror_topology")
1155
1156         col.prop(wpaint, "input_samples")
1157
1158         col.label("Show Zero Weights:")
1159         sub = col.row()
1160         sub.active = (not tool_settings.use_multipaint)
1161         sub.prop(tool_settings, "vertex_group_user", expand=True)
1162
1163         self.unified_paint_settings(col, context)
1164
1165 # ********** default tools for vertex-paint ****************
1166
1167
1168 class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
1169     bl_context = "vertexpaint"
1170     bl_label = "Options"
1171
1172     def draw(self, context):
1173         layout = self.layout
1174
1175         toolsettings = context.tool_settings
1176         vpaint = toolsettings.vertex_paint
1177
1178         col = layout.column()
1179         #col.prop(vpaint, "mode", text="")
1180         col.prop(vpaint, "use_all_faces")
1181         col.prop(vpaint, "use_normal")
1182         col.prop(vpaint, "use_spray")
1183
1184         col.prop(vpaint, "input_samples")
1185
1186         self.unified_paint_settings(col, context)
1187
1188 # Commented out because the Apply button isn't an operator yet, making these settings useless
1189 #~         col.label(text="Gamma:")
1190 #~         col.prop(vpaint, "gamma", text="")
1191 #~         col.label(text="Multiply:")
1192 #~         col.prop(vpaint, "mul", text="")
1193
1194 # ********** default tools for texture-paint ****************
1195
1196
1197 class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
1198     bl_context = "imagepaint"
1199     bl_label = "Project Paint"
1200
1201     @classmethod
1202     def poll(cls, context):
1203         brush = context.tool_settings.image_paint.brush
1204         return (brush is not None)
1205
1206     def draw(self, context):
1207         layout = self.layout
1208
1209         ob = context.active_object
1210         mesh = ob.data
1211         toolsettings = context.tool_settings
1212         ipaint = toolsettings.image_paint
1213         settings = toolsettings.image_paint
1214
1215         layout.prop(ipaint, "input_samples")
1216
1217         col = layout.column()
1218         col.prop(ipaint, "use_occlude")
1219         col.prop(ipaint, "use_backface_culling")
1220
1221         row = layout.row()
1222         row.prop(ipaint, "use_normal_falloff")
1223
1224         sub = row.row()
1225         sub.active = (ipaint.use_normal_falloff)
1226         sub.prop(ipaint, "normal_angle", text="")
1227
1228         split = layout.split()
1229
1230         split.prop(ipaint, "use_stencil_layer", text="Stencil")
1231
1232         row = split.row()
1233         row.active = (ipaint.use_stencil_layer)
1234         stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
1235         row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text, translate=False)
1236         row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1237
1238         col = layout.column()
1239         col.active = (settings.brush.image_tool == 'CLONE')
1240         col.prop(ipaint, "use_clone_layer", text="Clone from UV map")
1241         clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else ""
1242         col.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text, translate=False)
1243
1244         layout.prop(ipaint, "seam_bleed")
1245
1246         col = layout.column()
1247         col.label(text="External Editing:")
1248
1249         row = col.split(align=True, percentage=0.55)
1250         row.operator("image.project_edit", text="Quick Edit")
1251         row.operator("image.project_apply", text="Apply")
1252
1253         col.row().prop(ipaint, "screen_grab_size", text="")
1254
1255         col.operator("paint.project_image", text="Apply Camera Image")
1256         col.operator("image.save_dirty", text="Save All Edited")
1257
1258
1259 class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
1260     bl_label = "Options"
1261     bl_options = {'DEFAULT_CLOSED'}
1262
1263     @classmethod
1264     def poll(cls, context):
1265         return (context.image_paint_object and context.tool_settings.image_paint)
1266
1267     def draw(self, context):
1268         layout = self.layout
1269
1270         col = layout.column()
1271         self.unified_paint_settings(col, context)
1272
1273
1274 class VIEW3D_MT_tools_projectpaint_clone(Menu):
1275     bl_label = "Clone Layer"
1276
1277     def draw(self, context):
1278         layout = self.layout
1279
1280         for i, tex in enumerate(context.active_object.data.uv_textures):
1281             props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
1282             props.data_path = "active_object.data.uv_texture_clone_index"
1283             props.value = i
1284
1285
1286 class VIEW3D_MT_tools_projectpaint_stencil(Menu):
1287     bl_label = "Mask Layer"
1288
1289     def draw(self, context):
1290         layout = self.layout
1291         for i, tex in enumerate(context.active_object.data.uv_textures):
1292             props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
1293             props.data_path = "active_object.data.uv_texture_stencil_index"
1294             props.value = i
1295
1296
1297 class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
1298     """Default tools for particle mode"""
1299     bl_context = "particlemode"
1300     bl_label = "Options"
1301
1302     def draw(self, context):
1303         layout = self.layout
1304
1305         pe = context.tool_settings.particle_edit
1306         ob = pe.object
1307
1308         layout.prop(pe, "type", text="")
1309
1310         ptcache = None
1311
1312         if pe.type == 'PARTICLES':
1313             if ob.particle_systems:
1314                 if len(ob.particle_systems) > 1:
1315                     layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
1316                                          ob.particle_systems, "active_index", rows=2, maxrows=3)
1317
1318                 ptcache = ob.particle_systems.active.point_cache
1319         else:
1320             for md in ob.modifiers:
1321                 if md.type == pe.type:
1322                     ptcache = md.point_cache
1323
1324         if ptcache and len(ptcache.point_caches) > 1:
1325             layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches",
1326                                  ptcache.point_caches, "active_index", rows=2, maxrows=3)
1327
1328         if not pe.is_editable:
1329             layout.label(text="Point cache must be baked")
1330             layout.label(text="in memory to enable editing!")
1331
1332         col = layout.column(align=True)
1333         if pe.is_hair:
1334             col.active = pe.is_editable
1335             col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1336             sub = col.row()
1337             sub.active = pe.use_emitter_deflect
1338             sub.prop(pe, "emitter_distance", text="Distance")
1339
1340         col = layout.column(align=True)
1341         col.active = pe.is_editable
1342         col.label(text="Keep:")
1343         col.prop(pe, "use_preserve_length", text="Lengths")
1344         col.prop(pe, "use_preserve_root", text="Root")
1345         if not pe.is_hair:
1346             col.label(text="Correct:")
1347             col.prop(pe, "use_auto_velocity", text="Velocity")
1348         col.prop(ob.data, "use_mirror_x")
1349
1350         col = layout.column(align=True)
1351         col.active = pe.is_editable
1352         col.label(text="Draw:")
1353         col.prop(pe, "draw_step", text="Path Steps")
1354         if pe.is_hair:
1355             col.prop(pe, "show_particles", text="Children")
1356         else:
1357             if pe.type == 'PARTICLES':
1358                 col.prop(pe, "show_particles", text="Particles")
1359             col.prop(pe, "use_fade_time")
1360             sub = col.row()
1361             sub.active = pe.use_fade_time
1362             sub.prop(pe, "fade_frames", slider=True)
1363
1364 if __name__ == "__main__":  # only for live edit.
1365     bpy.utils.register_module(__name__)