diff options
Diffstat (limited to 'release/scripts/ui/space_dopesheet.py')
-rw-r--r-- | release/scripts/ui/space_dopesheet.py | 129 |
1 files changed, 118 insertions, 11 deletions
diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py index 19f64268481..9a1acfd76b8 100644 --- a/release/scripts/ui/space_dopesheet.py +++ b/release/scripts/ui/space_dopesheet.py @@ -20,8 +20,12 @@ import bpy + +####################################### +# DopeSheet Filtering + # used for DopeSheet, NLA, and Graph Editors -def dopesheet_filter(layout, context): +def dopesheet_filter(layout, context, genericFiltersOnly=False): dopesheet = context.space_data.dopesheet is_nla = context.area.type == 'NLA_EDITOR' @@ -29,6 +33,9 @@ def dopesheet_filter(layout, context): row.prop(dopesheet, "show_only_selected", text="") row.prop(dopesheet, "show_hidden", text="") + if genericFiltersOnly: + return + row = layout.row(align=True) row.prop(dopesheet, "show_transforms", text="") @@ -56,6 +63,8 @@ def dopesheet_filter(layout, context): row.prop(dopesheet, "show_curves", text="") if bpy.data.metaballs: row.prop(dopesheet, "show_metaballs", text="") + if bpy.data.lattices: + row.prop(dopesheet, "show_lattices", text="") if bpy.data.armatures: row.prop(dopesheet, "show_armatures", text="") if bpy.data.particles: @@ -68,6 +77,9 @@ def dopesheet_filter(layout, context): row.prop(dopesheet, "filter_group", text="") +####################################### +# DopeSheet Editor - General/Standard UI + class DOPESHEET_HT_header(bpy.types.Header): bl_space_type = 'DOPESHEET_EDITOR' @@ -84,25 +96,32 @@ class DOPESHEET_HT_header(bpy.types.Header): sub.menu("DOPESHEET_MT_view") sub.menu("DOPESHEET_MT_select") + sub.menu("DOPESHEET_MT_marker") 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") if st.mode == 'DOPESHEET': dopesheet_filter(layout, context) - elif st.mode == 'ACTION': + # 'genericFiltersOnly' limits the options to only the relevant 'generic' subset of + # filters which will work here and are useful (especially for character animation) + dopesheet_filter(layout, context, genericFiltersOnly=True) + + if 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="") @@ -168,14 +187,44 @@ 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' - layout.separator() - layout.operator("action.select_more") - layout.operator("action.select_less") + # 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_linked") + + +class DOPESHEET_MT_marker(bpy.types.Menu): + bl_label = "Marker" + + def draw(self, context): + layout = self.layout + + st = context.space_data + + #layout.operator_context = 'EXEC_REGION_WIN' + + layout.column() + layout.operator("marker.add", "Add Marker") + layout.operator("marker.duplicate", text="Duplicate Marker") + layout.operator("marker.delete", text="Delete Marker") layout.separator() - layout.operator("action.select_linked") + + layout.operator("marker.rename", text="Rename Marker") + layout.operator("marker.move", text="Grab/Move Marker") + + if st.mode in ('ACTION', 'SHAPEKEY') and st.action: + layout.separator() + layout.prop(st, "show_pose_markers") +####################################### +# Keyframe Editing + class DOPESHEET_MT_channel(bpy.types.Menu): bl_label = "Channel" @@ -194,11 +243,18 @@ class DOPESHEET_MT_channel(bpy.types.Menu): layout.separator() layout.operator("anim.channels_editable_toggle") + layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode") layout.separator() layout.operator("anim.channels_expand") layout.operator("anim.channels_collapse") + layout.separator() + layout.operator_menu_enum("anim.channels_move", "direction", text="Move...") + + layout.separator() + layout.operator("anim.channels_fcurves_enable") + class DOPESHEET_MT_key(bpy.types.Menu): bl_label = "Key" @@ -223,7 +279,6 @@ class DOPESHEET_MT_key(bpy.types.Menu): layout.operator_menu_enum("action.keyframe_type", "type", text="Keyframe Type") layout.operator_menu_enum("action.handle_type", "type", text="Handle Type") layout.operator_menu_enum("action.interpolation_type", "type", text="Interpolation Mode") - layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode") layout.separator() layout.operator("action.clean") @@ -247,12 +302,64 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu): 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 + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() |