forked from bartvdbraak/blender
Fix #35190: texture mask stencil Reset Transform did not work properly.
This commit is contained in:
parent
12db4f3eae
commit
cc86176a60
@ -131,7 +131,7 @@ def brush_mask_texture_settings(layout, brush):
|
|||||||
if mask_tex_slot.map_mode == 'STENCIL':
|
if mask_tex_slot.map_mode == 'STENCIL':
|
||||||
if brush.mask_texture and brush.mask_texture.type == 'IMAGE':
|
if brush.mask_texture and brush.mask_texture.type == 'IMAGE':
|
||||||
layout.operator("brush.stencil_fit_image_aspect").mask = True
|
layout.operator("brush.stencil_fit_image_aspect").mask = True
|
||||||
layout.operator("brush.stencil_reset_transform")
|
layout.operator("brush.stencil_reset_transform").mask = True
|
||||||
|
|
||||||
if brush.mask_texture:
|
if brush.mask_texture:
|
||||||
layout.label(text="Mask Mapping:")
|
layout.label(text="Mask Mapping:")
|
||||||
|
@ -826,14 +826,25 @@ static void BRUSH_OT_stencil_fit_image_aspect(wmOperatorType *ot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int stencil_reset_transform(bContext *C, wmOperator *UNUSED(op))
|
static int stencil_reset_transform(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||||
Brush *br = BKE_paint_brush(paint);
|
Brush *br = BKE_paint_brush(paint);
|
||||||
|
bool do_mask = RNA_boolean_get(op->ptr, "mask");
|
||||||
|
|
||||||
if (!br)
|
if (!br)
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
|
if (do_mask) {
|
||||||
|
br->mask_stencil_pos[0] = 256;
|
||||||
|
br->mask_stencil_pos[1] = 256;
|
||||||
|
|
||||||
|
br->mask_stencil_dimension[0] = 256;
|
||||||
|
br->mask_stencil_dimension[1] = 256;
|
||||||
|
|
||||||
|
br->mask_mtex.rot = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
br->stencil_pos[0] = 256;
|
br->stencil_pos[0] = 256;
|
||||||
br->stencil_pos[1] = 256;
|
br->stencil_pos[1] = 256;
|
||||||
|
|
||||||
@ -841,7 +852,7 @@ static int stencil_reset_transform(bContext *C, wmOperator *UNUSED(op))
|
|||||||
br->stencil_dimension[1] = 256;
|
br->stencil_dimension[1] = 256;
|
||||||
|
|
||||||
br->mtex.rot = 0;
|
br->mtex.rot = 0;
|
||||||
br->mask_mtex.rot = 0;
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||||
|
|
||||||
@ -862,6 +873,8 @@ static void BRUSH_OT_stencil_reset_transform(wmOperatorType *ot)
|
|||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
|
|
||||||
|
RNA_def_boolean(ot->srna, "mask", 0, "Modify Mask Stencil", "Modify either the primary or mask stencil");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user