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/space_clip/clip_utils.c
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/space_clip/clip_utils.c')
-rw-r--r--source/blender/editors/space_clip/clip_utils.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 271ec219809..bb79eb34129 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -484,7 +484,7 @@ static bool tracking_has_selection(SpaceClip *space_clip)
return false;
}
-static bool mask_has_selection(const bContext *C, bool include_handles)
+static bool mask_has_selection(const bContext *C)
{
Mask *mask = CTX_data_edit_mask(C);
if (mask == NULL) {
@@ -506,10 +506,7 @@ static bool mask_has_selection(const bContext *C, bool include_handles)
return true;
}
- if (!include_handles) {
- /* Ignore handles. */
- }
- else if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) {
+ if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) {
return true;
}
else {
@@ -527,14 +524,17 @@ static bool mask_has_selection(const bContext *C, bool include_handles)
return false;
}
-static bool selected_boundbox(const bContext *C, float min[2], float max[2], bool include_handles)
+static bool selected_boundbox(const bContext *C,
+ float min[2],
+ float max[2],
+ bool handles_as_control_point)
{
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc->mode == SC_MODE_TRACKING) {
return selected_tracking_boundbox(sc, min, max);
}
- if (ED_mask_selected_minmax(C, min, max, include_handles)) {
+ if (ED_mask_selected_minmax(C, min, max, handles_as_control_point)) {
MovieClip *clip = ED_space_clip_get_clip(sc);
int width, height;
ED_space_clip_get_size(sc, &width, &height);
@@ -563,12 +563,13 @@ bool clip_view_calculate_view_selection(
/* NOTE: The `fit` argument is set to truth when doing "View to Selected" operator, and it set to
* false when this function is used for Lock-to-Selection functionality. When locking to
- * selection the handles are to be ignored. So we can derive the `include_handles` from `fit`.
+ * selection the handles are to use control point position. So we can derive the
+ * `handles_as_control_point` from `fit`.
*
* TODO(sergey): Make such decision more explicit. Maybe pass use-case for the calculation to
* tell operator from lock-to-selection apart. */
float min[2], max[2];
- if (!selected_boundbox(C, min, max, fit)) {
+ if (!selected_boundbox(C, min, max, !fit)) {
return false;
}
@@ -622,7 +623,7 @@ bool clip_view_has_locked_selection(const bContext *C)
return tracking_has_selection(space_clip);
}
- return mask_has_selection(C, false);
+ return mask_has_selection(C);
}
void clip_draw_sfra_efra(View2D *v2d, Scene *scene)