Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_operators.c
| Show First 20 Lines • Show All 2,724 Lines • ▼ Show 20 Lines | default: | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| /* initialize numerical input */ | /* initialize numerical input */ | ||||
| initNumInput(&rc->num_input); | initNumInput(&rc->num_input); | ||||
| rc->num_input.idx_max = 0; | rc->num_input.idx_max = 0; | ||||
| rc->num_input.val_flag[0] |= NUM_NO_NEGATIVE; | rc->num_input.val_flag[0] |= NUM_NO_NEGATIVE; | ||||
| rc->num_input.unit_sys = USER_UNIT_NONE; | rc->num_input.unit_sys = USER_UNIT_NONE; | ||||
| rc->num_input.unit_type[0] = B_UNIT_LENGTH; | rc->num_input.unit_type[0] = RNA_SUBTYPE_UNIT_VALUE(RNA_property_unit(rc->prop)); | ||||
| /* get subtype of property */ | /* get subtype of property */ | ||||
| rc->subtype = RNA_property_subtype(rc->prop); | rc->subtype = RNA_property_subtype(rc->prop); | ||||
| if (!ELEM(rc->subtype, | if (!ELEM(rc->subtype, | ||||
| PROP_NONE, | PROP_NONE, | ||||
| PROP_DISTANCE, | PROP_DISTANCE, | ||||
| PROP_FACTOR, | PROP_FACTOR, | ||||
| PROP_PERCENTAGE, | PROP_PERCENTAGE, | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| snap = event->ctrl != 0; | snap = event->ctrl != 0; | ||||
| /* Modal numinput active, try to handle numeric inputs first... */ | /* Modal numinput active, try to handle numeric inputs first... */ | ||||
| if (event->val == KM_PRESS && has_numInput && handleNumInput(C, &rc->num_input, event)) { | if (event->val == KM_PRESS && has_numInput && handleNumInput(C, &rc->num_input, event)) { | ||||
| handled = true; | handled = true; | ||||
| applyNumInput(&rc->num_input, &numValue); | applyNumInput(&rc->num_input, &numValue); | ||||
| if (rc->subtype == PROP_ANGLE) { | if (rc->subtype == PROP_ANGLE) { | ||||
| numValue = DEG2RADF(numValue); | |||||
| numValue = fmod(numValue, 2.0f * (float)M_PI); | numValue = fmod(numValue, 2.0f * (float)M_PI); | ||||
| if (numValue < 0.0f) { | if (numValue < 0.0f) { | ||||
| numValue += 2.0f * (float)M_PI; | numValue += 2.0f * (float)M_PI; | ||||
| } | } | ||||
| } | } | ||||
| CLAMP(numValue, rc->min_value, rc->max_value); | CLAMP(numValue, rc->min_value, rc->max_value); | ||||
| new_value = numValue; | new_value = numValue; | ||||
| ▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | switch (event->type) { | ||||
| } | } | ||||
| } | } | ||||
| /* Modal numinput inactive, try to handle numeric inputs last... */ | /* Modal numinput inactive, try to handle numeric inputs last... */ | ||||
| if (!handled && event->val == KM_PRESS && handleNumInput(C, &rc->num_input, event)) { | if (!handled && event->val == KM_PRESS && handleNumInput(C, &rc->num_input, event)) { | ||||
| applyNumInput(&rc->num_input, &numValue); | applyNumInput(&rc->num_input, &numValue); | ||||
| if (rc->subtype == PROP_ANGLE) { | if (rc->subtype == PROP_ANGLE) { | ||||
| numValue = DEG2RADF(numValue); | |||||
| numValue = fmod(numValue, 2.0f * (float)M_PI); | numValue = fmod(numValue, 2.0f * (float)M_PI); | ||||
| if (numValue < 0.0f) { | if (numValue < 0.0f) { | ||||
| numValue += 2.0f * (float)M_PI; | numValue += 2.0f * (float)M_PI; | ||||
| } | } | ||||
| } | } | ||||
| CLAMP(numValue, rc->min_value, rc->max_value); | CLAMP(numValue, rc->min_value, rc->max_value); | ||||
| new_value = numValue; | new_value = numValue; | ||||
| ▲ Show 20 Lines • Show All 1,133 Lines • Show Last 20 Lines | |||||