-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
61 lines (42 loc) · 1.39 KB
/
__init__.py
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
# copyright (c) Zdenek Dolezal 2024-*
# Improved Node Search - Powerful tool to find nodes in node trees.
# Author: Zdenek Dolezal
# Licence: GPL 3.0
# Thanks to 'user3597862' for the code snipped used to implement 'mouse_to_region_coords' method
# https://blender.stackexchange.com/questions/218096/translate-area-mouse-coordinates-to-the-the-node-editors-blackboard-coordinates
bl_info = {
"name": "Improved Node Search",
"author": "Zdenek Dolezal",
"version": (1, 0, 3),
"blender": (4, 2, 0),
"location": "",
"description": "",
"category": "Node",
}
import bpy
from . import search
from . import prefs
CLASSES = [
prefs.Preferences,
]
KEYMAPS = []
def register():
KEYMAPS.clear()
search.register()
for cls in CLASSES:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
if wm.keyconfigs.addon is None:
return
km = wm.keyconfigs.addon.keymaps.new(name='Node Editor', space_type='NODE_EDITOR')
kmi = km.keymap_items.new(search.PerformNodeSearch.bl_idname, 'F', 'PRESS', ctrl=True)
KEYMAPS.append((km, kmi))
def unregister():
for cls in reversed(CLASSES):
bpy.utils.unregister_class(cls)
search.unregister()
if search.ToggleSearchOverlay.handle is not None:
search.ToggleSearchOverlay.remove_draw_handler()
for km, kmi in KEYMAPS:
km.keymap_items.remove(kmi)
KEYMAPS.clear()