diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-01 13:30:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-01 13:30:18 +0300 |
commit | c9b9803a772ccb7539a71785e121b049620d00d7 (patch) | |
tree | 2305d88fc64a84fbc3275cb25cd77ef05175e781 /source | |
parent | ba798e0412cdcb5e6a10464ced105c8d6708c4b7 (diff) |
RNA: add check for zero step arguments
Avoids errors like T70281 slipping through.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 4 |
4 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index aef15e6d30a..d7bb941b266 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1718,7 +1718,7 @@ static void rna_def_brush(BlenderRNA *brna) prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_funcs(prop, NULL, "rna_Brush_set_unprojected_radius", NULL); RNA_def_property_range(prop, 0.001, FLT_MAX); - RNA_def_property_ui_range(prop, 0.001, 1, 0, -1); + RNA_def_property_ui_range(prop, 0.001, 1, 1, -1); RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units"); RNA_def_property_update(prop, 0, "rna_Brush_size_update"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 758fbd07f85..fc22e9e6c74 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1688,6 +1688,11 @@ void RNA_def_property_ui_range( DefRNA.error = 1; } + if (step == 0) { + CLOG_ERROR(&LOG, "\"%s.%s\", step is zero.", srna->identifier, prop->identifier); + DefRNA.error = 1; + } + if (precision < -1 || precision > UI_PRECISION_FLOAT_MAX) { CLOG_ERROR(&LOG, "\"%s.%s\", precision outside range.", srna->identifier, prop->identifier); DefRNA.error = 1; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 4960dc82b28..1f967df7232 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3363,7 +3363,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 0.001, FLT_MAX); - RNA_def_property_ui_range(prop, 0.001, 1, 0, -1); + RNA_def_property_ui_range(prop, 0.001, 1, 1, -1); RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units"); RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index eb411538b41..1457bbfd3c3 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -648,7 +648,7 @@ static void rna_def_paint(BlenderRNA *brna) prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "num_input_samples"); - RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 0, -1); + RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 1, -1); RNA_def_property_ui_text( prop, "Input Samples", "Average multiple input samples together to smooth the brush stroke"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); @@ -1023,7 +1023,7 @@ static void rna_def_image_paint(BlenderRNA *brna) /* integers */ prop = RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_PIXEL); - RNA_def_property_ui_range(prop, 0, 8, 0, -1); + RNA_def_property_ui_range(prop, 0, 8, 1, -1); RNA_def_property_ui_text( prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)"); |