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")
62 # ********** 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="Shrink/Fatten")
121 col.operator("transform.push_pull", text="Push/Pull")
123 col = layout.column(align=True)
124 col.label(text="Deform:")
125 col.operator("transform.edge_slide")
126 col.operator("mesh.noise")
127 col.operator("mesh.vertices_smooth")
129 col = layout.column(align=True)
130 col.label(text="Add:")
131 col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
132 col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
133 col.operator("mesh.subdivide")
134 col.operator("mesh.loopcut_slide")
135 col.operator("mesh.duplicate_move", text="Duplicate")
136 col.operator("mesh.spin")
137 col.operator("mesh.screw")
139 col = layout.column(align=True)
140 col.label(text="Remove:")
141 col.operator("mesh.delete")
142 col.operator("mesh.merge")
143 col.operator("mesh.remove_doubles")
145 col = layout.column(align=True)
146 col.label(text="Normals:")
147 col.operator("mesh.normals_make_consistent", text="Recalculate")
148 col.operator("mesh.flip_normals", text="Flip Direction")
150 col = layout.column(align=True)
151 col.label(text="UV Mapping:")
152 col.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
153 col.operator("mesh.mark_seam")
154 col.operator("mesh.mark_seam", text="Clear Seam").clear = True
156 col = layout.column(align=True)
157 col.label(text="Shading:")
158 col.operator("mesh.faces_shade_smooth", text="Smooth")
159 col.operator("mesh.faces_shade_flat", text="Flat")
161 draw_repeat_tools(context, layout)
163 draw_gpencil_tools(context, layout)
166 class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel):
167 bl_context = "mesh_edit"
168 bl_label = "Mesh Options"
170 def draw(self, context):
173 ob = context.active_object
177 col = layout.column(align=True)
178 col.prop(mesh, "use_mirror_x")
180 sub.active = ob.data.use_mirror_x
181 sub.prop(mesh, "use_mirror_topology")
183 ts = context.tool_settings
185 col.label("Edge Select Mode")
186 col.prop(ts, "edge_path_mode", text="")
187 col.prop(context.tool_settings, "edge_path_live_unwrap")
189 # ********** default tools for editmode_curve ****************
192 class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel):
193 bl_context = "curve_edit"
194 bl_label = "Curve Tools"
196 def draw(self, context):
199 col = layout.column(align=True)
200 col.label(text="Transform:")
201 col.operator("transform.translate")
202 col.operator("transform.rotate")
203 col.operator("transform.resize", text="Scale")
205 col = layout.column(align=True)
206 col.operator("transform.transform", text="Tilt").mode = 'TILT'
207 col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
209 col = layout.column(align=True)
210 col.label(text="Curve:")
211 col.operator("curve.duplicate")
212 col.operator("curve.delete")
213 col.operator("curve.cyclic_toggle")
214 col.operator("curve.switch_direction")
215 col.operator("curve.spline_type_set")
217 col = layout.column(align=True)
218 col.label(text="Handles:")
220 row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
221 row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
223 row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
224 row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
226 col = layout.column(align=True)
227 col.label(text="Modeling:")
228 col.operator("curve.extrude")
229 col.operator("curve.subdivide")
231 draw_repeat_tools(context, layout)
233 draw_gpencil_tools(context, layout)
235 # ********** default tools for editmode_surface ****************
238 class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel):
239 bl_context = "surface_edit"
240 bl_label = "Surface Tools"
242 def draw(self, context):
245 col = layout.column(align=True)
246 col.label(text="Transform:")
247 col.operator("transform.translate")
248 col.operator("transform.rotate")
249 col.operator("transform.resize", text="Scale")
251 col = layout.column(align=True)
252 col.label(text="Curve:")
253 col.operator("curve.duplicate")
254 col.operator("curve.delete")
255 col.operator("curve.cyclic_toggle")
256 col.operator("curve.switch_direction")
258 col = layout.column(align=True)
259 col.label(text="Modeling:")
260 col.operator("curve.extrude")
261 col.operator("curve.subdivide")
263 draw_repeat_tools(context, layout)
265 draw_gpencil_tools(context, layout)
267 # ********** default tools for editmode_text ****************
270 class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel):
271 bl_context = "text_edit"
272 bl_label = "Text Tools"
274 def draw(self, context):
277 col = layout.column(align=True)
278 col.label(text="Text Edit:")
279 col.operator("font.text_copy", text="Copy")
280 col.operator("font.text_cut", text="Cut")
281 col.operator("font.text_paste", text="Paste")
283 col = layout.column(align=True)
284 col.label(text="Set Case:")
285 col.operator("font.case_set", text="To Upper").case = 'UPPER'
286 col.operator("font.case_set", text="To Lower").case = 'LOWER'
288 col = layout.column(align=True)
289 col.label(text="Style:")
290 col.operator("font.style_toggle", text="Bold").style = 'BOLD'
291 col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
292 col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
294 draw_repeat_tools(context, layout)
297 # ********** default tools for editmode_armature ****************
300 class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel):
301 bl_context = "armature_edit"
302 bl_label = "Armature Tools"
304 def draw(self, context):
307 col = layout.column(align=True)
308 col.label(text="Transform:")
309 col.operator("transform.translate")
310 col.operator("transform.rotate")
311 col.operator("transform.resize", text="Scale")
313 col = layout.column(align=True)
314 col.label(text="Bones:")
315 col.operator("armature.bone_primitive_add", text="Add")
316 col.operator("armature.duplicate_move", text="Duplicate")
317 col.operator("armature.delete", text="Delete")
319 col = layout.column(align=True)
320 col.label(text="Modeling:")
321 col.operator("armature.extrude_move")
322 col.operator("armature.subdivide", text="Subdivide")
324 draw_repeat_tools(context, layout)
326 draw_gpencil_tools(context, layout)
329 class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel):
330 bl_context = "armature_edit"
331 bl_label = "Armature Options"
333 def draw(self, context):
334 arm = context.active_object.data
336 self.layout.prop(arm, "use_mirror_x")
338 # ********** default tools for editmode_mball ****************
341 class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel):
342 bl_context = "mball_edit"
343 bl_label = "Meta Tools"
345 def draw(self, context):
348 col = layout.column(align=True)
349 col.label(text="Transform:")
350 col.operator("transform.translate")
351 col.operator("transform.rotate")
352 col.operator("transform.resize", text="Scale")
354 draw_repeat_tools(context, layout)
356 draw_gpencil_tools(context, layout)
358 # ********** default tools for editmode_lattice ****************
361 class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel):
362 bl_context = "lattice_edit"
363 bl_label = "Lattice Tools"
365 def draw(self, context):
368 col = layout.column(align=True)
369 col.label(text="Transform:")
370 col.operator("transform.translate")
371 col.operator("transform.rotate")
372 col.operator("transform.resize", text="Scale")
374 col = layout.column(align=True)
375 col.operator("lattice.make_regular")
377 draw_repeat_tools(context, layout)
379 draw_gpencil_tools(context, layout)
382 # ********** default tools for posemode ****************
385 class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel):
386 bl_context = "posemode"
387 bl_label = "Pose 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.label(text="In-Between:")
401 row.operator("pose.push", text="Push")
402 row.operator("pose.relax", text="Relax")
403 col.operator("pose.breakdown", text="Breakdowner")
405 col = layout.column(align=True)
406 col.label(text="Pose:")
408 row.operator("pose.copy", text="Copy")
409 row.operator("pose.paste", text="Paste")
411 col = layout.column(align=True)
412 col.operator("poselib.pose_add", text="Add To Library")
414 draw_keyframing_tools(context, layout)
416 col = layout.column(align=True)
417 col.label(text="Motion Paths:")
418 col.operator("pose.paths_calculate", text="Calculate Paths")
419 col.operator("pose.paths_clear", text="Clear Paths")
421 draw_repeat_tools(context, layout)
423 draw_gpencil_tools(context, layout)
426 class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel):
427 bl_context = "posemode"
428 bl_label = "Pose Options"
430 def draw(self, context):
431 arm = context.active_object.data
433 self.layout.prop(arm, "use_auto_ik")
435 # ********** default tools for paint modes ****************
439 bl_space_type = 'VIEW_3D'
440 bl_region_type = 'TOOLS'
443 def paint_settings(context):
444 ts = context.tool_settings
446 if context.sculpt_object:
448 elif context.vertex_paint_object:
449 return ts.vertex_paint
450 elif context.weight_paint_object:
451 return ts.weight_paint
452 elif context.image_paint_object:
453 return ts.image_paint
454 elif context.particle_edit_object:
455 return ts.particle_edit
460 class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
464 def poll(cls, context):
465 return cls.paint_settings(context)
467 def draw(self, context):
470 settings = self.paint_settings(context)
471 brush = settings.brush
473 if not context.particle_edit_object:
474 col = layout.split().column()
475 col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
479 # XXX This needs a check if psys is editable.
480 if context.particle_edit_object:
481 # XXX Select Particle System
482 layout.column().prop(settings, "tool", expand=True)
484 if settings.tool != 'NONE':
485 col = layout.column()
486 col.prop(brush, "size", slider=True)
487 if settings.tool != 'ADD':
488 col.prop(brush, "strength", slider=True)
490 if settings.tool == 'ADD':
491 col.prop(brush, "count")
492 col = layout.column()
493 col.prop(settings, "use_default_interpolate")
494 sub = col.column(align=True)
495 sub.active = settings.use_default_interpolate
496 sub.prop(brush, "steps", slider=True)
497 sub.prop(settings, "default_key_count", slider=True)
498 elif settings.tool == 'LENGTH':
499 layout.prop(brush, "length_mode", expand=True)
500 elif settings.tool == 'PUFF':
501 layout.prop(brush, "puff_mode", expand=True)
502 layout.prop(brush, "use_puff_volume")
506 elif context.sculpt_object and brush:
508 col = layout.column()
512 row = col.row(align=True)
514 if brush.use_locked_size:
515 row.prop(brush, "use_locked_size", toggle=True, text="", icon='LOCKED')
516 row.prop(brush, "unprojected_radius", text="Radius", slider=True)
518 row.prop(brush, "use_locked_size", toggle=True, text="", icon='UNLOCKED')
519 row.prop(brush, "size", slider=True)
521 row.prop(brush, "use_pressure_size", toggle=True, text="")
523 if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
526 row = col.row(align=True)
528 if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}:
529 if brush.use_space_atten:
530 row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
532 row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
534 row.prop(brush, "strength", text="Strength", slider=True)
535 row.prop(brush, "use_pressure_strength", text="")
537 if brush.sculpt_tool not in {'SMOOTH'}:
540 row = col.row(align=True)
541 row.prop(brush, "auto_smooth_factor", slider=True)
542 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
544 if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}:
547 row = col.row(align=True)
548 row.prop(brush, "normal_weight", slider=True)
550 if brush.sculpt_tool in {'CREASE', 'BLOB'}:
553 row = col.row(align=True)
554 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
556 if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
557 row = col.row(align=True)
561 if brush.use_original_normal:
562 row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED')
564 row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED')
566 row.prop(brush, "sculpt_plane", text="")
568 #if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
569 if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
570 row = col.row(align=True)
571 row.prop(brush, "plane_offset", slider=True)
572 row.prop(brush, "use_offset_pressure", text="")
577 row.prop(brush, "use_plane_trim", text="Trim")
579 row.active = brush.use_plane_trim
580 row.prop(brush, "plane_trim", slider=True, text="Distance")
582 if brush.sculpt_tool == 'LAYER':
584 row.prop(brush, "height", slider=True, text="Height")
589 row.prop(brush, "use_frontface", text="Front Faces Only")
592 col.row().prop(brush, "direction", expand=True)
594 if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
597 col.prop(brush, "use_accumulate")
599 if brush.sculpt_tool == 'LAYER':
602 ob = context.sculpt_object
605 # not supported yet for this case
606 for md in ob.modifiers:
607 if md.type == 'MULTIRES':
608 do_persistent = False
611 col.prop(brush, "use_persistent")
612 col.operator("sculpt.set_persistent_base")
614 # Texture Paint Mode #
616 elif context.image_paint_object and brush:
617 col = layout.column()
618 col.template_color_wheel(brush, "color", value_slider=True)
619 col.prop(brush, "color", text="")
621 row = col.row(align=True)
622 row.prop(brush, "size", slider=True)
623 row.prop(brush, "use_pressure_size", toggle=True, text="")
625 row = col.row(align=True)
626 row.prop(brush, "strength", text="Strength", slider=True)
627 row.prop(brush, "use_pressure_strength", toggle=True, text="")
629 row = col.row(align=True)
630 row.prop(brush, "jitter", slider=True)
631 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
633 col.prop(brush, "blend", text="Blend")
635 col = layout.column()
636 col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
637 col.prop(brush, "use_alpha")
639 # Weight Paint Mode #
640 elif context.weight_paint_object and brush:
641 layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
642 layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
644 layout.prop(context.tool_settings, "use_multipaint", text="Multi-Paint")
646 col = layout.column()
648 row = col.row(align=True)
649 row.prop(brush, "size", slider=True)
650 row.prop(brush, "use_pressure_size", toggle=True, text="")
652 row = col.row(align=True)
653 row.prop(brush, "strength", text="Strength", slider=True)
654 row.prop(brush, "use_pressure_strength", toggle=True, text="")
656 row = col.row(align=True)
657 row.prop(brush, "jitter", slider=True)
658 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
660 # Vertex Paint Mode #
661 elif context.vertex_paint_object and brush:
662 col = layout.column()
663 col.template_color_wheel(brush, "color", value_slider=True)
664 col.prop(brush, "color", text="")
666 row = col.row(align=True)
667 row.prop(brush, "size", slider=True)
668 row.prop(brush, "use_pressure_size", toggle=True, text="")
670 row = col.row(align=True)
671 row.prop(brush, "strength", text="Strength", slider=True)
672 row.prop(brush, "use_pressure_strength", toggle=True, text="")
675 #row = col.row(align=True)
676 #row.prop(brush, "jitter", slider=True)
677 #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
680 class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
682 bl_options = {'DEFAULT_CLOSED'}
685 def poll(cls, context):
686 settings = cls.paint_settings(context)
687 return (settings and settings.brush and (context.sculpt_object or
688 context.image_paint_object))
690 def draw(self, context):
693 settings = self.paint_settings(context)
694 brush = settings.brush
695 tex_slot = brush.texture_slot
697 col = layout.column()
699 col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
700 if brush.use_paint_image:
701 col.prop(brush, "use_fixed_texture")
703 if context.sculpt_object:
704 #XXX duplicated from properties_texture.py
708 col.label(text="Brush Mapping:")
709 row = col.row(align=True)
710 row.prop(tex_slot, "map_mode", expand=True)
714 col = layout.column()
715 col.active = tex_slot.map_mode in {'FIXED'}
716 col.label(text="Angle:")
718 col = layout.column()
719 if not brush.use_anchor and brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'} and tex_slot.map_mode in {'FIXED'}:
720 col.prop(brush, "texture_angle_source_random", text="")
722 col.prop(brush, "texture_angle_source_no_random", text="")
724 #row = col.row(align=True)
725 #row.label(text="Angle:")
726 #row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
728 #row = col.row(align=True)
731 #col.active = tex_slot.map_mode in {'FIXED'}
732 #col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="")
734 col = layout.column()
735 col.prop(tex_slot, "angle", text="")
736 col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
738 #col = layout.column()
739 #col.prop(brush, "use_random_rotation")
740 #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'}
742 split = layout.split()
745 col.prop(tex_slot, "offset")
749 col.prop(tex_slot, "scale")
751 col = layout.column()
753 row = col.row(align=True)
754 row.label(text="Sample Bias:")
755 row = col.row(align=True)
756 row.prop(brush, "texture_sample_bias", slider=True, text="")
758 row = col.row(align=True)
759 row.label(text="Overlay:")
760 row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
762 row = col.row(align=True)
766 if brush.use_texture_overlay:
767 col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_OFF')
769 col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_ON')
771 col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
774 col.prop(brush, "texture_overlay_alpha", text="Alpha")
775 col.active = tex_slot.map_mode in {'FIXED', 'TILED'} and brush.use_texture_overlay
778 class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
780 bl_options = {'DEFAULT_CLOSED'}
783 def poll(cls, context):
784 settings = cls.paint_settings(context)
785 return (settings and settings.brush and
786 (context.sculpt_object or context.image_paint_object or
787 context.vertex_paint_object or context.weight_paint_object))
789 def draw(self, context):
792 settings = self.paint_settings(context)
793 brush = settings.brush
795 col = layout.column(align=True)
797 if context.sculpt_object:
798 col.prop(brush, "sculpt_tool", expand=False, text="")
799 col.operator("brush.reset")
800 elif context.image_paint_object:
801 col.prop(brush, "image_tool", expand=False, text="")
802 elif context.vertex_paint_object or context.weight_paint_object:
803 col.prop(brush, "vertex_tool", expand=False, text="")
805 row = layout.row(align=True)
806 row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
807 row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
808 row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
809 row.prop(brush, "use_paint_image", text="", icon='TPAINT_HLT')
812 class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
814 bl_options = {'DEFAULT_CLOSED'}
817 def poll(cls, context):
818 settings = cls.paint_settings(context)
819 return (settings and settings.brush and (context.sculpt_object or
820 context.vertex_paint_object or
821 context.weight_paint_object or
822 context.image_paint_object))
824 def draw(self, context):
827 settings = self.paint_settings(context)
828 brush = settings.brush
829 image_paint = context.image_paint_object
831 col = layout.column()
833 if context.sculpt_object:
834 col.label(text="Stroke Method:")
835 col.prop(brush, "stroke_method", text="")
840 row.prop(brush, "use_edge_to_edge", "Edge To Edge")
842 if brush.use_airbrush:
845 row.prop(brush, "rate", text="Rate", slider=True)
850 row.active = brush.use_space
851 row.prop(brush, "spacing", text="Spacing")
853 if (brush.sculpt_tool not in {'GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'}) and (not brush.use_anchor) and (not brush.use_restore_mesh):
854 col = layout.column()
857 col.prop(brush, "use_smooth_stroke")
860 sub.active = brush.use_smooth_stroke
861 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
862 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
866 row = col.row(align=True)
867 row.prop(brush, "jitter", slider=True)
868 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
872 row.prop(brush, "use_airbrush")
875 row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
876 row.prop(brush, "rate", slider=True)
882 row.prop(brush, "use_smooth_stroke")
884 col = layout.column()
885 col.active = brush.use_smooth_stroke
886 col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
887 col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
891 col = layout.column()
892 col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'})
895 row.prop(brush, "use_space")
898 row.active = brush.use_space
899 row.prop(brush, "spacing", text="Spacing")
901 #col.prop(brush, "use_space_atten", text="Adaptive Strength")
902 #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
907 # row.prop(brush, "use_pressure_spacing", toggle=True, text="")
910 class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
912 bl_options = {'DEFAULT_CLOSED'}
915 def poll(cls, context):
916 settings = cls.paint_settings(context)
917 return (settings and settings.brush and settings.brush.curve)
919 def draw(self, context):
922 settings = self.paint_settings(context)
924 brush = settings.brush
926 layout.template_curve_mapping(brush, "curve", brush=True)
928 row = layout.row(align=True)
929 row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
930 row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
931 row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT'
932 row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
933 row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
934 row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
937 class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
939 bl_options = {'DEFAULT_CLOSED'}
942 def poll(cls, context):
943 return (context.sculpt_object and context.tool_settings.sculpt)
945 def draw(self, context):
948 tool_settings = context.tool_settings
949 sculpt = tool_settings.sculpt
951 layout.label(text="Lock:")
952 row = layout.row(align=True)
953 row.prop(sculpt, "lock_x", text="X", toggle=True)
954 row.prop(sculpt, "lock_y", text="Y", toggle=True)
955 row.prop(sculpt, "lock_z", text="Z", toggle=True)
957 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
958 layout.prop(sculpt, "show_low_resolution")
959 layout.prop(sculpt, "show_brush")
960 layout.prop(sculpt, "use_deform_only")
962 layout.label(text="Unified Settings:")
963 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
964 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
967 class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
968 bl_label = "Symmetry"
969 bl_options = {'DEFAULT_CLOSED'}
972 def poll(cls, context):
973 return (context.sculpt_object and context.tool_settings.sculpt)
975 def draw(self, context):
978 sculpt = context.tool_settings.sculpt
980 split = layout.split()
983 col.label(text="Mirror:")
984 col.prop(sculpt, "use_symmetry_x", text="X")
985 col.prop(sculpt, "use_symmetry_y", text="Y")
986 col.prop(sculpt, "use_symmetry_z", text="Z")
988 split.prop(sculpt, "radial_symmetry", text="Radial")
992 layout.prop(sculpt, "use_symmetry_feather", text="Feather")
995 class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
996 bl_label = "Appearance"
997 bl_options = {'DEFAULT_CLOSED'}
1000 def poll(cls, context):
1001 ts = context.tool_settings
1002 return ((context.sculpt_object and ts.sculpt) or
1003 (context.vertex_paint_object and ts.vertex_paint) or
1004 (context.weight_paint_object and ts.weight_paint) or
1005 (context.image_paint_object and ts.image_paint))
1007 def draw(self, context):
1008 layout = self.layout
1010 settings = self.paint_settings(context)
1011 brush = settings.brush
1013 if brush is None: # unlikely but can happen
1014 layout.label(text="Brush Unset")
1017 col = layout.column()
1019 if context.sculpt_object and context.tool_settings.sculpt:
1020 #if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'}:
1021 if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'}:
1022 col.prop(brush, "cursor_color_add", text="Add Color")
1023 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
1025 col.prop(brush, "cursor_color_add", text="Color")
1027 col.prop(brush, "cursor_color_add", text="Color")
1029 col = layout.column()
1030 col.label(text="Icon:")
1032 row = col.row(align=True)
1033 row.prop(brush, "use_custom_icon")
1034 if brush.use_custom_icon:
1035 row = col.row(align=True)
1036 row.prop(brush, "icon_filepath", text="")
1038 # ********** default tools for weightpaint ****************
1041 class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
1042 bl_context = "weightpaint"
1043 bl_label = "Weight Tools"
1045 def draw(self, context):
1046 layout = self.layout
1048 ob = context.active_object
1050 col = layout.column()
1051 col.active = ob.vertex_groups.active != None
1052 col.operator("object.vertex_group_normalize_all", text="Normalize All")
1053 col.operator("object.vertex_group_normalize", text="Normalize")
1054 col.operator("object.vertex_group_invert", text="Invert")
1055 col.operator("object.vertex_group_clean", text="Clean")
1056 col.operator("object.vertex_group_levels", text="Levels")
1057 col.operator("object.vertex_group_fix", text="Fix Deforms")
1060 class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel):
1061 bl_context = "weightpaint"
1062 bl_label = "Options"
1064 def draw(self, context):
1065 layout = self.layout
1067 tool_settings = context.tool_settings
1068 wpaint = tool_settings.weight_paint
1070 col = layout.column()
1071 col.prop(wpaint, "use_all_faces")
1072 col.prop(wpaint, "use_normal")
1073 col.prop(wpaint, "use_spray")
1075 obj = context.weight_paint_object
1076 if obj.type == 'MESH':
1078 col.prop(mesh, "use_mirror_x")
1079 col.prop(mesh, "use_mirror_topology")
1081 col.label(text="Unified Settings:")
1082 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
1083 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
1085 # Commented out because the Apply button isn't an operator yet, making these settings useless
1086 # col.label(text="Gamma:")
1087 # col.prop(wpaint, "gamma", text="")
1088 # col.label(text="Multiply:")
1089 # col.prop(wpaint, "mul", text="")
1092 # Soft, Vgroup, X-Mirror and "Clear" Operator.
1094 # ********** default tools for vertexpaint ****************
1097 class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel):
1098 bl_context = "vertexpaint"
1099 bl_label = "Options"
1101 def draw(self, context):
1102 layout = self.layout
1104 tool_settings = context.tool_settings
1105 vpaint = tool_settings.vertex_paint
1107 col = layout.column()
1108 #col.prop(vpaint, "mode", text="")
1109 col.prop(vpaint, "use_all_faces")
1110 col.prop(vpaint, "use_normal")
1111 col.prop(vpaint, "use_spray")
1113 col.label(text="Unified Settings:")
1114 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
1115 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
1117 # Commented out because the Apply button isn't an operator yet, making these settings useless
1118 # col.label(text="Gamma:")
1119 # col.prop(vpaint, "gamma", text="")
1120 # col.label(text="Multiply:")
1121 # col.prop(vpaint, "mul", text="")
1123 # ********** default tools for texturepaint ****************
1126 class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
1127 bl_context = "imagepaint"
1128 bl_label = "Project Paint"
1131 def poll(cls, context):
1132 brush = context.tool_settings.image_paint.brush
1133 return (brush and brush.image_tool != 'SOFTEN')
1135 def draw_header(self, context):
1136 ipaint = context.tool_settings.image_paint
1138 self.layout.prop(ipaint, "use_projection", text="")
1140 def draw(self, context):
1141 layout = self.layout
1143 ob = context.active_object
1145 ipaint = context.tool_settings.image_paint
1146 settings = context.tool_settings.image_paint
1147 use_projection = ipaint.use_projection
1149 col = layout.column()
1151 sub.active = use_projection
1152 sub.prop(ipaint, "use_occlude")
1153 sub.prop(ipaint, "use_backface_culling")
1155 split = layout.split()
1157 col = split.column()
1158 col.active = (use_projection)
1159 col.prop(ipaint, "use_normal_falloff")
1161 col = split.column()
1162 col.active = (ipaint.use_normal_falloff and use_projection)
1163 col.prop(ipaint, "normal_angle", text="")
1165 col = layout.column(align=False)
1167 row.active = (use_projection)
1168 row.prop(ipaint, "use_stencil_layer", text="Stencil")
1170 row2 = row.row(align=False)
1171 row2.active = (use_projection and ipaint.use_stencil_layer)
1172 row2.menu("VIEW3D_MT_tools_projectpaint_stencil", text=mesh.uv_texture_stencil.name)
1173 row2.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
1175 col = layout.column()
1178 row.active = (settings.brush.image_tool == 'CLONE')
1180 row.prop(ipaint, "use_clone_layer", text="Layer")
1181 row.menu("VIEW3D_MT_tools_projectpaint_clone", text=mesh.uv_texture_clone.name)
1184 sub.prop(ipaint, "seam_bleed")
1186 col.label(text="External Editing")
1187 row = col.split(align=True, percentage=0.55)
1188 row.operator("image.project_edit", text="Quick Edit")
1189 row.operator("image.project_apply", text="Apply")
1190 row = col.row(align=True)
1191 row.prop(ipaint, "screen_grab_size", text="")
1194 sub.operator("paint.project_image", text="Apply Camera Image")
1196 sub.operator("image.save_dirty", text="Save All Edited")
1199 class VIEW3D_PT_imagepaint_options(PaintPanel):
1200 bl_label = "Options"
1201 bl_options = {'DEFAULT_CLOSED'}
1204 def poll(cls, context):
1205 return (context.image_paint_object and context.tool_settings.image_paint)
1207 def draw(self, context):
1208 layout = self.layout
1210 tool_settings = context.tool_settings
1212 col = layout.column()
1213 col.label(text="Unified Settings:")
1214 col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
1215 col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
1218 class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
1219 bl_label = "Clone Layer"
1221 def draw(self, context):
1222 layout = self.layout
1223 for i, tex in enumerate(context.active_object.data.uv_textures):
1224 prop = layout.operator("wm.context_set_int", text=tex.name)
1225 prop.data_path = "active_object.data.uv_texture_clone_index"
1229 class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
1230 bl_label = "Mask Layer"
1232 def draw(self, context):
1233 layout = self.layout
1234 for i, tex in enumerate(context.active_object.data.uv_textures):
1235 prop = layout.operator("wm.context_set_int", text=tex.name)
1236 prop.data_path = "active_object.data.uv_texture_stencil_index"
1240 class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
1241 '''default tools for particle mode'''
1242 bl_context = "particlemode"
1243 bl_label = "Options"
1245 def draw(self, context):
1246 layout = self.layout
1248 pe = context.tool_settings.particle_edit
1251 layout.prop(pe, "type", text="")
1255 if pe.type == 'PARTICLES':
1256 if ob.particle_systems:
1257 if len(ob.particle_systems) > 1:
1258 layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2, maxrows=3)
1260 ptcache = ob.particle_systems.active.point_cache
1262 for md in ob.modifiers:
1263 if md.type == pe.type:
1264 ptcache = md.point_cache
1266 if ptcache and len(ptcache.point_caches) > 1:
1267 layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", rows=2, maxrows=3)
1269 if not pe.is_editable:
1270 layout.label(text="Point cache must be baked")
1271 layout.label(text="in memory to enable editing!")
1273 col = layout.column(align=True)
1275 col.active = pe.is_editable
1276 col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
1278 sub.active = pe.use_emitter_deflect
1279 sub.prop(pe, "emitter_distance", text="Distance")
1281 col = layout.column(align=True)
1282 col.active = pe.is_editable
1283 col.label(text="Keep:")
1284 col.prop(pe, "use_preserve_length", text="Lengths")
1285 col.prop(pe, "use_preserve_root", text="Root")
1287 col.label(text="Correct:")
1288 col.prop(pe, "use_auto_velocity", text="Velocity")
1289 col.prop(ob.data, "use_mirror_x")
1291 col = layout.column(align=True)
1292 col.active = pe.is_editable
1293 col.label(text="Draw:")
1294 col.prop(pe, "draw_step", text="Path Steps")
1296 col.prop(pe, "show_particles", text="Children")
1298 if pe.type == 'PARTICLES':
1299 col.prop(pe, "show_particles", text="Particles")
1300 col.prop(pe, "use_fade_time")
1302 sub.active = pe.use_fade_time
1303 sub.prop(pe, "fade_frames", slider=True)
1305 if __name__ == "__main__": # only for live edit.
1306 bpy.utils.register_module(__name__)