forked from dbr/tabtabtab-nuke
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmenu.py
More file actions
28 lines (23 loc) · 755 Bytes
/
menu.py
File metadata and controls
28 lines (23 loc) · 755 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
26
27
28
import nuke
import tabtabtab_nuke
import tabtabtab_prefs
import tabtabtab_prefs_dialog
try:
if tabtabtab_prefs.prefs_singleton.get("tabtabtab_enabled"):
tabtabtab_nuke.registerNukeAction()
except Exception:
import traceback
traceback.print_exc()
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...")
insert_index = project_settings_index + 1
edit_menu.addCommand(
"Tabtabtab Preferences...",
tabtabtab_prefs_dialog.show_prefs_dialog,
index=insert_index,
)