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-10-06 19:07:39 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-06 19:08:25 +0300
commit2b72860ff4473255ac73519e5a66c085c0c1fbe8 (patch)
tree608aeb380d6176ce451a1ddb4c2ddb4edbdf0e02 /source/blender/editors/sculpt_paint/paint_mask.c
parentd43e3f34d26daca4f2b0f4c524a35a98cc85d1ce (diff)
Sculpt: Union and Join mode for trim tools
This enables a union boolean mode for the trimming gestures tools which adds geometry to the mesh instead of cutting it. It also adds a Join mode, which adds the geometry directly without using a boolean operation. Depending if you plan to use dyntopo or not, it is useful to have both options available. This is using the full depth of the object from the camera view for the depth of the geometry, but options for controlling the trimming depth in all modes are going to be added in later patches Reviewed By: mont29 Differential Revision: https://developer.blender.org/D9066
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;