Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mask/mask_select.c
| Show First 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | |||||
| /** \name (De)select All Operator | /** \name (De)select All Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int select_all_exec(bContext *C, wmOperator *op) | static int select_all_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Mask *mask = CTX_data_edit_mask(C); | Mask *mask = CTX_data_edit_mask(C); | ||||
| int action = RNA_enum_get(op->ptr, "action"); | int action = RNA_enum_get(op->ptr, "action"); | ||||
| MaskViewLockState lock_state; | |||||
| ED_mask_view_lock_state_store(C, &lock_state); | |||||
| ED_mask_select_toggle_all(mask, action); | ED_mask_select_toggle_all(mask, action); | ||||
| ED_mask_select_flush_all(mask); | ED_mask_select_flush_all(mask); | ||||
| DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); | DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); | ||||
| WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); | WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); | ||||
| ED_mask_view_lock_state_restore_no_jump(C, &lock_state); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void MASK_OT_select_all(wmOperatorType *ot) | void MASK_OT_select_all(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "(De)select All"; | ot->name = "(De)select All"; | ||||
| ot->description = "Change selection of all curve points"; | ot->description = "Change selection of all curve points"; | ||||
| Show All 25 Lines | static int select_exec(bContext *C, wmOperator *op) | ||||
| float co[2]; | float co[2]; | ||||
| bool extend = RNA_boolean_get(op->ptr, "extend"); | bool extend = RNA_boolean_get(op->ptr, "extend"); | ||||
| bool deselect = RNA_boolean_get(op->ptr, "deselect"); | bool deselect = RNA_boolean_get(op->ptr, "deselect"); | ||||
| bool toggle = RNA_boolean_get(op->ptr, "toggle"); | bool toggle = RNA_boolean_get(op->ptr, "toggle"); | ||||
| const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all"); | const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all"); | ||||
| eMaskWhichHandle which_handle; | eMaskWhichHandle which_handle; | ||||
| const float threshold = 19; | const float threshold = 19; | ||||
| MaskViewLockState lock_state; | |||||
| ED_mask_view_lock_state_store(C, &lock_state); | |||||
| RNA_float_get_array(op->ptr, "location", co); | RNA_float_get_array(op->ptr, "location", co); | ||||
| point = ED_mask_point_find_nearest( | point = ED_mask_point_find_nearest( | ||||
| C, mask, co, threshold, &mask_layer, &spline, &which_handle, NULL); | C, mask, co, threshold, &mask_layer, &spline, &which_handle, NULL); | ||||
| if (extend == false && deselect == false && toggle == false) { | if (extend == false && deselect == false && toggle == false) { | ||||
| ED_mask_select_toggle_all(mask, SEL_DESELECT); | ED_mask_select_toggle_all(mask, SEL_DESELECT); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if (point) { | ||||
| mask_layer->act_spline = spline; | mask_layer->act_spline = spline; | ||||
| mask_layer->act_point = point; | mask_layer->act_point = point; | ||||
| ED_mask_select_flush_all(mask); | ED_mask_select_flush_all(mask); | ||||
| DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); | DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); | ||||
| WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); | WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); | ||||
| ED_mask_view_lock_state_restore_no_jump(C, &lock_state); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| MaskSplinePointUW *uw; | MaskSplinePointUW *uw; | ||||
| if (ED_mask_feather_find_nearest( | if (ED_mask_feather_find_nearest( | ||||
| C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) { | C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) { | ||||
| Show All 24 Lines | else { | ||||
| } | } | ||||
| } | } | ||||
| ED_mask_select_flush_all(mask); | ED_mask_select_flush_all(mask); | ||||
| DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); | DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); | ||||
| WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); | WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); | ||||
| ED_mask_view_lock_state_restore_no_jump(C, &lock_state); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| if (deselect_all) { | if (deselect_all) { | ||||
| /* For clip editor tracks, leave deselect all to clip editor. */ | /* For clip editor tracks, leave deselect all to clip editor. */ | ||||
| if (!ED_clip_can_select(C)) { | if (!ED_clip_can_select(C)) { | ||||
| ED_mask_deselect_all(C); | ED_mask_deselect_all(C); | ||||
| ED_mask_view_lock_state_restore_no_jump(C, &lock_state); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| } | } | ||||
| return OPERATOR_PASS_THROUGH; | return OPERATOR_PASS_THROUGH; | ||||
| } | } | ||||
| static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| ▲ Show 20 Lines • Show All 589 Lines • Show Last 20 Lines | |||||