Commit: 91f374c4004c4c7daefce7f32b78aba1a7868cae Author: Julian Eisel Date: Thu Oct 13 01:36:26 2016 +0200 Branches: soc-2016-layer_manager https://developer.blender.org/rB91f374c4004c4c7daefce7f32b78aba1a7868cae
Support displaying layer list in outliner Adds a new outliner display mode "Layers" in which the basic layer tree is drawn. The button for restricting layer visibility is also already there. =================================================================== M source/blender/editors/space_outliner/outliner_draw.c M source/blender/editors/space_outliner/outliner_tree.c M source/blender/makesdna/DNA_outliner_types.h M source/blender/makesdna/DNA_space_types.h M source/blender/makesrna/intern/rna_space.c =================================================================== diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index bc2e9c8..d516e00 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -356,6 +356,11 @@ static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), voi WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); } +static void restrictbutton_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2)) +{ + WM_event_add_notifier(C, NC_SCENE | ND_LAYER, NULL); +} + static int group_restrict_flag(Group *gr, int flag) { GroupObject *gob; @@ -806,6 +811,18 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar UI_block_emboss_set(block, UI_EMBOSS); } + else if (tselem->type == TSE_OBJECT_LAYER) { + LayerTreeItem *litem = te->directdata; + + UI_block_emboss_set(block, UI_EMBOSS_NONE); + + bt = uiDefIconButC(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_VIEW_OFF, + (int)(ar->v2d.cur.xmax - UI_UNIT_X), te->ys, UI_UNIT_X, UI_UNIT_Y, + &litem->is_hidden, 0.0f, 0.0f, 0.0f, 0.0f, "Hide/unhide this layer"); + UI_but_func_set(bt, restrictbutton_layer_flag_cb, NULL, NULL); + + UI_block_emboss_set(block, UI_EMBOSS); + } } if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 9962c5b..3d94062 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -905,8 +905,8 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i id = TREESTORE(parent)->id; } - /* One exception */ - if (type == TSE_ID_BASE) { + /* Exceptions */ + if (ELEM(type, TSE_ID_BASE, TSE_OBJECT_LAYER)) { /* pass */ } else if (id == NULL) { @@ -943,6 +943,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else if (type == TSE_GP_LAYER) { /* pass */ } + else if (type == TSE_OBJECT_LAYER) { + /* pass */ + } else if (type == TSE_ID_BASE) { /* pass */ } @@ -1368,6 +1371,24 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) } } +static void outliner_add_layers_recursive( + SpaceOops *soops, ListBase *tree, ListBase *layerlist, + TreeElement *parent_ten) +{ + for (LayerTreeItem *litem = layerlist->first; litem; litem = litem->next) { + TreeElement *ten = outliner_add_element(soops, tree, NULL, parent_ten, TSE_OBJECT_LAYER, 0); + ten->name = litem->name; + ten->directdata = litem; + + outliner_add_layers_recursive(soops, &ten->subtree, &litem->childs, ten); + } +} + +static void outliner_add_layers(SpaceOops *soops, LayerTree *ltree) +{ + outliner_add_layers_recursive(soops, &soops->tree, <ree->items, NULL); +} + /* ======================================================= */ /* Generic Tree Building helpers - order these are called is top to bottom */ @@ -1840,6 +1861,9 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) else if (soops->outlinevis == SO_ID_ORPHANS) { outliner_add_orphaned_datablocks(mainvar, soops); } + else if (soops->outlinevis == SO_LAYERS) { + outliner_add_layers(soops, scene->object_layers); + } else { ten = outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0); if (ten) ten->directdata = BASACT; diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h index 984e333..2c51965 100644 --- a/source/blender/makesdna/DNA_outliner_types.h +++ b/source/blender/makesdna/DNA_outliner_types.h @@ -96,6 +96,7 @@ typedef struct TreeStore { #define TSE_KEYMAP_ITEM 35 /* NO ID */ #define TSE_ID_BASE 36 /* NO ID */ #define TSE_GP_LAYER 37 /* NO ID */ +#define TSE_OBJECT_LAYER 38 /* Check whether given TreeStoreElem should have a real ID in its ->id member. */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 0af813d..e6b22a6 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -291,6 +291,7 @@ typedef enum eSpaceOutliner_Mode { SO_USERDEF = 12, /* SO_KEYMAP = 13, */ /* deprecated! */ SO_ID_ORPHANS = 14, + SO_LAYERS = 15, } eSpaceOutliner_Mode; /* SpaceOops->storeflag */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ee988fa..53dc00c 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2089,6 +2089,7 @@ static void rna_def_space_outliner(BlenderRNA *brna) {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display user preference data"}, {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data", "Display data-blocks which are unused and/or will be lost when the file is reloaded"}, + {SO_LAYERS, "LAYERS", 0, "Layers", "Display the layer tree of the current scene"}, {0, NULL, 0, NULL, NULL} }; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs