Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/collection.c
| Show First 20 Lines • Show All 704 Lines • ▼ Show 20 Lines | |||||
| /** \name Collection Naming | /** \name Collection Naming | ||||
| * \{ */ | * \{ */ | ||||
| void BKE_collection_new_name_get(Collection *collection_parent, char *rname) | void BKE_collection_new_name_get(Collection *collection_parent, char *rname) | ||||
| { | { | ||||
| char *name; | char *name; | ||||
| if (!collection_parent) { | if (!collection_parent) { | ||||
| name = BLI_strdup("Collection"); | name = BLI_strdup(DATA_("Collection")); | ||||
| } | } | ||||
| else if (collection_parent->flag & COLLECTION_IS_MASTER) { | else if (collection_parent->flag & COLLECTION_IS_MASTER) { | ||||
| name = BLI_sprintfN("Collection %d", BLI_listbase_count(&collection_parent->children) + 1); | name = BLI_sprintfN(DATA_("Collection %d"), BLI_listbase_count(&collection_parent->children) + 1); | ||||
| } | } | ||||
| else { | else { | ||||
| const int number = BLI_listbase_count(&collection_parent->children) + 1; | const int number = BLI_listbase_count(&collection_parent->children) + 1; | ||||
| const int digits = integer_digits_i(number); | const int digits = integer_digits_i(number); | ||||
| const int max_len = sizeof(collection_parent->id.name) - 1 /* NULL terminator */ - | const int max_len = sizeof(collection_parent->id.name) - 1 /* NULL terminator */ - | ||||
| (1 + digits) /* " %d" */ - 2 /* ID */; | (1 + digits) /* " %d" */ - 2 /* ID */; | ||||
| name = BLI_sprintfN("%.*s %d", max_len, collection_parent->id.name + 2, number); | name = BLI_sprintfN("%.*s %d", max_len, collection_parent->id.name + 2, number); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,374 Lines • Show Last 20 Lines | |||||