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

@@ -2571,7 +2571,7 @@ void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
orig_str = BLI_strdup(str);
bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
BKE_unit_name_to_alt(str, maxlen, orig_str, unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
MEM_freeN(orig_str);
}
@@ -2606,13 +2606,13 @@ static void ui_get_but_string_unit(
precision = float_precision;
}
bUnit_AsString2(str,
len_max,
ui_get_but_scale_unit(but, value),
precision,
RNA_SUBTYPE_UNIT_VALUE(unit_type),
unit,
pad);
BKE_unit_value_as_string(str,
len_max,
ui_get_but_scale_unit(but, value),
precision,
RNA_SUBTYPE_UNIT_VALUE(unit_type),
unit,
pad);
}
static float ui_get_but_step_unit(uiBut *but, float step_default)
@@ -2622,12 +2622,13 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
/* Scaling up 'step_origg ' here is a bit arbitrary,
* its just giving better scales from user POV */
const double scale_step = ui_get_but_scale_unit(but, step_orig * 10);
const double step = bUnit_ClosestScalar(scale_step, but->block->unit->system, unit_type);
const double step = BKE_unit_closest_scalar(scale_step, but->block->unit->system, unit_type);
/* -1 is an error value */
if (step != -1.0) {
const double scale_unit = ui_get_but_scale_unit(but, 1.0);
const double step_unit = bUnit_ClosestScalar(scale_unit, but->block->unit->system, unit_type);
const double step_unit = BKE_unit_closest_scalar(
scale_unit, but->block->unit->system, unit_type);
double step_final;
BLI_assert(step > 0.0);