From 8c638878e6a087791bc8ab7d4e5daa0075130771 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Fri, 9 Feb 2024 17:00:06 -0800 Subject: [PATCH] Sculpt: Disable SCULPT_OT_trim_* operators on invisible objects. Ref: \#112371 --- source/blender/editors/sculpt_paint/paint_mask.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/blender/editors/sculpt_paint/paint_mask.cc b/source/blender/editors/sculpt_paint/paint_mask.cc index 8fcc31cba65..fdd5aa06fe5 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.cc +++ b/source/blender/editors/sculpt_paint/paint_mask.cc @@ -32,6 +32,7 @@ #include "BKE_brush.hh" #include "BKE_ccg.h" #include "BKE_context.hh" +#include "BKE_layer.hh" #include "BKE_lib_id.hh" #include "BKE_mesh.hh" #include "BKE_multires.hh" @@ -2075,6 +2076,12 @@ static int sculpt_trim_gesture_box_invoke(bContext *C, wmOperator *op, const wmE Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + SculptCursorGeometryInfo sgi; const float mval_fl[2] = {float(event->mval[0]), float(event->mval[1])}; SCULPT_vertex_random_access_ensure(ss); @@ -2120,6 +2127,12 @@ static int sculpt_trim_gesture_lasso_invoke(bContext *C, wmOperator *op, const w Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + SculptCursorGeometryInfo sgi; const float mval_fl[2] = {float(event->mval[0]), float(event->mval[1])}; SCULPT_vertex_random_access_ensure(ss); -- 2.30.2