diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-01-09 21:23:15 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-01-09 21:23:27 +0300 |
commit | 67b1412bc956c857843db0551ce1ac426414f7c2 (patch) | |
tree | ea71346fbdf9ab45b5208ffa85f4838bfe440c1a /source/blender | |
parent | 58d7153c6c4d52005cde1547592efaced1507d9c (diff) |
Radial operator number angle input should use angles.
Much more lenient if you are a human.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 15ae9eba10f..5b944a7b1ec 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -4319,9 +4319,17 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even if (event->val == KM_PRESS && has_numInput && handleNumInput(C, &rc->num_input, event)) { handled = true; applyNumInput(&rc->num_input, &numValue); + + if (rc->subtype == PROP_ANGLE) { + numValue = DEG2RADF(numValue); + numValue = fmod(numValue, 2.0f * (float)M_PI); + if (numValue < 0.0f) + numValue += 2.0f * (float)M_PI; + } + CLAMP(numValue, rc->min_value, rc->max_value); new_value = numValue; - + radial_control_set_value(rc, new_value); rc->current_value = new_value; radial_control_update_header(op, C); @@ -4459,10 +4467,19 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even /* Modal numinput inactive, try to handle numeric inputs last... */ if (!handled && event->val == KM_PRESS && handleNumInput(C, &rc->num_input, event)) { applyNumInput(&rc->num_input, &numValue); + + if (rc->subtype == PROP_ANGLE) { + numValue = DEG2RADF(numValue); + numValue = fmod(numValue, 2.0f * (float)M_PI); + if (numValue < 0.0f) + numValue += 2.0f * (float)M_PI; + } + CLAMP(numValue, rc->min_value, rc->max_value); new_value = numValue; - + radial_control_set_value(rc, new_value); + rc->current_value = new_value; radial_control_update_header(op, C); return OPERATOR_RUNNING_MODAL; |