diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-03 02:28:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-03 02:28:18 +0400 |
commit | 29d348f8de4e81b3956934c5fad48e94c685a415 (patch) | |
tree | 09d32950c64600875f6ff43dd33d2e65e3c6cf2d /source/blender/makesrna/intern/rna_define.c | |
parent | 42a619c781ec7f464783ebb004595d3c9c478a6f (diff) |
add checks for bad args to RNA_def_property_ui_range & RNA_def_property_range and fix one instance where (min > max).
also remove redundant float/double conversion in ui_get_but_step_unit()
Diffstat (limited to 'source/blender/makesrna/intern/rna_define.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 214fd2954f7..d4b1130763b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1321,6 +1321,26 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double { StructRNA *srna = DefRNA.laststruct; +#ifdef DEBUG + if (min > max) { + fprintf(stderr, "%s: \"%s.%s\", min > max.\n", + __func__, srna->identifier, prop->identifier); + DefRNA.error = 1; + } + + if (step < 0 || step > 100) { + fprintf(stderr, "%s: \"%s.%s\", step outside range.\n", + __func__, srna->identifier, prop->identifier); + DefRNA.error = 1; + } + + if (precision < -1 || precision > 10) { + fprintf(stderr, "%s: \"%s.%s\", step outside range.\n", + __func__, srna->identifier, prop->identifier); + DefRNA.error = 1; + } +#endif + switch (prop->type) { case PROP_INT: { @@ -1366,6 +1386,14 @@ void RNA_def_property_range(PropertyRNA *prop, double min, double max) { StructRNA *srna = DefRNA.laststruct; +#ifdef DEBUG + if (min > max) { + fprintf(stderr, "%s: \"%s.%s\", min > max.\n", + __func__, srna->identifier, prop->identifier); + DefRNA.error = 1; + } +#endif + switch (prop->type) { case PROP_INT: { |