diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-02-15 14:25:55 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-02-15 15:21:46 +0300 |
commit | 0688f6e01201defc36df906c2d7086eb7f44d849 (patch) | |
tree | 4344a73dc52e5703b0ddd6dfd5e0765d23b57a5f /source/blender/editors/space_outliner/outliner_tree.c | |
parent | d0609d09e465529bacb9e2d1086b292bf845a013 (diff) |
Code Cleanup: Reshuffle libraries and orphaned datablocks views to a more appropriate place in the file
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index d176fd29867..681a0a72a0f 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1227,6 +1227,80 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t } } + +/* ----------------------------------------------- */ + + +static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeElement *te, Library *lib) +{ + TreeElement *ten; + ListBase *lbarray[MAX_LIBARRAY]; + int a, tot; + + tot = set_listbasepointers(mainvar, lbarray); + for (a = 0; a < tot; a++) { + if (lbarray[a]->first) { + ID *id = lbarray[a]->first; + + /* check if there's data in current lib */ + for (; id; id = id->next) + if (id->lib == lib) + break; + + if (id) { + ten = outliner_add_element(soops, &te->subtree, (void *)lbarray[a], NULL, TSE_ID_BASE, 0); + ten->directdata = lbarray[a]; + + ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name)); + if (ten->name == NULL) + ten->name = "UNKNOWN"; + + for (id = lbarray[a]->first; id; id = id->next) { + if (id->lib == lib) + outliner_add_element(soops, &ten->subtree, id, ten, 0, 0); + } + } + } + } + +} + +static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) +{ + TreeElement *ten; + ListBase *lbarray[MAX_LIBARRAY]; + int a, tot; + + tot = set_listbasepointers(mainvar, lbarray); + for (a = 0; a < tot; a++) { + if (lbarray[a]->first) { + ID *id = lbarray[a]->first; + + /* check if there are any datablocks of this type which are orphans */ + for (; id; id = id->next) { + if (ID_REAL_USERS(id) <= 0) + break; + } + + if (id) { + /* header for this type of datablock */ + ten = outliner_add_element(soops, &soops->tree, (void *)lbarray[a], NULL, TSE_ID_BASE, 0); + ten->directdata = lbarray[a]; + + ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name)); + if (ten->name == NULL) + ten->name = "UNKNOWN"; + + /* add the orphaned datablocks - these will not be added with any subtrees attached */ + for (id = lbarray[a]->first; id; id = id->next) { + if (ID_REAL_USERS(id) <= 0) + outliner_add_element(soops, &ten->subtree, id, ten, 0, 0); + } + } + } + } +} + /* ======================================================= */ /* Generic Tree Building helpers - order these are called is top to bottom */ @@ -1474,80 +1548,6 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb) return (BLI_listbase_is_empty(lb) == false); } -// XXX: move this above all the filters? -static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeElement *te, Library *lib) -{ - TreeElement *ten; - ListBase *lbarray[MAX_LIBARRAY]; - int a, tot; - - tot = set_listbasepointers(mainvar, lbarray); - for (a = 0; a < tot; a++) { - if (lbarray[a]->first) { - ID *id = lbarray[a]->first; - - /* check if there's data in current lib */ - for (; id; id = id->next) - if (id->lib == lib) - break; - - if (id) { - - ten = outliner_add_element(soops, &te->subtree, (void *)lbarray[a], NULL, TSE_ID_BASE, 0); - ten->directdata = lbarray[a]; - - ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name)); - if (ten->name == NULL) - ten->name = "UNKNOWN"; - - for (id = lbarray[a]->first; id; id = id->next) { - if (id->lib == lib) - outliner_add_element(soops, &ten->subtree, id, ten, 0, 0); - } - } - } - } - -} - -// XXX: move this above all the filters? -static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) -{ - TreeElement *ten; - ListBase *lbarray[MAX_LIBARRAY]; - int a, tot; - - tot = set_listbasepointers(mainvar, lbarray); - for (a = 0; a < tot; a++) { - if (lbarray[a]->first) { - ID *id = lbarray[a]->first; - - /* check if there are any datablocks of this type which are orphans */ - for (; id; id = id->next) { - if (ID_REAL_USERS(id) <= 0) - break; - } - - if (id) { - /* header for this type of datablock */ - ten = outliner_add_element(soops, &soops->tree, (void *)lbarray[a], NULL, TSE_ID_BASE, 0); - ten->directdata = lbarray[a]; - - ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name)); - if (ten->name == NULL) - ten->name = "UNKNOWN"; - - /* add the orphaned datablocks - these will not be added with any subtrees attached */ - for (id = lbarray[a]->first; id; id = id->next) { - if (ID_REAL_USERS(id) <= 0) - outliner_add_element(soops, &ten->subtree, id, ten, 0, 0); - } - } - } - } -} - - /* ======================================================= */ /* Main Tree Building API */ |