From 762daacbc7aed37c5984f02c4d4b29436e2cf005 Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Sat, 15 Aug 2020 17:03:58 +0200 Subject: Fix Face Set Visibility operator using wrong active Face Set The Face Set visibility operator was using the last active Face Set updated by the paint cursor, so when the paint cursor is not used (when using a filter or a transform tool), the active Face Set was not updating and it was hidding the wrong Face Set based on the last cursor position with a brush tool active. Now the Face Set Visitility operator has an invoke callback wich forces a active vertex and face set update regardless of the active tool, so it should always work correctly. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8580 --- .../blender/editors/sculpt_paint/sculpt_face_set.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index cd0720bbe1c..b9265380a35 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -932,6 +932,25 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static int sculpt_face_sets_change_visibility_invoke(bContext *C, + wmOperator *op, + const wmEvent *event) +{ + Object *ob = CTX_data_active_object(C); + SculptSession *ss = ob->sculpt; + + /* Update the active vertex and Face Set using the cursor position to avoid relying on the paint + * cursor updates. */ + SculptCursorGeometryInfo sgi; + float mouse[2]; + mouse[0] = event->mval[0]; + mouse[1] = event->mval[1]; + SCULPT_vertex_random_access_ensure(ss); + SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false); + + return sculpt_face_sets_change_visibility_exec(C, op); +} + void SCULPT_OT_face_sets_change_visibility(wmOperatorType *ot) { /* Identifiers. */ @@ -941,6 +960,7 @@ void SCULPT_OT_face_sets_change_visibility(wmOperatorType *ot) /* Api callbacks. */ ot->exec = sculpt_face_sets_change_visibility_exec; + ot->invoke = sculpt_face_sets_change_visibility_invoke; ot->poll = SCULPT_mode_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -- cgit v1.2.3