Skip to content

Commit 2f77048

Browse files
committed
pw_multiScriptEditor 官方代码ui资源包不支持 nuke13 暂时隐藏
1 parent 4bb0c62 commit 2f77048

File tree

19 files changed

+191
-160
lines changed

19 files changed

+191
-160
lines changed

menu.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,15 @@ def add_menu_tools(self):
152152
toolMenu = menubar.addMenu('&Tools')
153153
toolMenu_config = self.config["toolMenu"]
154154
for tools in toolMenu_config:
155-
self.create_menu_tools(toolMenu,
156-
toolMenu_config[tools]["name"],
157-
toolMenu_config[tools]["command"]
158-
)
155+
if "max_version" in toolMenu_config[tools].keys():
156+
max_version = toolMenu_config[tools]["max_version"]
157+
else:
158+
max_version = None
159+
if max_version is None or (self.nuke_version_number <= toolMenu_config[tools]["max_version"]):
160+
self.create_menu_tools(toolMenu,
161+
toolMenu_config[tools]["name"],
162+
toolMenu_config[tools]["command"]
163+
)
159164

160165
def replace_path(self, path):
161166
"""

python/pw_multiScriptEditor/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os, sys
1+
import importlib, os, sys
22

33
root = os.path.dirname(__file__)
44
if not root in sys.path:
@@ -12,14 +12,14 @@ def showHoudini(clear=False, ontop=False, name=None, floating=False, position=()
1212
This method use hqt module. Download it before
1313
"""
1414
from .managers import _houdini
15-
reload(_houdini)
15+
importlib.reload(_houdini)
1616
_houdini.show(clear=clear, ontop=ontop, name=name, floating=floating, position=position,
1717
size=size, pane=pane, replacePyPanel=replacePyPanel, hideTitleMenu=hideTitleMenu)
1818

1919
# NUKE
2020
def showNuke(panel=False):
2121
from .managers import _nuke
22-
reload(_nuke)
22+
importlib.reload(_nuke)
2323
_nuke.show(panel)
2424

2525

python/pw_multiScriptEditor/managers/_3dsmax.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import os, sys, re
2+
import importlib
3+
24
try:
35
from PySide.QtGui import *
46
from PySide.QtCore import *
@@ -8,7 +10,7 @@
810
from PySide2.QtWidgets import *
911

1012
from multi_script_editor import scriptEditor
11-
reload(scriptEditor)
13+
importlib.reload(scriptEditor)
1214
import MaxPlus
1315
q3dsmax = QApplication.instance()
1416

python/pw_multiScriptEditor/managers/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
main = __import__('__main__')
22
import platform
3-
3+
import importlib
44

55
####### COMPLETERS ##############################################
66

@@ -11,7 +11,7 @@ def nukeCompleter(*args):
1111

1212
def getNukeContextMenu(*args):
1313
from managers import _nuke
14-
reload(_nuke)
14+
importlib.reload(_nuke)
1515
return _nuke.contextMenu(*args)
1616
###################################################################
1717

@@ -21,26 +21,26 @@ def houdiniCompleter(*args):
2121
return _houdini.completer(*args)
2222
def getHoudiniContextMenu(*args):
2323
from managers import _houdini
24-
reload(_houdini)
24+
importlib.reload(_houdini)
2525
return _houdini.contextMenu(*args)
2626
def houdiniDropEvent(*args):
2727
from managers import _houdini
28-
reload(_houdini)
28+
importlib.reload(_houdini)
2929
return _houdini.wrapDroppedText(*args)
3030
###################################################################
3131

3232
# MAYA
3333
def mayaCompleter(*args):
3434
from managers import _maya
35-
reload(_maya)
35+
importlib.reload(_maya)
3636
return _maya.completer(*args)
3737

3838
def mayaDropEvent(*args):
3939
from managers import _maya
4040
return _maya.wrapDroppedText(*args)
4141
def getMayaContextMenu(*args):
4242
from managers import _maya
43-
reload(_maya)
43+
importlib.reload(_maya)
4444
return _maya.contextMenu(*args)
4545
###################################################################
4646

