[Bf-blender-cvs] [066bf316ced] blender-v3.2-release: Fix T94633: Sculpt mode missing check for hidden active object
Joseph Eagar
noreply at git.blender.org
Fri Jul 15 15:04:21 CEST 2022
Commit: 066bf316ced0ad3f82336090508bc5972b162794
Author: Joseph Eagar
Date: Sun Jul 10 23:39:45 2022 -0700
Branches: blender-v3.2-release
https://developer.blender.org/rB066bf316ced0ad3f82336090508bc5972b162794
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).
===================================================================
M source/blender/editors/sculpt_paint/sculpt.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list