diff options
Diffstat (limited to 'source/blender/editors/space_outliner/tree/common.cc')
-rw-r--r-- | source/blender/editors/space_outliner/tree/common.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/tree/common.cc b/source/blender/editors/space_outliner/tree/common.cc index 306d59288f4..c6b5ee3b7ef 100644 --- a/source/blender/editors/space_outliner/tree/common.cc +++ b/source/blender/editors/space_outliner/tree/common.cc @@ -20,10 +20,18 @@ * Functions and helpers shared between tree-display types or other tree related code. */ +#include "BLI_listbase.h" + #include "BKE_idtype.h" +#include "DNA_anim_types.h" +#include "DNA_object_types.h" +#include "DNA_outliner_types.h" + #include "RNA_access.h" +#include "../outliner_intern.hh" +#include "common.hh" #include "tree_display.hh" /* -------------------------------------------------------------------- */ @@ -38,3 +46,33 @@ const char *outliner_idcode_to_plural(short idcode) } /** \} */ + +void outliner_make_object_parent_hierarchy(ListBase *lb) +{ + /* build hierarchy */ + /* XXX also, set extents here... */ + TreeElement *te = reinterpret_cast<TreeElement *>(lb->first); + while (te) { + TreeElement *ten = te->next; + TreeStoreElem *tselem = TREESTORE(te); + + if ((tselem->type == TSE_SOME_ID) && te->idcode == ID_OB) { + Object *ob = (Object *)tselem->id; + if (ob->parent && ob->parent->id.newid) { + BLI_remlink(lb, te); + TreeElement *tep = (TreeElement *)ob->parent->id.newid; + BLI_addtail(&tep->subtree, te); + te->parent = tep; + } + } + te = ten; + } +} + +bool outliner_animdata_test(const AnimData *adt) +{ + if (adt) { + return (adt->action || adt->drivers.first || adt->nla_tracks.first); + } + return false; +} |