Skip to content

Commit

Permalink
Added Right Click Select Support
Browse files Browse the repository at this point in the history
By request upon submission to the Blender extension repo
  • Loading branch information
SpectralVectors authored Aug 1, 2024
1 parent ca10eaf commit 4665aed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions RightMouseNavigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,25 @@ def reset_cursor():
return {'PASS_THROUGH'}

def callMenu(self, context):
if context.space_data.type == 'NODE_EDITOR':
if context.space_data.node_tree:
if context.space_data.node_tree.nodes.active is not None and context.space_data.node_tree.nodes.active.select:
bpy.ops.wm.call_menu(name='NODE_MT_context_menu')
else:
bpy.ops.wm.search_single_menu('INVOKE_DEFAULT', menu_idname='NODE_MT_add')
select_mouse = context.window_manager.keyconfigs.active.preferences.select_mouse
space_type = context.space_data.type

if select_mouse == 'LEFT':
if space_type == 'NODE_EDITOR':
node_tree = context.space_data.node_tree
if node_tree:
if node_tree.nodes.active is not None and node_tree.nodes.active.select:
bpy.ops.wm.call_menu(name='NODE_MT_context_menu')
else:
bpy.ops.wm.search_single_menu('INVOKE_DEFAULT', menu_idname='NODE_MT_add')
else:
try:
bpy.ops.wm.call_menu(name=self.menu_by_mode[context.mode])
except RuntimeError:
bpy.ops.wm.call_panel(name=self.menu_by_mode[context.mode])
else:
try:
bpy.ops.wm.call_menu(name=self.menu_by_mode[context.mode])
except RuntimeError:
bpy.ops.wm.call_panel(name=self.menu_by_mode[context.mode])
if space_type == 'VIEW_3D':
bpy.ops.view3d.select('INVOKE_DEFAULT')

def invoke(self, context, event):
# Store Blender cursor position
Expand Down
2 changes: 1 addition & 1 deletion blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ schema_version = "1.0.0"
# Example of manifest file for a Blender extension
# Change the values according to your extension
id = "right_mouse_navigation"
version = "2.3.3"
version = "2.3.4"
name = "Right Mouse Navigation"
tagline = "Game Engine-style viewport & node graph navigation"
maintainer = "Spectral Vectors"
Expand Down

0 comments on commit 4665aed

Please sign in to comment.