Welcome to mirror list, hosted at ThFree Co, Russian Federation.

keys.py « mesh_snap_utilities_line - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d00e11aded1414b1222ec176021d31f028ec9fb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# SPDX-License-Identifier: GPL-2.0-or-later

# km_snap_utilities_modal_keymap = "Snap Utilities Modal Map"

km_tool_snap_utilities_line = "3D View Tool: Edit Mesh, Make Line"


def km_mesh_snap_utilities_operators():
    return (
        "Mesh",
        {"space_type": 'EMPTY', "region_type": 'WINDOW'},
        {"items": [
            ("mesh.snap_utilities_line", {"type": 'K', "value": 'PRESS'},
             {"properties": [("wait_for_input", True)],
              "active":False}),
        ]},
    )


"""
def km_snap_utilities_modal_map():
    items = []
    modal_enum = []
    keymap = (
        km_snap_utilities_modal_keymap,
        {"space_type": 'EMPTY', "region_type": 'WINDOW', "modal": True, "modal_enum": modal_enum},
        {"items": items},
    )

    modal_enum.extend([
        ("ADD_CUT", "ADD_CUT", ""),
        ("CANCEL", "CANCEL", ""),
        ("CONFIRM", "CONFIRM", ""),
        ("IGNORE_SNAP_ON", "IGNORE_SNAP_ON", ""),
        ("IGNORE_SNAP_OFF", "IGNORE_SNAP_OFF", ""),
    ])

    items.extend([
        ("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'ANY', "any": True}, None),
        ("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None),
        ("CANCEL", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "any": True}, None),
        ("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": 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),
        ("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),
    ])

    return keymap
"""


def km_3d_view_tool_snap_utilities_line(tool_mouse):
    return (
        km_tool_snap_utilities_line,
        {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
        {"items": [
            ("mesh.snap_utilities_line", {"type": tool_mouse, "value": 'PRESS'},
             {"properties": [("wait_for_input", False)]}),
        ]},
    )


def km_view3d_empty(km_name):
    return (
        km_name,
        {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
        {"items": []},
    )

# ------------------------------------------------------------------------------
# Full Configuration


def generate_empty_snap_utilities_tools_keymaps():
    return [
        # km_view3d_empty(km_snap_utilities_modal_keymap),

        km_view3d_empty(km_tool_snap_utilities_line),
    ]


def generate_snap_utilities_global_keymaps(tool_mouse='LEFTMOUSE'):
    return [
        km_mesh_snap_utilities_operators(),
    ]


def generate_snap_utilities_tools_keymaps(tool_mouse='LEFTMOUSE'):
    return [
        # Tool System.
        km_3d_view_tool_snap_utilities_line(tool_mouse),
    ]


def generate_snap_utilities_keymaps(tool_mouse='LEFTMOUSE'):
    return [
        km_mesh_snap_utilities_operators(),

        # Modal maps.
        # km_snap_utilities_modal_map(),

        # Tool System.
        km_3d_view_tool_snap_utilities_line(tool_mouse),
    ]