python/pw_multiScriptEditor/managers/_houdini.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import os, sys, re
1+
import importlib, os, sys, re
2+
23
main = __import__('__main__')
34
hou = main.__dict__['hou']
45
import hqt
5-
reload (hqt)
6+
7+
importlib.reload(hqt)
68
from managers.completeWidget import contextCompleterClass
79

810
path = os.path.join(os.path.dirname(__file__), 'houdini')
@@ -11,24 +13,27 @@
1113
for mod in [os.path.splitext(x)[0] for x in os.listdir(path)]:
1214
if not mod in ns:
1315
try:
14-
exec 'import ' + mod in ns
16+
exec
17+
'import ' + mod in ns
1518
except:
1619
pass
1720

1821
if not path in sys.path:
1922
sys.path.insert(0, path)
2023

2124
from multi_script_editor import scriptEditor
22-
reload(scriptEditor)
25+
26+
importlib.reload(scriptEditor)
2327

2428

2529
def show(*args, **kwargs):
2630
hqt.show(scriptEditor.scriptEditorClass, *args, **kwargs)
2731

32+
2833
def get_widget():
2934
widget = scriptEditor.scriptEditorClass()
30-
widget.setStyleSheet('')
31-
widget.setStyleSheet( hqt.get_h14_style() )
35+
widget.setStyleSheet('')
36+
widget.setStyleSheet(hqt.get_h14_style())
3237
return widget
3338

3439

@@ -43,7 +48,7 @@ def get_widget():
4348
# multi_script_editor.showHoudini(ontop=1)
4449

4550
# H14
46-
#import sys
51+
# import sys
4752
# path = 'path/to/MultiScriptEditor_module'
4853
# # example c:/houdini/python/lib
4954
# if not path in sys.path:
@@ -53,8 +58,6 @@ def get_widget():
5358
# multi_script_editor.showHoudini(name='Multi Script Editor',replacePyPanel=1, hideTitleMenu=0)
5459

5560

56-
57-
5861
###################### CONTEXT FUNCTIONS
5962

6063
# def saveToNode(code, node):
@@ -69,9 +72,11 @@ def getAllDifinitions():
6972
names = list(set(names))
7073
return names
7174

75+
7276
roots = ['obj', 'shop', 'ch', 'vex', 'img', 'out']
7377
nodes = list(set(getAllDifinitions()))
7478

79+
7580
def completer(line, ns):
7681
# node types
7782
func = ['createNode', 'createInputNode', 'createOutputNode']
@@ -96,9 +101,10 @@ def completer(line, ns):
96101
return auto, add
97102
return None, None
98103

104+
99105
def getChildrenFromPath(path):
100106
sp = path.rsplit('/', 1)
101-
if not sp[0]: # rootOnly
107+
if not sp[0]: # rootOnly
102108
if sp[1]:
103109
nodes = [contextCompleterClass(x, x[len(sp[1]):]) for x in roots if x.startswith(sp[1])]
104110
return nodes, None
@@ -116,10 +122,12 @@ def getChildrenFromPath(path):
116122
return nodes, channels
117123
return None, None
118124

125+
119126
def contextMenu(parent):
120127
m = houdiniMenuClass(parent)
121128
return m
122129

130+
123131
class houdiniMenuClass(hqt.QMenu):
124132
def __init__(self, parent):
125133
super(houdiniMenuClass, self).__init__('Houdini', parent)
@@ -132,8 +140,6 @@ def __init__(self, parent):
132140
self.addAction(hqt.QAction('Read from hou.session Sourse', parent, triggered=self.readFromSession))
133141
self.addAction(hqt.QAction('Save to hou.session', parent, triggered=self.saveToSession))
134142

135-
136-
137143
def readFromNode(self):
138144
sel = hou.selectedNodes()
139145
if sel:
@@ -150,7 +156,7 @@ def readFromNode(self):
150156
text = source.eval()
151157
elif isinstance(source, hou.HDASection):
152158
text = source.contents()
153-
self.par.tab.addNewTab(sel[0].name()+'|'+source.name(), text)
159+
self.par.tab.addNewTab(sel[0].name() + '|' + source.name(), text)
154160
else:
155161
hou.ui.displayMessage('Select One Node')
156162

