Skip to content

Commit 3b4d435

Browse files
Blender 4.2 compatibility update
Removed `bl_info`, replaced with `blender_manifest.toml` Updated Node Editor mode so that when a node is selected you will open the default context menu, but when no nodes are selected you will open the node search. I feel this is a practicality update, and the alternative would be an additional keybind, like `Ctrl + Right Mouse` to get the standard context menu. If you have a strong opinion about this, create an issue and solutions can be discussed. Thanks!
1 parent 3c9c5ae commit 3b4d435

4 files changed

Lines changed: 86 additions & 21 deletions

File tree

Preferences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def update_node_keymap(self, context):
1919
addon_kc = wm.keyconfigs.addon
2020
for key in addon_kc.keymaps['Node Editor'].keymap_items:
2121
if (
22-
key.idname == "blui.right_mouse_navigation"
22+
key.idname == "rmn.right_mouse_navigation"
2323
and key.type == "RIGHTMOUSE"
2424
):
2525
key.active = not key.active

RightMouseNavigation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import sys
55

66

7-
class BLUI_OT_right_mouse_navigation(Operator):
7+
class RMN_OT_right_mouse_navigation(Operator):
88
"""Timer that decides whether to display a menu after Right Click"""
9-
bl_idname = "blui.right_mouse_navigation"
9+
bl_idname = "rmn.right_mouse_navigation"
1010
bl_label = "Right Mouse Navigation"
1111
bl_options = {'REGISTER', 'UNDO'}
1212

@@ -102,7 +102,10 @@ def reset_cursor():
102102
def callMenu(self, context):
103103
if context.space_data.type == 'NODE_EDITOR':
104104
if context.space_data.node_tree:
105-
bpy.ops.wm.search_single_menu('INVOKE_DEFAULT', menu_idname='NODE_MT_add')
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')
106109
else:
107110
try:
108111
bpy.ops.wm.call_menu(name=self.menu_by_mode[context.mode])

__init__.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
11
from .Preferences import RightMouseNavigationPreferences
2-
from .RightMouseNavigation import BLUI_OT_right_mouse_navigation
2+
from .RightMouseNavigation import RMN_OT_right_mouse_navigation
33
import bpy
44

5-
bl_info = {
6-
'name': 'Right Mouse Navigation',
7-
'category': '3D View',
8-
'author': 'Spectral Vectors',
9-
'version': (2, 2, 0),
10-
'blender': (2, 90, 0),
11-
'location': '3D Viewport, Node Editor',
12-
"description": "Enables Right Mouse Viewport Navigation"
13-
}
14-
15-
165
addon_keymaps = []
176

187

198
def register():
209
if not bpy.app.background:
2110
bpy.utils.register_class(RightMouseNavigationPreferences)
22-
bpy.utils.register_class(BLUI_OT_right_mouse_navigation)
11+
bpy.utils.register_class(RMN_OT_right_mouse_navigation)
2312

2413
wm = bpy.context.window_manager
2514
addon_kc = wm.keyconfigs.addon
2615

2716
km = addon_kc.keymaps.new(name='3D View', space_type='VIEW_3D')
2817
kmi = km.keymap_items.new(
29-
"blui.right_mouse_navigation",
18+
"rmn.right_mouse_navigation",
3019
'RIGHTMOUSE',
3120
'PRESS'
3221
)
3322
kmi.active = True
3423

3524
km2 = addon_kc.keymaps.new(name='Node Editor', space_type='NODE_EDITOR')
3625
kmi2 = km2.keymap_items.new(
37-
"blui.right_mouse_navigation",
26+
"rmn.right_mouse_navigation",
3827
'RIGHTMOUSE',
3928
'PRESS'
4029
)
@@ -92,14 +81,14 @@ def register():
9281
def unregister():
9382
if not bpy.app.background:
9483

