diff --git a/release/datafiles/assets b/release/datafiles/assets index 1d44611dd36..0b910c0a718 160000 --- a/release/datafiles/assets +++ b/release/datafiles/assets @@ -1 +1 @@ -Subproject commit 1d44611dd36032c1889c66d673801ef7d699f592 +Subproject commit 0b910c0a718a1d54d07ecf95c63617576ee9a847 diff --git a/release/datafiles/icons/ops.sculpt.line_hide.dat b/release/datafiles/icons/ops.sculpt.line_hide.dat new file mode 100644 index 00000000000..00810d02c2a Binary files /dev/null and b/release/datafiles/icons/ops.sculpt.line_hide.dat differ diff --git a/scripts/presets/keyconfig/keymap_data/blender_default.py b/scripts/presets/keyconfig/keymap_data/blender_default.py index 16e3ddcc16b..f43808ccb68 100644 --- a/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -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), diff --git a/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/scripts/startup/bl_ui/space_toolsystem_toolbar.py index f6d9b3afcdc..e73dbecf39c 100644 --- a/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -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, diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index 88dbb228156..bd8a03fb8e5 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -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") diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index 837e4968685..dfb0e8017d1 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -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 diff --git a/source/blender/editors/sculpt_paint/paint_hide.cc b/source/blender/editors/sculpt_paint/paint_hide.cc index 13fddc42e89..3b18edb19ac 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.cc +++ b/source/blender/editors/sculpt_paint/paint_hide.cc @@ -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_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 diff --git a/source/blender/editors/sculpt_paint/paint_intern.hh b/source/blender/editors/sculpt_paint/paint_intern.hh index 04866b09974..689a6131645 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.hh +++ b/source/blender/editors/sculpt_paint/paint_intern.hh @@ -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 diff --git a/source/blender/editors/sculpt_paint/paint_ops.cc b/source/blender/editors/sculpt_paint/paint_ops.cc index 6a0a6bc6b89..3c7ba5c667e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.cc +++ b/source/blender/editors/sculpt_paint/paint_ops.cc @@ -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 */ diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index 53871350fd2..c7d59d0a440 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -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. */