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 #####
24 bl_space_type = 'VIEW_3D'
25 bl_region_type = 'TOOLS'
28 # **************** standard tool clusters ******************
30 # History/Repeat tools
31 def draw_repeat_tools(context, layout):
32 col = layout.column(align=True)
33 col.label(text="Repeat:")
34 col.operator("screen.repeat_last")
35 col.operator("screen.repeat_history", text="History...")
39 def draw_keyframing_tools(context, layout):
40 col = layout.column(align=True)
41 col.label(text="Keyframes:")
43 row.operator("anim.keyframe_insert_menu", text="Insert")
44 row.operator("anim.keyframe_delete_v3d", text="Remove")
48 def draw_gpencil_tools(context, layout):
49 col = layout.column(align=True)
51 col.label(text="Grease Pencil:")
54 row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
55 row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
56 row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
59 row.prop(context.tool_settings, "use_grease_pencil_sessions")
61 # ********** default tools for objectmode ****************
64 class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
65 bl_context = "objectmode"
66 bl_label = "Object Tools"
68 def draw(self, context):
71 col = layout.column(align=True)
72 col.label(text="Transform:")
73 col.operator("transform.translate")
74 col.operator("transform.rotate")
75 col.operator("transform.resize", text="Scale")
77 col = layout.column(align=True)
78 col.operator("object.origin_set", text="Origin")
80 col = layout.column(align=True)
81 col.label(text="Object:")
82 col.operator("object.duplicate_move")
83 col.operator("object.delete")
84 col.operator("object.join")
86 active_object = context.active_object
87 if active_object and active_object.type == 'MESH':
89 col = layout.column(align=True)
90 col.label(text="Shading:")
91 col.operator("object.shade_smooth", text="Smooth")
92 col.operator("object.shade_flat", text="Flat")
94 draw_keyframing_tools(context, layout)
96 col = layout.column(align=True)
97 col.label(text="Motion Paths:")
98 col.operator("object.paths_calculate", text="Calculate Paths")
99 col.operator("object.paths_clear", text="Clear Paths")
101 draw_repeat_tools(context, layout)
103 draw_gpencil_tools(context, layout)
105 # ********** default tools for editmode_mesh ****************
108 class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
109 bl_context = "mesh_edit"
110 bl_label = "Mesh Tools"
112 def draw(self, context):
115 col = layout.column(align=True)
116 col.label(text="Transform:")
117 col.operator("transform.translate")
118 col.operator("transform.rotate")
119 col.operator("transform.resize", text="Scale")
120 col.operator("transform.shrink_fatten", text="Along Normal")
122 col = layout.column(align=True)
123 col.label(text="Deform:")
124 col.operator("transform.edge_slide")
125 col.operator("mesh.noise")
126 col.operator("mesh.vertices_smooth")
128 col = layout.column(align=True)
129 col.label(text="Add:")
130 col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
131 col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
132 col.operator("mesh.subdivide")
133 col.operator("mesh.loopcut_slide")
134 col.operator("mesh.duplicate_move", text="Duplicate")
135 col.operator("mesh.spin")
136 col.operator("mesh.screw")
138 col = layout.column(align=True)
139 col.label(text="Remove:")
140 col.operator("mesh.delete")
141 col.operator("mesh.merge")
142 col.operator("mesh.remove_doubles")
144 col = layout.column(align=True)
145 col.label(text="Normals:")
146 col.operator("mesh.normals_make_consistent", text="Recalculate")
147 col.operator("mesh.flip_normals", text="Flip Direction")
149 col = layout.column(align=True)
150 col.label(text="UV Mapping:")
151 col.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
152 col.operator("mesh.mark_seam")
153 col.operator("mesh.mark_seam", text="Clear Seam").clear = True
155 col = layout.column(align=True)
156 col.label(text="Shading:")
157 col.operator("mesh.faces_shade_smooth", text="Smooth")
158 col.operator("mesh.faces_shade_flat", text="Flat")
160 draw_repeat_tools(context, layout)
162 draw_gpencil_tools(context, layout)
165 class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel):
166 bl_context = "mesh_edit"
167 bl_label = "Mesh Options"
169 def draw(self, context):
172 ob = context.active_object
176 col = layout.column(align=True)
177 col.prop(mesh, "use_mirror_x")
179 sub.active = ob.data.use_mirror_x
180 sub.prop(mesh, "use_mirror_topology")
182 ts = context.tool_settings
184 col.label("Edge Select Mode")
185 col.prop(ts, "edge_path_mode", text="")
186 col.prop(context.tool_settings, "edge_path_live_unwrap")
188 # ********** default tools for editmode_curve ****************
191 class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel):
192 bl_context = "curve_edit"
193 bl_label = "Curve Tools"
195 def draw(self, context):
198 col = layout.column(align=True)
199 col.label(text="Transform:")
200 col.operator("transform.translate")
201 col.operator("transform.rotate")
202 col.operator("transform.resize", text="Scale")
204 col = layout.column(align=True)
205 col.operator("transform.transform", text="Tilt").mode = 'TILT'
206 col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
208 col = layout.column(align=True)
209 col.label(text="Curve:")
210 col.operator("curve.duplicate")
211 col.operator("curve.delete")
212 col.operator("curve.cyclic_toggle")
213 col.operator("curve.switch_direction")
214 col.operator("curve.spline_type_set")
216 col = layout.column(align=True)
217 col.label(text="Handles:")
219 row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
220 row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
222 row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
223 row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
225 col = layout.column(align=True)
226 col.label(text="Modeling:")
227 col.operator("curve.extrude")
228 col.operator("curve.subdivide")
230 draw_repeat_tools(context, layout)
232 draw_gpencil_tools(context, layout)
234 # ********** default tools for editmode_surface ****************
237 class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel):
238 bl_context = "surface_edit"
239 bl_label = "Surface Tools"
241 def draw(self, context):
244 col = layout.column(align=True)
245 col.label(text="Transform:")
246 col.operator("transform.translate")
247 col.operator("transform.rotate")
248 col.operator("transform.resize", text="Scale")
250 col = layout.column(align=True)
251 col.label(text="Curve:")
252 col.operator("curve.duplicate")
253 col.operator("curve.delete")
254 col.operator("curve.cyclic_toggle")
255 col.operator("curve.switch_direction")
257 col = layout.column(align=True)
258 col.label(text="Modeling:")
259 col.operator("curve.extrude")
260 col.operator("curve.subdivide")
262 draw_repeat_tools(context, layout)
264 draw_gpencil_tools(context, layout)
266 # ********** default tools for editmode_text ****************
269 class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel):
270 bl_context = "text_edit"
271 bl_label = "Text Tools"
273 def draw(self, context):
276 col = layout.column(align=True)
277 col.label(text="Text Edit:")
278 col.operator("font.text_copy", text="Copy")
279 col.operator("font.text_cut", text="Cut")
280 col.operator("font.text_paste", text="Paste")
282 col = layout.column(align=True)
283 col.label(text="Set Case:")
284 col.operator("font.case_set", text="To Upper").case = 'UPPER'
285 col.operator("font.case_set", text="To Lower").case = 'LOWER'
287 col = layout.column(align=True)
288 col.label(text="Style:")
289 col.operator("font.style_toggle", text="Bold").style = 'BOLD'
290 col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
291 col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
293 draw_repeat_tools(context, layout)
296 # ********** default tools for editmode_armature ****************
299 class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel):
300 bl_context = "armature_edit"
301 bl_label = "Armature Tools"
303 def draw(self, context):
306 col = layout.column(align=True)
307 col.label(text="Transform:")
308 col.operator("transform.translate")
309 col.operator("transform.rotate")
310 col.operator("transform.resize", text="Scale")
312 col = layout.column(align=True)
313 col.label(text="Bones:")
314 col.operator("armature.bone_primitive_add", text="Add")
315 col.operator("armature.duplicate_move", text="Duplicate")
316 col.operator("armature.delete", text="Delete")
318 col = layout.column(align=True)
319 col.label(text="Modeling:")
320 col.operator("armature.extrude_move")
321 col.operator("armature.subdivide", text="Subdivide")
323 draw_repeat_tools(context, layout)
325 draw_gpencil_tools(context, layout)
328 class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel):
329 bl_context = "armature_edit"
330 bl_label = "Armature Options"
332 def draw(self, context):
333 arm = context.active_object.data
335 self.layout.prop(arm, "use_mirror_x")
337 # ********** default tools for editmode_mball ****************
340 class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel):
341 bl_context = "mball_edit"
342 bl_label = "Meta Tools"
344 def draw(self, context):
347 col = layout.column(align=True)
348 col.label(text="Transform:")
349 col.operator("transform.translate")
350 col.operator("transform.rotate")
351 col.operator("transform.resize", text="Scale")
353 draw_repeat_tools(context, layout)
355 draw_gpencil_tools(context, layout)
357 # ********** default tools for editmode_lattice ****************
360 class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel):
361 bl_context = "lattice_edit"
362 bl_label = "Lattice Tools"
364 def draw(self, context):
367 col = layout.column(align=True)
368 col.label(text="Transform:")
369 col.operator("transform.translate")
370 col.operator("transform.rotate")
371 col.operator("transform.resize", text="Scale")
373 col = layout.column(align=True)
374 col.operator("lattice.make_regular")
376 draw_repeat_tools(context, layout)
378 draw_gpencil_tools(context, layout)
381 # ********** default tools for posemode ****************
384 class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel):
385 bl_context = "posemode"
386 bl_label = "Pose Tools"
388 def draw(self, context):
391 col = layout.column(align=True)
392 col.label(text="Transform:")
393 col.operator("transform.translate")
394 col.operator("transform.rotate")
395 col.operator("transform.resize", text="Scale")
397 col = layout.column(align=True)
398 col.label(text="In-Between:")
400 row.operator("pose.push", text="Push")
401 row.operator("pose.relax", text="Relax")
402 col.operator("pose.breakdown", text="Breakdowner")
404 col = layout.column(align=True)
405 col.label(text="Pose:")
407 row.operator("pose.copy", text="Copy")
408 row.operator("pose.paste", text="Paste")
410 col = layout.column(align=True)
411 col.operator("poselib.pose_add", text="Add To Library")
413 draw_keyframing_tools(context, layout)
415 col = layout.column(align=True)
416 col.label(text="Motion Paths:")
417 col.operator("pose.paths_calculate", text="Calculate Paths")
418 col.operator("pose.paths_clear", text="Clear Paths")
420 draw_repeat_tools(context, layout)
422 draw_gpencil_tools(context, layout)
425 class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel):
426 bl_context = "posemode"
427 bl_label = "Pose Options"
429 def draw(self, context):
430 arm = context.active_object.data
432 self.layout.prop(arm, "use_auto_ik")
434 # ********** default tools for paint modes ****************
438 bl_space_type = 'VIEW_3D'
439 bl_region_type = 'TOOLS'
442 def paint_settings(context):
443 ts = context.tool_settings
445 if context.sculpt_object:
447 elif context.vertex_paint_object:
448 return ts.vertex_paint
449 elif context.weight_paint_object:
450 return ts.weight_paint
451 elif context.image_paint_object:
452 return ts.image_paint
453 elif context.particle_edit_object:
454 return ts.particle_edit
459 class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
463 def poll(cls, context):
464 return cls.paint_settings(context)
466 def draw(self, context):
469 settings = __class__.paint_settings(context)
470 brush = settings.brush
472 if not context.particle_edit_object:
473 col = layout.split().column()
474 col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
478 # XXX This needs a check if psys is editable.
479 if context.particle_edit_object:
480 # XXX Select Particle System
481 layout.column().prop(settings, "tool", expand=True)
483 if settings.tool != 'NONE':
484 col = layout.column()
485 col.prop(brush, "size", slider=True)
486 if settings.tool != 'ADD':
487 col.prop(brush, "strength", slider=True)
489 if settings.tool == 'ADD':
490 col.prop(brush, "count")
491 col = layout.column()
492 col.prop(settings, "use_default_interpolate")
493 sub = col.column(align=True)
494 sub.active = settings.use_default_interpolate
495 sub.prop(brush, "steps", slider=True)
496 sub.prop(settings, "default_key_count", slider=True)
497 elif settings.tool == 'LENGTH':
498 layout.prop(brush, "length_mode", expand=True)
499 elif settings.tool == 'PUFF':
500 layout.prop(brush, "puff_mode", expand=True)
501 layout.prop(brush, "use_puff_volume")
505 elif context.sculpt_object and brush:
507 col = layout.column()
511 row = col.row(align=True)
513 if brush.use_locked_size:
514 row.prop(brush, "use_locked_size", toggle=True, text="", icon='LOCKED')
515 row.prop(brush, "unprojected_radius", text="Radius", slider=True)
517 row.prop(brush, "use_locked_size", toggle=True, text="", icon='UNLOCKED')
518 row.prop(brush, "size", slider=True)
520 row.prop(brush, "use_pressure_size", toggle=True, text="")
522 if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
525 row = col.row(align=True)
527 if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}:
528 if brush.use_space_atten:
529 row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
531 row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
533 row.prop(brush, "strength", text="Strength", slider=True)
534 row.prop(brush, "use_pressure_strength", text="")
536 if brush.sculpt_tool not in {'SMOOTH'}:
539 row = col.row(align=True)
540 row.prop(brush, "auto_smooth_factor", slider=True)
541 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
543 if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}:
546 row = col.row(align=True)
547 row.prop(brush, "normal_weight", slider=True)
549 if brush.sculpt_tool in {'CREASE', 'BLOB'}:
552 row = col.row(align=True)
553 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
555 if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
556 row = col.row(align=True)
560 if brush.use_original_normal:
561 row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED')
563 row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED')
565 row.prop(brush, "sculpt_plane", text="")
567 #if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
568 if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
569 row = col.row(align=True)
570 row.prop(brush, "plane_offset", slider=True)
571 row.prop(brush, "use_offset_pressure", text="")
576 row.prop(brush, "use_plane_trim", text="Trim")
578 row.active = brush.use_plane_trim
579 row.prop(brush, "plane_trim", slider=True, text="Distance")
581 if brush.sculpt_tool == 'LAYER':
583 row.prop(brush, "height", slider=True, text="Height")
588 row.prop(brush, "use_frontface", text="Front Faces Only")
591 col.row().prop(brush, "direction", expand=True)
593 if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
596 col.prop(brush, "use_accumulate")
598 if brush.sculpt_tool == 'LAYER':
601 ob = context.sculpt_object
604 # not supported yet for this case
605 for md in ob.modifiers:
606 if md.type == 'MULTIRES':
607 do_persistent = False
610 col.prop(brush, "use_persistent")
611 col.operator("sculpt.set_persistent_base")
613 # Texture Paint Mode #
615 elif context.image_paint_object and brush:
616 col = layout.column()
617 col.template_color_wheel(brush, "color", value_slider=True)
618 col.prop(brush, "color", text="")
620 row = col.row(align=True)
621 row.prop(brush, "size", slider=True)
622 row.prop(brush, "use_pressure_size", toggle=True, text="")
624 row = col.row(align=True)
625 row.prop(brush, "strength", text="Strength", slider=True)
626 row.prop(brush, "use_pressure_strength", toggle=True, text="")
628 row = col.row(align=True)
629 row.prop(brush, "jitter", slider=True)
630 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
632 col.prop(brush, "blend", text="Blend")
634 col = layout.column()
635 col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
636 col.prop(brush, "use_alpha")
638 # Weight Paint Mode #
639 elif context.weight_paint_object and brush:
640 layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
641 layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
643 col = layout.column()
645 row = col.row(align=True)
646 row.prop(brush, "size", slider=True)
647 row.prop(brush, "use_pressure_size", toggle=True, text="")
649 row = col.row(align=True)
650 row.prop(brush, "strength", text="Strength", slider=True)
651 row.prop(brush, "use_pressure_strength", toggle=True, text="")
653 row = col.row(align=True)
654 row.prop(brush, "jitter", slider=True)
655 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
657 # Vertex Paint Mode #
658 elif context.vertex_paint_object and brush:
659 col = layout.column()
660 col.template_color_wheel(brush, "color", value_slider=True)
661 col.prop(brush, "color", text="")
663 row = col.row(align=True)
664 row.prop(brush, "size", slider=True)
665 row.prop(brush, "use_pressure_size", toggle=True, text="")
667 row = col.row(align=True)
668 row.prop(brush, "strength", text="Strength", slider=True)
669 row.prop(brush, "use_pressure_strength", toggle=True, text="")
672 #row = col.row(align=True)
673 #row.prop(brush, "jitter", slider=True)
674 #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
677 class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
679 bl_options = {'DEFAULT_CLOSED'}
682 def poll(cls, context):
683 settings = cls.paint_settings(context)
684 return (settings and settings.brush and (context.sculpt_object or
685 context.image_paint_object))
687 def draw(self, context):
690 settings = __class__.paint_settings(context)
691 brush = settings.brush
692 tex_slot = brush.texture_slot
694 col = layout.column()
696 col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
697 if brush.use_paint_image:
698 col.prop(brush, "use_fixed_texture")
700 if context.sculpt_object:
701 #XXX duplicated from properties_texture.py
705 col.label(text="Brush Mapping:")
706 row = col.row(align=True)
707 row.prop(tex_slot, "map_mode", expand=True)
711 col = layout.column()
712 col.active = tex_slot.map_mode in {'FIXED'}
713 col.label(text="Angle:")
715 col = layout.column()
716 if not brush.use_anchor and brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'} and tex_slot.map_mode in {'FIXED'}:
717 col.prop(brush, "texture_angle_source_random", text="")
719 col.prop(brush, "texture_angle_source_no_random", text="")
721 #row = col.row(align=True)
722 #row.label(text="Angle:")
723 #row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
725 #row = col.row(align=True)
728 #col.active = tex_slot.map_mode in {'FIXED'}
729 #col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="")
731 col = layout.column()
732 col.prop(tex_slot, "angle", text="")
733 col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
735 #col = layout.column()
736 #col.prop(brush, "use_random_rotation")
737 #col.active = (not brush.use_rake) and (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'}) and tex_slot.map_mode in {'FIXED'}
739 split = layout.split()
742 col.prop(tex_slot, "offset")
746 col.prop(tex_slot, "scale")
748 col = layout.column()
750 row = col.row(align=True)
751 row.label(text="Sample Bias:")
752 row = col.row(align=True)
753 row.prop(brush, "texture_sample_bias", slider=True, text="")
755 row = col.row(align=True)
756 row.label(text="Overlay:")
757 row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
759 row = col.row(align=True)
763 if brush.use_texture_overlay:
764 col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_OFF')
766 col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_ON')
768 col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
771 col.prop(brush, "texture_overlay_alpha", text="Alpha")
772 col.active = tex_slot.map_mode in {'FIXED', 'TILED'} and brush.use_texture_overlay
775 class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
777 bl_options = {'DEFAULT_CLOSED'}
780 def poll(cls, context):
781 settings = cls.paint_settings(context)
782 return (settings and settings.brush and
783 (context.sculpt_object or context.image_paint_object or
784 context.vertex_paint_object or context.weight_paint_object))
786 def draw(self, context):
789 settings = __class__.paint_settings(context)
790 brush = settings.brush
792 col = layout.column(align=True)
794 if context.sculpt_object:
795 col.prop(brush, "sculpt_tool", expand=False, text="")
796 col.operator("brush.reset")
797 elif context.image_paint_object:
798 col.prop(brush, "image_tool", expand=False, text="")
799 elif context.vertex_paint_object or context.weight_paint_object:
800 col.prop(brush, "vertex_tool", expand=False, text="")
802 row = layout.row(align=True)
803 row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
804 row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
805 row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
806 row.prop(brush, "use_paint_image", text="", icon='TPAINT_HLT')
809 class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
811 bl_options = {'DEFAULT_CLOSED'}
814 def poll(cls, context):
815 settings = cls.paint_settings(context)
816 return (settings and settings.brush and (context.sculpt_object or
817 context.vertex_paint_object or
818 context.weight_paint_object or
819 context.image_paint_object))
821 def draw(self, context):
824 settings = __class__.paint_settings(context)
825 brush = settings.brush
826 image_paint = context.image_paint_object
828 col = layout.column()
830 if context.sculpt_object:
831 col.label(text="Stroke Method:")
832 col.prop(brush, "stroke_method", text="")
837 row.prop(brush, "use_edge_to_edge", "Edge To Edge")
839 if brush.use_airbrush:
842 row.prop(brush, "rate", text="Rate", slider=True)
847 row.active = brush.use_space
848 row.prop(brush, "spacing", text="Spacing")
850 if (brush.sculpt_tool not in {'GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'}) and (not brush.use_anchor) and (not brush.use_restore_mesh):
851 col = layout.column()
854 col.prop(brush, "use_smooth_stroke")
857 sub.active = brush.use_smooth_stroke
858 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
859 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
863 row = col.row(align=True)
864 row.prop(brush, "jitter", slider=True)
865 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
869 row.prop(brush, "use_airbrush")
872 row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
873 row.prop(brush, "rate", slider=True)
879 row.prop(brush, "use_smooth_stroke")
881 col = layout.column()
882 col.active = brush.use_smooth_stroke
883 col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
884 col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
888 col = layout.column()
889 col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'})
892 row.prop(brush, "use_space")
895 row.active = brush.use_space
896 row.prop(brush, "spacing", text="Spacing")
898 #col.prop(brush, "use_space_atten", text="Adaptive Strength")
899 #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
904 # row.prop(brush, "use_pressure_spacing", toggle=True, text="")
907 class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
909 bl_options = {'DEFAULT_CLOSED'}
912 def poll(cls, context):
913 settings = cls.paint_settings(context)
914 return (settings and settings.brush and settings.brush.curve)
916 def draw(self, context):
919 settings = self.paint_settings(context)
921 brush = settings.brush
923 layout.template_curve_mapping(brush, "curve", brush=True)
925 row = layout.row(align=True)
926 row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
927 row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
928 row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT'
929 row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
930 row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
931 row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
934 class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
936 bl_options = {'DEFAULT_CLOSED'}
939 def poll(cls, context):
940 return (context.sculpt_object and context.tool_settings.sculpt)
942 def draw(self, context):
945 tool_settings = context.tool_settings
946 sculpt = tool_settings.sculpt
947 settings = __class__.paint_settings(context)
949 split = layout.split()
953 col.prop(sculpt, "use_threaded", text="Threaded Sculpt")
954 col.prop(sculpt, "show_low_resolution")
955 col.prop(sculpt, "show_brush")
957 col.label(text="Unified Settings:")
958 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
959 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
963 col.label(text="Lock:")
964 row = col.row(align=True)
965 row.prop(sculpt, "lock_x", text="X", toggle=True)
966 row.prop(sculpt, "lock_y", text="Y", toggle=True)
967 row.prop(sculpt, "lock_z", text="Z", toggle=True)
970 class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
971 bl_label = "Symmetry"
972 bl_options = {'DEFAULT_CLOSED'}
975 def poll(cls, context):
976 return (context.sculpt_object and context.tool_settings.sculpt)
978 def draw(self, context):
981 sculpt = context.tool_settings.sculpt
982 settings = __class__.paint_settings(context)
984 split = layout.split()
987 col.label(text="Mirror:")
988 col.prop(sculpt, "use_symmetry_x", text="X")
989 col.prop(sculpt, "use_symmetry_y", text="Y")
990 col.prop(sculpt, "use_symmetry_z", text="Z")
992 split.prop(sculpt, "radial_symmetry", text="Radial")
996 layout.prop(sculpt, "use_symmetry_feather", text="Feather")
999 class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
1000 bl_label = "Appearance"
1001 bl_options = {'DEFAULT_CLOSED'}
1004 def poll(cls, context):
1005 return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.image_paint_object and context.tool_settings.image_paint)
1007 def draw(self, context):
1008 layout = self.layout
1010 settings = __class__.paint_settings(context)
1011 brush = settings.brush
1013 col = layout.column()
1015 if context.sculpt_object and context.tool_settings.sculpt:
1016 #if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'}:
1017 if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'}:
1018 col.prop(brush, "cursor_color_add", text="Add Color")
1019 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
1021 col.prop(brush, "cursor_color_add", text="Color")
1023 col.prop(brush, "cursor_color_add", text="Color")
1025 col = layout.column()
1026 col.label(text="Icon:")
1028 row = col.row(align=True)
1029 row.prop(brush, "use_custom_icon")
1030 if brush.use_custom_icon:
1031 row = col.row(align=True)
1032 row.prop(brush, "icon_filepath", text="")
1034 # ********** default tools for weightpaint ****************
1037 class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
1038 bl_context = "weightpaint"
1039 bl_label = "Weight Tools"
1041 def draw(self, context):
1042 layout = self.layout
1044 ob = context.active_object
1046 col = layout.column()
1047 col.active = ob.vertex_groups.active != None
1048 col.operator("object.vertex_group_normalize_all", text="Normalize All")
1049 col.operator("object.vertex_group_normalize", text="Normalize")
1050 col.operator("object.vertex_group_invert", text="Invert")
1051 col.operator("object.vertex_group_clean", text="Clean")
1052 col.operator("object.vertex_group_levels", text="Levels")
1055 class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel):
1056 bl_context = "weightpaint"
1057 bl_label = "Options"
1059 def draw(self, context):
1060 layout = self.layout
1062 tool_settings = context.tool_settings
1063 wpaint = tool_settings.weight_paint
1065 col = layout.column()
1066 col.prop(wpaint, "use_all_faces")
1067 col.prop(wpaint, "use_normal")
1068 col.prop(wpaint, "use_spray")
1070 obj = context.weight_paint_object
1071 if obj.type == 'MESH':
1073 col.prop(mesh, "use_mirror_x")
1074 col.prop(mesh, "use_mirror_topology")
1076 col.label(text="Unified Settings:")
1077 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
1078 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
1080 # Commented out because the Apply button isn't an operator yet, making these settings useless
1081 # col.label(text="Gamma:")
1082 # col.prop(wpaint, "gamma", text="")
1083 # col.label(text="Multiply:")
1084 # col.prop(wpaint, "mul", text="")
1087 # Soft, Vgroup, X-Mirror and "Clear" Operator.
1089 # ********** default tools for vertexpaint ****************
1092 class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel):
1093 bl_context = "vertexpaint"
1094 bl_label = "Options"
1096 def draw(self, context):
1097 layout = self.layout
1099 tool_settings = context.tool_settings
1100 vpaint = tool_settings.vertex_paint
1102 col = layout.column()
1103 #col.prop(vpaint, "mode", text="")
1104 col.prop(vpaint, "use_all_faces")
1105 col.prop(vpaint, "use_normal")
1106 col.prop(vpaint, "use_spray")
1108 col.label(text="Unified Settings:")
1109 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
1110 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
1112 # Commented out because the Apply button isn't an operator yet, making these settings useless
1113 # col.label(text="Gamma:")
1114 # col.prop(vpaint, "gamma", text="")
1115 # col.label(text="Multiply:")
1116 # col.prop(vpaint, "mul", text="")
1118 # ********** default tools for texturepaint ****************
1121 class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
1122 bl_context = "imagepaint"
1123 bl_label = "Project Paint"
1126 def poll(cls, context):
1127 brush = context.tool_settings.image_paint.brush
1128 return (brush and brush.image_tool != 'SOFTEN')
1130 def draw_header(self, context):
1131 ipaint = context.tool_settings.image_paint
1133 self.layout.prop(ipaint, "use_projection", text="")
1135 def draw(self, context):
1136 layout = self.layout
1138 ob = context.active_object
1140 ipaint = context.tool_settings.image_paint
1141 settings = context.tool_settings.image_paint
1142 use_projection = ipaint.use_projection
1144 col = layout.column()
1146 sub.active = use_projection
1147 sub.prop(ipaint, "use_occlude")
1148 sub.prop(ipaint, "use_backface_culling")
1150 split = layout.split()
1152 col = split.column()
1153 col.active = (use_projection)
1154 col.prop(ipaint, "use_normal_falloff")
1156 col = split.column()
1157 col.active = (ipaint.use_normal_falloff and use_projection)
1158 col.prop(ipaint, "normal_angle", text="")
1160 col = layout.column(align=False)
1162 row.active = (use_projection)
1163 row.prop(ipaint, "use_stencil_layer", text="Stencil")
1165 row2 = row.row(align=False)
1166 row2.active = (use_projection and ipaint.use_stencil_layer)
1167 row2.menu("VIEW3D_MT_tools_projectpaint_stencil", text=mesh.uv_texture_stencil.name)
1168 row2.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1170 col = layout.column()
1173 row.active = (settings.brush.image_tool == 'CLONE')
1175 row.prop(ipaint, "use_clone_layer", text="Layer")
1176 row.menu("VIEW3D_MT_tools_projectpaint_clone", text=mesh.uv_texture_clone.name)
1179 sub.prop(ipaint, "seam_bleed")
1181 col.label(text="External Editing")
1182 row = col.split(align=True, percentage=0.55)
1183 row.operator("image.project_edit", text="Quick Edit")
1184 row.operator("image.project_apply", text="Apply")
1185 row = col.row(align=True)
1186 row.prop(ipaint, "screen_grab_size", text="")
1189 sub.operator("paint.project_image", text="Apply Camera Image")
1191 sub.operator("image.save_dirty", text="Save All Edited")
1194 class VIEW3D_PT_imagepaint_options(PaintPanel):
1195 bl_label = "Options"
1196 bl_options = {'DEFAULT_CLOSED'}
1199 def poll(cls, context):
1200 return (context.image_paint_object and context.tool_settings.image_paint)
1202 def draw(self, context):
1203 layout = self.layout
1205 tool_settings = context.tool_settings
1207 col = layout.column()
1208 col.label(text="Unified Settings:")
1209 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
1210 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
1213 class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
1214 bl_label = "Clone Layer"
1216 def draw(self, context):
1217 layout = self.layout
1218 for i, tex in enumerate(context.active_object.data.uv_textures):
1219 prop = layout.operator("wm.context_set_int", text=tex.name)
1220 prop.data_path = "active_object.data.uv_texture_clone_index"
1224 class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
1225 bl_label = "Mask Layer"
1227 def draw(self, context):
1228 layout = self.layout
1229 for i, tex in enumerate(context.active_object.data.uv_textures):
1230 prop = layout.operator("wm.context_set_int", text=tex.name)
1231 prop.data_path = "active_object.data.uv_texture_stencil_index"
1235 class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
1236 '''default tools for particle mode'''
1237 bl_context = "particlemode"
1238 bl_label = "Options"
1240 def draw(self, context):
1241 layout = self.layout
1243 pe = context.tool_settings.particle_edit
1246 layout.prop(pe, "type", text="")
1250 if pe.type == 'PARTICLES':
1251 if ob.particle_systems:
1252 if len(ob.particle_systems) > 1:
1253 layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", type='ICONS')
1255 ptcache = ob.particle_systems.active.point_cache
1257 for md in ob.modifiers:
1258 if md.type == pe.type:
1259 ptcache = md.point_cache
1261 if ptcache and len(ptcache.point_caches) > 1:
1262 layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS')
1264 if not pe.is_editable:
1265 layout.label(text="Point cache must be baked")
1266 layout.label(text="in memory to enable editing!")
1268 col = layout.column(align=True)
1270 col.active = pe.is_editable
1271 col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1273 sub.active = pe.use_emitter_deflect
1274 sub.prop(pe, "emitter_distance", text="Distance")
1276 col = layout.column(align=True)
1277 col.active = pe.is_editable
1278 col.label(text="Keep:")
1279 col.prop(pe, "use_preserve_length", text="Lengths")
1280 col.prop(pe, "use_preserve_root", text="Root")
1282 col.label(text="Correct:")
1283 col.prop(pe, "use_auto_velocity", text="Velocity")
1284 col.prop(ob.data, "use_mirror_x")
1286 col = layout.column(align=True)
1287 col.active = pe.is_editable
1288 col.label(text="Draw:")
1289 col.prop(pe, "draw_step", text="Path Steps")
1291 col.prop(pe, "show_particles", text="Children")
1293 if pe.type == 'PARTICLES':
1294 col.prop(pe, "show_particles", text="Particles")
1295 col.prop(pe, "use_fade_time")
1297 sub.active = pe.use_fade_time
1298 sub.prop(pe, "fade_frames", slider=True)
1300 if __name__ == "__main__": # only for live edit.
1301 bpy.utils.register_module(__name__)