Toolbar
authorWilliam Reynish <william@reynish.com>
Fri, 24 Jul 2009 11:14:59 +0000 (11:14 +0000)
committerWilliam Reynish <william@reynish.com>
Fri, 24 Jul 2009 11:14:59 +0000 (11:14 +0000)
Improved the brush tools UI and added a bunch of brush controls. There seems to be some RNA magic missing for texture paint to work, so that's empty for now. Added tablet pressure buttons, which needs a new icon.

Added a bunch of tools in a categorized fashion for all edit modes. Need to figure out what to do for vert/edge/face specific tools - perhaps it could detect the mode setting and show most appropriate tools for each mode.

release/ui/space_view3d_toolbar.py

index cab22af44e3e7192edd5baa052142262db0d65e9..6eb3886f4088acfc5e3879c22fa52ca17a4bbe78 100644 (file)
@@ -14,13 +14,28 @@ class VIEW3D_PT_tools_objectmode(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               layout.row().itemO("object.duplicate")
-               layout.row().itemO("object.delete")
-               layout.row().itemO("object.mesh_add")
-               layout.row().itemO("object.curve_add")
-               layout.row().itemO("object.text_add")
-               layout.row().itemO("object.surface_add")
+               
+               layout.itemL(text="Transform:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
+               
+               layout.itemL(text="Object:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("object.duplicate")
+               col.itemO("object.delete")
+               
+               layout.itemL(text="Keyframes:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("anim.insert_keyframe_menu", text="Insert")
+               col.itemO("anim.delete_keyframe_v3d", text="Remove")
 
 # ********** default tools for editmode_mesh ****************
 
 
 # ********** default tools for editmode_mesh ****************
 
@@ -35,17 +50,42 @@ class VIEW3D_PT_tools_editmode_mesh(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               layout.row().itemO("mesh.duplicate")
-               layout.row().itemO("mesh.delete")
-               layout.row().itemO("mesh.spin")
-               layout.row().itemO("mesh.screw")
-               layout.row().itemO("mesh.primitive_plane_add")
-               layout.row().itemO("mesh.primitive_cube_add")
-               layout.row().itemO("mesh.primitive_circle_add")
-               layout.row().itemO("mesh.primitive_cylinder_add")
-               layout.row().itemO("mesh.faces_shade_smooth")
-               layout.row().itemO("mesh.faces_shade_flat")
+               layout.itemL(text="Transform:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
+               
+               layout.itemL(text="Mesh:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("mesh.duplicate")
+               col.itemO("mesh.delete")
+               
+               layout.itemL(text="Modeling:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("mesh.extrude")
+               col.itemO("mesh.subdivide")
+               col.itemO("mesh.spin")
+               col.itemO("mesh.screw")
+               
+               layout.itemL(text="Shading:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("mesh.faces_shade_smooth", text="Smooth")
+               col.itemO("mesh.faces_shade_flat", text="Flat")
+               
+               layout.itemL(text="UV Mapping:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("uv.mapping_menu", text="Unwrap")
+               col.itemO("mesh.uvs_rotate")
+               col.itemO("mesh.uvs_mirror")
 
 # ********** default tools for editmode_curve ****************
 
 
 # ********** default tools for editmode_curve ****************
 
@@ -60,11 +100,27 @@ class VIEW3D_PT_tools_editmode_curve(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               layout.row().itemO("curve.duplicate")
-               layout.row().itemO("curve.delete")
-               layout.row().itemO("object.curve_add")
-               layout.row().itemO("curve.subdivide")
+               layout.itemL(text="Transform:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
+               
+               layout.itemL(text="Curve:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("curve.duplicate")
+               col.itemO("curve.delete")
+               col.itemO("curve.cyclic_toggle")
+               col.itemO("curve.switch_direction")
+               
+               layout.itemL(text="Modeling:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("curve.extrude")
+               col.itemO("curve.subdivide")
 
 # ********** default tools for editmode_surface ****************
 
 
 # ********** default tools for editmode_surface ****************
 
@@ -79,11 +135,26 @@ class VIEW3D_PT_tools_editmode_surface(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               layout.row().itemO("curve.duplicate")
-               layout.row().itemO("curve.delete")
-               layout.row().itemO("object.surface_add")
-               layout.row().itemO("curve.subdivide")
+               layout.itemL(text="Transform:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
+               
+               layout.itemL(text="Curve:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("curve.duplicate")
+               col.itemO("curve.delete")
+               col.itemO("curve.cyclic_toggle")
+               col.itemO("curve.switch_direction")
+               
+               layout.itemL(text="Modeling:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("curve.extrude")
+               col.itemO("curve.subdivide")
 
 # ********** default tools for editmode_text ****************
 
 
 # ********** default tools for editmode_text ****************
 
@@ -117,12 +188,26 @@ class VIEW3D_PT_tools_editmode_armature(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               layout.row().itemO("armature.duplicate_selected")
-               layout.row().itemO("armature.bone_primitive_add")
-               layout.row().itemO("armature.delete")
-               layout.row().itemO("armature.parent_clear")
-
+               layout.itemL(text="Transform:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
+               
+               layout.itemL(text="Bones:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("armature.bone_primitive_add", text="Add")
+               col.itemO("armature.duplicate_selected", text="Duplicate")
+               col.itemO("armature.delete", text="Delete")
+               
+               layout.itemL(text="Modeling:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("armature.extrude")
+               
+               
 # ********** default tools for editmode_mball ****************
 
 class View3DPanel(bpy.types.Panel):
 # ********** default tools for editmode_mball ****************
 
 class View3DPanel(bpy.types.Panel):
@@ -136,8 +221,12 @@ class VIEW3D_PT_tools_editmode_mball(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               row = layout.row()
+               layout.itemL(text="Transform:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
 
 # ********** default tools for editmode_lattice ****************
 
 
 # ********** default tools for editmode_lattice ****************
 
@@ -152,8 +241,12 @@ class VIEW3D_PT_tools_editmode_lattice(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
-
-               row = layout.row()
+               layout.itemL(text="Transform:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
 
 # ********** default tools for posemode ****************
 
 
 # ********** default tools for posemode ****************
 
@@ -168,27 +261,37 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
 
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
+               layout.itemL(text="Transform:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("tfm.translate")
+               col.itemO("tfm.rotate")
+               col.itemO("tfm.resize", text="Scale")
+               
+               layout.itemL(text="Bones:")
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("pose.hide", text="Hide")
+               col.itemO("pose.reveal", text="Reveal")
+               
+               layout.itemL(text="Keyframes:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("anim.insert_keyframe_menu", text="Insert")
+               col.itemO("anim.delete_keyframe_v3d", text="Remove")
+               
+               layout.itemL(text="Pose:")
+               
+               split = layout.split()
+               col = split.column(align=True)
+               col.itemO("pose.copy", text="Copy")
+               col.itemO("pose.paste", text="Paste")
+               col.itemO("poselib.pose_add", text="Add to Library")
+               col.itemO("poselib.pose_remove", text="Remove From Library")
 
 
-               layout.row().itemO("pose.hide")
-               layout.row().itemO("pose.reveal")
-               layout.row().itemO("pose.rot_clear")
-               layout.row().itemO("pose.loc_clear")
-
-# ********** default tools for sculptmode ****************
-
-class View3DPanel(bpy.types.Panel):
-       __space_type__ = "VIEW_3D"
-       __region_type__ = "TOOLS"
-       __context__ = "sculptmode"
+# ********** default tools for paint modes ****************
 
 
-#class VIEW3D_PT_tools_sculptmode(View3DPanel):
-#      __idname__ = "VIEW3D_PT_tools_sculptmode"
-#      __label__ = "Sculpt Tools"
-#
-#      def draw(self, context):
-#              layout = self.layout
-#
-#              layout.row().itemO("sculpt.radial_control")
 
 class VIEW3D_PT_tools_brush(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
 
 class VIEW3D_PT_tools_brush(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
@@ -203,6 +306,8 @@ class VIEW3D_PT_tools_brush(bpy.types.Panel):
                        return ts.vpaint
                elif context.wpaint_object:
                        return ts.wpaint
                        return ts.vpaint
                elif context.wpaint_object:
                        return ts.wpaint
+               elif context.tpaint_object:
+                       return ts.tpaint
                return False
 
        def poll(self, context):
                return False
 
        def poll(self, context):
@@ -220,27 +325,65 @@ class VIEW3D_PT_tools_brush(bpy.types.Panel):
 
                split = layout.split()
                col = split.column()
 
                split = layout.split()
                col = split.column()
-               col.itemR(brush, "size", slider=True)
+               row = col.row(align=True)
+               row.itemR(brush, "size", slider=True)
+               row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
                if context.wpaint_object:
                        col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
                col.itemR(brush, "strength", slider=True)
                if context.wpaint_object:
                        col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
                col.itemR(brush, "strength", slider=True)
-
-
+               row = col.row(align=True)
+               row.itemR(brush, "falloff", slider=True)
+               row.itemR(brush, "falloff_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+               if context.vpaint_object:
+                       col.itemR(brush, "color", text="")
+               if context.tpaint_object:
+                       row = col.row(align=True)
+                       row.itemR(brush, "clone_opacity", slider=True, text=Opacity)
+                       row.itemR(brush, "opacity_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+               
+               row = col.row(align=True)
+               row.itemR(brush, "space", text="")
+               rowsub = row.row(align=True)
+               rowsub.active = brush.space
+               rowsub.itemR(brush, "spacing", text="Spacing", slider=True)
+               rowsub.itemR(brush, "spacing_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
 
                split = layout.split()
                col = split.column()
                col.itemR(brush, "airbrush")
                col.itemR(brush, "anchored")
                col.itemR(brush, "rake")
 
                split = layout.split()
                col = split.column()
                col.itemR(brush, "airbrush")
                col.itemR(brush, "anchored")
                col.itemR(brush, "rake")
-               col.itemR(brush, "space", text="Spacing")
-               colsub = col.column()
-               colsub.active = brush.space
-               colsub.itemR(brush, "spacing", text="")
+
+
+class VIEW3D_PT_tools_brush_curve(bpy.types.Panel):
+       __space_type__ = "VIEW_3D"
+       __region_type__ = "TOOLS"
+       __label__ = "Curve"
+
+       def brush_src(self, context):
+               ts = context.tool_settings
+               if context.sculpt_object:
+                       return ts.sculpt
+               elif context.vpaint_object:
+                       return ts.vpaint
+               elif context.wpaint_object:
+                       return ts.wpaint
+               elif context.tpaint_object:
+                       return ts.tpaint
+               return False
+
+       def poll(self, context):
+               return self.brush_src(context)
+
+       def draw(self, context):
+               src = self.brush_src(context)
+               brush = src.brush
+               layout = self.layout
 
                split = layout.split()
                split.template_curve_mapping(brush.curve)
                
 
                split = layout.split()
                split.template_curve_mapping(brush.curve)
                
-class VIEW3D_PT_sculptoptions(bpy.types.Panel):
+class VIEW3D_PT_sculpt_options(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
        __region_type__ = "TOOLS"
        __label__ = "Options"
        __space_type__ = "VIEW_3D"
        __region_type__ = "TOOLS"
        __label__ = "Options"
@@ -254,22 +397,27 @@ class VIEW3D_PT_sculptoptions(bpy.types.Panel):
                split = self.layout.split()
                
                col = split.column()
                split = self.layout.split()
                
                col = split.column()
-               col.itemL(text="Symmetry:")
-               row = col.row(align=True)
-               row.itemR(sculpt, "symmetry_x", text="X", toggle=True)
-               row.itemR(sculpt, "symmetry_y", text="Y", toggle=True)
-               row.itemR(sculpt, "symmetry_z", text="Z", toggle=True)
+               col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
+               col.itemR(sculpt, "show_brush")
+
 
                split = self.layout.split()
                
                col = split.column()
 
                split = self.layout.split()
                
                col = split.column()
-               col.itemL(text="Lock Axis:")
-               row = col.row(align=True)
-               row.itemR(sculpt, "lock_x", text="X", toggle=True)
-               row.itemR(sculpt, "lock_y", text="Y", toggle=True)
-               row.itemR(sculpt, "lock_z", text="Z", toggle=True)
-
-
+               col.itemL(text="Symmetry:")
+               col.itemR(sculpt, "symmetry_x", text="X")
+               col.itemR(sculpt, "symmetry_y", text="Y")
+               col.itemR(sculpt, "symmetry_z", text="Z")
+               
+               col = split.column()
+               col.itemL(text="Lock:")
+               col.itemR(sculpt, "lock_x", text="X")
+               col.itemR(sculpt, "lock_y", text="Y")
+               col.itemR(sculpt, "lock_z", text="Z")
+               
+               
+               
+               
 # ********** default tools for weightpaint ****************
 
 class View3DPanel(bpy.types.Panel):
 # ********** default tools for weightpaint ****************
 
 class View3DPanel(bpy.types.Panel):
@@ -277,14 +425,30 @@ class View3DPanel(bpy.types.Panel):
        __region_type__ = "TOOLS"
        __context__ = "weightpaint"
 
        __region_type__ = "TOOLS"
        __context__ = "weightpaint"
 
-class VIEW3D_PT_tools_weightpaint(View3DPanel):
+class VIEW3D_PT_weightpaint_options(View3DPanel):
        __idname__ = "VIEW3D_PT_tools_weightpaint"
        __idname__ = "VIEW3D_PT_tools_weightpaint"
-       __label__ = "Weight Paint Tools"
+       __label__ = "Options"
 
        def draw(self, context):
 
        def draw(self, context):
+               wpaint = context.tool_settings.wpaint
                layout = self.layout
                layout = self.layout
+               split = self.layout.split()
+               col = split.column()
+               col.itemL(text="Blend:")
+               col.itemR(wpaint, "mode", text="")
+               col.itemR(wpaint, "all_faces")
+               col.itemR(wpaint, "normals")
+               col.itemR(wpaint, "spray")
+               col.itemR(wpaint, "vertex_dist", text="Distance")
+
+# Commented out because the Apply button isn't an operator yet, making these settings useless
+#              col.itemL(text="Gamma:")
+#              col.itemR(wpaint, "gamma", text="")
+#              col.itemL(text="Multiply:")
+#              col.itemR(wpaint, "mul", text="")
 
 
-               layout.row().itemO("paint.weight_paint_radial_control")
+               
+       
 
 # ********** default tools for vertexpaint ****************
 
 
 # ********** default tools for vertexpaint ****************
 
@@ -293,15 +457,27 @@ class View3DPanel(bpy.types.Panel):
        __region_type__ = "TOOLS"
        __context__ = "vertexpaint"
 
        __region_type__ = "TOOLS"
        __context__ = "vertexpaint"
 
-class VIEW3D_PT_tools_vertexpaint(View3DPanel):
-       __idname__ = "VIEW3D_PT_tools_vertexpaint"
-       __label__ = "Vertex Paint Tools"
+class VIEW3D_PT_vertexpaint_options(View3DPanel):
+       __idname__ = "VIEW3D_PT_vertexpaintoptions"
+       __label__ = "Options"
 
        def draw(self, context):
 
        def draw(self, context):
+               vpaint = context.tool_settings.vpaint
                layout = self.layout
                layout = self.layout
-
-               layout.row().itemO("paint.vertex_paint_radial_control")
-
+               split = self.layout.split()
+               col = split.column()
+               col.itemL(text="Blend:")
+               col.itemR(vpaint, "mode", text="")
+               col.itemR(vpaint, "all_faces")
+               col.itemR(vpaint, "normals")
+               col.itemR(vpaint, "spray")
+               col.itemR(vpaint, "vertex_dist", text="Distance")
+# Commented out because the Apply button isn't an operator yet, making these settings useless
+#              col.itemL(text="Gamma:")
+#              col.itemR(vpaint, "gamma", text="")
+#              col.itemL(text="Multiply:")
+#              col.itemR(vpaint, "mul", text="")
+               
 # ********** default tools for texturepaint ****************
 
 class View3DPanel(bpy.types.Panel):
 # ********** default tools for texturepaint ****************
 
 class View3DPanel(bpy.types.Panel):
@@ -316,7 +492,6 @@ class VIEW3D_PT_tools_texturepaint(View3DPanel):
        def draw(self, context):
                layout = self.layout
 
        def draw(self, context):
                layout = self.layout
 
-               layout.row().itemO("paint.texture_paint_radial_control")
 
 
 bpy.types.register(VIEW3D_PT_tools_objectmode)
 
 
 bpy.types.register(VIEW3D_PT_tools_objectmode)
@@ -329,9 +504,10 @@ bpy.types.register(VIEW3D_PT_tools_editmode_mball)
 bpy.types.register(VIEW3D_PT_tools_editmode_lattice)
 bpy.types.register(VIEW3D_PT_tools_posemode)
 bpy.types.register(VIEW3D_PT_tools_brush)
 bpy.types.register(VIEW3D_PT_tools_editmode_lattice)
 bpy.types.register(VIEW3D_PT_tools_posemode)
 bpy.types.register(VIEW3D_PT_tools_brush)
-bpy.types.register(VIEW3D_PT_sculptoptions)
-bpy.types.register(VIEW3D_PT_tools_weightpaint)
-bpy.types.register(VIEW3D_PT_tools_vertexpaint)
+bpy.types.register(VIEW3D_PT_tools_brush_curve)
+bpy.types.register(VIEW3D_PT_sculpt_options)
+bpy.types.register(VIEW3D_PT_vertexpaint_options)
+bpy.types.register(VIEW3D_PT_weightpaint_options)
 bpy.types.register(VIEW3D_PT_tools_texturepaint)
 
 
 bpy.types.register(VIEW3D_PT_tools_texturepaint)