diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-10-16 03:53:11 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-10-16 15:29:38 +0300 |
commit | 9a9a663f40d55e1f94d23029ed3962b21f8aaca2 (patch) | |
tree | 27d49daca43a1664d8f80e32359a30ae6aeee01c /source/blender/editors/space_outliner/outliner_edit.c | |
parent | f929045c2c1f8aa5ab458f99e6c9696fbd4397d2 (diff) |
Outliner: Rework element selection behavior
* LMB now replaces selection instead of adding to it. Shift+LMB adds to selection (or removes if already selected). This is usual selection behavior Blender.
* Outliner selection isn't completely separate from object/sequencer-strip/render-layer/... selection anymore, when selecting an outliner item we now always try to select (and activate) the object it belongs to. Previously you had to click the name or icon of an item to select the object (or whatever) and on empty space within the row to set outliner selection.
* Collapsed items may show click-able icons for their children (nothing new). Clicking on such an icon will also select the hidden item it represents now, you'll notice after opening the parent. This valid from a technical POV, I'm not sure if this is wanted from user POV though. Changing would be easy, feedback welcome!
* Code cleanup.
Part of T37430.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_edit.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index b8883371213..87e6be76de8 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -150,16 +150,11 @@ TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2] return NULL; } -/* ************************************************************** */ - -/* Highlight --------------------------------------------------- */ - /** * Try to find an item under y-coordinate \a view_co_y (view-space). * \note Recursive */ -static TreeElement *outliner_find_item_at_y( - const SpaceOops *soops, const ListBase *tree, float view_co_y) +TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y) { for (TreeElement *te_iter = tree->first; te_iter; te_iter = te_iter->next) { if (view_co_y < (te_iter->ys + UI_UNIT_Y)) { @@ -180,6 +175,35 @@ static TreeElement *outliner_find_item_at_y( return NULL; } +/** + * Collapsed items can show their children as click-able icons. This function tries to find + * such an icon that represents the child item at x-coordinate \a view_co_x (view-space). + * + * \return a hovered child item or \a parent_te (if no hovered child found). + */ +TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x) +{ + if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) { /* if parent_te is opened, it doesn't show childs in row */ + /* no recursion, items can only display their direct children in the row */ + for (TreeElement *child_te = parent_te->subtree.first; + child_te && view_co_x >= child_te->xs; /* don't look further if co_x is smaller than child position*/ + child_te = child_te->next) + { + if ((child_te->flag & TE_ICONROW) && (view_co_x > child_te->xs) && (view_co_x < child_te->xend)) { + return child_te; + } + } + } + + /* return parent if no child is hovered */ + return (TreeElement *)parent_te; +} + + +/* ************************************************************** */ + +/* Highlight --------------------------------------------------- */ + static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { ARegion *ar = CTX_wm_region(C); |