1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17 # ##### END GPL LICENSE BLOCK #####
21 from bpy.types import Menu, Panel
22 from bl_ui.properties_paint_common import UnifiedPaintPanel
23 from bl_ui.properties_paint_common import sculpt_brush_texture_settings
27 bl_space_type = 'VIEW_3D'
28 bl_region_type = 'TOOLS'
31 # **************** standard tool clusters ******************
33 # History/Repeat tools
34 def draw_repeat_tools(context, layout):
35 col = layout.column(align=True)
36 col.label(text="Repeat:")
37 col.operator("screen.repeat_last")
38 col.operator("screen.repeat_history", text="History...")
42 def draw_keyframing_tools(context, layout):
43 col = layout.column(align=True)
44 col.label(text="Keyframes:")
46 row.operator("anim.keyframe_insert_menu", text="Insert")
47 row.operator("anim.keyframe_delete_v3d", text="Remove")
51 def draw_gpencil_tools(context, layout):
52 col = layout.column(align=True)
54 col.label(text="Grease Pencil:")
57 row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
58 row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
61 row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
62 row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
65 row.prop(context.tool_settings, "use_grease_pencil_sessions")
68 # ********** default tools for object-mode ****************
70 class VIEW3D_PT_tools_objectmode(View3DPanel, Panel):
71 bl_context = "objectmode"
72 bl_label = "Object Tools"
74 def draw(self, context):
77 col = layout.column(align=True)
78 col.label(text="Transform:")
79 col.operator("transform.translate")
80 col.operator("transform.rotate")
81 col.operator("transform.resize", text="Scale")
83 col = layout.column(align=True)
84 col.operator("object.origin_set", text="Origin")
86 col = layout.column(align=True)
87 col.label(text="Object:")
88 col.operator("object.duplicate_move")
89 col.operator("object.delete")
90 col.operator("object.join")
92 active_object = context.active_object
93 if active_object and active_object.type in {'MESH', 'CURVE', 'SURFACE'}:
95 col = layout.column(align=True)
96 col.label(text="Shading:")
97 row = col.row(align=True)
98 row.operator("object.shade_smooth", text="Smooth")
99 row.operator("object.shade_flat", text="Flat")
101 draw_keyframing_tools(context, layout)
103 col = layout.column(align=True)
104 col.label(text="Motion Paths:")
105 col.operator("object.paths_calculate", text="Calculate Paths")
106 col.operator("object.paths_clear", text="Clear Paths")
108 draw_repeat_tools(context, layout)
110 draw_gpencil_tools(context, layout)
112 # ********** default tools for editmode_mesh ****************
115 class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
116 bl_context = "mesh_edit"
117 bl_label = "Mesh Tools"
119 def draw(self, context):
122 col = layout.column(align=True)
123 col.label(text="Transform:")
124 col.operator("transform.translate")
125 col.operator("transform.rotate")
126 col.operator("transform.resize", text="Scale")
127 col.operator("transform.shrink_fatten", text="Shrink/Fatten")
128 col.operator("transform.push_pull", text="Push/Pull")
130 col = layout.column(align=True)
131 col.label(text="Deform:")
132 col.operator("transform.edge_slide")
133 col.operator("mesh.noise")
134 col.operator("mesh.vertices_smooth")
136 col = layout.column(align=True)
137 col.label(text="Add:")
138 col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
139 col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
140 col.operator("mesh.subdivide")
141 col.operator("mesh.loopcut_slide")
142 col.operator("mesh.duplicate_move", text="Duplicate")
143 col.operator("mesh.spin")
144 col.operator("mesh.screw")
146 row = col.row(align=True)
147 props = row.operator("mesh.knife_tool", text="Knife")
148 props.use_occlude_geometry = True
149 props.only_selected = False
150 props = row.operator("mesh.knife_tool", text="Select")
151 props.use_occlude_geometry = False
152 props.only_selected = True
154 col = layout.column(align=True)
155 col.label(text="Remove:")
156 col.menu("VIEW3D_MT_edit_mesh_delete")
157 col.operator("mesh.merge")
158 col.operator("mesh.remove_doubles")
160 col = layout.column(align=True)
161 col.label(text="Normals:")
162 col.operator("mesh.normals_make_consistent", text="Recalculate")
163 col.operator("mesh.flip_normals", text="Flip Direction")
165 col = layout.column(align=True)
166 col.label(text="UV Mapping:")
167 col.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
168 col.operator("mesh.mark_seam").clear = False
169 col.operator("mesh.mark_seam", text="Clear Seam").clear = True
171 col = layout.column(align=True)
172 col.label(text="Shading:")
173 row = col.row(align=True)
174 row.operator("mesh.faces_shade_smooth", text="Smooth")
175 row.operator("mesh.faces_shade_flat", text="Flat")
177 draw_repeat_tools(context, layout)
179 draw_gpencil_tools(context, layout)
182 class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
183 bl_context = "mesh_edit"
184 bl_label = "Mesh Options"
187 def poll(cls, context):
188 return context.active_object
190 def draw(self, context):
193 ob = context.active_object
195 tool_settings = context.tool_settings
198 col = layout.column(align=True)
199 col.active = tool_settings.proportional_edit == 'DISABLED'
200 col.prop(mesh, "use_mirror_x")
203 row.active = ob.data.use_mirror_x
204 row.prop(mesh, "use_mirror_topology")
206 col = layout.column(align=True)
207 col.label("Edge Select Mode:")
208 col.prop(tool_settings, "edge_path_mode", text="")
209 col.prop(tool_settings, "edge_path_live_unwrap")
210 col.label("Double Threshold:")
211 col.prop(tool_settings, "double_threshold", text="")
213 # ********** default tools for editmode_curve ****************
216 class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
217 bl_context = "curve_edit"
218 bl_label = "Curve Tools"
220 def draw(self, context):
223 col = layout.column(align=True)
224 col.label(text="Transform:")
225 col.operator("transform.translate")
226 col.operator("transform.rotate")
227 col.operator("transform.resize", text="Scale")
229 col = layout.column(align=True)
230 col.operator("transform.tilt", text="Tilt")
231 col.operator("transform.transform", text="Scale Feather").mode = 'CURVE_SHRINKFATTEN'
233 col = layout.column(align=True)
234 col.label(text="Curve:")
235 col.operator("curve.duplicate_move", text="Duplicate")
236 col.operator("curve.delete")
237 col.operator("curve.cyclic_toggle")
238 col.operator("curve.switch_direction")
239 col.operator("curve.spline_type_set")
241 col = layout.column(align=True)
242 col.label(text="Handles:")
244 row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
245 row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
247 row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
248 row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
250 col = layout.column(align=True)
251 col.label(text="Modeling:")
252 col.operator("curve.extrude_move", text="Extrude")
253 col.operator("curve.subdivide")
255 draw_repeat_tools(context, layout)
257 draw_gpencil_tools(context, layout)
259 # ********** default tools for editmode_surface ****************
262 class VIEW3D_PT_tools_surfaceedit(View3DPanel, Panel):
263 bl_context = "surface_edit"
264 bl_label = "Surface Tools"
266 def draw(self, context):
269 col = layout.column(align=True)
270 col.label(text="Transform:")
271 col.operator("transform.translate")
272 col.operator("transform.rotate")
273 col.operator("transform.resize", text="Scale")
275 col = layout.column(align=True)
276 col.label(text="Curve:")
277 col.operator("curve.duplicate_move", text="Duplicate")
278 col.operator("curve.delete")
279 col.operator("curve.cyclic_toggle")
280 col.operator("curve.switch_direction")
282 col = layout.column(align=True)
283 col.label(text="Modeling:")
284 col.operator("curve.extrude", text="Extrude")
285 col.operator("curve.subdivide")
287 draw_repeat_tools(context, layout)
289 draw_gpencil_tools(context, layout)
291 # ********** default tools for editmode_text ****************
294 class VIEW3D_PT_tools_textedit(View3DPanel, Panel):
295 bl_context = "text_edit"
296 bl_label = "Text Tools"
298 def draw(self, context):
301 col = layout.column(align=True)
302 col.label(text="Text Edit:")
303 col.operator("font.text_copy", text="Copy")
304 col.operator("font.text_cut", text="Cut")
305 col.operator("font.text_paste", text="Paste")
307 col = layout.column(align=True)
308 col.label(text="Set Case:")
309 col.operator("font.case_set", text="To Upper").case = 'UPPER'
310 col.operator("font.case_set", text="To Lower").case = 'LOWER'
312 col = layout.column(align=True)
313 col.label(text="Style:")
314 col.operator("font.style_toggle", text="Bold").style = 'BOLD'
315 col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
316 col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
318 draw_repeat_tools(context, layout)
321 # ********** default tools for editmode_armature ****************
324 class VIEW3D_PT_tools_armatureedit(View3DPanel, Panel):
325 bl_context = "armature_edit"
326 bl_label = "Armature Tools"
328 def draw(self, context):
331 col = layout.column(align=True)
332 col.label(text="Transform:")
333 col.operator("transform.translate")
334 col.operator("transform.rotate")
335 col.operator("transform.resize", text="Scale")
337 col = layout.column(align=True)
338 col.label(text="Bones:")
339 col.operator("armature.bone_primitive_add", text="Add")
340 col.operator("armature.duplicate_move", text="Duplicate")
341 col.operator("armature.delete", text="Delete")
343 col = layout.column(align=True)
344 col.label(text="Modeling:")
345 col.operator("armature.extrude_move")
346 col.operator("armature.subdivide", text="Subdivide")
348 draw_repeat_tools(context, layout)
350 draw_gpencil_tools(context, layout)
353 class VIEW3D_PT_tools_armatureedit_options(View3DPanel, Panel):
354 bl_context = "armature_edit"
355 bl_label = "Armature Options"
357 def draw(self, context):
358 arm = context.active_object.data
360 self.layout.prop(arm, "use_mirror_x")
362 # ********** default tools for editmode_mball ****************
365 class VIEW3D_PT_tools_mballedit(View3DPanel, Panel):
366 bl_context = "mball_edit"
367 bl_label = "Meta Tools"
369 def draw(self, context):
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")
378 draw_repeat_tools(context, layout)
380 draw_gpencil_tools(context, layout)
382 # ********** default tools for editmode_lattice ****************
385 class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel):
386 bl_context = "lattice_edit"
387 bl_label = "Lattice Tools"
389 def draw(self, context):
392 col = layout.column(align=True)
393 col.label(text="Transform:")
394 col.operator("transform.translate")
395 col.operator("transform.rotate")
396 col.operator("transform.resize", text="Scale")
398 col = layout.column(align=True)
399 col.operator("lattice.make_regular")
401 draw_repeat_tools(context, layout)
403 draw_gpencil_tools(context, layout)
406 # ********** default tools for pose-mode ****************
409 class VIEW3D_PT_tools_posemode(View3DPanel, Panel):
410 bl_context = "posemode"
411 bl_label = "Pose Tools"
413 def draw(self, context):
416 col = layout.column(align=True)
417 col.label(text="Transform:")
418 col.operator("transform.translate")
419 col.operator("transform.rotate")
420 col.operator("transform.resize", text="Scale")
422 col = layout.column(align=True)
423 col.label(text="In-Between:")
425 row.operator("pose.push", text="Push")
426 row.operator("pose.relax", text="Relax")
427 col.operator("pose.breakdown", text="Breakdowner")
429 col = layout.column(align=True)
430 col.label(text="Pose:")
432 row.operator("pose.copy", text="Copy")
433 row.operator("pose.paste", text="Paste")
435 col = layout.column(align=True)
436 col.operator("poselib.pose_add", text="Add To Library")
438 draw_keyframing_tools(context, layout)
440 col = layout.column(align=True)
441 col.label(text="Motion Paths:")
442 col.operator("pose.paths_calculate", text="Calculate Paths")
443 col.operator("pose.paths_clear", text="Clear Paths")
445 draw_repeat_tools(context, layout)
447 draw_gpencil_tools(context, layout)
450 class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
451 bl_context = "posemode"
452 bl_label = "Pose Options"
454 def draw(self, context):
455 arm = context.active_object.data
457 self.layout.prop(arm, "use_auto_ik")
459 # ********** default tools for paint modes ****************
462 class View3DPaintPanel(UnifiedPaintPanel):
463 bl_space_type = 'VIEW_3D'
464 bl_region_type = 'TOOLS'
467 class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
471 def poll(cls, context):
472 return cls.paint_settings(context)
474 def draw(self, context):
477 toolsettings = context.tool_settings
478 settings = self.paint_settings(context)
479 brush = settings.brush
481 if not context.particle_edit_object:
482 col = layout.split().column()
483 col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
486 if context.particle_edit_object:
489 layout.column().prop(settings, "tool", expand=True)
492 col = layout.column()
493 col.prop(brush, "size", slider=True)
495 col.prop(brush, "strength", slider=True)
498 col.prop(brush, "count")
499 col = layout.column()
500 col.prop(settings, "use_default_interpolate")
501 sub = col.column(align=True)
502 sub.active = settings.use_default_interpolate
503 sub.prop(brush, "steps", slider=True)
504 sub.prop(settings, "default_key_count", slider=True)
505 elif tool == 'LENGTH':
506 layout.prop(brush, "length_mode", expand=True)
508 layout.prop(brush, "puff_mode", expand=True)
509 layout.prop(brush, "use_puff_volume")
513 elif context.sculpt_object and brush:
514 capabilities = brush.sculpt_capabilities
516 col = layout.column()
520 row = col.row(align=True)
522 ups = toolsettings.unified_paint_settings
523 if ((ups.use_unified_size and ups.use_locked_size) or
524 ((not ups.use_unified_size) and brush.use_locked_size)):
525 self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
526 self.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
528 self.prop_unified_size(row, context, brush, "use_locked_size", icon='UNLOCKED')
529 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
531 self.prop_unified_size(row, context, brush, "use_pressure_size")
533 # strength, use_strength_pressure, and use_strength_attenuation
534 if capabilities.has_strength:
536 row = col.row(align=True)
538 if capabilities.has_space_attenuation:
539 if brush.use_space_attenuation:
540 row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='LOCKED')
542 row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='UNLOCKED')
544 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
545 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
547 # auto_smooth_factor and use_inverse_smooth_pressure
548 if capabilities.has_auto_smooth:
551 row = col.row(align=True)
552 row.prop(brush, "auto_smooth_factor", slider=True)
553 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
556 if capabilities.has_normal_weight:
558 row = col.row(align=True)
559 row.prop(brush, "normal_weight", slider=True)
561 # crease_pinch_factor
562 if capabilities.has_pinch_factor:
564 row = col.row(align=True)
565 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
567 # use_original_normal and sculpt_plane
568 if capabilities.has_sculpt_plane:
569 row = col.row(align=True)
572 if brush.use_original_normal:
573 row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED')
575 row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED')
577 row.prop(brush, "sculpt_plane", text="")
579 if brush.sculpt_tool == 'MASK':
580 col.prop(brush, "mask_tool", text="")
582 # plane_offset, use_offset_pressure, use_plane_trim, plane_trim
583 if capabilities.has_plane_offset:
584 row = col.row(align=True)
585 row.prop(brush, "plane_offset", slider=True)
586 row.prop(brush, "use_offset_pressure", text="")
591 row.prop(brush, "use_plane_trim", text="Trim")
593 row.active = brush.use_plane_trim
594 row.prop(brush, "plane_trim", slider=True, text="Distance")
597 if capabilities.has_height:
599 row.prop(brush, "height", slider=True, text="Height")
604 row.prop(brush, "use_frontface", text="Front Faces Only")
608 col.row().prop(brush, "direction", expand=True)
611 if capabilities.has_accumulate:
614 col.prop(brush, "use_accumulate")
616 # use_persistent, set_persistent_base
617 if capabilities.has_persistence:
620 ob = context.sculpt_object
623 # not supported yet for this case
624 for md in ob.modifiers:
625 if md.type == 'MULTIRES':
626 do_persistent = False
629 col.prop(brush, "use_persistent")
630 col.operator("sculpt.set_persistent_base")
632 # Texture Paint Mode #
634 elif context.image_paint_object and brush:
635 col = layout.column()
636 col.template_color_wheel(brush, "color", value_slider=True)
637 col.prop(brush, "color", text="")
639 row = col.row(align=True)
640 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
641 self.prop_unified_size(row, context, brush, "use_pressure_size")
643 row = col.row(align=True)
644 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
645 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
647 row = col.row(align=True)
648 row.prop(brush, "jitter", slider=True)
649 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
651 col.prop(brush, "blend", text="Blend")
653 col = layout.column()
654 col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
655 col.prop(brush, "use_alpha")
657 # Weight Paint Mode #
658 elif context.weight_paint_object and brush:
659 layout.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
660 layout.prop(toolsettings, "use_multipaint", text="Multi-Paint")
662 col = layout.column()
664 row = col.row(align=True)
665 self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
667 row = col.row(align=True)
668 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
669 self.prop_unified_size(row, context, brush, "use_pressure_size")
671 row = col.row(align=True)
672 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
673 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
675 row = col.row(align=True)
676 row.prop(brush, "jitter", slider=True)
677 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
679 col.prop(brush, "vertex_tool", text="Blend")
681 # Vertex Paint Mode #
682 elif context.vertex_paint_object and brush:
683 col = layout.column()
684 col.template_color_wheel(brush, "color", value_slider=True)
685 col.prop(brush, "color", text="")
687 row = col.row(align=True)
688 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
689 self.prop_unified_size(row, context, brush, "use_pressure_size")
691 row = col.row(align=True)
692 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
693 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
696 #row = col.row(align=True)
697 #row.prop(brush, "jitter", slider=True)
698 #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
700 col.prop(brush, "vertex_tool", text="Blend")
703 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
705 bl_options = {'DEFAULT_CLOSED'}
708 def poll(cls, context):
709 settings = cls.paint_settings(context)
710 return (settings and settings.brush and (context.sculpt_object or
711 context.image_paint_object))
713 def draw(self, context):
716 settings = self.paint_settings(context)
717 brush = settings.brush
718 tex_slot = brush.texture_slot
720 col = layout.column()
722 col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
723 if brush.use_paint_image:
724 col.prop(brush, "use_fixed_texture")
726 if context.sculpt_object:
727 sculpt_brush_texture_settings(col, brush)
729 # use_texture_overlay and texture_overlay_alpha
730 col = layout.column(align=True)
731 col.active = brush.sculpt_capabilities.has_overlay
732 col.label(text="Overlay:")
735 if brush.use_texture_overlay:
736 row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
738 row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
740 sub.prop(brush, "texture_overlay_alpha", text="Alpha")
743 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
745 bl_options = {'DEFAULT_CLOSED'}
748 def poll(cls, context):
749 settings = cls.paint_settings(context)
750 return (settings and settings.brush and (context.sculpt_object or
751 context.vertex_paint_object or
752 context.weight_paint_object or
753 context.image_paint_object))
755 def draw(self, context):
758 settings = self.paint_settings(context)
759 brush = settings.brush
760 image_paint = context.image_paint_object
762 col = layout.column()
764 if context.sculpt_object:
765 col.label(text="Stroke Method:")
766 col.prop(brush, "stroke_method", text="")
770 col.prop(brush, "use_edge_to_edge", "Edge To Edge")
772 if brush.use_airbrush:
774 col.prop(brush, "rate", text="Rate", slider=True)
779 row.active = brush.use_space
780 row.prop(brush, "spacing", text="Spacing")
782 if brush.sculpt_capabilities.has_smooth_stroke:
783 col = layout.column()
786 col.prop(brush, "use_smooth_stroke")
789 sub.active = brush.use_smooth_stroke
790 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
791 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
793 if brush.sculpt_capabilities.has_jitter:
796 row = col.row(align=True)
797 row.prop(brush, "jitter", slider=True)
798 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
801 col.prop(brush, "use_airbrush")
804 row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
805 row.prop(brush, "rate", slider=True)
810 col.prop(brush, "use_smooth_stroke")
812 col = layout.column()
813 col.active = brush.use_smooth_stroke
814 col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
815 col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
819 col = layout.column()
820 col.active = brush.sculpt_capabilities.has_spacing
821 col.prop(brush, "use_space")
824 row.active = brush.use_space
825 row.prop(brush, "spacing", text="Spacing")
828 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
830 bl_options = {'DEFAULT_CLOSED'}
833 def poll(cls, context):
834 settings = cls.paint_settings(context)
835 return (settings and settings.brush and settings.brush.curve)
837 def draw(self, context):
840 settings = self.paint_settings(context)
842 brush = settings.brush
844 layout.template_curve_mapping(brush, "curve", brush=True)
846 row = layout.row(align=True)
847 row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
848 row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
849 row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
850 row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
851 row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
852 row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
855 class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
857 bl_options = {'DEFAULT_CLOSED'}
860 def poll(cls, context):
861 return (context.sculpt_object and context.tool_settings.sculpt)
863 def draw(self, context):
866 toolsettings = context.tool_settings
867 sculpt = toolsettings.sculpt
869 layout.label(text="Lock:")
870 row = layout.row(align=True)
871 row.prop(sculpt, "lock_x", text="X", toggle=True)
872 row.prop(sculpt, "lock_y", text="Y", toggle=True)
873 row.prop(sculpt, "lock_z", text="Z", toggle=True)
875 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
876 layout.prop(sculpt, "show_low_resolution")
877 layout.prop(sculpt, "show_brush")
878 layout.prop(sculpt, "use_deform_only")
880 layout.prop(sculpt, "input_samples")
882 self.unified_paint_settings(layout, context)
885 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
886 bl_label = "Symmetry"
887 bl_options = {'DEFAULT_CLOSED'}
890 def poll(cls, context):
891 return (context.sculpt_object and context.tool_settings.sculpt)
893 def draw(self, context):
896 sculpt = context.tool_settings.sculpt
898 col = layout.column(align=True)
899 col.label(text="Mirror:")
901 row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
902 row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
903 row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
905 layout.column().prop(sculpt, "radial_symmetry", text="Radial")
906 layout.prop(sculpt, "use_symmetry_feather", text="Feather")
909 class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
910 bl_label = "Appearance"
911 bl_options = {'DEFAULT_CLOSED'}
914 def poll(cls, context):
915 toolsettings = context.tool_settings
916 return ((context.sculpt_object and toolsettings.sculpt) or
917 (context.vertex_paint_object and toolsettings.vertex_paint) or
918 (context.weight_paint_object and toolsettings.weight_paint) or
919 (context.image_paint_object and toolsettings.image_paint))
921 def draw(self, context):
924 settings = self.paint_settings(context)
925 brush = settings.brush
927 if brush is None: # unlikely but can happen
928 layout.label(text="Brush Unset")
931 col = layout.column()
933 if context.sculpt_object and context.tool_settings.sculpt:
934 if brush.sculpt_capabilities.has_secondary_color:
935 col.prop(brush, "cursor_color_add", text="Add Color")
936 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
938 col.prop(brush, "cursor_color_add", text="Color")
940 col.prop(brush, "cursor_color_add", text="Color")
942 col = layout.column(align=True)
943 col.prop(brush, "use_custom_icon")
944 if brush.use_custom_icon:
945 col.prop(brush, "icon_filepath", text="")
947 # ********** default tools for weight-paint ****************
950 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
951 bl_context = "weightpaint"
952 bl_label = "Weight Tools"
954 def draw(self, context):
957 ob = context.active_object
959 col = layout.column()
960 col.active = ob.vertex_groups.active is not None
961 col.operator("object.vertex_group_normalize_all", text="Normalize All")
962 col.operator("object.vertex_group_normalize", text="Normalize")
963 col.operator("object.vertex_group_mirror", text="Mirror")
964 col.operator("object.vertex_group_invert", text="Invert")
965 col.operator("object.vertex_group_clean", text="Clean")
966 col.operator("object.vertex_group_levels", text="Levels")
967 col.operator("object.vertex_group_blend", text="Blend")
968 col.operator("object.vertex_group_fix", text="Fix Deforms")
971 class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
972 bl_context = "weightpaint"
975 def draw(self, context):
978 tool_settings = context.tool_settings
979 wpaint = tool_settings.weight_paint
981 col = layout.column()
983 col.prop(wpaint, "use_all_faces")
984 col.prop(wpaint, "use_normal")
985 col.prop(wpaint, "use_spray")
986 col.prop(wpaint, "use_group_restrict")
988 obj = context.weight_paint_object
989 if obj.type == 'MESH':
991 col.prop(mesh, "use_mirror_x")
992 col.prop(mesh, "use_mirror_topology")
994 col.prop(wpaint, "input_samples")
996 self.unified_paint_settings(col, context)
998 # Commented out because the Apply button isn't an operator yet, making these settings useless
999 #~ col.label(text="Gamma:")
1000 #~ col.prop(wpaint, "gamma", text="")
1001 #~ col.label(text="Multiply:")
1002 #~ col.prop(wpaint, "mul", text="")
1005 # Soft, Vertex-Group, X-Mirror and "Clear" Operator.
1007 # ********** default tools for vertex-paint ****************
1010 class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
1011 bl_context = "vertexpaint"
1012 bl_label = "Options"
1014 def draw(self, context):
1015 layout = self.layout
1017 toolsettings = context.tool_settings
1018 vpaint = toolsettings.vertex_paint
1020 col = layout.column()
1021 #col.prop(vpaint, "mode", text="")
1022 col.prop(vpaint, "use_all_faces")
1023 col.prop(vpaint, "use_normal")
1024 col.prop(vpaint, "use_spray")
1026 col.prop(vpaint, "input_samples")
1028 self.unified_paint_settings(col, context)
1030 # Commented out because the Apply button isn't an operator yet, making these settings useless
1031 #~ col.label(text="Gamma:")
1032 #~ col.prop(vpaint, "gamma", text="")
1033 #~ col.label(text="Multiply:")
1034 #~ col.prop(vpaint, "mul", text="")
1036 # ********** default tools for texture-paint ****************
1039 class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
1040 bl_context = "imagepaint"
1041 bl_label = "Project Paint"
1044 def poll(cls, context):
1045 brush = context.tool_settings.image_paint.brush
1046 return (brush and brush.image_tool != 'SOFTEN')
1048 def draw_header(self, context):
1049 ipaint = context.tool_settings.image_paint
1051 self.layout.prop(ipaint, "use_projection", text="")
1053 def draw(self, context):
1054 layout = self.layout
1056 ob = context.active_object
1058 toolsettings = context.tool_settings
1059 ipaint = toolsettings.image_paint
1060 settings = toolsettings.image_paint
1061 use_projection = ipaint.use_projection
1063 col = layout.column()
1064 col.active = use_projection
1065 col.prop(ipaint, "use_occlude")
1066 col.prop(ipaint, "use_backface_culling")
1069 row.active = (use_projection)
1070 row.prop(ipaint, "use_normal_falloff")
1073 sub.active = (ipaint.use_normal_falloff)
1074 sub.prop(ipaint, "normal_angle", text="")
1076 split = layout.split()
1078 split.active = (use_projection)
1079 split.prop(ipaint, "use_stencil_layer", text="Stencil")
1082 row.active = (ipaint.use_stencil_layer)
1083 stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
1084 row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text)
1085 row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1088 row.active = (settings.brush.image_tool == 'CLONE')
1089 row.prop(ipaint, "use_clone_layer", text="Clone")
1090 clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else ""
1091 row.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text)
1093 layout.prop(ipaint, "seam_bleed")
1095 col = layout.column()
1096 col.label(text="External Editing:")
1098 row = col.split(align=True, percentage=0.55)
1099 row.operator("image.project_edit", text="Quick Edit")
1100 row.operator("image.project_apply", text="Apply")
1102 col.row().prop(ipaint, "screen_grab_size", text="")
1104 col.operator("paint.project_image", text="Apply Camera Image")
1105 col.operator("image.save_dirty", text="Save All Edited")
1108 class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
1109 bl_label = "Options"
1110 bl_options = {'DEFAULT_CLOSED'}
1113 def poll(cls, context):
1114 return (context.image_paint_object and context.tool_settings.image_paint)
1116 def draw(self, context):
1117 layout = self.layout
1119 col = layout.column()
1120 self.unified_paint_settings(col, context)
1123 class VIEW3D_MT_tools_projectpaint_clone(Menu):
1124 bl_label = "Clone Layer"
1126 def draw(self, context):
1127 layout = self.layout
1129 for i, tex in enumerate(context.active_object.data.uv_textures):
1130 props = layout.operator("wm.context_set_int", text=tex.name)
1131 props.data_path = "active_object.data.uv_texture_clone_index"
1135 class VIEW3D_MT_tools_projectpaint_stencil(Menu):
1136 bl_label = "Mask Layer"
1138 def draw(self, context):
1139 layout = self.layout
1140 for i, tex in enumerate(context.active_object.data.uv_textures):
1141 props = layout.operator("wm.context_set_int", text=tex.name)
1142 props.data_path = "active_object.data.uv_texture_stencil_index"
1146 class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
1147 """default tools for particle mode"""
1148 bl_context = "particlemode"
1149 bl_label = "Options"
1151 def draw(self, context):
1152 layout = self.layout
1154 pe = context.tool_settings.particle_edit
1157 layout.prop(pe, "type", text="")
1161 if pe.type == 'PARTICLES':
1162 if ob.particle_systems:
1163 if len(ob.particle_systems) > 1:
1164 layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2, maxrows=3)
1166 ptcache = ob.particle_systems.active.point_cache
1168 for md in ob.modifiers:
1169 if md.type == pe.type:
1170 ptcache = md.point_cache
1172 if ptcache and len(ptcache.point_caches) > 1:
1173 layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", rows=2, maxrows=3)
1175 if not pe.is_editable:
1176 layout.label(text="Point cache must be baked")
1177 layout.label(text="in memory to enable editing!")
1179 col = layout.column(align=True)
1181 col.active = pe.is_editable
1182 col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1184 sub.active = pe.use_emitter_deflect
1185 sub.prop(pe, "emitter_distance", text="Distance")
1187 col = layout.column(align=True)
1188 col.active = pe.is_editable
1189 col.label(text="Keep:")
1190 col.prop(pe, "use_preserve_length", text="Lengths")
1191 col.prop(pe, "use_preserve_root", text="Root")
1193 col.label(text="Correct:")
1194 col.prop(pe, "use_auto_velocity", text="Velocity")
1195 col.prop(ob.data, "use_mirror_x")
1197 col = layout.column(align=True)
1198 col.active = pe.is_editable
1199 col.label(text="Draw:")
1200 col.prop(pe, "draw_step", text="Path Steps")
1202 col.prop(pe, "show_particles", text="Children")
1204 if pe.type == 'PARTICLES':
1205 col.prop(pe, "show_particles", text="Particles")
1206 col.prop(pe, "use_fade_time")
1208 sub.active = pe.use_fade_time
1209 sub.prop(pe, "fade_frames", slider=True)
1211 if __name__ == "__main__": # only for live edit.
1212 bpy.utils.register_module(__name__)