RNA: use correct ui scale type string in generated rna code

Previously, it printed the elements of `PropertyScaleType` as floats which does
not make sense. It also resulted in compile errors when attempting to compile
the generated code as c++ code.

Pull Request: https://projects.blender.org/blender/blender/pulls/107724
This commit is contained in:
Jacques Lucke 2023-05-12 13:50:06 +02:00
parent 4cf7b95a15
commit 38416e7ad2
1 changed files with 15 additions and 2 deletions

View File

@ -615,6 +615,20 @@ static void rna_float_print(FILE *f, float num)
}
}
static const char *rna_ui_scale_type_string(const PropertyScaleType type)
{
switch (type) {
case PROP_SCALE_LINEAR:
return "PROP_SCALE_LINEAR";
case PROP_SCALE_LOG:
return "PROP_SCALE_LOG";
case PROP_SCALE_CUBIC:
return "PROP_SCALE_CUBIC";
}
BLI_assert_unreachable();
return "";
}
static void rna_int_print(FILE *f, int64_t num)
{
if (num == INT_MIN) {
@ -4164,8 +4178,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_function_string(fprop->getarray_ex),
rna_function_string(fprop->setarray_ex),
rna_function_string(fprop->range_ex));
rna_float_print(f, fprop->ui_scale_type);
fprintf(f, ", ");
fprintf(f, "%s, ", rna_ui_scale_type_string(fprop->ui_scale_type));
rna_float_print(f, fprop->softmin);
fprintf(f, ", ");
rna_float_print(f, fprop->softmax);