Fix T97927: bpy.utils.units.to_string uses wrong units for velocity, acceleration, lens length, and power
`TEMPERATURE` type was also missing, not only the new-ish `TIME_ABSOLUTE` one... Added a static assert on the size of the `bpyunits_ucategories_items` array, and a comment on anonymous enum of `B_UNIT_`, in the hope this won't happen again in the future.
This commit is contained in:
parent
6f773b1a4f
commit
43e31d26a9
Notes:
blender-bot
2023-02-14 09:44:56 +01:00
Referenced by issue #97927, bpy.utils.units.to_string uses wrong units for velocity, acceleration, lens length, and power
|
@ -91,7 +91,7 @@ const char *BKE_unit_identifier_get(const void *usys_pt, int index);
|
|||
double BKE_unit_scalar_get(const void *usys_pt, int index);
|
||||
bool BKE_unit_is_suppressed(const void *usys_pt, int index);
|
||||
|
||||
/** Aligned with #PropertyUnit. */
|
||||
/** Aligned with #PropertyUnit and `bpyunits_ucategories_items` in `bpy_utils_units.c`. */
|
||||
enum {
|
||||
B_UNIT_NONE = 0,
|
||||
B_UNIT_LENGTH = 1,
|
||||
|
|
|
@ -43,13 +43,19 @@ static const char *bpyunits_ucategories_items[] = {
|
|||
"MASS",
|
||||
"ROTATION",
|
||||
"TIME",
|
||||
"TIME_ABSOLUTE",
|
||||
"VELOCITY",
|
||||
"ACCELERATION",
|
||||
"CAMERA",
|
||||
"POWER",
|
||||
"TEMPERATURE",
|
||||
NULL,
|
||||
};
|
||||
|
||||
BLI_STATIC_ASSERT(
|
||||
ARRAY_SIZE(bpyunits_ucategories_items) == B_UNIT_TYPE_TOT + 1,
|
||||
"`bpyunits_ucategories_items` should match `B_UNIT_` enum items in `BKE_units.h`")
|
||||
|
||||
/**
|
||||
* These fields are just empty placeholders, actual values get set in initializations functions.
|
||||
* This allows us to avoid many handwriting, and above all,
|
||||
|
|
Loading…
Reference in New Issue