UI: add menu search functionality to operator search menu
This has some advantages over operator search: - Some operators need options set to be usefully accessed. - Shows key bindings to access menus (for actions that don't have key bindings themselves). - Non operator actions such as check-boxes are also shown. - Menu items can control execution context, using invoke or execute where appropriate so we can control how the operator runs. Part of the design task T74157. This can be tested using the 'Experimental' preferences section or selected in the key-map editor.
This commit is contained in:
@@ -207,7 +207,8 @@ class TOPBAR_MT_editor_menus(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
if context.area.show_menus:
|
||||
# Allow calling this menu directly (this might not be a header area).
|
||||
if getattr(context.area, "show_menus"):
|
||||
layout.menu("TOPBAR_MT_app", text="", icon='BLENDER')
|
||||
else:
|
||||
layout.menu("TOPBAR_MT_app", text="Blender")
|
||||
|
@@ -2134,6 +2134,21 @@ class ExperimentalPanel:
|
||||
|
||||
url_prefix = "https://developer.blender.org/"
|
||||
|
||||
def _draw_items(self, context, items):
|
||||
prefs = context.preferences
|
||||
experimental = prefs.experimental
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
for prop_keywords, task in items:
|
||||
split = layout.split(factor=0.66)
|
||||
col = split.split()
|
||||
col.prop(experimental, **prop_keywords)
|
||||
col = split.split()
|
||||
col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
|
||||
|
||||
"""
|
||||
# Example panel, leave it here so we always have a template to follow even
|
||||
# after the features are gone from the experimental panel.
|
||||
@@ -2142,46 +2157,34 @@ class USERPREF_PT_experimental_virtual_reality(ExperimentalPanel, Panel):
|
||||
bl_label = "Virtual Reality"
|
||||
|
||||
def draw(self, context):
|
||||
prefs = context.preferences
|
||||
experimental = prefs.experimental
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
task = "T71347"
|
||||
split = layout.split(factor=0.66)
|
||||
col = split.split()
|
||||
col.prop(experimental, "use_virtual_reality_scene_inspection", text="Scene Inspection")
|
||||
col = split.split()
|
||||
col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
|
||||
|
||||
task = "T71348"
|
||||
split = layout.split(factor=0.66)
|
||||
col = split.column()
|
||||
col.prop(experimental, "use_virtual_reality_immersive_drawing", text="Continuous Immersive Drawing")
|
||||
col = split.column()
|
||||
col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
|
||||
self._draw_items(
|
||||
context, (
|
||||
({"property": "use_virtual_reality_scene_inspection"}, "T71347"),
|
||||
({"property": "use_virtual_reality_immersive_drawing"}, "T71348"),
|
||||
)
|
||||
)
|
||||
"""
|
||||
|
||||
class USERPREF_PT_experimental_ui(ExperimentalPanel, Panel):
|
||||
bl_label = "UI"
|
||||
|
||||
def draw(self, context):
|
||||
self._draw_items(
|
||||
context, (
|
||||
({"property": "use_menu_search"}, "T74157"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class USERPREF_PT_experimental_system(ExperimentalPanel, Panel):
|
||||
bl_label = "System"
|
||||
|
||||
def draw(self, context):
|
||||
prefs = context.preferences
|
||||
experimental = prefs.experimental
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
task = "T60695"
|
||||
split = layout.split(factor=0.66)
|
||||
col = split.split()
|
||||
col.prop(experimental, "use_undo_speedup")
|
||||
col = split.split()
|
||||
col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
|
||||
self._draw_items(
|
||||
context, (
|
||||
({"property": "use_undo_speedup"}, "T60695"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -2274,6 +2277,7 @@ classes = (
|
||||
# Popovers.
|
||||
USERPREF_PT_ndof_settings,
|
||||
|
||||
USERPREF_PT_experimental_ui,
|
||||
USERPREF_PT_experimental_system,
|
||||
|
||||
# Add dynamically generated editor theme panels last,
|
||||
|
Reference in New Issue
Block a user