Sculpt: Add Line Hide tool
This PR adds the *Line Hide* tool and the corresponding `PAINT_OT_hide_show_line_gesture` operator to Sculpt Mode. *Line Hide* supports common modal functionality including: * Snapping to angles * Flipping the selection area * Moving selection area Addresses one of the tools in #80390 Pull Request: https://projects.blender.org/blender/blender/pulls/119671
This commit is contained in:
Submodule release/datafiles/assets updated: 1d44611dd3...0b910c0a71
BIN
release/datafiles/icons/ops.sculpt.line_hide.dat
Normal file
BIN
release/datafiles/icons/ops.sculpt.line_hide.dat
Normal file
Binary file not shown.
@@ -7907,6 +7907,21 @@ def km_3d_view_tool_sculpt_lasso_hide(params):
|
||||
)
|
||||
|
||||
|
||||
def km_3d_view_tool_sculpt_line_hide(params):
|
||||
return (
|
||||
"3D View Tool: Sculpt, Line Hide",
|
||||
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
("paint.hide_show_line_gesture", params.tool_maybe_tweak_event,
|
||||
{"properties": [("action", 'HIDE')]}),
|
||||
("paint.hide_show_line_gesture", {**params.tool_maybe_tweak_event, "ctrl": True},
|
||||
{"properties": [("action", 'SHOW')]}),
|
||||
("paint.hide_show_all", {"type": params.select_mouse, "value": params.select_mouse_value},
|
||||
{"properties": [("action", 'SHOW')]}),
|
||||
]},
|
||||
)
|
||||
|
||||
|
||||
def km_3d_view_tool_sculpt_box_mask(params):
|
||||
return (
|
||||
"3D View Tool: Sculpt, Box Mask",
|
||||
@@ -8753,6 +8768,7 @@ def generate_keymaps(params=None):
|
||||
km_3d_view_tool_edit_curves_draw(params),
|
||||
km_3d_view_tool_sculpt_box_hide(params),
|
||||
km_3d_view_tool_sculpt_lasso_hide(params),
|
||||
km_3d_view_tool_sculpt_line_hide(params),
|
||||
km_3d_view_tool_sculpt_box_mask(params),
|
||||
km_3d_view_tool_sculpt_lasso_mask(params),
|
||||
km_3d_view_tool_sculpt_box_face_set(params),
|
||||
|
||||
@@ -1416,6 +1416,21 @@ class _defs_sculpt:
|
||||
draw_settings=draw_settings,
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def hide_line():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("paint.hide_show_line_gesture")
|
||||
layout.prop(props, "use_limit_to_segment", expand=False)
|
||||
|
||||
return dict(
|
||||
idname="builtin.line_hide",
|
||||
label="Line Hide",
|
||||
icon="ops.sculpt.line_hide",
|
||||
widget=None,
|
||||
keymap=(),
|
||||
draw_settings=draw_settings,
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def mask_border():
|
||||
def draw_settings(_context, layout, tool):
|
||||
@@ -3108,7 +3123,8 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
),
|
||||
(
|
||||
_defs_sculpt.hide_border,
|
||||
_defs_sculpt.hide_lasso
|
||||
_defs_sculpt.hide_lasso,
|
||||
_defs_sculpt.hide_line,
|
||||
),
|
||||
(
|
||||
_defs_sculpt.face_set_box,
|
||||
|
||||
@@ -3585,6 +3585,12 @@ class VIEW3D_MT_sculpt(Menu):
|
||||
props = layout.operator("paint.hide_show_lasso_gesture", text="Lasso Show")
|
||||
props.action = 'SHOW'
|
||||
|
||||
props = layout.operator("paint.hide_show_line_gesture", text="Line Hide")
|
||||
props.action = 'HIDE'
|
||||
|
||||
props = layout.operator("paint.hide_show_line_gesture", text="Line Show")
|
||||
props.action = 'SHOW'
|
||||
|
||||
layout.separator()
|
||||
|
||||
props = layout.operator("sculpt.face_set_change_visibility", text="Toggle Visibility")
|
||||
|
||||
@@ -878,6 +878,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
|
||||
ops.sculpt.lasso_hide
|
||||
ops.sculpt.lasso_mask
|
||||
ops.sculpt.lasso_trim
|
||||
ops.sculpt.line_hide
|
||||
ops.sculpt.line_mask
|
||||
ops.sculpt.line_project
|
||||
ops.sculpt.mask_by_color
|
||||
|
||||
@@ -866,6 +866,17 @@ static int hide_show_gesture_lasso_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int hide_show_gesture_line_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
std::unique_ptr<gesture::GestureData> gesture_data = gesture::init_from_line(C, op);
|
||||
if (!gesture_data) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
hide_show_init_properties(*C, *gesture_data, *op);
|
||||
gesture::apply(*C, *gesture_data, *op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void hide_show_operator_gesture_properties(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem area_items[] = {
|
||||
@@ -930,6 +941,26 @@ void PAINT_OT_hide_show_lasso_gesture(wmOperatorType *ot)
|
||||
gesture::operator_properties(ot, gesture::ShapeType::Lasso);
|
||||
}
|
||||
|
||||
void PAINT_OT_hide_show_line_gesture(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Hide/Show Line";
|
||||
ot->idname = "PAINT_OT_hide_show_line_gesture";
|
||||
ot->description = "Hide/show some vertices";
|
||||
|
||||
ot->invoke = WM_gesture_straightline_active_side_invoke;
|
||||
ot->modal = WM_gesture_straightline_oneshot_modal;
|
||||
ot->exec = hide_show_gesture_line_exec;
|
||||
/* Sculpt-only for now. */
|
||||
ot->poll = SCULPT_mode_poll_view3d;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER;
|
||||
|
||||
WM_operator_properties_gesture_straightline(ot, WM_CURSOR_EDIT);
|
||||
hide_show_operator_properties(ot);
|
||||
hide_show_operator_gesture_properties(ot);
|
||||
gesture::operator_properties(ot, gesture::ShapeType::Line);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::ed::sculpt_paint::hide
|
||||
|
||||
@@ -471,6 +471,7 @@ void PAINT_OT_hide_show_masked(wmOperatorType *ot);
|
||||
void PAINT_OT_hide_show_all(wmOperatorType *ot);
|
||||
void PAINT_OT_hide_show(wmOperatorType *ot);
|
||||
void PAINT_OT_hide_show_lasso_gesture(wmOperatorType *ot);
|
||||
void PAINT_OT_hide_show_line_gesture(wmOperatorType *ot);
|
||||
|
||||
void PAINT_OT_visibility_invert(wmOperatorType *ot);
|
||||
} // namespace blender::ed::sculpt_paint::hide
|
||||
|
||||
@@ -1551,6 +1551,7 @@ void ED_operatortypes_paint()
|
||||
WM_operatortype_append(hide::PAINT_OT_hide_show_masked);
|
||||
WM_operatortype_append(hide::PAINT_OT_hide_show);
|
||||
WM_operatortype_append(hide::PAINT_OT_hide_show_lasso_gesture);
|
||||
WM_operatortype_append(hide::PAINT_OT_hide_show_line_gesture);
|
||||
WM_operatortype_append(hide::PAINT_OT_visibility_invert);
|
||||
|
||||
/* paint masking */
|
||||
|
||||
@@ -4133,6 +4133,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
|
||||
WM_modalkeymap_assign(keymap, "MESH_OT_bisect");
|
||||
WM_modalkeymap_assign(keymap, "PAINT_OT_mask_line_gesture");
|
||||
WM_modalkeymap_assign(keymap, "SCULPT_OT_project_line_gesture");
|
||||
WM_modalkeymap_assign(keymap, "PAINT_OT_hide_show_line_gesture");
|
||||
}
|
||||
|
||||
/* Box_select-like modal operators. */
|
||||
|
||||
Reference in New Issue
Block a user