Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_select.c
| Show First 20 Lines • Show All 1,624 Lines • ▼ Show 20 Lines | static TreeElement *outliner_find_next_element(SpaceOutliner *space_outliner, TreeElement *te) | ||||
| } | } | ||||
| else { | else { | ||||
| te = outliner_element_find_successor_in_parents(te); | te = outliner_element_find_successor_in_parents(te); | ||||
| } | } | ||||
| return te; | return te; | ||||
| } | } | ||||
| static TreeElement *outliner_walk_left(SpaceOutliner *space_outliner, | |||||
| TreeElement *te, | |||||
| bool toggle_all) | |||||
| { | |||||
| TreeStoreElem *tselem = TREESTORE(te); | |||||
| if (TSELEM_OPEN(tselem, space_outliner)) { | |||||
| outliner_item_openclose(te, false, toggle_all); | |||||
| } | |||||
| /* Only walk up a level if the element is closed and not toggling expand */ | |||||
| else if (!toggle_all && te->parent) { | |||||
| te = te->parent; | |||||
| } | |||||
| return te; | |||||
| } | |||||
| static TreeElement *outliner_walk_right(SpaceOutliner *space_outliner, | |||||
| TreeElement *te, | |||||
| bool toggle_all) | |||||
| { | |||||
| TreeStoreElem *tselem = TREESTORE(te); | |||||
| /* Only walk down a level if the element is open and not toggling expand */ | |||||
| if (!toggle_all && TSELEM_OPEN(tselem, space_outliner) && te->subtree.first) { | |||||
| te = te->subtree.first; | |||||
| } | |||||
| else { | |||||
| outliner_item_openclose(te, true, toggle_all); | |||||
| } | |||||
| return te; | |||||
| } | |||||
| static TreeElement *do_outliner_select_walk(SpaceOutliner *space_outliner, | static TreeElement *do_outliner_select_walk(SpaceOutliner *space_outliner, | ||||
| TreeElement *te, | TreeElement *te, | ||||
| const int direction, | const int direction, | ||||
| const bool extend, | const bool extend, | ||||
| const bool toggle_all) | const bool toggle_all) | ||||
| { | { | ||||
| TreeStoreElem *tselem = TREESTORE(te); | TreeStoreElem *tselem = TREESTORE(te); | ||||
| switch (direction) { | switch (direction) { | ||||
| case UI_SELECT_WALK_UP: | case UI_SELECT_WALK_UP: | ||||
| te = outliner_find_previous_element(space_outliner, te); | te = outliner_find_previous_element(space_outliner, te); | ||||
| break; | break; | ||||
| case UI_SELECT_WALK_DOWN: | case UI_SELECT_WALK_DOWN: | ||||
| te = outliner_find_next_element(space_outliner, te); | te = outliner_find_next_element(space_outliner, te); | ||||
| break; | break; | ||||
| case UI_SELECT_WALK_LEFT: | case UI_SELECT_WALK_LEFT: | ||||
| outliner_item_openclose(te, false, toggle_all); | te = outliner_walk_left(space_outliner, te, toggle_all); | ||||
| break; | break; | ||||
| case UI_SELECT_WALK_RIGHT: | case UI_SELECT_WALK_RIGHT: | ||||
| outliner_item_openclose(te, true, toggle_all); | te = outliner_walk_right(space_outliner, te, toggle_all); | ||||
| break; | break; | ||||
| } | } | ||||
| /* If new element is already selected, deselect the previous element */ | /* If new element is already selected, deselect the previous element */ | ||||
| TreeStoreElem *tselem_new = TREESTORE(te); | TreeStoreElem *tselem_new = TREESTORE(te); | ||||
| if (extend) { | if (extend) { | ||||
| tselem->flag = (tselem_new->flag & TSE_SELECTED) ? (tselem->flag & ~TSE_SELECTED) : | tselem->flag = (tselem_new->flag & TSE_SELECTED) ? (tselem->flag & ~TSE_SELECTED) : | ||||
| (tselem->flag | TSE_SELECTED); | (tselem->flag | TSE_SELECTED); | ||||
| ▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines | |||||