[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53276] trunk/blender/source/blender: Reshuffled data view for Outliner.
Ton Roosendaal
ton at blender.org
Sat Dec 22 17:49:51 CET 2012
Revision: 53276
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53276
Author: ton
Date: 2012-12-22 16:49:50 +0000 (Sat, 22 Dec 2012)
Log Message:
-----------
Reshuffled data view for Outliner.
- The new "Main Data" option is now under the category "Blender File".
- That category also displays the Linked Library files.
(Including allows browsing what's used from this file)
Also fixed CTRL+click on names, crashed.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
trunk/blender/source/blender/makesdna/DNA_space_types.h
trunk/blender/source/blender/makesrna/intern/rna_space.c
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2012-12-22 16:18:20 UTC (rev 53275)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2012-12-22 16:49:50 UTC (rev 53276)
@@ -1641,7 +1641,7 @@
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;
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_edit.c 2012-12-22 16:18:20 UTC (rev 53275)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_edit.c 2012-12-22 16:49:50 UTC (rev 53276)
@@ -183,8 +183,8 @@
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,
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tree.c 2012-12-22 16:18:20 UTC (rev 53275)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tree.c 2012-12-22 16:49:50 UTC (rev 53276)
@@ -595,6 +595,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h 2012-12-22 16:18:20 UTC (rev 53275)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h 2012-12-22 16:49:50 UTC (rev 53276)
@@ -270,7 +270,6 @@
SO_DATABLOCKS = 11,
SO_USERDEF = 12,
SO_KEYMAP = 13,
- SO_DATAMAIN = 9,
} eSpaceOutliner_Mode;
/* SpaceOops->storeflag */
Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c 2012-12-22 16:18:20 UTC (rev 53275)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c 2012-12-22 16:49:50 UTC (rev 53276)
@@ -1253,9 +1253,8 @@
{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"},
More information about the Bf-blender-cvs
mailing list