diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-01-04 06:14:01 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-01-04 06:14:01 +0300 |
commit | cdc7d0b85f088967684c6b6efb7600d06398abc9 (patch) | |
tree | 309c828da7f6cafb48b056bc8cf06aa74315137b /release | |
parent | 522615536952c02fababd72ab9106c0a68a8071d (diff) |
Grease Pencil Todos: "Sketching Sessions"
Due to popular request and usability considerations, this commit
reintroduces functionality similar to 2.4's "Draw Mode" for Grease
Pencil.
In the toolbar under the Draw/Line/Eraser buttons, you can find the
"Use Sketching Sessions" toggle, which enables this feature. This is a
per-scene setting, and defaults to off, so that the current 2.5
behaviour is still the default (i.e. the Grease Pencil operator will
only do a single stroke at a time).
With this option enabled, drawing with Grease Pencil will enter a
semi-modal state where you can draw multiple strokes without needing
to keep holding the DKEY throughout (though you'll still need to do so
to start the strokes, unless you use some toolbar buttons), while
still being able to manipulate the viewport. Header help-text prints
show the appropriate keybindings (i.e. press ESCKEY or ENTER to end
the sketching session).
Notes:
- To aid maintainability of the 3D-View toolbar code, I've taken the
liberty to factor out the groups of widgets which commonly occur in
most of the toolbars into separate functions (namely "Repeat" and
"Grease Pencil"). Perhaps it might make it slightly harder to newbies
to the toolbar code to grasp, though the physics panels are far worse
;)
- I've reshuffled some code in the Grease Pencil code to separate out
the various states of operation again more clearly, though some more
work is still needed there (TODO)
- There can now be only one Grease Pencil operator running at a time
- Redoing Grease Pencil operations where sketching sessions was
enabled still needs work. Namely, a way of delimiting the set of
points recorded into strokes is still needed (TODO)
- Ultimately, it should be possible to switch tools midway through a
session. Currently sessions are limited to only being able to be used
with a single drawing mode (TODO)
- After ending a drawing session, the titlebar contols may not work on
Windows without manually making the main window lose focus and then
regain (i.e. click on some other window in toolbar, then come back).
This may be related to (bug #25480)
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 124 |
1 files changed, 40 insertions, 84 deletions
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 5731a915ab2..780853adb89 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -25,6 +25,29 @@ class View3DPanel(): bl_region_type = 'TOOLS' +# **************** standard tool clusters ****************** + +# History/Repeat tools +def draw_repeat_tools(context, layout): + col = layout.column(align=True) + col.label(text="Repeat:") + col.operator("screen.repeat_last") + col.operator("screen.repeat_history", text="History...") + +# Grease Pencil tools +def draw_gpencil_tools(context, layout): + col = layout.column(align=True) + + col.label(text="Grease Pencil:") + + row = col.row() + row.operator("gpencil.draw", text="Draw").mode = 'DRAW' + row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' + row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + + row = col.row() + row.prop(context.tool_settings, "use_grease_pencil_sessions") + # ********** default tools for objectmode **************** @@ -63,17 +86,9 @@ class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel): col.operator("anim.keyframe_insert_menu", text="Insert") col.operator("anim.keyframe_delete_v3d", text="Remove") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) # ********** default tools for editmode_mesh **************** @@ -131,17 +146,9 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel): col.operator("mesh.faces_shade_smooth", text="Smooth") col.operator("mesh.faces_shade_flat", text="Flat") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel): @@ -202,17 +209,9 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel): col.operator("curve.extrude") col.operator("curve.subdivide") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) # ********** default tools for editmode_surface **************** @@ -242,17 +241,9 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel): col.operator("curve.extrude") col.operator("curve.subdivide") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) # ********** default tools for editmode_text **************** @@ -281,10 +272,7 @@ class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel): col.operator("font.style_toggle", text="Italic").style = 'ITALIC' col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE' - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) # ********** default tools for editmode_armature **************** @@ -314,17 +302,9 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel): col.operator("armature.extrude_move") col.operator("armature.subdivide", text="Subdivide") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel): @@ -355,17 +335,9 @@ class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel): col.operator("transform.rotate") col.operator("transform.resize", text="Scale") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) # ********** default tools for editmode_lattice **************** @@ -386,17 +358,9 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel): col = layout.column(align=True) col.operator("lattice.make_regular") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) # ********** default tools for posemode **************** @@ -437,17 +401,9 @@ class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel): col.operator("anim.keyframe_insert_menu", text="Insert") col.operator("anim.keyframe_delete_v3d", text="Remove") - col = layout.column(align=True) - col.label(text="Repeat:") - col.operator("screen.repeat_last") - col.operator("screen.repeat_history", text="History...") + draw_repeat_tools(context, layout) - col = layout.column(align=True) - col.label(text="Grease Pencil:") - row = col.row() - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + draw_gpencil_tools(context, layout) class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel): |