diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-20 01:29:11 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-20 01:29:11 +0300 |
commit | 2d5b89be89c20f36c3607fd52666dcdb6c9a597d (patch) | |
tree | 95e79191ae6113644bc49e5edae6876a8b648fc1 /source/blender/editors/space_outliner/outliner_intern.h | |
parent | a961a2189cb38ffb368d6781aa57177bfefe0e36 (diff) |
Cleanup: Disentangle outliner active status "get" and "set"
Previously the same functions were used to both set and get the active
state for outliner tree elements. This has quite a few problems.
- It's hard to tell when data is changed or simply read
- It prevents using `const`
- The code is full of if statements, making it longer and less readable.
This commit replaces the `tree_element_type_active` and
`tree_element_active` functions with `_get` and `_set` variants. One
has const arguments and returns the active state, the other deals only
with setting the state. While this refactor results in slightly more
lines of code, the result is much better in my opinion.
This commit also removes unused variables from arguments of the affected
functions.
Differential Revision: https://developer.blender.org/D10232
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_intern.h')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 9413b7a9613..593c33bd3df 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -288,19 +288,24 @@ void outliner_collection_isolate_flag(struct Scene *scene, int tree_element_id_type_to_index(TreeElement *te); /* outliner_select.c -------------------------------------------- */ -eOLDrawState tree_element_type_active(struct bContext *C, - const TreeViewContext *tvc, - struct SpaceOutliner *space_outliner, - TreeElement *te, - TreeStoreElem *tselem, - const eOLSetState set, - bool recursive); -eOLDrawState tree_element_active(struct bContext *C, - const TreeViewContext *tvc, - SpaceOutliner *space_outliner, - TreeElement *te, - const eOLSetState set, - const bool handle_all_types); +void tree_element_type_active_set(struct bContext *C, + const TreeViewContext *tvc, + TreeElement *te, + TreeStoreElem *tselem, + const eOLSetState set, + bool recursive); +eOLDrawState tree_element_type_active_state_get(const struct bContext *C, + const struct TreeViewContext *tvc, + const TreeElement *te, + const TreeStoreElem *tselem); +void tree_element_activate(struct bContext *C, + const TreeViewContext *tvc, + TreeElement *te, + const eOLSetState set, + const bool handle_all_types); +eOLDrawState tree_element_active_state_get(const TreeViewContext *tvc, + const TreeElement *te, + const TreeStoreElem *tselem); struct bPoseChannel *outliner_find_parent_bone(TreeElement *te, TreeElement **r_bone_te); |