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:
authorSergey Sharybin <sergey@blender.org>2021-01-20 14:52:12 +0300
committerSergey Sharybin <sergey@blender.org>2021-01-20 15:46:39 +0300
commit87db3423c98ea5d11a6bdbef6658b67970023a4e (patch)
tree91663b8ac982045ad05112475496dc63f325af7a /source/blender/editors/mask/mask_query.c
parent8e5b6320a6b240c266af1a93c6cee47d54e21757 (diff)
Fix Lock to Selection does not work in mask mode
A regression since 2.80: need to use evaluated mask to calculate its bounds. Non-evaluated mask does not contain state for the current frame, so iterating over control points of the original mask gives points state from the time they were edited last (aka, not affected by the animation).
Diffstat (limited to 'source/blender/editors/mask/mask_query.c')
-rw-r--r--source/blender/editors/mask/mask_query.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/mask/mask_query.c b/source/blender/editors/mask/mask_query.c
index cf5997d8a18..cfd57ca3477 100644
--- a/source/blender/editors/mask/mask_query.c
+++ b/source/blender/editors/mask/mask_query.c
@@ -606,7 +606,14 @@ void ED_mask_point_pos__reverse(
bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2])
{
+ Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Mask *mask = CTX_data_edit_mask(C);
+
+ /* Use evaluated mask to take animation into account.
+ * The animation of splies is not "flushed" back to original, so need to explicitly
+ * sue evaluated datablock here. */
+ Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask->id);
+
bool ok = false;
if (mask == NULL) {
@@ -614,7 +621,7 @@ bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2])
}
INIT_MINMAX2(min, max);
- for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL;
+ for (MaskLayer *mask_layer = mask_eval->masklayers.first; mask_layer != NULL;
mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;