[Bf-blender-cvs] [f53ae843b38] blender-v2.83-release: Fix T76267: Stencil texture with negative scale dissapears after clicking Image Aspect
Philipp Oeser
noreply at git.blender.org
Mon May 25 17:03:25 CEST 2020
Commit: f53ae843b38e049b49ff2df0ab7477ad2180488d
Author: Philipp Oeser
Date: Fri May 22 16:09:22 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBf53ae843b38e049b49ff2df0ab7477ad2180488d
Fix T76267: Stencil texture with negative scale dissapears after
clicking Image Aspect
Calculate with positive areas here and ensure stencil_dimension stays
positive.
Maniphest Tasks: T76267
Differential Revision: https://developer.blender.org/D7821
===================================================================
M source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 634e29ca400..0f54d5e0821 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1147,24 +1147,24 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
aspy *= tex->yrepeat;
}
- orig_area = aspx * aspy;
+ orig_area = fabsf(aspx * aspy);
if (do_mask) {
- stencil_area = br->mask_stencil_dimension[0] * br->mask_stencil_dimension[1];
+ stencil_area = fabsf(br->mask_stencil_dimension[0] * br->mask_stencil_dimension[1]);
}
else {
- stencil_area = br->stencil_dimension[0] * br->stencil_dimension[1];
+ stencil_area = fabsf(br->stencil_dimension[0] * br->stencil_dimension[1]);
}
factor = sqrtf(stencil_area / orig_area);
if (do_mask) {
- br->mask_stencil_dimension[0] = factor * aspx;
- br->mask_stencil_dimension[1] = factor * aspy;
+ br->mask_stencil_dimension[0] = fabsf(factor * aspx);
+ br->mask_stencil_dimension[1] = fabsf(factor * aspy);
}
else {
- br->stencil_dimension[0] = factor * aspx;
- br->stencil_dimension[1] = factor * aspy;
+ br->stencil_dimension[0] = fabsf(factor * aspx);
+ br->stencil_dimension[1] = fabsf(factor * aspy);
}
}
More information about the Bf-blender-cvs
mailing list