Outliner: allow for renaming of collection and small touch ups in the

code

Note: Master Collection should not be renamable, but also, it should be marked as MasterCollection (with an icon probably)
This commit is contained in:
Dalai Felinto 2017-02-13 11:16:07 +01:00
parent 8a92277a31
commit 4e64151787
3 changed files with 12 additions and 13 deletions

View File

@ -758,13 +758,12 @@ static eOLDrawState tree_element_active_collection(
bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set)
{
if (set != OL_SETSEL_NONE) {
Scene *scene = CTX_data_scene(C);
SceneLayer *slayer = BLI_findlink(&scene->render_layers, scene->active_layer);
LayerCollection *collection = te->directdata;
const int collection_index = BKE_layer_collection_findindex(slayer, collection);
SceneLayer *sl = CTX_data_scene_layer(C);
LayerCollection *lc = te->directdata;
const int collection_index = BKE_layer_collection_findindex(sl, lc);
BLI_assert(collection_index >= 0);
slayer->active_collection = collection_index;
sl->active_collection = collection_index;
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OL_DRAWSEL_ACTIVE;
}

View File

@ -1374,22 +1374,22 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
}
}
static void outliner_add_collections_recursive(SpaceOops *soops, ListBase *tree, ListBase *layer_collections,
TreeElement *parent_ten)
static void outliner_add_collections_recursive(SpaceOops *soops, ListBase *tree, Scene *scene,
ListBase *layer_collections, TreeElement *parent_ten)
{
for (LayerCollection *collection = layer_collections->first; collection; collection = collection->next) {
TreeElement *ten = outliner_add_element(soops, tree, NULL, parent_ten, TSE_COLLECTION, 0);
TreeElement *ten = outliner_add_element(soops, tree, scene, parent_ten, TSE_COLLECTION, 0);
ten->name = collection->scene_collection->name;
ten->directdata = collection;
outliner_add_collections_recursive(soops, &ten->subtree, &collection->layer_collections, ten);
outliner_add_collections_recursive(soops, &ten->subtree, scene, &collection->layer_collections, ten);
}
}
static void outliner_add_collections(SpaceOops *soops, SceneLayer *layer)
static void outliner_add_collections(SpaceOops *soops, SceneLayer *layer, Scene *scene)
{
outliner_add_collections_recursive(soops, &soops->tree, &layer->layer_collections, NULL);
outliner_add_collections_recursive(soops, &soops->tree, scene, &layer->layer_collections, NULL);
}
/* ======================================================= */
@ -1854,7 +1854,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SceneLayer *sl, SpaceOops
outliner_add_orphaned_datablocks(mainvar, soops);
}
else if (soops->outlinevis == SO_COLLECTIONS) {
outliner_add_collections(soops, BLI_findlink(&scene->render_layers, scene->active_layer));
outliner_add_collections(soops, BLI_findlink(&scene->render_layers, scene->active_layer), scene);
}
else {
ten = outliner_add_element(soops, &soops->tree, OBACT_NEW, NULL, 0, 0);

View File

@ -1112,7 +1112,7 @@ static void view3d_select_loop(ViewContext *vc, Scene *scene, SceneLayer *sl, Vi
v3d->xray = true; /* otherwise it postpones drawing */
for (base = sl->object_bases.first; base; base = base->next) {
if ((base->flag & BASE_VISIBLED) != 0) {
if ((base->object->restrictflag & OB_RESTRICT_SELECT) ||
if (((base->flag & BASE_SELECTABLED) == 0) ||
(use_obedit_skip && (scene->obedit->data == base->object->data)))
{
base->selcol = 0;