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.
This commit is contained in:
Campbell Barton 2011-11-03 12:47:39 +00:00
parent aefa2cda10
commit 0e51c9014c
6 changed files with 42 additions and 56 deletions

View File

@ -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")

View File

@ -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?

View File

@ -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):

View File

@ -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):

View File

@ -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__)

View File

@ -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