diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-26 06:08:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-26 06:09:42 +0300 |
commit | 5b28fdb6359cba7d80bc51d9a43b36f164cafbab (patch) | |
tree | 76773aecb346e785cfce195320ad652b5ec40852 /source/blender/editors | |
parent | 27cc015581c0ec269d9f0638b867a74630c50aca (diff) |
Cleanup: use const for outliner args
Also c99 edits for outliner_find_id
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 6 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 27 |
2 files changed, 18 insertions, 15 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index c1a26c10fa6..dc81be7a8e0 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -130,9 +130,9 @@ typedef enum { void outliner_free_tree(ListBase *lb); void outliner_cleanup_tree(struct SpaceOops *soops); -TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse); -TreeElement *outliner_find_tree_element(ListBase *lb, TreeStoreElem *store_elem); -TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id); +TreeElement *outliner_find_tse(struct SpaceOops *soops, const TreeStoreElem *tse); +TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem); +TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, const struct ID *id); TreeElement *outliner_find_posechannel(struct SpaceOops *soops, ListBase *lb, const struct bPoseChannel *pchan); TreeElement *outliner_find_editbone(struct SpaceOops *soops, ListBase *lb, const struct EditBone *ebone); struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index afa2210d3ed..a687f61d69f 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -199,7 +199,7 @@ void outliner_cleanup_tree(SpaceOops *soops) } /* Find specific item from the treestore */ -TreeElement *outliner_find_tree_element(ListBase *lb, TreeStoreElem *store_elem) +TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem) { TreeElement *te, *tes; for (te = lb->first; te; te = te->next) { @@ -211,7 +211,7 @@ TreeElement *outliner_find_tree_element(ListBase *lb, TreeStoreElem *store_elem) } /* tse is not in the treestore, we use its contents to find a match */ -TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) +TreeElement *outliner_find_tse(SpaceOops *soops, const TreeStoreElem *tse) { TreeStoreElem *tselem; @@ -226,19 +226,22 @@ TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) } /* Find treestore that refers to given ID */ -TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) +TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, const ID *id) { - TreeElement *te, *tes; - TreeStoreElem *tselem; - - for (te = lb->first; te; te = te->next) { - tselem = TREESTORE(te); + for (TreeElement *te = lb->first; te; te = te->next) { + TreeStoreElem *tselem = TREESTORE(te); if (tselem->type == 0) { - if (tselem->id == id) return te; + if (tselem->id == id) { + return te; + } /* only deeper on scene or object */ - if (te->idcode == ID_OB || te->idcode == ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode == ID_GR)) { - tes = outliner_find_id(soops, &te->subtree, id); - if (tes) return tes; + if (ELEM(te->idcode, ID_OB, ID_SCE) || + ((soops->outlinevis == SO_GROUPS) && (te->idcode == ID_GR))) + { + TreeElement *tes = outliner_find_id(soops, &te->subtree, id); + if (tes) { + return tes; + } } } } |