diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2020-06-18 05:15:21 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2020-06-18 05:31:55 +0300 |
commit | 18ccf328ac5611221e073aebaddde1b0b2169984 (patch) | |
tree | 7edfddbbb3aee08af478ab352fe22355329f684f /source/blender/editors/space_outliner/outliner_utils.c | |
parent | e079bf6996fca01ea6b127f5e8f4944dd173b388 (diff) |
Outliner: Fix (unreported) object select in multiple collections
Previous commits to fix parent selection introduced incorrect behavior
when selecting objects linked to multiple collections. The clicked
object would be selected, but also the first listed object in the tree
would be selected.
Instead of always searching for a parent object to select, only search
back when the selected element is not an ID_OB. This prevents multiple
selection of objects linked to multiple collections.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_utils.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_utils.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c index a058c30cef2..5f19d8b8757 100644 --- a/source/blender/editors/space_outliner/outliner_utils.c +++ b/source/blender/editors/space_outliner/outliner_utils.c @@ -256,7 +256,7 @@ TreeElement *outliner_find_editbone(ListBase *lb, const EditBone *ebone) return NULL; } -ID *outliner_search_back(TreeElement *te, short idcode) +TreeElement *outliner_search_back_te(TreeElement *te, short idcode) { TreeStoreElem *tselem; te = te->parent; @@ -264,13 +264,26 @@ ID *outliner_search_back(TreeElement *te, short idcode) while (te) { tselem = TREESTORE(te); if (tselem->type == 0 && te->idcode == idcode) { - return tselem->id; + return te; } te = te->parent; } return NULL; } +ID *outliner_search_back(TreeElement *te, short idcode) +{ + TreeElement *search_te; + TreeStoreElem *tselem; + + search_te = outliner_search_back_te(te, idcode); + if (search_te) { + tselem = TREESTORE(search_te); + return tselem->id; + } + return NULL; +} + /** * Iterate over all tree elements (pre-order traversal), executing \a func callback for * each tree element matching the optional filters. |