diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-01-19 16:28:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-01-26 18:23:09 +0300 |
commit | 66f8835f9c03e7736297b5995a68e1455ed14e2a (patch) | |
tree | d44f2a93d14c55944a5ae55282a1527d7db90664 /source/blender/editors/mask/mask_query.c | |
parent | 3d3b6d94e6e646828bd03c5656673a5d00a806aa (diff) |
Fix T84850: "Lock to Selection" causes unwanted jumps
Adding new tracks, mask points, mask primitives, changing selection was
causing an unwanted jumps in the view.
This change makes it so those operations are preserving view offset.
Differential Revision: https://developer.blender.org/D10146
Diffstat (limited to 'source/blender/editors/mask/mask_query.c')
-rw-r--r-- | source/blender/editors/mask/mask_query.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/mask/mask_query.c b/source/blender/editors/mask/mask_query.c index cfd57ca3477..8f4f14a1ba8 100644 --- a/source/blender/editors/mask/mask_query.c +++ b/source/blender/editors/mask/mask_query.c @@ -604,7 +604,7 @@ void ED_mask_point_pos__reverse( *yr = co[1]; } -bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2]) +bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool include_handles) { Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Mask *mask = CTX_data_edit_mask(C); @@ -638,22 +638,29 @@ bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2]) } if (bezt->f2 & SELECT) { minmax_v2v2_v2(min, max, deform_point->bezt.vec[1]); + ok = true; } - if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) { + + 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); 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); 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); minmax_v2v2_v2(min, max, handle); + ok = true; } } - ok = true; } } } |