Todo #22395: Restoring Grease Pencil Editing Mode in DopeSheet Editor

This commit restores some basic functionality for retiming Grease
Pencil sketches. Some of the functionality that existed before still
hasn't been restored (namely snap/mirror tools as well as copy+paste),
though it should be possible to use this for basic retiming and
sketch-frame management again.

- There's still a lot of work required to get this up to the standard
of the rest of the animation editor code, as some of this code was
originally just hacked in based on the old-style code.
- Work is already required to not have to directly access the main db
global to get the list of Grease Pencil datablocks to show, but that
can come along with pending cleanups of the filtering code.
This commit is contained in:
2011-01-10 22:10:28 +00:00
parent d841a20631
commit cf25b10eb5
14 changed files with 508 additions and 367 deletions

View File

@@ -20,6 +20,8 @@
import bpy
#######################################
# DopeSheet Filtering
# used for DopeSheet, NLA, and Graph Editors
def dopesheet_filter(layout, context):
@@ -70,6 +72,8 @@ def dopesheet_filter(layout, context):
if dopesheet.show_only_group_objects:
row.prop(dopesheet, "filter_group", text="")
#######################################
# DopeSheet Editor - General/Standard UI
class DOPESHEET_HT_header(bpy.types.Header):
bl_space_type = 'DOPESHEET_EDITOR'
@@ -92,11 +96,12 @@ class DOPESHEET_HT_header(bpy.types.Header):
if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None):
sub.menu("DOPESHEET_MT_channel")
elif st.mode == 'GPENCIL':
# gpencil Channel menu
pass
sub.menu("DOPESHEET_MT_gpencil_channel")
if st.mode != 'GPENCIL':
sub.menu("DOPESHEET_MT_key")
else:
sub.menu("DOPESHEET_MT_gpencil_frame")
layout.prop(st, "mode", text="")
layout.prop(st.dopesheet, "show_summary", text="Summary")
@@ -106,7 +111,8 @@ class DOPESHEET_HT_header(bpy.types.Header):
elif st.mode in ('ACTION', 'SHAPEKEY'):
layout.template_ID(st, "action", new="action.new")
# Grease Pencil mode doesn't need snapping, as it's frame-aligned only
if st.mode != 'GPENCIL':
layout.prop(st, "auto_snap", text="")
@@ -171,13 +177,15 @@ class DOPESHEET_MT_select(bpy.types.Menu):
layout.operator("action.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
layout.operator("action.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
# FIXME: grease pencil mode isn't supported for these yet, so skip for that mode only
if context.space_data.mode != 'GPENCIL':
layout.separator()
layout.operator("action.select_more")
layout.operator("action.select_less")
layout.separator()
layout.operator("action.select_more")
layout.operator("action.select_less")
layout.separator()
layout.operator("action.select_linked")
layout.separator()
layout.operator("action.select_linked")
class DOPESHEET_MT_marker(bpy.types.Menu):
bl_label = "Marker"
@@ -203,6 +211,9 @@ class DOPESHEET_MT_marker(bpy.types.Menu):
layout.separator()
layout.prop(st, "show_pose_markers")
#######################################
# Keyframe Editing
class DOPESHEET_MT_channel(bpy.types.Menu):
bl_label = "Channel"
@@ -266,7 +277,6 @@ class DOPESHEET_MT_key(bpy.types.Menu):
layout.operator("action.copy")
layout.operator("action.paste")
class DOPESHEET_MT_key_transform(bpy.types.Menu):
bl_label = "Transform"
@@ -279,6 +289,56 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
#######################################
# Grease Pencil Editing
class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
bl_label = "Channel"
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_CHANNELS'
layout.column()
layout.operator("anim.channels_delete")
layout.separator()
layout.operator("anim.channels_setting_toggle")
layout.operator("anim.channels_setting_enable")
layout.operator("anim.channels_setting_disable")
layout.separator()
layout.operator("anim.channels_editable_toggle")
# XXX: to be enabled when these are ready for use!
#layout.separator()
#layout.operator("anim.channels_expand")
#layout.operator("anim.channels_collapse")
#layout.separator()
#layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
bl_label = "Frame"
def draw(self, context):
layout = self.layout
layout.column()
layout.menu("DOPESHEET_MT_key_transform", text="Transform")
#layout.operator_menu_enum("action.snap", "type", text="Snap")
#layout.operator_menu_enum("action.mirror", "type", text="Mirror")
layout.separator()
layout.operator("action.duplicate")
layout.operator("action.delete")
#layout.separator()
#layout.operator("action.copy")
#layout.operator("action.paste")
def register():
pass