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:
authorPhilipp Oeser <info@graphics-engineer.com>2022-04-08 15:09:59 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-04-19 17:11:21 +0300
commitd2ca2c6e747063d7db1e224f0958c3a0cc8730ba (patch)
tree5708859d1332c859befe46d10bf685d0d554a05b
parent59e68d80319427de983355067f9cbef3148190d6 (diff)
Fix T85467: Mask transform center doesn't take parent Track into account
Coordinate checks in `spline_under_mouse_get` need to take place with the evaluated mask to get the right center. This is now more in line to how this is done in `ED_mask_point_find_nearest`. Note: similar issues are reported with box/circle/lasso selection in T97135, will tackle these separately though. Maniphest Tasks: T85467 Differential Revision: https://developer.blender.org/D14598
-rw-r--r--source/blender/editors/mask/mask_ops.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 1a6ac8597ae..033f899d900 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -31,6 +31,7 @@
#include "BKE_mask.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "DNA_mask_types.h"
#include "DNA_object_types.h" /* SELECT */
@@ -260,7 +261,7 @@ static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float c
}
static bool spline_under_mouse_get(const bContext *C,
- Mask *mask,
+ Mask *mask_orig,
const float co[2],
MaskLayer **r_mask_layer,
MaskSpline **r_mask_spline)
@@ -275,6 +276,9 @@ static bool spline_under_mouse_get(const bContext *C,
*r_mask_layer = NULL;
*r_mask_spline = NULL;
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+ Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
+
int width, height;
ED_mask_get_size(area, &width, &height);
float pixel_co[2];
@@ -283,22 +287,25 @@ static bool spline_under_mouse_get(const bContext *C,
if (sc != NULL) {
undistort = (sc->clip != NULL) && (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
}
- for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL;
- mask_layer = mask_layer->next) {
- if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
+
+ for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first,
+ *mask_layer_eval = mask_eval->masklayers.first;
+ mask_layer_orig != NULL;
+ mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
+ if (mask_layer_orig->restrictflag & MASK_RESTRICT_SELECT) {
continue;
}
-
- for (MaskSpline *spline = mask_layer->splines.first; spline != NULL; spline = spline->next) {
- MaskSplinePoint *points_array;
- float min[2], max[2], center[2];
- if ((spline->flag & SELECT) == 0) {
+ for (MaskSpline *spline_orig = mask_layer_orig->splines.first,
+ *spline_eval = mask_layer_eval->splines.first;
+ spline_orig != NULL;
+ spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
+ if ((spline_orig->flag & SELECT) == 0) {
continue;
}
-
- points_array = BKE_mask_spline_point_array(spline);
+ MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
+ float min[2], max[2], center[2];
INIT_MINMAX2(min, max);
- for (int i = 0; i < spline->tot_point; i++) {
+ for (int i = 0; i < spline_orig->tot_point; i++) {
MaskSplinePoint *point_deform = &points_array[i];
BezTriple *bezt = &point_deform->bezt;
@@ -319,8 +326,8 @@ static bool spline_under_mouse_get(const bContext *C,
float max_bb_side = min_ff((max[0] - min[0]) * width, (max[1] - min[1]) * height);
if (dist_squared <= max_bb_side * max_bb_side * 0.5f &&
(closest_spline == NULL || dist_squared < closest_dist_squared)) {
- closest_layer = mask_layer;
- closest_spline = spline;
+ closest_layer = mask_layer_orig;
+ closest_spline = spline_orig;
closest_dist_squared = dist_squared;
}
}
@@ -328,7 +335,7 @@ static bool spline_under_mouse_get(const bContext *C,
if (closest_dist_squared < square_f(threshold) && closest_spline != NULL) {
float diff_score;
if (ED_mask_find_nearest_diff_point(C,
- mask,
+ mask_orig,
co,
threshold,
false,