-
Notifications
You must be signed in to change notification settings - Fork 195
/
MainMenuCommon.xml
176 lines (163 loc) · 5.21 KB
/
MainMenuCommon.xml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?xml version="1.0" encoding="UTF-8"?>
<!--
-->
<mainMenu>
<!-- menuDocument can only contain 1 menu element, whose id is
implicitly "root_menu"
-->
<menu>
<!-- Set external editor -->
<addScriptItem id="set_external_editor">
<label>Set External Text Editor</label>
<parent>preferences_submenu</parent>
<insertAtIndex>26</insertAtIndex>
<scriptCode>
<![CDATA[
from HoudiniExprEditor import ParmWatcher
try:
reload(ParmWatcher)
except NameError:
from importlib import reload
reload(ParmWatcher)
ParmWatcher.set_external_editor()]]>
</scriptCode>
</addScriptItem>
<!-- Open session module source watcher -->
<addScriptItem id="external_python_source_editor">
<label>External Python Source Editor</label>
<parent>windows_menu</parent>
<insertAtIndex>8</insertAtIndex>
<context>
<expression>
<![CDATA[
try:
from HoudiniExprEditor import ParmWatcher
return True
except Exception as e:
return False]]>
</expression>
</context>
<scriptCode>
<![CDATA[
from HoudiniExprEditor import ParmWatcher
try:
reload(ParmWatcher)
except NameError:
from importlib import reload
reload(ParmWatcher)
ParmWatcher.add_watcher("__temp__python_source_editor", type_="__temp__python_source_editor")]]>
</scriptCode>
</addScriptItem>
</menu>
<menuBar>
<!-- An example of how to add a new submenu at the beginning of the
window menu.
-->
<subMenu id="file_menu">
<!--<insertAtIndex>3</insertAtIndex>-->
<subMenu id="crash_recovery">
<label>Crash Recovery</label>
<insertAtIndex>3</insertAtIndex>
<scriptItem id="open_crashfile">
<label>Open Crashfile</label>
<scriptCode>
<![CDATA[
from labsopui import restore_backup
try:
reload(restore_backup)
except NameError:
from importlib import reload
reload(restore_backup)
restore_backup.recoverFile()
]]>
</scriptCode>
</scriptItem>
<scriptItem id="open_crashdirectory">
<label>Open Crash Directory</label>
<scriptCode>
<![CDATA[
file = hou.ui.selectFile(start_directory="$TEMP/", title="Select a file to open", collapse_sequences=False, file_type=hou.fileType.Hip, pattern=None, default_value=None, multiple_select=False, image_chooser=False, chooser_mode=hou.fileChooserMode.Read, width=0, height=0)
if file != "":
hou.hipFile.load(file, suppress_save_prompt=False, ignore_load_warnings=False)]]>
</scriptCode>
</scriptItem>
</subMenu>
<scriptItem id="show_hip_in_file_browser">
<label>Show in File Browser</label>
<insertAtIndex>4</insertAtIndex>
<scriptCode>
<![CDATA[
import os
path = hou.hipFile.path()
if os.path.isfile(path):
hou.ui.showInFileBrowser(path)
else:
hou.ui.displayMessage("You need to save your hip file first before being able to open it in the file browser.", buttons=('OK',), severity=hou.severityType.Message)
]]>
</scriptCode>
</scriptItem>
</subMenu>
<subMenu id="assets_menu">
<scriptItem id="check_tool_versions">
<label>Check Asset Versions in Scene</label>
<insertAtIndex>10</insertAtIndex>
<scriptCode>
<![CDATA[
LabsNodeInstances = [x for x in hou.node("/").allSubChildren() if x.type().nameComponents()[1] == "labs"]
for node in LabsNodeInstances:
if node.type().definition().nodeType().name() != hou.nodeType(node.type().definition().nodeTypeCategory(), node.type().definition().nodeTypeName()).namespaceOrder()[0]:
print ("Warning... Node instance is using older definition: ", node.path())
]]>
</scriptCode>
</scriptItem>
</subMenu>
<subMenu id="help_menu">
<scriptItem id="reset_viewport">
<label>Reset Viewport</label>
<insertAtIndex>5</insertAtIndex>
<scriptCode>
<![CDATA[
from labsopui import reset_viewport
try:
reload(reset_viewport)
except NameError:
from importlib import reload
reload(reset_viewport)
reset_viewport.resetSceneViewers()]]>
</scriptCode>
</scriptItem>
<scriptItem id="quick_tip">
<label>Quick Tip</label>
<insertAtIndex>9</insertAtIndex>
<scriptCode>
<![CDATA[
from labsopui import quicktip
try:
reload(quicktip)
except NameError:
from importlib import reload
reload(quicktip)
quicktip.ShowQuickTip()]]>
</scriptCode>
</scriptItem>
<scriptItem id="export_diagnostics">
<label>Export Diagnostics</label>
<insertAtIndex>6</insertAtIndex>
<scriptCode>
<![CDATA[
from labsopui import export_diagnostics
import hou
try:
reload(export_diagnostics)
except NameError:
from importlib import reload
reload(export_diagnostics)
directory = hou.ui.selectFile(start_directory=None, title="Save Diagnostics Information", collapse_sequences=False, file_type=hou.fileType.Directory, pattern=None, default_value=None, multiple_select=False, image_chooser=None, chooser_mode=hou.fileChooserMode.ReadAndWrite, width=0, height=0)
file = export_diagnostics.ExportDiagnostics(directory)
hou.ui.showInFileBrowser(file)
]]>
</scriptCode>
</scriptItem>
</subMenu>
</menuBar>
</mainMenu>