diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-07-11 09:39:45 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2022-07-15 15:53:30 +0300 |
commit | 066bf316ced0ad3f82336090508bc5972b162794 (patch) | |
tree | 87b5a188753fdc2ea595615d9e493f876d5beaf1 | |
parent | 8116d460255c46590d7893ad21a9ae655da4ce56 (diff) |
Fix T94633: Sculpt mode missing check for hidden active object
Note there is a bug in BKE_object_is_visible_in_viewport, it
returns false when the object is in local mode.
The transform operator poll should do a similar test. That
would allow us to move the test from sculpt_brush_strok_invoke
to SCULPT_mode_poll (at the moment we cannot do this due to
the brush operator falling through to the translate keymap
item in global view3d keymap).
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 3f726531a05..967a13badd4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5461,10 +5461,23 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent struct PaintStroke *stroke; int ignore_background_click; int retval; + Object *ob = CTX_data_active_object(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) { + return OPERATOR_CANCELLED; + } sculpt_brush_stroke_init(C, op); - Object *ob = CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); |