95-
bpy.utils.unregister_class(BLUI_OT_right_mouse_navigation)
84+
bpy.utils.unregister_class(RMN_OT_right_mouse_navigation)
9685
bpy.utils.unregister_class(RightMouseNavigationPreferences)
9786

9887
wm = bpy.context.window_manager
9988
active_kc = wm.keyconfigs.active
10089

10190
for key in active_kc.keymaps['Node Editor'].keymap_items:
102-
if (key.idname == 'blui.right_mouse_navigation'):
91+
if (key.idname == 'rmn.right_mouse_navigation'):
10392
active_kc.keymaps['Node Editor'].keymap_items.remove(key)
10493

10594
addon_keymaps.clear()

blender_manifest.toml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
schema_version = "1.0.0"
2+
3+
# Example of manifest file for a Blender extension
4+
# Change the values according to your extension
5+
id = "right_mouse_navigation"
6+
version = "2.3.3"
7+
name = "Right Mouse Navigation"
8+
tagline = "Game Engine-style viewport & node graph navigation"
9+
maintainer = "Spectral Vectors"
10+
# Supported types: "add-on", "theme"
11+
type = "add-on"
12+
13+
# Optional link to documentation, support, source files, etc
14+
website = "https://github.com/SpectralVectors/RightMouseNavigation"
15+
16+
# Optional list defined by Blender and server, see:
17+
# https://docs.blender.org/manual/en/dev/advanced/extensions/tags.html
18+
tags = ["Animation", "Sequencer"]
19+
20+
blender_version_min = "4.2.0"
21+
# # Optional: Blender version that the extension does not support, earlier versions are supported.
22+
# # This can be omitted and defined later on the extensions platform if an issue is found.
23+
# blender_version_max = "5.1.0"
24+
25+
# License conforming to https://spdx.org/licenses/ (use "SPDX: prefix)
26+
# https://docs.blender.org/manual/en/dev/advanced/extensions/licenses.html
27+
license = [
28+
"SPDX:GPL-2.0-or-later",
29+
]
30+
# Optional: required by some licenses.
31+
# copyright = [
32+
# "2002-2024 Developer Name",
33+
# "1998 Company Name",
34+
# ]
35+
36+
# Optional list of supported platforms. If omitted, the extension will be available in all operating systems.
37+
# platforms = ["windows-x64", "macos-arm64", "linux-x64"]
38+
# Other supported platforms: "windows-arm64", "macos-x64"
39+
40+
# Optional: bundle 3rd party Python modules.
41+
# https://docs.blender.org/manual/en/dev/advanced/extensions/python_wheels.html
42+
# wheels = [
43+
# "./wheels/hexdump-3.3-py3-none-any.whl",
44+
# "./wheels/jsmin-3.0.1-py3-none-any.whl",
45+
# ]
46+
47+
# # Optional: add-ons can list which resources they will require:
48+
# # * files (for access of any filesystem operations)
49+
# # * network (for internet access)
50+
# # * clipboard (to read and/or write the system clipboard)
51+
# # * camera (to capture photos and videos)
52+
# # * microphone (to capture audio)
53+
# #
54+
# # If using network, remember to also check `bpy.app.online_access`
55+
# # https://docs.blender.org/manual/en/dev/advanced/extensions/addons.html#internet-access
56+
# #
57+
# # For each permission it is important to also specify the reason why it is required.
58+
# # Keep this a single short sentence without a period (.) at the end.
59+
# # For longer explanations use the documentation or detail page.
60+
#
61+
# [permissions]
62+
# network = "Need to sync motion-capture data to server"
63+
# files = "Import/export FBX from/to disk"
64+
# clipboard = "Copy and paste bone transforms"
65+
66+
# Optional: build settings.
67+
# https://docs.blender.org/manual/en/dev/advanced/extensions/command_line_arguments.html#command-line-args-extension-build
68+
# [build]
69+
# paths_exclude_pattern = [
70+
# "__pycache__/",
71+
# "/.git/",
72+
# "/*.zip",
73+
# ]

0 commit comments

Comments
 (0)