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
711 (context.sculpt_object or 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)
752 (context.sculpt_object or
753 context.vertex_paint_object or
754 context.weight_paint_object or
755 context.image_paint_object))
757 def draw(self, context):
760 settings = self.paint_settings(context)
761 brush = settings.brush
762 image_paint = context.image_paint_object
764 col = layout.column()
766 if context.sculpt_object:
767 col.label(text="Stroke Method:")
768 col.prop(brush, "stroke_method", text="")
772 col.prop(brush, "use_edge_to_edge", "Edge To Edge")
774 if brush.use_airbrush:
776 col.prop(brush, "rate", text="Rate", slider=True)
781 row.active = brush.use_space
782 row.prop(brush, "spacing", text="Spacing")
784 if brush.sculpt_capabilities.has_smooth_stroke:
785 col = layout.column()
788 col.prop(brush, "use_smooth_stroke")
791 sub.active = brush.use_smooth_stroke
792 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
793 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
795 if brush.sculpt_capabilities.has_jitter:
798 row = col.row(align=True)
799 row.prop(brush, "jitter", slider=True)
800 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
803 col.prop(brush, "use_airbrush")
806 row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
807 row.prop(brush, "rate", slider=True)
812 col.prop(brush, "use_smooth_stroke")
814 col = layout.column()
815 col.active = brush.use_smooth_stroke
816 col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
817 col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
821 col = layout.column()
822 col.active = brush.sculpt_capabilities.has_spacing
823 col.prop(brush, "use_space")
826 row.active = brush.use_space
827 row.prop(brush, "spacing", text="Spacing")
830 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
832 bl_options = {'DEFAULT_CLOSED'}
835 def poll(cls, context):
836 settings = cls.paint_settings(context)
837 return (settings and settings.brush and settings.brush.curve)
839 def draw(self, context):
842 settings = self.paint_settings(context)
844 brush = settings.brush
846 layout.template_curve_mapping(brush, "curve", brush=True)
848 row = layout.row(align=True)
849 row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
850 row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
851 row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
852 row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
853 row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
854 row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
857 class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
859 bl_options = {'DEFAULT_CLOSED'}
862 def poll(cls, context):
863 return (context.sculpt_object and context.tool_settings.sculpt)
865 def draw(self, context):
868 toolsettings = context.tool_settings
869 sculpt = toolsettings.sculpt
871 layout.label(text="Lock:")
872 row = layout.row(align=True)
873 row.prop(sculpt, "lock_x", text="X", toggle=True)
874 row.prop(sculpt, "lock_y", text="Y", toggle=True)
875 row.prop(sculpt, "lock_z", text="Z", toggle=True)
877 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
878 layout.prop(sculpt, "show_low_resolution")
879 layout.prop(sculpt, "show_brush")
880 layout.prop(sculpt, "use_deform_only")
882 layout.prop(sculpt, "input_samples")
884 self.unified_paint_settings(layout, context)
887 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
888 bl_label = "Symmetry"
889 bl_options = {'DEFAULT_CLOSED'}
892 def poll(cls, context):
893 return (context.sculpt_object and context.tool_settings.sculpt)
895 def draw(self, context):
898 sculpt = context.tool_settings.sculpt
900 col = layout.column(align=True)
901 col.label(text="Mirror:")
903 row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
904 row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
905 row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
907 layout.column().prop(sculpt, "radial_symmetry", text="Radial")
908 layout.prop(sculpt, "use_symmetry_feather", text="Feather")
911 class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
912 bl_label = "Appearance"
913 bl_options = {'DEFAULT_CLOSED'}
916 def poll(cls, context):
917 toolsettings = context.tool_settings
918 return ((context.sculpt_object and toolsettings.sculpt) or
919 (context.vertex_paint_object and toolsettings.vertex_paint) or
920 (context.weight_paint_object and toolsettings.weight_paint) or
921 (context.image_paint_object and toolsettings.image_paint))
923 def draw(self, context):
926 settings = self.paint_settings(context)
927 brush = settings.brush
929 if brush is None: # unlikely but can happen
930 layout.label(text="Brush Unset")
933 col = layout.column()
935 if context.sculpt_object and context.tool_settings.sculpt:
936 if brush.sculpt_capabilities.has_secondary_color:
937 col.prop(brush, "cursor_color_add", text="Add Color")
938 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
940 col.prop(brush, "cursor_color_add", text="Color")
942 col.prop(brush, "cursor_color_add", text="Color")
944 col = layout.column(align=True)
945 col.prop(brush, "use_custom_icon")
946 if brush.use_custom_icon:
947 col.prop(brush, "icon_filepath", text="")
949 # ********** default tools for weight-paint ****************
952 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
953 bl_context = "weightpaint"
954 bl_label = "Weight Tools"
956 def draw(self, context):
959 ob = context.active_object
961 col = layout.column()
962 col.active = ob.vertex_groups.active is not None
963 col.operator("object.vertex_group_normalize_all", text="Normalize All")
964 col.operator("object.vertex_group_normalize", text="Normalize")
965 col.operator("object.vertex_group_mirror", text="Mirror")
966 col.operator("object.vertex_group_invert", text="Invert")
967 col.operator("object.vertex_group_clean", text="Clean")
968 col.operator("object.vertex_group_levels", text="Levels")
969 col.operator("object.vertex_group_blend", text="Blend")
970 col.operator("object.vertex_group_fix", text="Fix Deforms")
973 class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
974 bl_context = "weightpaint"
977 def draw(self, context):
980 tool_settings = context.tool_settings
981 wpaint = tool_settings.weight_paint
983 col = layout.column()
985 col.prop(wpaint, "use_all_faces")
986 col.prop(wpaint, "use_normal")
987 col.prop(wpaint, "use_spray")
988 col.prop(wpaint, "use_group_restrict")
990 obj = context.weight_paint_object
991 if obj.type == 'MESH':
993 col.prop(mesh, "use_mirror_x")
994 col.prop(mesh, "use_mirror_topology")
996 col.prop(wpaint, "input_samples")
998 self.unified_paint_settings(col, context)
1000 # Commented out because the Apply button isn't an operator yet, making these settings useless
1001 #~ col.label(text="Gamma:")
1002 #~ col.prop(wpaint, "gamma", text="")
1003 #~ col.label(text="Multiply:")
1004 #~ col.prop(wpaint, "mul", text="")
1007 # Soft, Vertex-Group, X-Mirror and "Clear" Operator.
1009 # ********** default tools for vertex-paint ****************
1012 class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
1013 bl_context = "vertexpaint"
1014 bl_label = "Options"
1016 def draw(self, context):
1017 layout = self.layout
1019 toolsettings = context.tool_settings
1020 vpaint = toolsettings.vertex_paint
1022 col = layout.column()
1023 #col.prop(vpaint, "mode", text="")
1024 col.prop(vpaint, "use_all_faces")
1025 col.prop(vpaint, "use_normal")
1026 col.prop(vpaint, "use_spray")
1028 col.prop(vpaint, "input_samples")
1030 self.unified_paint_settings(col, context)
1032 # Commented out because the Apply button isn't an operator yet, making these settings useless
1033 #~ col.label(text="Gamma:")
1034 #~ col.prop(vpaint, "gamma", text="")
1035 #~ col.label(text="Multiply:")
1036 #~ col.prop(vpaint, "mul", text="")
1038 # ********** default tools for texture-paint ****************
1041 class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
1042 bl_context = "imagepaint"
1043 bl_label = "Project Paint"
1046 def poll(cls, context):
1047 brush = context.tool_settings.image_paint.brush
1048 return (brush and brush.image_tool != 'SOFTEN')
1050 def draw_header(self, context):
1051 ipaint = context.tool_settings.image_paint
1053 self.layout.prop(ipaint, "use_projection", text="")
1055 def draw(self, context):
1056 layout = self.layout
1058 ob = context.active_object
1060 toolsettings = context.tool_settings
1061 ipaint = toolsettings.image_paint
1062 settings = toolsettings.image_paint
1063 use_projection = ipaint.use_projection
1065 col = layout.column()
1066 col.active = use_projection
1067 col.prop(ipaint, "use_occlude")
1068 col.prop(ipaint, "use_backface_culling")
1071 row.active = (use_projection)
1072 row.prop(ipaint, "use_normal_falloff")
1075 sub.active = (ipaint.use_normal_falloff)
1076 sub.prop(ipaint, "normal_angle", text="")
1078 split = layout.split()
1080 split.active = (use_projection)
1081 split.prop(ipaint, "use_stencil_layer", text="Stencil")
1084 row.active = (ipaint.use_stencil_layer)
1085 stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
1086 row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text)
1087 row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1090 row.active = (settings.brush.image_tool == 'CLONE')
1091 row.prop(ipaint, "use_clone_layer", text="Clone")
1092 clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else ""
1093 row.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text)
1095 layout.prop(ipaint, "seam_bleed")
1097 col = layout.column()
1098 col.label(text="External Editing:")
1100 row = col.split(align=True, percentage=0.55)
1101 row.operator("image.project_edit", text="Quick Edit")
1102 row.operator("image.project_apply", text="Apply")
1104 col.row().prop(ipaint, "screen_grab_size", text="")
1106 col.operator("paint.project_image", text="Apply Camera Image")
1107 col.operator("image.save_dirty", text="Save All Edited")
1110 class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
1111 bl_label = "Options"
1112 bl_options = {'DEFAULT_CLOSED'}
1115 def poll(cls, context):
1116 return (context.image_paint_object and context.tool_settings.image_paint)
1118 def draw(self, context):
1119 layout = self.layout
1121 col = layout.column()
1122 self.unified_paint_settings(col, context)
1125 class VIEW3D_MT_tools_projectpaint_clone(Menu):
1126 bl_label = "Clone Layer"
1128 def draw(self, context):
1129 layout = self.layout
1131 for i, tex in enumerate(context.active_object.data.uv_textures):
1132 props = layout.operator("wm.context_set_int", text=tex.name)
1133 props.data_path = "active_object.data.uv_texture_clone_index"
1137 class VIEW3D_MT_tools_projectpaint_stencil(Menu):
1138 bl_label = "Mask Layer"
1140 def draw(self, context):
1141 layout = self.layout
1142 for i, tex in enumerate(context.active_object.data.uv_textures):
1143 props = layout.operator("wm.context_set_int", text=tex.name)
1144 props.data_path = "active_object.data.uv_texture_stencil_index"
1148 class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
1149 """default tools for particle mode"""
1150 bl_context = "particlemode"
1151 bl_label = "Options"
1153 def draw(self, context):
1154 layout = self.layout
1156 pe = context.tool_settings.particle_edit
1159 layout.prop(pe, "type", text="")
1163 if pe.type == 'PARTICLES':
1164 if ob.particle_systems:
1165 if len(ob.particle_systems) > 1:
1166 layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2, maxrows=3)
1168 ptcache = ob.particle_systems.active.point_cache
1170 for md in ob.modifiers:
1171 if md.type == pe.type:
1172 ptcache = md.point_cache
1174 if ptcache and len(ptcache.point_caches) > 1:
1175 layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", rows=2, maxrows=3)
1177 if not pe.is_editable:
1178 layout.label(text="Point cache must be baked")
1179 layout.label(text="in memory to enable editing!")
1181 col = layout.column(align=True)
1183 col.active = pe.is_editable
1184 col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1186 sub.active = pe.use_emitter_deflect
1187 sub.prop(pe, "emitter_distance", text="Distance")
1189 col = layout.column(align=True)
1190 col.active = pe.is_editable
1191 col.label(text="Keep:")
1192 col.prop(pe, "use_preserve_length", text="Lengths")
1193 col.prop(pe, "use_preserve_root", text="Root")
1195 col.label(text="Correct:")
1196 col.prop(pe, "use_auto_velocity", text="Velocity")
1197 col.prop(ob.data, "use_mirror_x")
1199 col = layout.column(align=True)
1200 col.active = pe.is_editable
1201 col.label(text="Draw:")
1202 col.prop(pe, "draw_step", text="Path Steps")
1204 col.prop(pe, "show_particles", text="Children")
1206 if pe.type == 'PARTICLES':
1207 col.prop(pe, "show_particles", text="Particles")
1208 col.prop(pe, "use_fade_time")
1210 sub.active = pe.use_fade_time
1211 sub.prop(pe, "fade_frames", slider=True)
1213 if __name__ == "__main__": # only for live edit.
1214 bpy.utils.register_module(__name__)