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="Shrink/Fatten").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 # Vertex Paint Mode #
680 elif context.vertex_paint_object and brush:
681 col = layout.column()
682 col.template_color_wheel(brush, "color", value_slider=True)
683 col.prop(brush, "color", text="")
685 row = col.row(align=True)
686 self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
687 self.prop_unified_size(row, context, brush, "use_pressure_size")
689 row = col.row(align=True)
690 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
691 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
694 #row = col.row(align=True)
695 #row.prop(brush, "jitter", slider=True)
696 #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
699 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
701 bl_options = {'DEFAULT_CLOSED'}
704 def poll(cls, context):
705 settings = cls.paint_settings(context)
706 return (settings and settings.brush and (context.sculpt_object or
707 context.image_paint_object))
709 def draw(self, context):
712 settings = self.paint_settings(context)
713 brush = settings.brush
714 tex_slot = brush.texture_slot
716 col = layout.column()
718 col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
719 if brush.use_paint_image:
720 col.prop(brush, "use_fixed_texture")
722 if context.sculpt_object:
723 sculpt_brush_texture_settings(col, brush)
725 # use_texture_overlay and texture_overlay_alpha
726 col = layout.column(align=True)
727 col.active = brush.sculpt_capabilities.has_overlay
728 col.label(text="Overlay:")
731 if brush.use_texture_overlay:
732 row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
734 row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
736 sub.prop(brush, "texture_overlay_alpha", text="Alpha")
739 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
741 bl_options = {'DEFAULT_CLOSED'}
744 def poll(cls, context):
745 settings = cls.paint_settings(context)
746 return (settings and settings.brush and (context.sculpt_object or
747 context.vertex_paint_object or
748 context.weight_paint_object or
749 context.image_paint_object))
751 def draw(self, context):
754 settings = self.paint_settings(context)
755 brush = settings.brush
756 image_paint = context.image_paint_object
758 col = layout.column()
760 if context.sculpt_object:
761 col.label(text="Stroke Method:")
762 col.prop(brush, "stroke_method", text="")
766 col.prop(brush, "use_edge_to_edge", "Edge To Edge")
768 if brush.use_airbrush:
770 col.prop(brush, "rate", text="Rate", slider=True)
775 row.active = brush.use_space
776 row.prop(brush, "spacing", text="Spacing")
778 if brush.sculpt_capabilities.has_smooth_stroke:
779 col = layout.column()
782 col.prop(brush, "use_smooth_stroke")
785 sub.active = brush.use_smooth_stroke
786 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
787 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
789 if brush.sculpt_capabilities.has_jitter:
792 row = col.row(align=True)
793 row.prop(brush, "jitter", slider=True)
794 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
797 col.prop(brush, "use_airbrush")
800 row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
801 row.prop(brush, "rate", slider=True)
806 col.prop(brush, "use_smooth_stroke")
808 col = layout.column()
809 col.active = brush.use_smooth_stroke
810 col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
811 col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
815 col = layout.column()
816 col.active = brush.sculpt_capabilities.has_spacing
817 col.prop(brush, "use_space")
820 row.active = brush.use_space
821 row.prop(brush, "spacing", text="Spacing")
824 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
826 bl_options = {'DEFAULT_CLOSED'}
829 def poll(cls, context):
830 settings = cls.paint_settings(context)
831 return (settings and settings.brush and settings.brush.curve)
833 def draw(self, context):
836 settings = self.paint_settings(context)
838 brush = settings.brush
840 layout.template_curve_mapping(brush, "curve", brush=True)
842 row = layout.row(align=True)
843 row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
844 row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
845 row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
846 row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
847 row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
848 row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
851 class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
853 bl_options = {'DEFAULT_CLOSED'}
856 def poll(cls, context):
857 return (context.sculpt_object and context.tool_settings.sculpt)
859 def draw(self, context):
862 toolsettings = context.tool_settings
863 sculpt = toolsettings.sculpt
865 layout.label(text="Lock:")
866 row = layout.row(align=True)
867 row.prop(sculpt, "lock_x", text="X", toggle=True)
868 row.prop(sculpt, "lock_y", text="Y", toggle=True)
869 row.prop(sculpt, "lock_z", text="Z", toggle=True)
871 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
872 layout.prop(sculpt, "show_low_resolution")
873 layout.prop(sculpt, "show_brush")
874 layout.prop(sculpt, "use_deform_only")
876 self.unified_paint_settings(layout, context)
879 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
880 bl_label = "Symmetry"
881 bl_options = {'DEFAULT_CLOSED'}
884 def poll(cls, context):
885 return (context.sculpt_object and context.tool_settings.sculpt)
887 def draw(self, context):
890 sculpt = context.tool_settings.sculpt
892 col = layout.column(align=True)
893 col.label(text="Mirror:")
895 row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
896 row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
897 row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
899 layout.column().prop(sculpt, "radial_symmetry", text="Radial")
900 layout.prop(sculpt, "use_symmetry_feather", text="Feather")
903 class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
904 bl_label = "Appearance"
905 bl_options = {'DEFAULT_CLOSED'}
908 def poll(cls, context):
909 toolsettings = context.tool_settings
910 return ((context.sculpt_object and toolsettings.sculpt) or
911 (context.vertex_paint_object and toolsettings.vertex_paint) or
912 (context.weight_paint_object and toolsettings.weight_paint) or
913 (context.image_paint_object and toolsettings.image_paint))
915 def draw(self, context):
918 settings = self.paint_settings(context)
919 brush = settings.brush
921 if brush is None: # unlikely but can happen
922 layout.label(text="Brush Unset")
925 col = layout.column()
927 if context.sculpt_object and context.tool_settings.sculpt:
928 if brush.sculpt_capabilities.has_secondary_color:
929 col.prop(brush, "cursor_color_add", text="Add Color")
930 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
932 col.prop(brush, "cursor_color_add", text="Color")
934 col.prop(brush, "cursor_color_add", text="Color")
936 col = layout.column(align=True)
937 col.prop(brush, "use_custom_icon")
938 if brush.use_custom_icon:
939 col.prop(brush, "icon_filepath", text="")
941 # ********** default tools for weight-paint ****************
944 class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
945 bl_context = "weightpaint"
946 bl_label = "Weight Tools"
948 def draw(self, context):
951 ob = context.active_object
953 col = layout.column()
954 col.active = ob.vertex_groups.active is not None
955 col.operator("object.vertex_group_transfer_weight", text="Transfer weight")
956 col.operator("object.vertex_group_normalize_all", text="Normalize All")
957 col.operator("object.vertex_group_normalize", text="Normalize")
958 col.operator("object.vertex_group_mirror", text="Mirror")
959 col.operator("object.vertex_group_invert", text="Invert")
960 col.operator("object.vertex_group_clean", text="Clean")
961 col.operator("object.vertex_group_levels", text="Levels")
962 col.operator("object.vertex_group_blend", text="Blend")
963 col.operator("object.vertex_group_fix", text="Fix Deforms")
966 class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
967 bl_context = "weightpaint"
970 def draw(self, context):
973 tool_settings = context.tool_settings
974 wpaint = tool_settings.weight_paint
976 col = layout.column()
978 col.prop(wpaint, "use_normal")
979 col.prop(wpaint, "use_spray")
980 col.prop(wpaint, "use_group_restrict")
982 obj = context.weight_paint_object
983 if obj.type == 'MESH':
985 col.prop(mesh, "use_mirror_x")
986 col.prop(mesh, "use_mirror_topology")
988 self.unified_paint_settings(col, context)
990 # Commented out because the Apply button isn't an operator yet, making these settings useless
991 #~ col.label(text="Gamma:")
992 #~ col.prop(wpaint, "gamma", text="")
993 #~ col.label(text="Multiply:")
994 #~ col.prop(wpaint, "mul", text="")
997 # Soft, Vertex-Group, X-Mirror and "Clear" Operator.
999 # ********** default tools for vertex-paint ****************
1002 class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
1003 bl_context = "vertexpaint"
1004 bl_label = "Options"
1006 def draw(self, context):
1007 layout = self.layout
1009 toolsettings = context.tool_settings
1010 vpaint = toolsettings.vertex_paint
1012 col = layout.column()
1013 #col.prop(vpaint, "mode", text="")
1014 col.prop(vpaint, "use_all_faces")
1015 col.prop(vpaint, "use_normal")
1016 col.prop(vpaint, "use_spray")
1018 self.unified_paint_settings(col, context)
1020 # Commented out because the Apply button isn't an operator yet, making these settings useless
1021 #~ col.label(text="Gamma:")
1022 #~ col.prop(vpaint, "gamma", text="")
1023 #~ col.label(text="Multiply:")
1024 #~ col.prop(vpaint, "mul", text="")
1026 # ********** default tools for texture-paint ****************
1029 class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
1030 bl_context = "imagepaint"
1031 bl_label = "Project Paint"
1034 def poll(cls, context):
1035 brush = context.tool_settings.image_paint.brush
1036 return (brush and brush.image_tool != 'SOFTEN')
1038 def draw_header(self, context):
1039 ipaint = context.tool_settings.image_paint
1041 self.layout.prop(ipaint, "use_projection", text="")
1043 def draw(self, context):
1044 layout = self.layout
1046 ob = context.active_object
1048 toolsettings = context.tool_settings
1049 ipaint = toolsettings.image_paint
1050 settings = toolsettings.image_paint
1051 use_projection = ipaint.use_projection
1053 col = layout.column()
1054 col.active = use_projection
1055 col.prop(ipaint, "use_occlude")
1056 col.prop(ipaint, "use_backface_culling")
1059 row.active = (use_projection)
1060 row.prop(ipaint, "use_normal_falloff")
1063 sub.active = (ipaint.use_normal_falloff)
1064 sub.prop(ipaint, "normal_angle", text="")
1066 split = layout.split()
1068 split.active = (use_projection)
1069 split.prop(ipaint, "use_stencil_layer", text="Stencil")
1072 row.active = (ipaint.use_stencil_layer)
1073 stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
1074 row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text)
1075 row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1078 row.active = (settings.brush.image_tool == 'CLONE')
1079 row.prop(ipaint, "use_clone_layer", text="Clone")
1080 clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else ""
1081 row.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text)
1083 layout.prop(ipaint, "seam_bleed")
1085 col = layout.column()
1086 col.label(text="External Editing:")
1088 row = col.split(align=True, percentage=0.55)
1089 row.operator("image.project_edit", text="Quick Edit")
1090 row.operator("image.project_apply", text="Apply")
1092 col.row().prop(ipaint, "screen_grab_size", text="")
1094 col.operator("paint.project_image", text="Apply Camera Image")
1095 col.operator("image.save_dirty", text="Save All Edited")
1098 class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
1099 bl_label = "Options"
1100 bl_options = {'DEFAULT_CLOSED'}
1103 def poll(cls, context):
1104 return (context.image_paint_object and context.tool_settings.image_paint)
1106 def draw(self, context):
1107 layout = self.layout
1109 col = layout.column()
1110 self.unified_paint_settings(col, context)
1113 class VIEW3D_MT_tools_projectpaint_clone(Menu):
1114 bl_label = "Clone Layer"
1116 def draw(self, context):
1117 layout = self.layout
1118 for i, tex in enumerate(context.active_object.data.uv_textures):
1119 props = layout.operator("wm.context_set_int", text=tex.name)
1120 props.data_path = "active_object.data.uv_texture_clone_index"
1124 class VIEW3D_MT_tools_projectpaint_stencil(Menu):
1125 bl_label = "Mask Layer"
1127 def draw(self, context):
1128 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_stencil_index"
1135 class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
1136 '''default tools for particle mode'''
1137 bl_context = "particlemode"
1138 bl_label = "Options"
1140 def draw(self, context):
1141 layout = self.layout
1143 pe = context.tool_settings.particle_edit
1146 layout.prop(pe, "type", text="")
1150 if pe.type == 'PARTICLES':
1151 if ob.particle_systems:
1152 if len(ob.particle_systems) > 1:
1153 layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2, maxrows=3)
1155 ptcache = ob.particle_systems.active.point_cache
1157 for md in ob.modifiers:
1158 if md.type == pe.type:
1159 ptcache = md.point_cache
1161 if ptcache and len(ptcache.point_caches) > 1:
1162 layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", rows=2, maxrows=3)
1164 if not pe.is_editable:
1165 layout.label(text="Point cache must be baked")
1166 layout.label(text="in memory to enable editing!")
1168 col = layout.column(align=True)
1170 col.active = pe.is_editable
1171 col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1173 sub.active = pe.use_emitter_deflect
1174 sub.prop(pe, "emitter_distance", text="Distance")
1176 col = layout.column(align=True)
1177 col.active = pe.is_editable
1178 col.label(text="Keep:")
1179 col.prop(pe, "use_preserve_length", text="Lengths")
1180 col.prop(pe, "use_preserve_root", text="Root")
1182 col.label(text="Correct:")
1183 col.prop(pe, "use_auto_velocity", text="Velocity")
1184 col.prop(ob.data, "use_mirror_x")
1186 col = layout.column(align=True)
1187 col.active = pe.is_editable
1188 col.label(text="Draw:")
1189 col.prop(pe, "draw_step", text="Path Steps")
1191 col.prop(pe, "show_particles", text="Children")
1193 if pe.type == 'PARTICLES':
1194 col.prop(pe, "show_particles", text="Particles")
1195 col.prop(pe, "use_fade_time")
1197 sub.active = pe.use_fade_time
1198 sub.prop(pe, "fade_frames", slider=True)
1200 if __name__ == "__main__": # only for live edit.
1201 bpy.utils.register_module(__name__)