Applying patch D12600, GSOC Knife Tools branch
This adds constrained angle mode improvements, snapping to global and local orientation, visible distance and angle measurements, undo capability, x-ray mode, multi-object edit mode. See https://developer.blender.org/D12600 for more details. Note: this project moved some of the default keymappings around a bit, as discussed with users in the thread https://devtalk.blender.org/t/gsoc-2021-knife-tool-improvements-feedback/19047 We'll change the manual documentation in the next couple of days.
This commit is contained in:
parent
a78d3c5261
commit
6e77afe6ec
Notes:
blender-bot
2023-02-14 05:51:15 +01:00
Referenced by commit2bacf1cb26
, Fix T101721: Knife project crashes Referenced by commitaab947eb46
, Fix T98349: Knife project resulting selection is wrong Referenced by commit26c6ec5594
, Cleanup: remove context argument from EDBM_mesh_knife Referenced by commit1dc0bf86bb
, Fix T93695: Discontinuous cutting with the knife tool Referenced by issue #98349, Regression: Knife project - resulting selection is wrong Referenced by issue #95138, Knife tool 'E' command missing Referenced by issue #94313, Knife tool fails to draw cuts in orthographic mode Referenced by issue #94145, Knife project fails in orthographic mode Referenced by issue #93979, Knife tool issue : create duplicate vertex unexpectedly. Referenced by issue #93695, Discontinuous cutting with the knife tool
|
@ -5626,21 +5626,24 @@ def km_knife_tool_modal_map(_params):
|
|||
("PANNING", {"type": 'MIDDLEMOUSE', "value": 'ANY', "any": True}, None),
|
||||
("ADD_CUT_CLOSED", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "any": True}, None),
|
||||
("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'ANY', "any": True}, None),
|
||||
("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None),
|
||||
("UNDO", {"type": 'Z', "value": 'PRESS', "ctrl": True}, None),
|
||||
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None),
|
||||
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
|
||||
("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None),
|
||||
("NEW_CUT", {"type": 'E', "value": 'PRESS'}, None),
|
||||
("SNAP_MIDPOINTS_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None),
|
||||
("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None),
|
||||
("SNAP_MIDPOINTS_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None),
|
||||
("SNAP_MIDPOINTS_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None),
|
||||
("IGNORE_SNAP_ON", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None),
|
||||
("IGNORE_SNAP_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None),
|
||||
("IGNORE_SNAP_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None),
|
||||
("IGNORE_SNAP_OFF", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None),
|
||||
("ANGLE_SNAP_TOGGLE", {"type": 'C', "value": 'PRESS'}, None),
|
||||
("CUT_THROUGH_TOGGLE", {"type": 'Z', "value": 'PRESS'}, None),
|
||||
("NEW_CUT", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, None),
|
||||
("SNAP_MIDPOINTS_ON", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None),
|
||||
("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None),
|
||||
("SNAP_MIDPOINTS_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None),
|
||||
("SNAP_MIDPOINTS_OFF", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None),
|
||||
("IGNORE_SNAP_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None),
|
||||
("IGNORE_SNAP_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None),
|
||||
("IGNORE_SNAP_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None),
|
||||
("IGNORE_SNAP_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None),
|
||||
("ANGLE_SNAP_TOGGLE", {"type": 'A', "value": 'PRESS'}, None),
|
||||
("CYCLE_ANGLE_SNAP_EDGE", {"type": 'R', "value": 'PRESS'}, None),
|
||||
("CUT_THROUGH_TOGGLE", {"type": 'C', "value": 'PRESS'}, None),
|
||||
("SHOW_DISTANCE_ANGLE_TOGGLE", {"type": 'S', "value": 'PRESS'}, None),
|
||||
("DEPTH_TEST_TOGGLE", {"type": 'V', "value": 'PRESS'}, None),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
|
|
@ -3866,7 +3866,8 @@ def km_knife_tool_modal_map(_params):
|
|||
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
|
||||
("ADD_CUT_CLOSED", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "any": True}, None),
|
||||
("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'ANY', "any": True}, None),
|
||||
("NEW_CUT", {"type": 'E', "value": 'PRESS'}, None),
|
||||
("UNDO", {"type": 'Z', "value": 'PRESS', "ctrl": True}, None),
|
||||
("NEW_CUT", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, None),
|
||||
("SNAP_MIDPOINTS_ON", {"type": 'LEFT_CTRL', "value": 'PRESS'}, None),
|
||||
("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE'}, None),
|
||||
("SNAP_MIDPOINTS_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS'}, None),
|
||||
|
@ -3875,11 +3876,13 @@ def km_knife_tool_modal_map(_params):
|
|||
("IGNORE_SNAP_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None),
|
||||
("IGNORE_SNAP_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None),
|
||||
("IGNORE_SNAP_OFF", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None),
|
||||
("ANGLE_SNAP_TOGGLE", {"type": 'C', "value": 'PRESS'}, None),
|
||||
("CUT_THROUGH_TOGGLE", {"type": 'X', "value": 'PRESS'}, None),
|
||||
("ANGLE_SNAP_TOGGLE", {"type": 'A', "value": 'PRESS'}, None),
|
||||
("CYCLE_ANGLE_SNAP_EDGE", {"type": 'R', "value": 'PRESS'}, None),
|
||||
("CUT_THROUGH_TOGGLE", {"type": 'C', "value": 'PRESS'}, None),
|
||||
("PANNING", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("PANNING", {"type": 'RIGHTMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("CONFIRM", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, None),
|
||||
("SHOW_DISTANCE_ANGLE_TOGGLE", {"type": 'D', "value": 'PRESS'}, None),
|
||||
("DEPTH_TEST_TOGGLE", {"type": 'V', "value": 'PRESS'}, None),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
|
|
@ -1087,11 +1087,29 @@ class _defs_edit_mesh:
|
|||
|
||||
@ToolDef.from_fn
|
||||
def knife():
|
||||
def draw_settings(_context, layout, tool):
|
||||
def draw_settings(_context, layout, tool, *, extra=False):
|
||||
show_extra = False
|
||||
props = tool.operator_properties("mesh.knife_tool")
|
||||
layout.prop(props, "use_occlude_geometry")
|
||||
layout.prop(props, "only_selected")
|
||||
|
||||
if not extra:
|
||||
row = layout.row()
|
||||
layout.prop(props, "use_occlude_geometry")
|
||||
row = layout.row()
|
||||
layout.prop(props, "only_selected")
|
||||
row = layout.row()
|
||||
layout.prop(props, "xray")
|
||||
region_is_header = bpy.context.region.type == 'TOOL_HEADER'
|
||||
if region_is_header:
|
||||
show_extra = True
|
||||
else:
|
||||
extra = True
|
||||
if extra:
|
||||
layout.use_property_split = True
|
||||
layout.prop(props, "visible_measurements")
|
||||
layout.prop(props, "angle_snapping")
|
||||
layout.label(text="Angle Snapping Increment")
|
||||
layout.row().prop(props, "angle_snapping_increment", text="", expand=True)
|
||||
if show_extra:
|
||||
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
|
||||
return dict(
|
||||
idname="builtin.knife",
|
||||
label="Knife",
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
set(INC
|
||||
../include
|
||||
../uvedit
|
||||
../../blenfont
|
||||
../../blenkernel
|
||||
../../blenlib
|
||||
../../blentranslation
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -158,7 +158,7 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
|
|||
ED_view3d_viewcontext_init_object(&vc, obedit);
|
||||
BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
|
||||
EDBM_mesh_knife(&vc, polys, true, cut_through);
|
||||
EDBM_mesh_knife(C, &vc, polys, true, cut_through);
|
||||
|
||||
/* select only tagged faces */
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
|
||||
|
|
|
@ -150,7 +150,8 @@ void MESH_OT_face_split_by_edges(struct wmOperatorType *ot);
|
|||
/* *** editmesh_knife.c *** */
|
||||
void MESH_OT_knife_tool(struct wmOperatorType *ot);
|
||||
void MESH_OT_knife_project(struct wmOperatorType *ot);
|
||||
void EDBM_mesh_knife(struct ViewContext *vc,
|
||||
void EDBM_mesh_knife(struct bContext *C,
|
||||
struct ViewContext *vc,
|
||||
struct LinkNode *polys,
|
||||
bool use_tag,
|
||||
bool cut_through);
|
||||
|
|
Loading…
Reference in New Issue