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:
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_mask.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index f7e8abde021..622ea82bf25 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -821,11 +821,24 @@ static void paint_mask_gesture_operator_properties(wmOperatorType *ot)
typedef enum eSculptTrimOperationType {
SCULPT_GESTURE_TRIM_INTERSECT,
SCULPT_GESTURE_TRIM_DIFFERENCE,
+ SCULPT_GESTURE_TRIM_UNION,
+ SCULPT_GESTURE_TRIM_JOIN,
} eSculptTrimOperationType;
+/* Intersect is not exposed in the UI because it does not work correctly with symmetry (it deletes
+ * the symmetrical part of the mesh in the first symmetry pass). */
static EnumPropertyItem prop_trim_operation_types[] = {
- {SCULPT_GESTURE_TRIM_INTERSECT, "INTERSECT", 0, "Intersect", ""},
- {SCULPT_GESTURE_TRIM_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
+ {SCULPT_GESTURE_TRIM_DIFFERENCE,
+ "DIFFERENCE",
+ 0,
+ "Difference",
+ "Use a difference boolean operation"},
+ {SCULPT_GESTURE_TRIM_UNION, "UNION", 0, "Union", "Use a union boolean operation"},
+ {SCULPT_GESTURE_TRIM_JOIN,
+ "JOIN",
+ 0,
+ "Join",
+ "Join the new mesh as separate geometry, without preforming any boolean operation"},
{0, NULL, 0, NULL, NULL},
};
@@ -1088,18 +1101,26 @@ static void sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
}
}
- int boolean_mode;
- switch (trim_operation->mode) {
- case SCULPT_GESTURE_TRIM_INTERSECT:
- boolean_mode = eBooleanModifierOp_Intersect;
- break;
- case SCULPT_GESTURE_TRIM_DIFFERENCE:
- boolean_mode = eBooleanModifierOp_Difference;
- break;
+ /* Join does not do a boolean operation, it just adds the geometry. */
+ if (trim_operation->mode != SCULPT_GESTURE_TRIM_JOIN) {
+ int boolean_mode = 0;
+ switch (trim_operation->mode) {
+ case SCULPT_GESTURE_TRIM_INTERSECT:
+ boolean_mode = eBooleanModifierOp_Intersect;
+ break;
+ case SCULPT_GESTURE_TRIM_DIFFERENCE:
+ boolean_mode = eBooleanModifierOp_Difference;
+ break;
+ case SCULPT_GESTURE_TRIM_UNION:
+ boolean_mode = eBooleanModifierOp_Union;
+ break;
+ case SCULPT_GESTURE_TRIM_JOIN:
+ BLI_assert(false);
+ break;
+ }
+ BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, 2, false, boolean_mode);
}
- BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, 2, false, boolean_mode);
-
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, sculpt_mesh);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;