[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58578] branches/soc-2013-ui_replay/ release/scripts/startup/bl_ui/space_view3d_toolbar.py: Quick experiment to put mode switching buttons at the top of the toolbar.
Vincent Akkermans
vincent at ack-err.net
Wed Jul 24 20:06:41 CEST 2013
Revision: 58578
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58578
Author: ack-err
Date: 2013-07-24 18:06:41 +0000 (Wed, 24 Jul 2013)
Log Message:
-----------
Quick experiment to put mode switching buttons at the top of the toolbar.
Modified Paths:
--------------
branches/soc-2013-ui_replay/release/scripts/startup/bl_ui/space_view3d_toolbar.py
Modified: branches/soc-2013-ui_replay/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2013-ui_replay/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2013-07-24 15:51:05 UTC (rev 58577)
+++ branches/soc-2013-ui_replay/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2013-07-24 18:06:41 UTC (rev 58578)
@@ -30,6 +30,38 @@
# ********** common tools for two or more modes ****************
+class VIEW3D_PT_tools_modeswitch(View3DPanel, Panel):
+ # bl_context = mode
+ bl_label = "Modes"
+
+ # TODO: doesn't work, try to not draw a header
+ def draw_header(self, context):
+ print(dir(self))
+ print(dir(context))
+ # layout = self.layout
+ # col = layout.column(align=True)
+ # col.label("blub")
+
+ def draw(self, context):
+ layout = self.layout
+ active_object = context.active_object
+
+ col = layout.column(align=True)
+ row = col.row(align=True)
+ row.operator("object.mode_set", text="", single_unit=True, icon='OBJECT_DATAMODE').mode = "OBJECT"
+ row.operator("object.mode_set", text="", single_unit=True, icon='EDITMODE_HLT').mode = "EDIT"
+ row.operator("object.mode_set", text="", single_unit=True, icon='SCULPTMODE_HLT').mode = "SCULPT"
+ #row.operator("object.mode_set", text="", single_unit=True, icon='POSE_HLT').mode = "POSE"
+
+ col = layout.column(align=True)
+ row = col.row(align=True)
+ row.operator("object.mode_set", text="", single_unit=True, icon='VPAINT_HLT').mode = "VERTEX_PAINT"
+ row.operator("object.mode_set", text="", single_unit=True, icon='TPAINT_HLT').mode = "TEXTURE_PAINT"
+ row.operator("object.mode_set", text="", single_unit=True, icon='WPAINT_HLT').mode = "WEIGHT_PAINT"
+
+ # TODO: adapt the buttons to what items are selected
+ #if active_object and active_object.type in {'MESH', 'CURVE', 'SURFACE'}:
+
def grease_panel(mode):
class cls(View3DPanel, Panel):
bl_context = mode
@@ -72,9 +104,10 @@
cls.__name__ = "VIEW3D_PT_tools_%s_history" % mode
return cls
-
# ********** default tools for object-mode ****************
+# VIEW3D_PT_tools_objectmode_modes = switch_panel("objectmode");
+
class VIEW3D_PT_tools_objectmode_transform(View3DPanel, Panel):
bl_context = "objectmode"
bl_label = "Transform"
@@ -170,6 +203,8 @@
# ********** default tools for editmode_mesh ****************
+# VIEW3D_PT_tools_editmode_modes = switch_panel("mesh_edit");
+
class VIEW3D_PT_tools_editmode_transform(View3DPanel, Panel):
bl_context = "mesh_edit"
bl_label = "Transform"
@@ -310,6 +345,7 @@
# ********** default tools for editmode_curve ****************
+# VIEW3D_PT_tools_curvemode_modes = switch_panel("curve_edit");
class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
bl_context = "curve_edit"
@@ -359,6 +395,7 @@
# ********** default tools for editmode_surface ****************
+# VIEW3D_PT_tools_surfacemode_modes = switch_panel("surface_edit");
class VIEW3D_PT_tools_surfaceedit(View3DPanel, Panel):
bl_context = "surface_edit"
@@ -391,6 +428,7 @@
# ********** default tools for editmode_text ****************
+# VIEW3D_PT_tools_textmode_modes = switch_panel("text_edit");
class VIEW3D_PT_tools_textedit(View3DPanel, Panel):
bl_context = "text_edit"
@@ -421,6 +459,7 @@
# ********** default tools for editmode_armature ****************
+# VIEW3D_PT_tools_armaturemode_modes = switch_panel("armature_edit");
class VIEW3D_PT_tools_armatureedit(View3DPanel, Panel):
bl_context = "armature_edit"
@@ -450,7 +489,6 @@
draw_gpencil_tools(context, layout)
-
class VIEW3D_PT_tools_armatureedit_options(View3DPanel, Panel):
bl_context = "armature_edit"
bl_label = "Armature Options"
@@ -462,6 +500,7 @@
# ********** default tools for editmode_mball ****************
+# VIEW3D_PT_tools_mballmode_modes = switch_panel("mball_edit");
class VIEW3D_PT_tools_mballedit(View3DPanel, Panel):
bl_context = "mball_edit"
@@ -482,6 +521,7 @@
# ********** default tools for editmode_lattice ****************
+# VIEW3D_PT_tools_latticemode_modes = switch_panel("lattice_edit");
class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel):
bl_context = "lattice_edit"
@@ -503,9 +543,9 @@
draw_gpencil_tools(context, layout)
-
# ********** default tools for pose-mode ****************
+# VIEW3D_PT_tools_posemode_modes = switch_panel("posemode");
class VIEW3D_PT_tools_posemode(View3DPanel, Panel):
bl_context = "posemode"
@@ -548,7 +588,6 @@
draw_gpencil_tools(context, layout)
-
class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
bl_context = "posemode"
bl_label = "Pose Options"
@@ -560,12 +599,14 @@
# ********** default tools for paint modes ****************
+# VIEW3D_PT_tools_imagepaint_modes = switch_panel("imagepaint");
+# VIEW3D_PT_tools_weightpaint_modes = switch_panel("weightpaint");
+# VIEW3D_PT_tools_vertexpaint_modes = switch_panel("vertexpaint");
class View3DPaintPanel(UnifiedPaintPanel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
-
class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
bl_label = "Brush"
@@ -841,7 +882,6 @@
sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
-
class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
bl_label = "Texture"
bl_options = {'DEFAULT_CLOSED'}
@@ -881,7 +921,6 @@
sub.prop(brush, "texture_overlay_alpha", text="Alpha")
sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
-
class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
bl_context = "imagepaint"
bl_label = "Texture Mask"
@@ -919,7 +958,6 @@
sub.prop(brush, "mask_overlay_alpha", text="Alpha")
sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
-
class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
bl_label = "Stroke"
bl_options = {'DEFAULT_CLOSED'}
@@ -1008,7 +1046,6 @@
sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
-
class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
bl_label = "Curve"
bl_options = {'DEFAULT_CLOSED'}
@@ -1035,7 +1072,6 @@
row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
-
class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel):
bl_label = "Topology"
bl_options = {'DEFAULT_CLOSED'}
@@ -1065,7 +1101,6 @@
col.prop(sculpt, "symmetrize_direction")
col.operator("sculpt.symmetrize")
-
class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
bl_label = "Options"
bl_options = {'DEFAULT_CLOSED'}
@@ -1095,7 +1130,6 @@
self.unified_paint_settings(layout, context)
-
class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
bl_label = "Symmetry"
bl_options = {'DEFAULT_CLOSED'}
@@ -1119,7 +1153,6 @@
layout.column().prop(sculpt, "radial_symmetry", text="Radial")
layout.prop(sculpt, "use_symmetry_feather", text="Feather")
-
class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
bl_label = "Appearance"
bl_options = {'DEFAULT_CLOSED'}
@@ -1166,7 +1199,6 @@
# ********** default tools for weight-paint ****************
-
class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
bl_context = "weightpaint"
bl_label = "Weight Tools"
@@ -1190,7 +1222,6 @@
col.operator("object.vertex_group_fix", text="Fix Deforms")
col.operator("paint.weight_gradient")
-
class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
bl_context = "weightpaint"
bl_label = "Options"
@@ -1227,7 +1258,6 @@
# ********** default tools for vertex-paint ****************
-
class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
bl_context = "vertexpaint"
bl_label = "Options"
@@ -1318,7 +1348,6 @@
col.operator("paint.project_image", text="Apply Camera Image")
col.operator("image.save_dirty", text="Save All Edited")
-
class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
bl_label = "Options"
bl_options = {'DEFAULT_CLOSED'}
@@ -1333,7 +1362,6 @@
col = layout.column()
self.unified_paint_settings(col, context)
-
class VIEW3D_MT_tools_projectpaint_clone(Menu):
bl_label = "Clone Layer"
@@ -1345,7 +1373,6 @@
props.data_path = "active_object.data.uv_texture_clone_index"
props.value = i
-
class VIEW3D_MT_tools_projectpaint_stencil(Menu):
bl_label = "Mask Layer"
@@ -1356,7 +1383,6 @@
props.data_path = "active_object.data.uv_texture_stencil_index"
props.value = i
-
class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
"""Default tools for particle mode"""
bl_context = "particlemode"
More information about the Bf-blender-cvs
mailing list