Cleanup: Rename public "bUnit" functions

This commit renames the functions in "BKE_unit.h` to be consistent
with the naming in the rest of blenkernel.

bUnit_AsString -> BKE_unit_value_as_string_adaptive
bUnit_AsString2 -> BKE_unit_value_as_string
bUnit_ReplaceString -> BKE_unit_replace_string
bUnit_ApplyPreferredUnit -> BKE_unit_apply_preferred_unit
bUnit_ToUnitAltName -> BKE_unit_name_to_alt
bUnit_ClosestScalar -> BKE_unit_closest_scalar
bUnit_BaseScalar -> BKE_unit_base_scalar
bUnit_IsValid -> BKE_unit_is_valid
bUnit_GetSystem -> BKE_unit_system_get
bUnit_GetBaseUnit -> BKE_unit_base_get
bUnit_GetBaseUnitOfType -> BKE_unit_base_of_type_get
bUnit_GetName -> BKE_unit_name_get
bUnit_GetNameDisplay -> BKE_unit_display_name_get
bUnit_GetIdentifier -> BKE_unit_identifier_get
bUnit_GetScaler -> BKE_unit_scalar_get
bUnit_IsSuppressed -> BKE_unit_is_suppressed

Differential Revision: https://developer.blender.org/D8828
This commit is contained in:
2020-09-09 08:41:15 -05:00
parent 6dc7266cf1
commit 842f52d418
15 changed files with 160 additions and 157 deletions

View File

@@ -134,7 +134,7 @@ static bool bpyunits_validate(const char *usys_str, const char *ucat_str, int *r
return false;
}
if (!bUnit_IsValid(*r_usys, *r_ucat)) {
if (!BKE_unit_is_valid(*r_usys, *r_ucat)) {
PyErr_Format(PyExc_ValueError,
"%.200s / %.200s unit system/category combination is not valid.",
usys_str,
@@ -197,7 +197,7 @@ static PyObject *bpyunits_to_value(PyObject *UNUSED(self), PyObject *args, PyObj
str = PyMem_MALLOC(sizeof(*str) * (size_t)str_len);
BLI_strncpy(str, inpt, (size_t)str_len);
bUnit_ReplaceString(str, (int)str_len, uref, scale, usys, ucat);
BKE_unit_replace_string(str, (int)str_len, uref, scale, usys, ucat);
if (!PyC_RunString_AsNumber(NULL, str, "<bpy_units_api>", &result)) {
if (PyErr_Occurred()) {
@@ -291,10 +291,11 @@ static PyObject *bpyunits_to_string(PyObject *UNUSED(self), PyObject *args, PyOb
char buf1[64], buf2[64], *str;
PyObject *result;
bUnit_AsString(buf1, sizeof(buf1), value, precision, usys, ucat, (bool)split_unit, false);
BKE_unit_value_as_string_adaptive(
buf1, sizeof(buf1), value, precision, usys, ucat, (bool)split_unit, false);
if (compatible_unit) {
bUnit_ToUnitAltName(buf2, sizeof(buf2), buf1, usys, ucat);
BKE_unit_name_to_alt(buf2, sizeof(buf2), buf1, usys, ucat);
str = buf2;
}
else {