Util to get collection UI name
Note we still have hardcoded IFACE_("Scene Collection") in the outliner.
I'm ok with getting of them as well, though no strong feelings here.
This commit is contained in:
@@ -103,6 +103,7 @@ struct Base *BKE_collection_or_layer_objects(const struct ViewLayer *view_layer,
|
||||
|
||||
struct Collection *BKE_collection_from_index(struct Scene *scene, const int index);
|
||||
void BKE_collection_new_name_get(struct Collection *collection_parent, char *rname);
|
||||
const char *BKE_collection_ui_name_get(struct Collection *collection);
|
||||
bool BKE_collection_objects_select(struct ViewLayer *view_layer, struct Collection *collection, bool deselect);
|
||||
|
||||
/* Collection children */
|
||||
|
||||
@@ -298,6 +298,19 @@ void BKE_collection_new_name_get(Collection *collection_parent, char *rname)
|
||||
MEM_freeN(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* The name to show in the interface.
|
||||
*/
|
||||
const char *BKE_collection_ui_name_get(struct Collection *collection)
|
||||
{
|
||||
if (collection->flag & COLLECTION_IS_MASTER) {
|
||||
return IFACE_("Scene Collection");
|
||||
}
|
||||
else {
|
||||
return collection->id.name + 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* **************** Object List Cache *******************/
|
||||
|
||||
static void collection_object_cache_fill(ListBase *lb, Collection *collection, int parent_restrict)
|
||||
|
||||
@@ -1960,14 +1960,7 @@ static void move_to_collection_menus_free(MoveToCollectionData **menu)
|
||||
static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout, void *menu_v)
|
||||
{
|
||||
MoveToCollectionData *menu = menu_v;
|
||||
const char *name;
|
||||
|
||||
if (menu->collection->flag & COLLECTION_IS_MASTER) {
|
||||
name = IFACE_("Scene Collection");
|
||||
}
|
||||
else {
|
||||
name = menu->collection->id.name + 2;
|
||||
}
|
||||
const char *name = BKE_collection_ui_name_get(menu->collection);
|
||||
|
||||
uiItemIntO(layout,
|
||||
name,
|
||||
|
||||
@@ -1345,13 +1345,7 @@ static void outliner_add_view_layer(SpaceOops *soops, ListBase *tree, TreeElemen
|
||||
|
||||
BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collection)
|
||||
{
|
||||
if (collection->flag & COLLECTION_IS_MASTER) {
|
||||
te->name = IFACE_("Scene Collection");
|
||||
}
|
||||
else {
|
||||
te->name = collection->id.name + 2;
|
||||
}
|
||||
|
||||
te->name = BKE_collection_ui_name_get(collection);
|
||||
te->directdata = collection;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user