Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_operators.c
| Show First 20 Lines • Show All 2,081 Lines • ▼ Show 20 Lines | typedef struct { | ||||
| int slow_mouse[2]; | int slow_mouse[2]; | ||||
| bool slow_mode; | bool slow_mode; | ||||
| Dial *dial; | Dial *dial; | ||||
| GPUTexture *texture; | GPUTexture *texture; | ||||
| ListBase orig_paintcursors; | ListBase orig_paintcursors; | ||||
| bool use_secondary_tex; | bool use_secondary_tex; | ||||
| void *cursor; | void *cursor; | ||||
| NumInput num_input; | NumInput num_input; | ||||
| int init_event; | |||||
| } RadialControl; | } RadialControl; | ||||
| static void radial_control_update_header(wmOperator *op, bContext *C) | static void radial_control_update_header(wmOperator *op, bContext *C) | ||||
| { | { | ||||
| RadialControl *rc = op->customdata; | RadialControl *rc = op->customdata; | ||||
| char msg[UI_MAX_DRAW_STR]; | char msg[UI_MAX_DRAW_STR]; | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ▲ Show 20 Lines • Show All 602 Lines • ▼ Show 20 Lines | if (!ELEM(rc->subtype, | ||||
| MEM_freeN(rc); | MEM_freeN(rc); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| rc->current_value = rc->initial_value; | rc->current_value = rc->initial_value; | ||||
| radial_control_set_initial_mouse(rc, event); | radial_control_set_initial_mouse(rc, event); | ||||
| radial_control_set_tex(rc); | radial_control_set_tex(rc); | ||||
| rc->init_event = WM_userdef_event_type_from_keymap_type(event->type); | |||||
| /* temporarily disable other paint cursors */ | /* temporarily disable other paint cursors */ | ||||
| wm = CTX_wm_manager(C); | wm = CTX_wm_manager(C); | ||||
| rc->orig_paintcursors = wm->paintcursors; | rc->orig_paintcursors = wm->paintcursors; | ||||
| BLI_listbase_clear(&wm->paintcursors); | BLI_listbase_clear(&wm->paintcursors); | ||||
| /* add radial control paint cursor */ | /* add radial control paint cursor */ | ||||
| rc->cursor = WM_paint_cursor_activate( | rc->cursor = WM_paint_cursor_activate( | ||||
| SPACE_TYPE_ANY, RGN_TYPE_ANY, op->type->poll, radial_control_paint_cursor, rc); | SPACE_TYPE_ANY, RGN_TYPE_ANY, op->type->poll, radial_control_paint_cursor, rc); | ||||
| ▲ Show 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | if (!handled && event->val == KM_PRESS && handleNumInput(C, &rc->num_input, event)) { | ||||
| radial_control_set_value(rc, new_value); | radial_control_set_value(rc, new_value); | ||||
| rc->current_value = new_value; | rc->current_value = new_value; | ||||
| radial_control_update_header(op, C); | radial_control_update_header(op, C); | ||||
| return OPERATOR_RUNNING_MODAL; | return OPERATOR_RUNNING_MODAL; | ||||
| } | } | ||||
| if (!handled && (event->val == KM_RELEASE) && (rc->init_event == event->type) && | |||||
| RNA_boolean_get(op->ptr, "release_confirm")) { | |||||
| ret = OPERATOR_FINISHED; | |||||
| } | |||||
| ED_region_tag_redraw(CTX_wm_region(C)); | ED_region_tag_redraw(CTX_wm_region(C)); | ||||
| radial_control_update_header(op, C); | radial_control_update_header(op, C); | ||||
| if (ret & OPERATOR_FINISHED) { | if (ret & OPERATOR_FINISHED) { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| if (wm->op_undo_depth == 0) { | if (wm->op_undo_depth == 0) { | ||||
| ID *id = rc->ptr.owner_id; | ID *id = rc->ptr.owner_id; | ||||
| if (ED_undo_is_legacy_compatible_for_property(C, id)) { | if (ED_undo_is_legacy_compatible_for_property(C, id)) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | prop = RNA_def_string(ot->srna, | ||||
| 0, | 0, | ||||
| "Image ID", | "Image ID", | ||||
| "Path of ID that is used to generate an image for the control"); | "Path of ID that is used to generate an image for the control"); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| prop = RNA_def_boolean( | prop = RNA_def_boolean( | ||||
| ot->srna, "secondary_tex", false, "Secondary Texture", "Tweak brush secondary/mask texture"); | ot->srna, "secondary_tex", false, "Secondary Texture", "Tweak brush secondary/mask texture"); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| prop = RNA_def_boolean( | |||||
| ot->srna, "release_confirm", false, "Confirm On Release", "Finish operation on key release"); | |||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Redraw Timer Operator | /** \name Redraw Timer Operator | ||||
| * | * | ||||
| * Use for simple benchmarks. | * Use for simple benchmarks. | ||||
| ▲ Show 20 Lines • Show All 1,042 Lines • Show Last 20 Lines | |||||