Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-08-15 18:03:58 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-08-18 13:33:54 +0300
commit762daacbc7aed37c5984f02c4d4b29436e2cf005 (patch)
tree99cb84071b0af2c05a773fbf27e05113a9f5a410 /source/blender/editors/sculpt_paint/sculpt_face_set.c
parentcfeadaa2959408f5bfaf8ba809cec8137ece9c29 (diff)
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
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_face_set.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.c20
1 files changed, 20 insertions, 0 deletions
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;