@@ -167,7 +173,7 @@ def saveToNode(self):
167173
d = (keys.index(section),)
168174
else:
169175
d = ()
170-
s = hou.ui.selectFromList(keys, default_choices=d,exclusive=1)
176+
s = hou.ui.selectFromList(keys, default_choices=d, exclusive=1)
171177
if s:
172178
source = res[keys[s[0]]]
173179
if isinstance(source, hou.Parm):
@@ -181,7 +187,8 @@ def saveToNode(self):
181187
hou.ui.displayMessage('Select One Node')
182188

183189
def getSectionsFromNode(self, node):
184-
default = ['Help', 'TypePropertiesOptions', 'ExtraFileOptions', 'Tools.shelf', 'InternalFileOptions', 'Contents.gz', 'CreateScript', 'DialogScript']
190+
default = ['Help', 'TypePropertiesOptions', 'ExtraFileOptions', 'Tools.shelf', 'InternalFileOptions',
191+
'Contents.gz', 'CreateScript', 'DialogScript']
185192
res = {}
186193
Def = node.type().definition()
187194
if Def:
@@ -203,17 +210,16 @@ def saveToSession(self):
203210
hou.setSessionModuleSource(text)
204211

205212

206-
207213
def wrapDroppedText(namespace, text, event):
208214
if event.keyboardModifiers() == hqt.Qt.AltModifier:
209215
syntax = []
210-
#node
216+
# node
211217
for node_parm in text.split(','):
212218
node = hou.node(node_parm)
213219
if node:
214220
syntax.append('hou.node("%s")' % node_parm)
215221

216-
#parmTuple
222+
# parmTuple
217223
spl = text.split(',')
218224
if len(list(set([x[:-1] for x in spl]))) == 1:
219225
parmTuple = hou.parmTuple(spl[0][:-1])
@@ -229,4 +235,3 @@ def wrapDroppedText(namespace, text, event):
229235
return '\n'.join(syntax)
230236

231237
return text
232-

python/pw_multiScriptEditor/managers/_maya.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
_pyside_ver = 0
2+
import importlib
23
try:
34
from PySide.QtCore import *
45
from PySide.QtGui import *
@@ -12,11 +13,11 @@
1213
import maya.OpenMayaUI as omui
1314

1415
import os, sys, re
15-
from managers.completeWidget import contextCompleterClass
16+
from python.pw_multiScriptEditor.managers.completeWidget import contextCompleterClass
1617

1718
main = __import__('__main__')
1819
ns = main.__dict__
19-
exec 'import pymel.core as pm' in ns
20+
exec('import pymel.core as pm', ns)
2021
pm = main.__dict__['pm']
2122

2223
# jedi completion path
@@ -42,7 +43,7 @@ def show(dock=False):
4243

4344
def showWindow():
4445
from multi_script_editor import scriptEditor
45-
reload(scriptEditor)
46+
importlib.reload(scriptEditor)
4647

4748
editor = scriptEditor.scriptEditorClass(parent=getMayaWindow())
4849
editor.show()
@@ -58,7 +59,7 @@ def showDickControl():
5859
if pm.window(name, q=1, ex=1):
5960
pm.deleteUI(name)
6061
from multi_script_editor import scriptEditor
61-
reload(scriptEditor)
62+
importlib.reload(scriptEditor)
6263
editor = scriptEditor.scriptEditorClass(parent=getMayaWindow())
6364
clearDoc()
6465
pm.dockControl(dockName, area='left',
@@ -223,7 +224,8 @@ def findInPath(self, path):
223224
return result
224225

225226
def print_name(self, item):
226-
print item.data(32)
227+
print(item.data(32))
228+
227229

228230
class saveToShelfClass(QDialog):
229231
def __init__(self, parent):

0 commit comments

Comments
 (0)