patch [#27917] MARKER MENUS: Unification and adding "Duplicate Marker to Scene..."
authorCampbell Barton <ideasman42@gmail.com>
Thu, 3 Nov 2011 12:47:39 +0000 (12:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 3 Nov 2011 12:47:39 +0000 (12:47 +0000)
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.

release/scripts/startup/bl_ui/space_dopesheet.py
release/scripts/startup/bl_ui/space_graph.py
release/scripts/startup/bl_ui/space_nla.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_time.py
release/scripts/startup/bl_ui/space_view3d.py

index 90dcc99e6d74859f58fcf2f57748543e44a11b8d..106bbd857174070072a8b22f6988c4a6db2cbacb 100644 (file)
@@ -213,18 +213,10 @@ class DOPESHEET_MT_marker(Menu):
     def draw(self, context):
         layout = self.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")
+        from .space_time import marker_menu_generic
+        marker_menu_generic(layout)
 
-        layout.separator()
-
-        layout.operator("marker.rename", text="Rename Marker")
-        layout.operator("marker.move", text="Grab/Move Marker")
+        st = context.space_data
 
         if st.mode in {'ACTION', 'SHAPEKEY'} and st.action:
             layout.separator()
index d4b8c415a7f4fcb989004ce1c11b7ea668942bfa..b57d421dfaf44d36c0c9b26d787f9aff6ea64982 100644 (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?
 
index ffead81c5070f8ea4635a9d58e349fb42a325fb4..c878c20c8a71413eb41042e04894413e999cba75 100644 (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):
index 2e957effccdb0a8a7171c01b37edb6e7149e8365..a4dcf64b679f1db3524aba084d4b24a4ea1b26a9 100644 (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):
index db009fe43c223aa697ddfe7892d612aeb305a575..6f8e6a574ec02a82f1a3cebf8946f92ac31268c7 100644 (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__)
index 07c860fca31117be7443e15ddac4c1a977c6eb3e..3f5b7b86e89ef753f77f40290070830be5ef108c 100644 (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