diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-05-22 17:09:22 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-05-25 17:57:36 +0300 |
commit | f53ae843b38e049b49ff2df0ab7477ad2180488d (patch) | |
tree | 4898bcc24fab26ca561927e9e6b1c14adaa6bdfb | |
parent | ce0db0d329985e44930e32322012e5f2d6bca3b8 (diff) |
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
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 14 |
1 files changed, 7 insertions, 7 deletions
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); } } |