[Bf-blender-cvs] [3982d3c1715] master: WM: add gesture variable to detect first execution
Campbell Barton
noreply at git.blender.org
Fri Mar 1 13:22:46 CET 2019
Commit: 3982d3c171522ca730685dd7a14c7dca663d8fe3
Author: Campbell Barton
Date: Fri Mar 1 23:00:11 2019 +1100
Branches: master
https://developer.blender.org/rB3982d3c171522ca730685dd7a14c7dca663d8fe3
WM: add gesture variable to detect first execution
Needed for circle select to replace the current selection.
===================================================================
M source/blender/windowmanager/WM_types.h
M source/blender/windowmanager/intern/wm_gesture_ops.c
===================================================================
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index dd4fe95db3b..7d1e13bb1e4 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -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;
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index db63eccfd41..030cf15adfb 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -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;
}
More information about the Bf-blender-cvs
mailing list