Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-11-13 23:10:30 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-11-13 23:14:14 +0300
commit42fbb8af8342e916b8f4e8d4591ad49574a88fe4 (patch)
tree44ebaed3621ff450a7a8d914d1246f8af7aa1401 /source
parent520f71b43a4b24fb7c59d5798657cb7afb552ecf (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_collection.h1
-rw-r--r--source/blender/blenkernel/intern/collection.c13
-rw-r--r--source/blender/editors/object/object_edit.c9
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c8
4 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index a9539b3a3c4..d78133499ce 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -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 */
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 9cec20a8f2b..47fb3622c66 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -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)
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index aa148512e16..18f5f7f0207 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -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,
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 74510c3b02f..86d909220e2 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -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;
}