diff options
Diffstat (limited to 'source')
5 files changed, 58 insertions, 32 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 388857e3741..6913ebc8a11 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1641,7 +1641,7 @@ static void outliner_draw_restrictcols(ARegion *ar) void draw_outliner(const bContext *C) { - Main *mainvar = CTX_data_main(C); + Main *mainvar = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); View2D *v2d = &ar->v2d; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index d11a8ed6369..a087ff65f63 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -183,8 +183,8 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) { - /* can't rename rna datablocks entries */ - if (ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { + /* can't rename rna datablocks entries or listbases */ + if (ELEM4(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE)) { /* do nothing */; } else if (ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 12f79ec999d..1cfb85afdae 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -595,6 +595,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0); } + // can be inlined if necessary static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, ID *id) { @@ -801,7 +802,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i if (!id) id = ((PointerRNA *)idv)->data; } - if (id == NULL) return NULL; + /* One exception */ + if (type == TSE_ID_BASE); + else if (id == NULL) return NULL; te = MEM_callocN(sizeof(TreeElement), "tree elem"); /* add to the visual tree */ @@ -1419,6 +1422,42 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb) return (lb->first != NULL); } +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); + } + } + } + } + +} + + /* ======================================================= */ /* Main Tree Building API */ @@ -1453,9 +1492,22 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) if (soops->outlinevis == SO_LIBRARIES) { Library *lib; + /* current file first */ + ten = outliner_add_element(soops, &soops->tree, NULL, NULL, TSE_ID_BASE, 0); + ten->name = "Current File"; + + tselem = TREESTORE(ten); + if (!tselem->used) + tselem->flag &= ~TSE_CLOSED; + + outliner_add_library_contents(mainvar, soops, ten, NULL); + for (lib = mainvar->library.first; lib; lib = lib->id.next) { ten = outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0); lib->id.newid = (ID *)ten; + + outliner_add_library_contents(mainvar, soops, ten, lib); + } /* make hierarchy */ ten = soops->tree.first; @@ -1463,7 +1515,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) TreeElement *nten = ten->next, *par; tselem = TREESTORE(ten); lib = (Library *)tselem->id; - if (lib->parent) { + if (lib && lib->parent) { BLI_remlink(&soops->tree, ten); par = (TreeElement *)lib->parent->id.newid; BLI_addtail(&par->subtree, ten); @@ -1587,30 +1639,6 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) tselem->flag &= ~TSE_CLOSED; } } - else if (soops->outlinevis == SO_DATAMAIN) { - 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; - - 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 (UNLIKELY(ten->name == NULL)) { - ten->name = "UNKNOWN"; - } - - for (; id; id = id->next) { - outliner_add_element(soops, &ten->subtree, id, ten, 0, 0); - } - } - } - - } else if (soops->outlinevis == SO_USERDEF) { PointerRNA userdefptr; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index ff775d75bc8..d632a886130 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -270,7 +270,6 @@ typedef enum eSpaceOutliner_Mode { SO_DATABLOCKS = 11, SO_USERDEF = 12, SO_KEYMAP = 13, - SO_DATAMAIN = 9, } eSpaceOutliner_Mode; /* SpaceOops->storeflag */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 3e32cbc2808..c3fd7d92a9d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1253,9 +1253,8 @@ static void rna_def_space_outliner(BlenderRNA *brna) {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", "Display datablocks of all objects of same type as selected object"}, {SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their datablocks"}, - {SO_LIBRARIES, "LIBRARIES", 0, "Libraries", "Display libraries"}, {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence datablocks"}, - {SO_DATAMAIN, "DATAMAIN", 0, "Main Data", "Displays all Main (relinkable) datablocks"}, + {SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"}, {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", "Display all raw datablocks"}, {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display the user preference datablocks"}, {SO_KEYMAP, "KEYMAPS", 0, "Key Maps", "Display keymap datablocks"}, |