WM: add gesture variable to detect first execution
Needed for circle select to replace the current selection.
This commit is contained in:
@@ -427,6 +427,8 @@ typedef struct wmGesture {
|
||||
/* For modal operators which may be running idle, waiting for an event to activate the gesture.
|
||||
* Typically this is set when the user is click-dragging the gesture (border and circle select for eg). */
|
||||
uint is_active : 1;
|
||||
/* Previous value of is-active (use to detect first run & edge cases). */
|
||||
uint is_active_prev : 1;
|
||||
/* Use for gestures that support both immediate or delayed activation. */
|
||||
uint wait_for_input : 1;
|
||||
|
||||
|
||||
@@ -251,6 +251,7 @@ int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
gesture->is_active_prev = gesture->is_active;
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
@@ -383,8 +384,8 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
else {
|
||||
/* apply first click */
|
||||
gesture_circle_apply(C, op);
|
||||
gesture->is_active = true;
|
||||
gesture_circle_apply(C, op);
|
||||
wm_gesture_tag_redraw(C);
|
||||
}
|
||||
break;
|
||||
@@ -422,7 +423,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
gesture->is_active_prev = gesture->is_active;
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
@@ -655,6 +656,8 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
gesture_modal_end(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
gesture->is_active_prev = gesture->is_active;
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
@@ -841,6 +844,7 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
}
|
||||
}
|
||||
|
||||
gesture->is_active_prev = gesture->is_active;
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user