-
Notifications
You must be signed in to change notification settings - Fork 195
/
MainMenuCommon.xml
187 lines (185 loc) · 7.02 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
177
178
179
180
181
182
183
184
185
186
187
<?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
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
ParmWatcher.add_watcher("__temp__python_source_editor", type_="__temp__python_source_editor")
]]>
</scriptCode>
</addScriptItem>
</menu>
<menuBar>
<!-- File -->
<subMenu id="file_menu">
<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
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>
<!-- Labs -->
<subMenu id="labs_menu">
<modifyItem>
<insertBefore>help_menu</insertBefore>
</modifyItem>
<label>Labs</label>
<scriptItem id="labs_pref">
<label>Labs Add-ons</label>
<scriptCode>
<![CDATA[
import labprefs
window = labprefs.LabsPreferences(hou.qt.mainWindow())
window.show()
]]>
</scriptCode>
</scriptItem>
<separatorItem id="labs_menu_sep1"/>
<scriptItem id="reset_viewport">
<label>Reset Viewport</label>
<scriptCode>
<![CDATA[
from labsopui import reset_viewport
reset_viewport.resetSceneViewers()
]]>
</scriptCode>
</scriptItem>
<scriptItem id="ruler">
<label>Ruler</label>
<scriptCode>
<![CDATA[
import stateutils
# We want to launch a SOP state, so we need to make sure the
# viewer is at the SOP level first
viewer = stateutils.findSceneViewer()
network = viewer.pwd()
if network.childTypeCategory() != hou.sopNodeTypeCategory():
# The user pressed Enter without selecting an object
raise hou.Error("You must be in the Geometry (SOP) context to use this tool.")
if network.displayNode() == None:
raise hou.Error("You must have the display flag set on a node.")
# Set the viewer's current state to my state
viewer.setCurrentState("labs::ruler")
]]>
</scriptCode>
</scriptItem>
<scriptItem id="enable_go_z">
<label>Start GoZ</label>
<scriptCode>
<![CDATA[
import hrpyc
already_running = True
try:
connection = hrpyc.rpyc.classic.connect("127.0.0.1", 18811)
except:
already_running = False
if already_running:
hou.ui.displayMessage("Go Z Already Running")
else:
hrpyc.start_server()
hou.ui.displayMessage("Go Z Port Opened")
temp_goz_node = hou.node("/obj").createNode("geo", "tmp_zbrush")
temp_goz_node.createNode("labs::goz_export", exact_type_name=False)
temp_goz_node.destroy()
]]>
</scriptCode>
</scriptItem>
<scriptItem id="export_diagnostics">
<label>Export Diagnostics</label>
<scriptCode>
<![CDATA[
from labsopui import export_diagnostics
import hou
print ("Please select a directory to save the diagnostics ZIP file to...")
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)
if directory and directory != '':
print ("Please wait a moment for Houdini to export the diagnostics...")
file = export_diagnostics.ExportDiagnostics(directory)
hou.ui.showInFileBrowser(file)
print ("The diagnostics ZIP file has been saved to: {0}".format(directory))
else:
print ("No directory has been selected.")
]]>
</scriptCode>
</scriptItem>
<separatorItem id="labs_menu_sep2"/>
<scriptItem id="h.sidefxlabs">
<label>Update Labs</label>
<scriptCode>
<![CDATA[
import sidefxlabs
sidefxlabs.SideFXLabsUpdater(updater_dialog=True)
print ("For all installation and update options, please visit:\nhttps://github.com/sideeffects/SideFXLabs?tab=readme-ov-file#installation")
if hou.applicationVersion()[0] + 0.5 * hou.applicationVersion()[1] < 19.5:
print ("Installing Labs via Houdini Launcher is now preferred over installing it via the old Update Toolset window.\n")
]]>
</scriptCode>
</scriptItem>
</subMenu>
</menuBar>
</mainMenu>