forked from bartvdbraak/blender
Cleanup: clarification of 'name' in BKE_idtype functions
The 'name' parameter of `BKE_idtype_idcode_from_name()`, and the `str` parameter of `idtype_get_info_from_name()`, are expected to be the 'user visible name' of an `IDTypeInfo` struct. This is made clearer in the code by renaming those parameters to `idtype_name` and mentioning it in the documentation of the `BKE_idtype_idcode_from_name()` function. Differential Revision: https://developer.blender.org/D7317
This commit is contained in:
parent
3208454aa8
commit
d1011c9e64
@ -183,7 +183,7 @@ const char *BKE_idtype_idcode_to_translation_context(const short idcode);
|
||||
bool BKE_idtype_idcode_is_linkable(const short idcode);
|
||||
bool BKE_idtype_idcode_is_valid(const short idcode);
|
||||
|
||||
short BKE_idtype_idcode_from_name(const char *name);
|
||||
short BKE_idtype_idcode_from_name(const char *idtype_name);
|
||||
|
||||
uint64_t BKE_idtype_idcode_to_idfilter(const short idcode);
|
||||
short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter);
|
||||
|
@ -124,10 +124,10 @@ const IDTypeInfo *BKE_idtype_get_info_from_id(const ID *id)
|
||||
return BKE_idtype_get_info_from_idcode(GS(id->name));
|
||||
}
|
||||
|
||||
static const IDTypeInfo *idtype_get_info_from_name(const char *str)
|
||||
static const IDTypeInfo *idtype_get_info_from_name(const char *idtype_name)
|
||||
{
|
||||
for (int i = ARRAY_SIZE(id_types); i--;) {
|
||||
if (id_types[i] != NULL && STREQ(str, id_types[i]->name)) {
|
||||
if (id_types[i] != NULL && STREQ(idtype_name, id_types[i]->name)) {
|
||||
return id_types[i];
|
||||
}
|
||||
}
|
||||
@ -179,14 +179,14 @@ const char *BKE_idtype_idcode_to_translation_context(const short idcode)
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a name into an idcode (ie. ID_SCE)
|
||||
* Convert an IDType name into an idcode (ie. ID_SCE)
|
||||
*
|
||||
* \param name: The name to convert.
|
||||
* \return The code for the name, or 0 if invalid.
|
||||
* \param idtype_name: The IDType's 'user visible name' to convert.
|
||||
* \return The idcode for the name, or 0 if invalid.
|
||||
*/
|
||||
short BKE_idtype_idcode_from_name(const char *name)
|
||||
short BKE_idtype_idcode_from_name(const char *idtype_name)
|
||||
{
|
||||
const IDTypeInfo *id_type = idtype_get_info_from_name(name);
|
||||
const IDTypeInfo *id_type = idtype_get_info_from_name(idtype_name);
|
||||
BLI_assert(id_type);
|
||||
return id_type != NULL ? id_type->id_code : 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user