Skip to content

Commit 4665aed

Browse files
Added Right Click Select Support
By request upon submission to the Blender extension repo
1 parent ca10eaf commit 4665aed

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

RightMouseNavigation.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,25 @@ def reset_cursor():
100100
return {'PASS_THROUGH'}
101101

102102
def callMenu(self, context):
103-
if context.space_data.type == 'NODE_EDITOR':
104-
if context.space_data.node_tree:
105-
if context.space_data.node_tree.nodes.active is not None and context.space_data.node_tree.nodes.active.select:
106-
bpy.ops.wm.call_menu(name='NODE_MT_context_menu')
107-
else:
108-
bpy.ops.wm.search_single_menu('INVOKE_DEFAULT', menu_idname='NODE_MT_add')
103+
select_mouse = context.window_manager.keyconfigs.active.preferences.select_mouse
104+
space_type = context.space_data.type
105+
106+
if select_mouse == 'LEFT':
107+
if space_type == 'NODE_EDITOR':
108+
node_tree = context.space_data.node_tree
109+
if node_tree:
110+
if node_tree.nodes.active is not None and node_tree.nodes.active.select:
111+
bpy.ops.wm.call_menu(name='NODE_MT_context_menu')
112+
else:
113+
bpy.ops.wm.search_single_menu('INVOKE_DEFAULT', menu_idname='NODE_MT_add')
114+
else:
115+
try:
116+
bpy.ops.wm.call_menu(name=self.menu_by_mode[context.mode])
117+
except RuntimeError:
118+
bpy.ops.wm.call_panel(name=self.menu_by_mode[context.mode])
109119
else:
110-
try:
111-
bpy.ops.wm.call_menu(name=self.menu_by_mode[context.mode])
112-
except RuntimeError:
113-
bpy.ops.wm.call_panel(name=self.menu_by_mode[context.mode])
120+
if space_type == 'VIEW_3D':
121+
bpy.ops.view3d.select('INVOKE_DEFAULT')
114122

115123
def invoke(self, context, event):
116124
# Store Blender cursor position

blender_manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ schema_version = "1.0.0"
33
# Example of manifest file for a Blender extension
44
# Change the values according to your extension
55
id = "right_mouse_navigation"
6-
version = "2.3.3"
6+
version = "2.3.4"
77
name = "Right Mouse Navigation"
88
tagline = "Game Engine-style viewport & node graph navigation"
99
maintainer = "Spectral Vectors"

0 commit comments

Comments
 (0)