Cleanup: pass context to draw method instead of accessing from bpy
authorCampbell Barton <ideasman42@gmail.com>
Wed, 13 Mar 2019 00:52:54 +0000 (11:52 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 13 Mar 2019 02:32:10 +0000 (13:32 +1100)
Allows for context overrides/mocking.

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

index 69a835b757a439a87aaab1b4defec94a981a2b92..7c3a9efa68ac8be71dac3c0a9a99d43356fdda3f 100644 (file)
@@ -411,7 +411,7 @@ class DOPESHEET_MT_marker(Menu):
         layout = self.layout
 
         from .space_time import marker_menu_generic
-        marker_menu_generic(layout)
+        marker_menu_generic(layout, context)
 
         st = context.space_data
 
index b12cde67599bf7af93ee17c6591fd21e055ea99f..3c9e23d86124d7e61152e97277af8078032581a2 100644 (file)
@@ -210,7 +210,7 @@ class GRAPH_MT_marker(Menu):
         layout = self.layout
 
         from .space_time import marker_menu_generic
-        marker_menu_generic(layout)
+        marker_menu_generic(layout, context)
 
         # TODO: pose markers for action edit mode only?
 
index b51a42a04cbbd02e5b8c13f2b22998473d1ec5ed..13f07c0a69c4e4fb2869302f0a9ad878307a40c4 100644 (file)
@@ -146,7 +146,7 @@ class NLA_MT_marker(Menu):
         layout = self.layout
 
         from .space_time import marker_menu_generic
-        marker_menu_generic(layout)
+        marker_menu_generic(layout, context)
 
 
 class NLA_MT_edit(Menu):
index 7fcc5a079804a40b48a894be7c5ead50585650a0..678050aa58a42a896e651e0eb6493134f5a0752c 100644 (file)
@@ -277,7 +277,7 @@ class SEQUENCER_MT_marker(Menu):
         is_sequencer_view = st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}
 
         from .space_time import marker_menu_generic
-        marker_menu_generic(layout)
+        marker_menu_generic(layout, context)
 
         if is_sequencer_view:
             layout.prop(st, "use_marker_sync")
index 726081b2bf59b9d25c1e9ed1040fd3fa1c0b4077..ffb285557a0cce096aed258f2ea1d54e30b867d9 100644 (file)
@@ -117,7 +117,7 @@ class TIME_MT_marker(Menu):
     def draw(self, context):
         layout = self.layout
 
-        marker_menu_generic(layout)
+        marker_menu_generic(layout, context)
 
 
 class TIME_MT_view(Menu):
@@ -175,8 +175,7 @@ class TIME_MT_cache(Menu):
         col.prop(st, "cache_rigidbody")
 
 
-def marker_menu_generic(layout):
-    from bpy import context
+def marker_menu_generic(layout, context):
 
     # layout.operator_context = 'EXEC_REGION_WIN'