From 0e51c9014c6a1cbdfe916edf79d1ca05d796e1fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 3 Nov 2011 12:47:39 +0000 Subject: [PATCH] patch [#27917] MARKER MENUS: Unification and adding "Duplicate Marker to Scene..." from Troy Sobotka (sobotka), with edits - remove Markers from Ctrl+L menu (was out of place here and was broken from recent changes to marker operators) - further de-duplicte scripts by having all menus call the same function: marker_menu_generic(). this fixes bug [#29083] too. --- .../scripts/startup/bl_ui/space_dopesheet.py | 14 ++---- release/scripts/startup/bl_ui/space_graph.py | 12 +---- release/scripts/startup/bl_ui/space_nla.py | 12 +---- .../scripts/startup/bl_ui/space_sequencer.py | 14 +----- release/scripts/startup/bl_ui/space_time.py | 44 ++++++++++++++----- release/scripts/startup/bl_ui/space_view3d.py | 2 - 6 files changed, 42 insertions(+), 56 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 90dcc99e6d7..106bbd85717 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -213,19 +213,11 @@ class DOPESHEET_MT_marker(Menu): def draw(self, context): layout = self.layout + from .space_time import marker_menu_generic + marker_menu_generic(layout) + st = context.space_data - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - 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") diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index d4b8c415a7f..b57d421dfaf 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -144,16 +144,8 @@ class GRAPH_MT_marker(Menu): def draw(self, context): layout = self.layout - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") + from .space_time import marker_menu_generic + marker_menu_generic(layout) # TODO: pose markers for action edit mode only? diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index ffead81c507..c878c20c8a7 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -104,16 +104,8 @@ class NLA_MT_marker(Menu): def draw(self, context): layout = self.layout - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") + from .space_time import marker_menu_generic + marker_menu_generic(layout) class NLA_MT_edit(Menu): diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 2e957effccd..a4dcf64b679 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -158,18 +158,8 @@ class SEQUENCER_MT_marker(Menu): def draw(self, context): layout = self.layout - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") - - #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS) + from .space_time import marker_menu_generic + marker_menu_generic(layout) class SEQUENCER_MT_change(Menu): diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index db009fe43c2..6f8e6a574ec 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -36,6 +36,7 @@ class TIME_HT_header(Header): if context.area.show_menus: row.menu("TIME_MT_view") + row.menu("TIME_MT_marker") row.menu("TIME_MT_frame") row.menu("TIME_MT_playback") @@ -91,6 +92,15 @@ class TIME_HT_header(Header): row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT') +class TIME_MT_marker(bpy.types.Menu): + bl_label = "Marker" + + def draw(self, context): + layout = self.layout + + marker_menu_generic(layout) + + class TIME_MT_view(Menu): bl_label = "View" @@ -142,17 +152,6 @@ class TIME_MT_frame(Menu): def draw(self, context): layout = self.layout - layout.operator("marker.add", text="Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") - - layout.separator() - layout.operator("time.start_frame_set") layout.operator("time.end_frame_set") @@ -197,5 +196,28 @@ class TIME_MT_autokey(Menu): layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS') layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS') + +def marker_menu_generic(layout): + + #layout.operator_context = 'EXEC_REGION_WIN' + + layout.column() + layout.operator("marker.add", "Add Marker") + layout.operator("marker.duplicate", text="Duplicate Marker") + + if(len(bpy.data.scenes) > 10): + layout.operator_context = 'INVOKE_DEFAULT' + layout.operator("marker.make_links_scene", text="Duplicate Marker to Scene...", icon='OUTLINER_OB_EMPTY') + else: + layout.operator_menu_enum("marker.make_links_scene", "scene", text="Duplicate Marker to Scene...") + + layout.operator("marker.delete", text="Delete Marker") + + layout.separator() + + layout.operator("marker.rename", text="Rename Marker") + layout.operator("marker.move", text="Grab/Move Marker") + + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 07c860fca31..3f5b7b86e89 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -976,10 +976,8 @@ class VIEW3D_MT_make_links(Menu): if(len(bpy.data.scenes) > 10): layout.operator_context = 'INVOKE_DEFAULT' layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY') - layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY') else: layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...") - layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...") layout.operator_enum("object.make_links_data", "type") # inline