Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-18 13:16:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-18 13:44:17 +0300
commit6aef124e7d2869a692dd564a4515f2304924da33 (patch)
tree9ed5d09fd9a94761ce08db54abe2b5082a00029f /release
parentd55a9cac2c0aa6a7d130a256cac7c04e52cdee4a (diff)
UI: move region toggling to properties
Each space had separate operators, duplicating logic. Use RNA properties instead so adding the ability to toggle other region types (floating redo region for eg) doesn't need to have an extra operator per space type. It's also nicer to show a check-box for something which can be toggled.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py62
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py15
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py5
-rw-r--r--release/scripts/startup/bl_ui/space_dopesheet.py3
-rw-r--r--release/scripts/startup/bl_ui/space_graph.py2
-rw-r--r--release/scripts/startup/bl_ui/space_image.py4
-rw-r--r--release/scripts/startup/bl_ui/space_nla.py3
-rw-r--r--release/scripts/startup/bl_ui/space_node.py4
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py2
-rw-r--r--release/scripts/startup/bl_ui/space_text.py4
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py4
11 files changed, 74 insertions, 34 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 92ad7cc52a5..9dc57ac08bb 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -153,6 +153,21 @@ def op_tool_cycle(tool, kmi_args):
# ------------------------------------------------------------------------------
# Keymap Templates
+def _template_space_region_type_toggle(*, toolbar_key=None, sidebar_key=None):
+ items = []
+ if toolbar_key is not None:
+ items.append(
+ ("wm.context_toggle", toolbar_key,
+ {"properties": [("data_path", 'space_data.show_region_toolbar')]})
+ )
+ if sidebar_key is not None:
+ items.append(
+ ("wm.context_toggle", sidebar_key,
+ {"properties": [("data_path", 'space_data.show_region_ui')]}),
+ )
+ return items
+
+
def _template_items_select_actions(params, operator):
if not params.use_select_all_toggle:
return [
@@ -900,8 +915,10 @@ def km_view3d_generic(_params):
)
items.extend([
- ("view3d.properties", {"type": 'N', "value": 'PRESS'}, None),
- ("view3d.toolshelf", {"type": 'T', "value": 'PRESS'}, None),
+ *_template_space_region_type_toggle(
+ toolbar_key={"type": 'T', "value": 'PRESS'},
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ )
])
return keymap
@@ -1328,7 +1345,9 @@ def km_graph_editor_generic(_params):
)
items.extend([
- ("graph.properties", {"type": 'N', "value": 'PRESS'}, None),
+ *_template_space_region_type_toggle(
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
("graph.extrapolation_type", {"type": 'E', "value": 'PRESS', "shift": True}, None),
("anim.channels_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None),
("graph.hide", {"type": 'H', "value": 'PRESS'},
@@ -1464,14 +1483,16 @@ def km_image_generic(_params):
)
items.extend([
+ *_template_space_region_type_toggle(
+ toolbar_key={"type": 'T', "value": 'PRESS'},
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
("image.new", {"type": 'N', "value": 'PRESS', "alt": True}, None),
("image.open", {"type": 'O', "value": 'PRESS', "alt": True}, None),
("image.reload", {"type": 'R', "value": 'PRESS', "alt": True}, None),
("image.read_viewlayers", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
("image.save", {"type": 'S', "value": 'PRESS', "alt": True}, None),
("image.save_as", {"type": 'S', "value": 'PRESS', "shift": True}, None),
- ("image.properties", {"type": 'N', "value": 'PRESS'}, None),
- ("image.toolshelf", {"type": 'T', "value": 'PRESS'}, None),
("image.cycle_render_slot", {"type": 'J', "value": 'PRESS'}, None),
("image.cycle_render_slot", {"type": 'J', "value": 'PRESS', "alt": True},
{"properties": [("reverse", True)]}),
@@ -1558,8 +1579,10 @@ def km_node_generic(_params):
)
items.extend([
- ("node.properties", {"type": 'N', "value": 'PRESS'}, None),
- ("node.toolbar", {"type": 'T', "value": 'PRESS'}, None),
+ *_template_space_region_type_toggle(
+ toolbar_key={"type": 'T', "value": 'PRESS'},
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
])
return keymap
@@ -1864,9 +1887,10 @@ def km_dopesheet_generic(_params):
)
items.extend([
- ("action.properties", {"type": 'N', "value": 'PRESS'}, None),
- ("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True},
- {"properties": [("data_path", 'area.type'), ("value", 'GRAPH_EDITOR')]})
+ *_template_space_region_type_toggle(
+ toolbar_key={"type": 'T', "value": 'PRESS'},
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
])
return keymap
@@ -1985,7 +2009,9 @@ def km_nla_generic(_params):
)
items.extend([
- ("nla.properties", {"type": 'N', "value": 'PRESS'}, None),
+ *_template_space_region_type_toggle(
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
("nla.tweakmode_enter", {"type": 'TAB', "value": 'PRESS'}, None),
("nla.tweakmode_exit", {"type": 'TAB', "value": 'PRESS'}, None),
("nla.tweakmode_enter", {"type": 'TAB', "value": 'PRESS', "shift": True},
@@ -2098,11 +2124,13 @@ def km_text_generic(params):
)
items.extend([
+ *_template_space_region_type_toggle(
+ sidebar_key={"type": 'T', "value": 'PRESS', "ctrl": True},
+ ),
("text.start_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, None),
("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
("text.replace", {"type": 'H', "value": 'PRESS', "ctrl": True}, None),
- ("text.properties", {"type": 'T', "value": 'PRESS', "ctrl": True}, None),
])
if params.apple:
@@ -2297,7 +2325,9 @@ def km_sequencercommon(_params):
)
items.extend([
- ("sequencer.properties", {"type": 'N', "value": 'PRESS'}, None),
+ *_template_space_region_type_toggle(
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True},
{"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}),
("sequencer.view_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None),
@@ -2521,9 +2551,11 @@ def km_clip(_params):
)
items.extend([
+ *_template_space_region_type_toggle(
+ toolbar_key={"type": 'T', "value": 'PRESS'},
+ sidebar_key={"type": 'N', "value": 'PRESS'},
+ ),
("clip.open", {"type": 'O', "value": 'PRESS', "alt": True}, None),
- ("clip.tools", {"type": 'T', "value": 'PRESS'}, None),
- ("clip.properties", {"type": 'N', "value": 'PRESS'}, None),
("clip.track_markers", {"type": 'LEFT_ARROW', "value": 'PRESS', "alt": True},
{"properties": [("backwards", True), ("sequence", False)]}),
("clip.track_markers", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True},
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 4eb13b263c6..a91787298f8 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -588,8 +588,10 @@ def km_view3d_generic(_params):
)
items.extend([
- ("view3d.toolshelf", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True}, None),
- ("view3d.properties", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, None),
+ ("wm.context_toggle", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True},
+ {"properties": [("data_path", 'space_data.show_region_toolbar')]}),
+ ("wm.context_toggle", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True},
+ {"properties": [("data_path", 'space_data.show_region_ui')]}),
])
return keymap
@@ -1277,7 +1279,8 @@ def km_dopesheet_generic(params):
)
items.extend([
- ("action.properties", {"type": 'N', "value": 'PRESS'}, None),
+ ("wm.context_toggle", {"type": 'N', "value": 'PRESS'},
+ {"properties": [("data_path", 'space_data.show_region_ui')]}),
("wm.context_set_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'area.type'), ("value", 'GRAPH_EDITOR')]})
])
@@ -1482,7 +1485,8 @@ def km_text_generic(params):
("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
("text.replace", {"type": 'H', "value": 'PRESS', "ctrl": True}, None),
- ("text.properties", {"type": 'I', "value": 'PRESS', "ctrl": True}, None),
+ ("wm.context_toggle", {"type": 'I', "value": 'PRESS', "ctrl": True},
+ {"properties": [("data_path", 'space_data.show_region_ui')]}),
])
return keymap
@@ -1638,7 +1642,8 @@ def km_sequencercommon(_params):
)
items.extend([
- ("sequencer.properties", {"type": 'N', "value": 'PRESS'}, None),
+ ("wm.context_toggle", {"type": 'N', "value": 'PRESS'},
+ {"properties": [("data_path", 'space_data.show_region_ui')]}),
("wm.context_toggle", {"type": 'O', "value": 'PRESS', "shift": True},
{"properties": [("data_path", 'scene.sequence_editor.show_overlay')]}),
#("sequencer.view_toggle", {"type": 'TAB', "value": 'PRESS', "ctrl": True}, None),
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 436a87c2e93..32c8d9af0bc 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1231,8 +1231,9 @@ class CLIP_MT_view(Menu):
sc = context.space_data
if sc.view == 'CLIP':
- layout.operator("clip.properties", icon='MENU_PANEL')
- layout.operator("clip.tools", icon='MENU_PANEL')
+ layout.prop(sc, "show_region_ui")
+ layout.prop(sc, "show_region_toolbar")
+
layout.separator()
layout.operator("clip.view_selected")
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index e3d5aaf2169..d67ceacd3de 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -323,7 +323,8 @@ class DOPESHEET_MT_view(Menu):
st = context.space_data
- layout.operator("action.properties", icon='MENU_PANEL')
+ layout.prop(st, "show_region_ui")
+
layout.separator()
layout.prop(st.dopesheet, "use_multi_word_filter", text="Multi-word Match Search")
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 09f9529c302..2e7fb2e0083 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -111,7 +111,7 @@ class GRAPH_MT_view(Menu):
st = context.space_data
- layout.operator("graph.properties", icon='MENU_PANEL')
+ layout.prop(st, "show_region_ui")
layout.separator()
layout.prop(st, "use_realtime_update")
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index de0b6f8cc1d..163e75165da 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -69,8 +69,8 @@ class IMAGE_MT_view(Menu):
show_uvedit = sima.show_uvedit
show_render = sima.show_render
- layout.operator("image.properties", icon='MENU_PANEL')
- layout.operator("image.toolshelf", icon='MENU_PANEL')
+ layout.prop(sima, "show_region_toolbar")
+ layout.prop(sima, "show_region_ui")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py
index 62a8e87b779..a836fdf5d19 100644
--- a/release/scripts/startup/bl_ui/space_nla.py
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -87,8 +87,7 @@ class NLA_MT_view(Menu):
st = context.space_data
- layout.operator("nla.properties", icon='MENU_PANEL')
-
+ layout.prop(st, "show_region_ui")
layout.separator()
layout.prop(st, "use_realtime_update")
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 12c51da3e29..374ef912303 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -213,8 +213,8 @@ class NODE_MT_view(Menu):
snode = context.space_data
- layout.operator("node.properties", icon='MENU_PANEL')
- layout.operator("node.toolbar", icon='MENU_PANEL')
+ layout.prop(snode, "show_region_toolbar")
+ layout.prop(snode, "show_region_ui")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 95e76bd077c..f8c628faf22 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -175,7 +175,7 @@ class SEQUENCER_MT_view(Menu):
# mode, else the lookup for the shortcut will fail in
# wm_keymap_item_find_props() (see #32595).
layout.operator_context = 'INVOKE_REGION_PREVIEW'
- layout.operator("sequencer.properties", icon='MENU_PANEL')
+ layout.prop(st, "show_region_ui")
layout.operator_context = 'INVOKE_DEFAULT'
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index 07184c81e42..917c700f027 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -188,7 +188,9 @@ class TEXT_MT_view(Menu):
def draw(self, context):
layout = self.layout
- layout.operator("text.properties", icon='MENU_PANEL')
+ st = context.space_data
+
+ layout.prop(st, "show_region_ui")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 9c326372f89..074773c6bc9 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -580,8 +580,8 @@ class VIEW3D_MT_view(Menu):
layout = self.layout
view = context.space_data
- layout.operator("view3d.toolshelf", icon='MENU_PANEL')
- layout.operator("view3d.properties", icon='MENU_PANEL')
+ layout.prop(view, "show_region_toolbar")
+ layout.prop(view, "show_region_ui")
layout.separator()