diff options
author | Valentin <Poulpator> | 2020-03-02 18:05:59 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2020-03-02 18:07:34 +0300 |
commit | 7b8db971d42f6d6b7b1c74959758266ce8c859e0 (patch) | |
tree | 1ba8b885eaa68a50cdfd4ca37a229ae46c21e00a /source/blender/windowmanager | |
parent | 51bce18b6f97dd6c21899e43f4ee4491d0061e92 (diff) |
Cleanup: Use generics properties for arrow keys navigation (walk-select)
This patch refactors arrow keys navigation to move properties and enum
to generic ED_select_utils.h and property to
WM_operator_properties_select_walk_direction()
No functional change
Reviewed By: Julian Eisel
Differential Revision: https://developer.blender.org/D4771
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_props.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 58e312c67c9..1c86e4da291 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -483,6 +483,7 @@ void WM_operator_properties_select_random(struct wmOperatorType *ot); int WM_operator_properties_select_random_seed_increment_get(wmOperator *op); void WM_operator_properties_select_operation(struct wmOperatorType *ot); void WM_operator_properties_select_operation_simple(struct wmOperatorType *ot); +void WM_operator_properties_select_walk_direction(struct wmOperatorType *ot); void WM_operator_properties_generic_select(struct wmOperatorType *ot); struct CheckerIntervalParams { int nth; /* bypass when set to zero */ diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c index 4c0b35a65e5..676ce655a42 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.c +++ b/source/blender/windowmanager/intern/wm_operator_props.c @@ -399,6 +399,25 @@ void WM_operator_properties_select_operation_simple(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } +void WM_operator_properties_select_walk_direction(wmOperatorType *ot) +{ + static const EnumPropertyItem direction_items[] = { + {UI_SELECT_WALK_UP, "UP", 0, "Prev", ""}, + {UI_SELECT_WALK_DOWN, "DOWN", 0, "Next", ""}, + {UI_SELECT_WALK_LEFT, "LEFT", 0, "Left", ""}, + {UI_SELECT_WALK_RIGHT, "RIGHT", 0, "Right", ""}, + {0, NULL, 0, NULL, NULL}, + }; + PropertyRNA *prop; + prop = RNA_def_enum(ot->srna, + "direction", + direction_items, + 0, + "Walk Direction", + "Select/Deselect element in this direction"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); +} + /** * Selecting and tweaking items are overlapping operations. Getting both to work without conflicts * requires special care. See |