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-11 20:24:01 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-08-12 19:09:27 +0300
commit77e40708c2ce91cfa27930a0250c5602ec0e93ec (patch)
treed375d9f33d6651046b5d511927e9479dcae4d6cd /source/blender/editors/sculpt_paint/sculpt_face_set.c
parent051f067fb85092ba6d1098e7396bbaf742b8afe1 (diff)
Sculpt: Expose Edit Face Set as a tool
Previously the way to use this operations was using the shortcut Ctrl + W and Ctrl + Alt + W, which was not very discoverable and it was limiting the amount of options that can be added to the operator.Now the same functionality of the operator is available as a tool, which will make easier to add other editing operations and options without adding more entries to the keymap. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8545
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_face_set.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index a8de3be3baf..2afa3556dd9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -1082,7 +1082,7 @@ static void sculpt_face_set_apply_edit(Object *ob,
MEM_SAFE_FREE(prev_face_sets);
}
-static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
@@ -1096,8 +1096,21 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven
return OPERATOR_CANCELLED;
}
+ /* Ignore other events to avoid repeated operations. */
+ if (event->val != KM_PRESS) {
+ return OPERATOR_CANCELLED;
+ }
+
BKE_sculpt_update_object_for_edit(depsgraph, ob, true, false, false);
+ /* Update the current active Face Set and Vertex as the operator can be used directly from the
+ * tool without brush cursor. */
+ SculptCursorGeometryInfo sgi;
+ float mouse[2];
+ mouse[0] = event->mval[0];
+ mouse[1] = event->mval[1];
+ SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false);
+
PBVH *pbvh = ob->sculpt->pbvh;
PBVHNode **nodes;
int totnode;