Commit: 67b1412bc956c857843db0551ce1ac426414f7c2
Author: Antony Riakiotakis
Date:   Fri Jan 9 19:23:15 2015 +0100
Branches: master
https://developer.blender.org/rB67b1412bc956c857843db0551ce1ac426414f7c2

Radial operator number angle input should use angles.

Much more lenient if you are a human.

===================================================================

M       source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index 15ae9eb..5b944a7 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to