Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Koenig <sebastian_k>2021-02-08 13:11:33 +0300
committerSergey Sharybin <sergey@blender.org>2021-02-08 13:14:34 +0300
commitc33a3cfd9aaba9686d24349189bb2a9b6351cdfb (patch)
tree4a4083b121026cca9be3d34514dcfb4e4e6268fa /source/blender/editors/mask
parent62ef35db6d7f06f7c84e66a86ea7b989305a3b2d (diff)
Mask: Use control point position when handle is selected
This is something what comes after an experiment, which makes behavior more desirable. Basically, for Lock-to-Selection functionality always use control point position if any of control point itself or handles are selected. Initial patch from Sebastian, modification from Sergey. Differential Revision: https://developer.blender.org/D10265
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r--source/blender/editors/mask/mask_query.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/editors/mask/mask_query.c b/source/blender/editors/mask/mask_query.c
index eace146dbe9..401b6eac4f2 100644
--- a/source/blender/editors/mask/mask_query.c
+++ b/source/blender/editors/mask/mask_query.c
@@ -604,7 +604,22 @@ void ED_mask_point_pos__reverse(
*yr = co[1];
}
-bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool include_handles)
+static void handle_position_for_minmax(const MaskSplinePoint *point,
+ eMaskWhichHandle which_handle,
+ bool handles_as_control_point,
+ float r_handle[2])
+{
+ if (handles_as_control_point) {
+ copy_v2_v2(r_handle, point->bezt.vec[1]);
+ return;
+ }
+ BKE_mask_point_handle(point, which_handle, r_handle);
+}
+
+bool ED_mask_selected_minmax(const bContext *C,
+ float min[2],
+ float max[2],
+ bool handles_as_control_point)
{
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Mask *mask = CTX_data_edit_mask(C);
@@ -641,22 +656,22 @@ bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool
ok = true;
}
- if (!include_handles) {
- /* Ignore handles. */
- }
- else if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) {
- BKE_mask_point_handle(deform_point, MASK_WHICH_HANDLE_STICK, handle);
+ if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) {
+ handle_position_for_minmax(
+ deform_point, MASK_WHICH_HANDLE_STICK, handles_as_control_point, handle);
minmax_v2v2_v2(min, max, handle);
ok = true;
}
else {
if ((bezt->f1 & SELECT) && (bezt->h1 != HD_VECT)) {
- BKE_mask_point_handle(deform_point, MASK_WHICH_HANDLE_LEFT, handle);
+ handle_position_for_minmax(
+ deform_point, MASK_WHICH_HANDLE_LEFT, handles_as_control_point, handle);
minmax_v2v2_v2(min, max, handle);
ok = true;
}
if ((bezt->f3 & SELECT) && (bezt->h2 != HD_VECT)) {
- BKE_mask_point_handle(deform_point, MASK_WHICH_HANDLE_RIGHT, handle);
+ handle_position_for_minmax(
+ deform_point, MASK_WHICH_HANDLE_RIGHT, handles_as_control_point, handle);
minmax_v2v2_v2(min, max, handle);
ok = true;
}