[Bf-blender-cvs] [955c9dd98bb] soc-2019-outliner: Outliner: Add open/close all children to walk navigation
Nathan Craddock
noreply at git.blender.org
Fri Jul 26 04:40:10 CEST 2019
Commit: 955c9dd98bb70d066bcbe13458e3e334a522eff3
Author: Nathan Craddock
Date: Thu Jul 25 20:38:08 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB955c9dd98bb70d066bcbe13458e3e334a522eff3
Outliner: Add open/close all children to walk navigation
When pressing Shift and left or right arrow, expand or collapse
all child elements in walk navigation.
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M source/blender/editors/space_outliner/outliner_intern.h
M source/blender/editors/space_outliner/outliner_select.c
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 07fbe8ebff8..e3608fbb54e 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -721,7 +721,11 @@ def km_outliner(params):
("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS', "shift": True},
{"properties": [("direction", 'DOWN'), ("extend", True)]}),
("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS'}, {"properties": [("direction", 'LEFT')]}),
+ ("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS', "shift": True},
+ {"properties": [("direction", 'LEFT'), ("toggle_all", True)]}),
("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS'}, {"properties": [("direction", 'RIGHT')]}),
+ ("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS', "shift": True},
+ {"properties": [("direction", 'RIGHT'), ("toggle_all", True)]}),
("outliner.item_openclose", {"type": 'LEFTMOUSE', "value": 'CLICK'},
{"properties": [("all", False)]}),
("outliner.item_openclose", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index e00eb5ea365..387bfd18f68 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -352,6 +352,8 @@ void item_object_mode_exit_cb(struct bContext *C,
void outliner_set_coordinates(struct ARegion *ar, struct SpaceOutliner *soops);
+bool outliner_item_openclose(TreeElement *te, bool toggle_all);
+
/* outliner_dragdrop.c */
void outliner_dropboxes(void);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 6e74eab160f..bf3066766d5 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1657,7 +1657,8 @@ static TreeElement *outliner_find_next_element(SpaceOutliner *soops, TreeElement
static void do_outliner_select_walk(SpaceOutliner *soops,
TreeElement *walk_element,
const int direction,
- const bool extend)
+ const bool extend,
+ const bool toggle_all)
{
TreeStoreElem *tselem = TREESTORE(walk_element);
@@ -1674,17 +1675,19 @@ static void do_outliner_select_walk(SpaceOutliner *soops,
walk_element = outliner_find_next_element(soops, walk_element);
break;
case OUTLINER_SELECT_WALK_LEFT:
- /* Close open element or jummp active to parent */
+ /* Close open element or walk to parent */
if (TSELEM_OPEN(tselem, soops)) {
- tselem->flag |= TSE_CLOSED;
+ outliner_item_openclose(walk_element, toggle_all);
}
else if (walk_element->parent) {
walk_element = walk_element->parent;
}
break;
case OUTLINER_SELECT_WALK_RIGHT:
- if (!TSELEM_OPEN(tselem, soops) && walk_element->subtree.first) {
- tselem->flag &= ~TSE_CLOSED;
+ if ((!TSELEM_OPEN(tselem, soops) ||
+ outliner_flag_is_any_test(&walk_element->subtree, TSE_CLOSED, 1)) &&
+ walk_element->subtree.first) {
+ outliner_item_openclose(walk_element, toggle_all);
}
break;
}
@@ -1743,13 +1746,14 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven
const int direction = RNA_enum_get(op->ptr, "direction");
const bool extend = RNA_boolean_get(op->ptr, "extend");
+ const bool toggle_all = RNA_boolean_get(op->ptr, "toggle_all");
bool changed;
TreeElement *walk_element = find_walk_select_start_element(soops, &changed);
/* If finding the starting walk select element did not move the element, proceed to walk */
if (!changed) {
- do_outliner_select_walk(soops, walk_element, direction, extend);
+ do_outliner_select_walk(soops, walk_element, direction, extend, toggle_all);
}
else {
TREESTORE(walk_element)->flag |= TSE_SELECTED | TSE_WALK;
@@ -1793,6 +1797,9 @@ void OUTLINER_OT_select_walk(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
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(
+ ot->srna, "toggle_all", false, "Toggle All", "Toggle open/close hierarchy");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ****************************************************** */
More information about the Bf-blender-cvs
mailing list