VFONT: Text Selection Operator #106915

Merged
Harley Acheson merged 12 commits from Harley/blender:TextObjectSelection into main 2023-04-21 19:08:58 +02:00
4 changed files with 27 additions and 3 deletions
Showing only changes of commit f980840666 - Show all commits

View File

@ -5611,7 +5611,6 @@ def km_font(params):
{"properties": [("delta", 1)]}),
("font.change_character", {"type": 'DOWN_ARROW', "value": 'PRESS', "alt": True, "repeat": True},
{"properties": [("delta", -1)]}),
("font.selection_set", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
("font.select_word", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
Harley marked this conversation as resolved Outdated

Better make this part of the tools key-map too. Seems strange this would be accessible without regular selection.

Better make this part of the tools key-map too. Seems strange this would be accessible without regular selection.
("font.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
("font.text_copy", {"type": 'C', "value": 'PRESS', "ctrl": True}, None),
@ -6782,6 +6781,16 @@ def km_3d_view_tool_cursor(params):
)
def km_3d_view_tool_text_select(params):
return (
"3D View Tool: Text Select",
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
{"items": [
("font.selection_set", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
]},
)
def km_3d_view_tool_select(params, *, fallback):
if params.use_tweak_select_passthrough:
operator_props = (("vert_without_handles", True),)
@ -8195,6 +8204,7 @@ def generate_keymaps(params=None):
*(km_node_editor_tool_select_circle(params, fallback=fallback) for fallback in (False, True)),
km_node_editor_tool_links_cut(params),
km_3d_view_tool_cursor(params),
km_3d_view_tool_text_select(params),
*(km_3d_view_tool_select(params, fallback=fallback) for fallback in (False, True)),
*(km_3d_view_tool_select_box(params, fallback=fallback) for fallback in (False, True)),
*(km_3d_view_tool_select_circle(params, fallback=fallback) for fallback in (False, True)),

View File

@ -3803,7 +3803,6 @@ def km_font(params):
{"properties": [("delta", 1)]}),
("font.change_character", {"type": 'DOWN_ARROW', "value": 'PRESS', "alt": True, "repeat": True},
{"properties": [("delta", -1)]}),
("font.selection_set", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
("font.select_word", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
("font.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
("font.text_copy", {"type": 'C', "value": 'PRESS', "ctrl": True}, None),

View File

@ -1259,6 +1259,20 @@ class _defs_edit_curve:
)
class _defs_edit_text:
@ToolDef.from_fn
def select_text():
return dict(
idname="builtin.select_text",
label="Select Text",
cursor='CROSSHAIR',
icon="ops.generic.select_box",
widget=None,
keymap=("3D View Tool: Text Select"),
Harley marked this conversation as resolved Outdated

This should be left an empty tuple for the name to be generated (as is done with other tools).

This should be left an empty tuple for the name to be generated (as is done with other tools).
)
class _defs_pose:
@ToolDef.from_fn
@ -3028,6 +3042,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
_defs_transform.shear,
],
'EDIT_TEXT': [
_defs_edit_text.select_text,
_defs_view3d_generic.cursor,
None,
*_tools_annotate,

View File

@ -729,7 +729,7 @@ static const char *toolsystem_default_tool(const bToolKey *tkey)
case CTX_MODE_PARTICLE:
return "builtin_brush.Comb";
case CTX_MODE_EDIT_TEXT:
return "builtin.cursor";
return "builtin.select_text";
}
break;
case SPACE_IMAGE: