Fix T45060: Brush size snaps back to default max

This commit is contained in:
Campbell Barton 2015-06-15 22:26:19 +10:00 committed by Sergey Sharybin
parent 12de321a01
commit 84e4eed317
Notes: blender-bot 2023-02-14 11:28:43 +01:00
Referenced by issue #45060, Maximum brush size snaps back to default max value when its set to a higher number than maximum allowed number
1 changed files with 21 additions and 10 deletions

View File

@ -4256,8 +4256,7 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve
{
wmWindowManager *wm;
RadialControl *rc;
int min_value_int, max_value_int, step_int;
float step_float, precision;
if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
return OPERATOR_CANCELLED;
@ -4270,17 +4269,29 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve
/* get type, initial, min, and max values of the property */
switch ((rc->type = RNA_property_type(rc->prop))) {
case PROP_INT:
rc->initial_value = RNA_property_int_get(&rc->ptr, rc->prop);
RNA_property_int_ui_range(&rc->ptr, rc->prop, &min_value_int,
&max_value_int, &step_int);
rc->min_value = min_value_int;
rc->max_value = max_value_int;
{
int value, min, max, step;
value = RNA_property_int_get(&rc->ptr, rc->prop);
RNA_property_int_ui_range(&rc->ptr, rc->prop, &min, &max, &step);
rc->initial_value = value;
rc->min_value = min_ii(value, min);
rc->max_value = max_ii(value, max);
break;
}
case PROP_FLOAT:
rc->initial_value = RNA_property_float_get(&rc->ptr, rc->prop);
RNA_property_float_ui_range(&rc->ptr, rc->prop, &rc->min_value,
&rc->max_value, &step_float, &precision);
{
float value, min, max, step, precision;
value = RNA_property_float_get(&rc->ptr, rc->prop);
RNA_property_float_ui_range(&rc->ptr, rc->prop, &min, &min, &step, &precision);
rc->initial_value = value;
rc->min_value = min_ff(value, min);
rc->max_value = max_ff(value, max);
break;
}
default:
BKE_report(op->reports, RPT_ERROR, "Property must be an integer or a float");
MEM_freeN(rc);