diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 49dc215bb45..2c58ac174a5 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -44,6 +44,7 @@ #include "BKE_customdata.hh" #include "BKE_image.h" #include "BKE_key.hh" +#include "BKE_layer.hh" #include "BKE_lib_id.hh" #include "BKE_main.hh" #include "BKE_mesh.hh" @@ -4894,7 +4895,10 @@ bool SCULPT_cursor_geometry_info_update(bContext *C, ob = vc.obact; ss = ob->sculpt; - if (!ss->pbvh || !vc.rv3d) { + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + + if (!ss->pbvh || !vc.rv3d || !BKE_base_is_visible(v3d, base)) { zero_v3(out->location); zero_v3(out->normal); zero_v3(out->active_vertex_co); @@ -5635,16 +5639,13 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent int retval; Object *ob = CTX_data_active_object(C); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); /* Test that ob is visible; otherwise we won't be able to get evaluated data * from the depsgraph. We do this here instead of SCULPT_mode_poll * to avoid falling through to the translate operator in the - * global view3d keymap. - * - * NOTE: #BKE_object_is_visible_in_viewport is not working here (it returns false - * if the object is in local view); instead, test for OB_HIDE_VIEWPORT directly. - */ - - if (ob->visibility_flag & OB_HIDE_VIEWPORT) { + * global view3d keymap. */ + if (!BKE_base_is_visible(v3d, base)) { return OPERATOR_CANCELLED; }