diff options
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b20d9218316..ef65a99c73b 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -684,6 +684,29 @@ static char *rna_def_property_get_func( } } } + + /* Check log scale sliders for negative range. */ + if (prop->type == PROP_FLOAT) { + FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; + /* NOTE: UI_BTYPE_NUM_SLIDER can't have a softmin of zero. */ + if ((fprop->ui_scale_type == PROP_SCALE_LOG) && (fprop->hardmin < 0 || fprop->softmin < 0)) { + CLOG_ERROR( + &LOG, "\"%s.%s\", range for log scale < 0.", srna->identifier, prop->identifier); + DefRNA.error = true; + return NULL; + } + } + if (prop->type == PROP_INT) { + IntPropertyRNA *iprop = (IntPropertyRNA *)prop; + /* Only UI_BTYPE_NUM_SLIDER is implemented and that one can't have a softmin of zero. */ + if ((iprop->ui_scale_type == PROP_SCALE_LOG) && + (iprop->hardmin <= 0 || iprop->softmin <= 0)) { + CLOG_ERROR( + &LOG, "\"%s.%s\", range for log scale <= 0.", srna->identifier, prop->identifier); + DefRNA.error = true; + return NULL; + } + } } func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); @@ -3935,6 +3958,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(iprop->getarray_ex), rna_function_string(iprop->setarray_ex), rna_function_string(iprop->range_ex)); + rna_int_print(f, iprop->ui_scale_type); + fprintf(f, ", "); rna_int_print(f, iprop->softmin); fprintf(f, ", "); rna_int_print(f, iprop->softmax); @@ -3969,6 +3994,8 @@ 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, ", "); rna_float_print(f, fprop->softmin); fprintf(f, ", "); rna_float_print(f, fprop->softmax); |