Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_operators.c
| Show First 20 Lines • Show All 638 Lines • ▼ Show 20 Lines | switch (RNA_property_type(prop)) { | ||||
| } | } | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| RNA_STRUCT_END; | RNA_STRUCT_END; | ||||
| } | } | ||||
| /** set all props to their default, | /** | ||||
| * Set all props to their default. | |||||
| * | |||||
| * \param do_update: Only update un-initialized props. | * \param do_update: Only update un-initialized props. | ||||
| * | * | ||||
| * \note, there's nothing specific to operators here. | * \note There's nothing specific to operators here. | ||||
| * this could be made a general function. | * This could be made a general function. | ||||
| */ | */ | ||||
| bool WM_operator_properties_default(PointerRNA *ptr, const bool do_update) | bool WM_operator_properties_default(PointerRNA *ptr, const bool do_update) | ||||
| { | { | ||||
| bool changed = false; | bool changed = false; | ||||
| RNA_STRUCT_BEGIN (ptr, prop) { | RNA_STRUCT_BEGIN (ptr, prop) { | ||||
| switch (RNA_property_type(prop)) { | switch (RNA_property_type(prop)) { | ||||
| case PROP_POINTER: { | case PROP_POINTER: { | ||||
| StructRNA *ptype = RNA_property_pointer_type(ptr, prop); | StructRNA *ptype = RNA_property_pointer_type(ptr, prop); | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Default Operator Callbacks | /** \name Default Operator Callbacks | ||||
| * \{ */ | * \{ */ | ||||
| /** | |||||
| * Helper to get select and tweak-transform to work conflict free and as desired. See | |||||
| * #WM_operator_properties_generic_select() for details. | |||||
| * | |||||
| * To be used together with #WM_generic_select_invoke() and | |||||
| * #WM_operator_properties_generic_select(). | |||||
| */ | |||||
| int WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event) | int WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| PropertyRNA *wait_to_deselect_prop = RNA_struct_find_property(op->ptr, | PropertyRNA *wait_to_deselect_prop = RNA_struct_find_property(op->ptr, | ||||
| "wait_to_deselect_others"); | "wait_to_deselect_others"); | ||||
| const short init_event_type = (short)POINTER_AS_INT(op->customdata); | const short init_event_type = (short)POINTER_AS_INT(op->customdata); | ||||
| int ret_value = 0; | int ret_value = 0; | ||||
| /* get settings from RNA properties for operator */ | /* get settings from RNA properties for operator */ | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | else { | ||||
| * otherwise it prevents underlying tweak detection code to work properly. */ | * otherwise it prevents underlying tweak detection code to work properly. */ | ||||
| return OPERATOR_PASS_THROUGH; | return OPERATOR_PASS_THROUGH; | ||||
| } | } | ||||
| } | } | ||||
| return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH; | return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH; | ||||
| } | } | ||||
| /** | |||||
| * Helper to get select and tweak-transform to work conflict free and as desired. See | |||||
| * #WM_operator_properties_generic_select() for details. | |||||
| * | |||||
| * To be used together with #WM_generic_select_modal() and | |||||
| * #WM_operator_properties_generic_select(). | |||||
| */ | |||||
| int WM_generic_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) | int WM_generic_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| RNA_int_set(op->ptr, "mouse_x", event->mval[0]); | RNA_int_set(op->ptr, "mouse_x", event->mval[0]); | ||||
| RNA_int_set(op->ptr, "mouse_y", event->mval[1]); | RNA_int_set(op->ptr, "mouse_y", event->mval[1]); | ||||
| op->customdata = POINTER_FROM_INT(0); | op->customdata = POINTER_FROM_INT(0); | ||||
| return op->type->modal(C, op, event); | return op->type->modal(C, op, event); | ||||
| ▲ Show 20 Lines • Show All 3,057 Lines • Show Last 20 Lines | |||||