From 842f52d418aaccae45c8e400eb0a8bddef0dbb51 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 9 Sep 2020 08:41:15 -0500 Subject: 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 --- source/blender/editors/util/numinput.c | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'source/blender/editors/util/numinput.c') diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index f8e3dda0ed3..ba22bcca0e1 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -136,14 +136,14 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings) BLI_strncpy(val, "Invalid", sizeof(val)); } else { - bUnit_AsString(val, - sizeof(val), - (double)(n->val[i] * fac), - prec, - n->unit_sys, - n->unit_type[i], - true, - false); + BKE_unit_value_as_string_adaptive(val, + sizeof(val), + (double)(n->val[i] * fac), + prec, + n->unit_sys, + n->unit_type[i], + true, + false); } /* +1 because of trailing '\0' */ @@ -165,7 +165,7 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings) } else { char tstr[NUM_STR_REP_LEN]; - bUnit_AsString( + BKE_unit_value_as_string_adaptive( tstr, ln, (double)n->val[i], prec, n->unit_sys, n->unit_type[i], true, false); BLI_snprintf(&str[j * ln], ln, "%s%s%s", cur, tstr, cur); } @@ -252,14 +252,14 @@ bool applyNumInput(NumInput *n, float *vec) static void value_to_editstr(NumInput *n, int idx) { const int prec = 6; /* editing, higher precision needed. */ - n->str_cur = bUnit_AsString(n->str, - NUM_STR_REP_LEN, - (double)n->val[idx], - prec, - n->unit_sys, - n->unit_type[idx], - true, - false); + n->str_cur = BKE_unit_value_as_string_adaptive(n->str, + NUM_STR_REP_LEN, + (double)n->val[idx], + prec, + n->unit_sys, + n->unit_type[idx], + true, + false); } static bool editstr_insert_at_cursor(NumInput *n, const char *buf, const int buf_len) @@ -288,17 +288,17 @@ bool user_string_to_number(bContext *C, { #ifdef WITH_PYTHON double unit_scale = BKE_scene_unit_scale(unit, type, 1.0); - if (bUnit_ContainsUnit(str, type)) { + if (BKE_unit_string_contains_unit(str, type)) { char str_unit_convert[256]; BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); - bUnit_ReplaceString( + BKE_unit_replace_string( str_unit_convert, sizeof(str_unit_convert), str, unit_scale, unit->system, type); return BPY_run_string_as_number(C, NULL, str_unit_convert, error_prefix, r_value); } int success = BPY_run_string_as_number(C, NULL, str, error_prefix, r_value); - *r_value = bUnit_ApplyPreferredUnit(unit, type, *r_value); + *r_value = BKE_unit_apply_preferred_unit(unit, type, *r_value); *r_value /= unit_scale; return success; -- cgit v1.2.3