Commit: 2b72860ff4473255ac73519e5a66c085c0c1fbe8 Author: Pablo Dobarro Date: Tue Oct 6 18:07:39 2020 +0200 Branches: master https://developer.blender.org/rB2b72860ff4473255ac73519e5a66c085c0c1fbe8
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 =================================================================== M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py M source/blender/editors/sculpt_paint/paint_mask.c =================================================================== diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index e021433bee3..af263bf5d53 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -1304,22 +1304,30 @@ class _defs_sculpt: @ToolDef.from_fn def trim_box(): + def draw_settings(_context, layout, tool): + props = tool.operator_properties("sculpt.trim_box_gesture") + layout.prop(props, "trim_mode", expand=False) return dict( idname="builtin.box_trim", label="Box Trim", icon="ops.sculpt.box_trim", widget=None, keymap=(), + draw_settings=draw_settings, ) @ToolDef.from_fn def trim_lasso(): + def draw_settings(_context, layout, tool): + props = tool.operator_properties("sculpt.trim_lasso_gesture") + layout.prop(props, "trim_mode", expand=False) return dict( idname="builtin.lasso_trim", label="Lasso Trim", icon="ops.sculpt.lasso_trim", widget=None, keymap=(), + draw_settings=draw_settings, ) @ToolDef.from_fn 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; _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
