[Bf-blender-cvs] [d1011c9e641] master: Cleanup: clarification of 'name' in BKE_idtype functions
Sybren A. Stüvel
noreply at git.blender.org
Fri Apr 3 16:55:42 CEST 2020
Commit: d1011c9e641220c335aab2456b0598e2c6707d4d
Author: Sybren A. Stüvel
Date: Fri Apr 3 10:39:57 2020 +0200
Branches: master
https://developer.blender.org/rBd1011c9e641220c335aab2456b0598e2c6707d4d
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
===================================================================
M source/blender/blenkernel/BKE_idtype.h
M source/blender/blenkernel/intern/idtype.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h
index 93bcfe5323d..05545216217 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c
index b7fc167cf33..5a6e8f532c9 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -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;
}
More information about the Bf-blender-cvs
mailing list