-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.py
More file actions
25 lines (21 loc) · 725 Bytes
/
menu.py
File metadata and controls
25 lines (21 loc) · 725 Bytes
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
import nuke
import labelmaker
import labelmaker_deoverlap
import labelmaker_prefs_dialog
edit_menu = nuke.menu("Nuke").findItem("Edit")
def _find_item_index(parent_menu, item_name):
for position, menu_item in enumerate(parent_menu.items()):
if menu_item.name() == item_name:
return position
return -1
project_settings_index = _find_item_index(edit_menu, "Project Settings...")
edit_menu.addCommand(
"Labelmaker Preferences...",
labelmaker_prefs_dialog.show_prefs_dialog,
index=project_settings_index + 1,
)
node_layout_menu = edit_menu.addMenu("Node Layout")
node_layout_menu.addCommand(
"De-overlap All Nodes",
lambda: labelmaker_deoverlap.deoverlap_all(undoable=True),
)