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/editors/space_outliner | |
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/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 8 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 24 |
2 files changed, 5 insertions, 27 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 8075065e5c2..f83f53c5300 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -49,14 +49,6 @@ typedef enum TreeElementInsertType { TE_INSERT_INTO, } TreeElementInsertType; -/* Use generic walk select after D4771 is committed */ -typedef enum WalkSelectDirection { - OUTLINER_SELECT_WALK_UP, - OUTLINER_SELECT_WALK_DOWN, - OUTLINER_SELECT_WALK_LEFT, - OUTLINER_SELECT_WALK_RIGHT, -} WalkSelectDirection; - typedef enum TreeTraversalAction { /* Continue traversal regularly, don't skip children. */ TRAVERSE_CONTINUE = 0, diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 51e837db4c2..fd0dbd63c89 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -1636,16 +1636,16 @@ static TreeElement *do_outliner_select_walk(SpaceOutliner *soops, tselem->flag &= ~TSE_ACTIVE_WALK; switch (direction) { - case OUTLINER_SELECT_WALK_UP: + case UI_SELECT_WALK_UP: walk_element = outliner_find_previous_element(soops, walk_element); break; - case OUTLINER_SELECT_WALK_DOWN: + case UI_SELECT_WALK_DOWN: walk_element = outliner_find_next_element(soops, walk_element); break; - case OUTLINER_SELECT_WALK_LEFT: + case UI_SELECT_WALK_LEFT: outliner_item_openclose(walk_element, false, toggle_all); break; - case OUTLINER_SELECT_WALK_RIGHT: + case UI_SELECT_WALK_RIGHT: outliner_item_openclose(walk_element, true, toggle_all); break; } @@ -1748,14 +1748,6 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven void OUTLINER_OT_select_walk(wmOperatorType *ot) { - static const EnumPropertyItem direction_items[] = { - {OUTLINER_SELECT_WALK_UP, "UP", 0, "Up", ""}, - {OUTLINER_SELECT_WALK_DOWN, "DOWN", 0, "Down", ""}, - {OUTLINER_SELECT_WALK_LEFT, "LEFT", 0, "Left", ""}, - {OUTLINER_SELECT_WALK_RIGHT, "RIGHT", 0, "Right", ""}, - {0, NULL, 0, NULL, NULL}, - }; - /* identifiers */ ot->name = "Walk Select"; ot->idname = "OUTLINER_OT_select_walk"; @@ -1769,13 +1761,7 @@ void OUTLINER_OT_select_walk(wmOperatorType *ot) /* properties */ PropertyRNA *prop; - prop = RNA_def_enum(ot->srna, - "direction", - direction_items, - 0, - "Walk Direction", - "Select element in this direction"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); + WM_operator_properties_select_walk_direction(ot); prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection on walk"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean( |