1 # gpl author: Stanislav Blinov
4 "name": "V/E/F Context Menu",
5 "author": "Stanislav Blinov",
8 "description": "Vert Edge Face Double Right Click Edit Mode",
14 from bpy
.types
import (
20 class MESH_MT_CombinedMenu(Menu
):
21 bl_idname
= "mesh.addon_combined_component_menu"
22 bl_label
= "Components"
25 def poll(cls
, context
):
26 return context
.mode
== 'EDIT_MESH'
28 def draw(self
, context
):
31 mode
= context
.tool_settings
.mesh_select_mode
33 layout
.menu("VIEW3D_MT_edit_mesh_vertices")
35 layout
.menu("VIEW3D_MT_edit_mesh_edges")
37 layout
.menu("VIEW3D_MT_edit_mesh_faces")
40 class MESH_OT_CallContextMenu(Operator
):
41 bl_idname
= "mesh.addon_call_context_menu"
42 bl_label
= "Context Menu"
45 def poll(cls
, context
):
46 return context
.mode
== 'EDIT_MESH'
48 def execute(self
, context
):
49 mode
= context
.tool_settings
.mesh_select_mode
50 num
= sum(int(m
) for m
in mode
)
53 return bpy
.ops
.wm
.call_menu(name
="VIEW3D_MT_edit_mesh_vertices")
55 return bpy
.ops
.wm
.call_menu(name
="VIEW3D_MT_edit_mesh_edges")
57 return bpy
.ops
.wm
.call_menu(name
="VIEW3D_MT_edit_mesh_faces")
59 return bpy
.ops
.wm
.call_menu(name
=MESH_MT_CombinedMenu
.bl_idname
)
64 MESH_OT_CallContextMenu
,
69 # First, keymap identifiers (last bool is True for modal km).
70 (("3D View", "VIEW_3D", "WINDOW", False), (
71 # Then a tuple of keymap items, defined by a dict of kwargs
72 # for the km new func, and a tuple of tuples (name, val)
73 # for ops properties, if needing non-default values.
74 ({"idname": MESH_OT_CallContextMenu
.bl_idname
, "type": 'RIGHTMOUSE', "value": 'DOUBLE_CLICK'},
82 bpy
.utils
.register_class(cls
)
84 bpy_extras
.keyconfig_utils
.addon_keymap_register(bpy
.context
.window_manager
, KEYMAPS
)
88 bpy_extras
.keyconfig_utils
.addon_keymap_unregister(bpy
.context
.window_manager
, KEYMAPS
)
91 bpy
.utils
.unregister_class(cls
)
94 if __name__
== "__main__":