Cleanup: move UV element keymap items into a loop

Also add explanation for non-obvious dummy key-map item.
This commit is contained in:
Campbell Barton 2021-05-07 13:34:55 +10:00
parent 5a3307230e
commit 026a9cdc21
1 changed files with 4 additions and 8 deletions

View File

@ -278,15 +278,11 @@ def _template_items_uv_select_mode(params):
else:
return [
*_template_items_editmode_mesh_select_mode(params),
# Hack to prevent fall-through, when sync select isn't enabled (and the island button isn't visible).
("mesh.select_mode", {"type": 'FOUR', "value": 'PRESS'}, None),
("wm.context_set_enum", {"type": 'ONE', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.uv_select_mode'), ("value", 'VERTEX')]}),
("wm.context_set_enum", {"type": 'TWO', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.uv_select_mode'), ("value", 'EDGE')]}),
("wm.context_set_enum", {"type": 'THREE', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.uv_select_mode'), ("value", 'FACE')]}),
("wm.context_set_enum", {"type": 'FOUR', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.uv_select_mode'), ("value", 'ISLAND')]}),
*(("wm.context_set_enum", {"type": NUMBERS_1[i], "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.uv_select_mode'), ("value", ty)]})
for i, ty in enumerate(('VERTEX', 'EDGE', 'FACE', 'ISLAND')))
]