diff options
author | Bastien Montagne <bastien@blender.org> | 2022-05-09 17:35:25 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-05-09 17:35:25 +0300 |
commit | 5823e749dc91a1c150bbcca335f91cbc218b2eda (patch) | |
tree | da83576fae622fce2275ae6567f87eb71448d3d0 /source/blender/python | |
parent | 36e330bd9cc1d5864d3420031aa7c0ba5ef5d27f (diff) | |
parent | 43e31d26a955034882035d2e0ec320dfab8f1375 (diff) |
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_utils_units.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_utils_units.c b/source/blender/python/intern/bpy_utils_units.c index 3e0698caa50..1e5856a3285 100644 --- a/source/blender/python/intern/bpy_utils_units.c +++ b/source/blender/python/intern/bpy_utils_units.c @@ -35,7 +35,7 @@ static const char *bpyunits_usystem_items[] = { NULL, }; -static const char *bpyunits_ucategorie_items[] = { +static const char *bpyunits_ucategories_items[] = { "NONE", "LENGTH", "AREA", @@ -43,20 +43,26 @@ static const char *bpyunits_ucategorie_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, * to keep all systems/categories definition stuff in `BKE_unit.h`. */ static PyStructSequence_Field bpyunits_systems_fields[ARRAY_SIZE(bpyunits_usystem_items)]; -static PyStructSequence_Field bpyunits_categories_fields[ARRAY_SIZE(bpyunits_ucategorie_items)]; +static PyStructSequence_Field bpyunits_categories_fields[ARRAY_SIZE(bpyunits_ucategories_items)]; static PyStructSequence_Desc bpyunits_systems_desc = { "bpy.utils.units.systems", /* name */ @@ -114,7 +120,7 @@ static bool bpyunits_validate(const char *usys_str, const char *ucat_str, int *r return false; } - *r_ucat = BLI_str_index_in_array(ucat_str, bpyunits_ucategorie_items); + *r_ucat = BLI_str_index_in_array(ucat_str, bpyunits_ucategories_items); if (*r_ucat < 0) { PyErr_Format(PyExc_ValueError, "Unknown unit category specified: %.200s.", ucat_str); return false; @@ -356,7 +362,7 @@ PyObject *BPY_utils_units(void) /* bpy.utils.units.categories */ item = py_structseq_from_strings( - &BPyUnitsCategoriesType, &bpyunits_categories_desc, bpyunits_ucategorie_items); + &BPyUnitsCategoriesType, &bpyunits_categories_desc, bpyunits_ucategories_items); PyModule_AddObject(submodule, "categories", item); /* steals ref */ return submodule; |