vfxwindow
ved PyMEL
QT窗口类设计用于在多个VFX程序之间兼容的工具。
课程的主要目的是将其集成到程序UI中,但它还包含有用的功能,例如安全处理回调并自动保存窗口位置。
预期的用法是使您的窗口类继承VFXWindow这是QMainWindow的实例。通过调用cls.show() ,它将根据加载程序以及以前保存的设置启动正确的窗口类型。
这是完全稳定的,但是仍然有很多需要改进的地方。非常感谢扩展现有应用程序支持或添加新应用程序的任何帮助。
pip install vfxwindow
from Qt import QtWidgets
from vfxwindow import VFXWindow
class MyWindow ( VFXWindow ):
"""Test window to show off some features."""
WindowID = 'vfx.window.test'
WindowName = 'My Window'
WindowDockable = True
def __init__ ( self , parent = None , ** kwargs ):
super ( MyWindow , self ). __init__ ( parent , ** kwargs )
# Setup widgets/build UI here as you normally would
self . setCentralWidget ( QtWidgets . QWidget ())
# Setup callbacks
self . callbacks . add ( 'file.new' , self . afterSceneChange )
self . callbacks . add ( 'file.load' , self . afterSceneChange )
if self . application == 'Maya' : # Maya supports before/after callbacks
self . callbacks . add ( 'file.new.before' , self . beforeSceneChange )
self . callbacks . add ( 'file.load.before' , self . beforeSceneChange )
elif self . application in ( 'Nuke' , 'Substance' ): # Nuke and Painter/Designer support close
self . callbacks . add ( 'file.close' , self . beforeSceneChange )
# Wait until the program is ready before triggering the new scene method
self . deferred ( self . afterSceneChange )
def afterSceneChange ( self , * args ):
"""Create the scene specific callbacks.
These are being created in a callback "group".
Subgroups are also supported.
Even though the callback is the same, the signatures can differ.
See '/vfxwindow/<app>/callbacks.py' for the relevant signatures.
"""
if self . application == 'Maya' :
self . callbacks [ 'scene' ]. add ( 'node.add' , self . mayaNodeAdded , nodeType = 'dependNode' )
if self . application == 'Nuke' :
self . callbacks [ 'scene' ]. add ( 'node.add' , self . nukeNodeAdded )
def beforeSceneChange ( self , * args ):
"""Delete the scene specific callbacks."""
self . callbacks [ 'scene' ]. delete ()
def mayaNodeAdded ( self , node , clientData ):
"""Print out the node that was added in Maya."""
import maya . api . OpenMaya as om2
print ( 'Node was added: {}' . format ( om2 . MFnDependencyNode ( node ). name ()))
def nukeNodeAdded ( self ):
"""Print out the node that was added in Nuke."""
import nuke
node = nuke . thisNode ()
print ( 'Node was added: {}' . format ( node . name () or 'Root' ))
def checkForChanges ( self ):
"""Update the UI if it is has been in a "paused" state.
This is needed for Nuke and Substance Designer/Painter, because
there's no way to detect if the window is closed or just hidden.
For safety all callbacks will get paused, and upon unpausing,
this method will be run to allow the window to correctly update.
"""
self . beforeSceneChange ()
self . afterSceneChange ()
if __name__ == '__main__' :
MyWindow . show ()✔️工作 /❔未经测试 /不工作
| 标准窗口 | 停靠窗口 | 回调 | 经过测试的版本 | Linux | 视窗 | macos | |
|---|---|---|---|---|---|---|---|
| 玛雅 | ✔️ | ✔️ | ✔️ | 2011-2016,2017+ | ✔️ | ✔️ | ❔ |
| 玛雅(独立) | ✔️ | ✔️ | ❔ | ✔️ | ❔ | ||
| 核武器 | ✔️ | ✔️ | ✔️ | 9-14 | ❔ | ✔️ | ❔ |
| 核武器(终端) | ✔️ | ✔️ | ❔ | ✔️ | ❔ | ||
| 霍迪尼 | ✔️ | 16-19 | ✔️ | ✔️ | ❔ | ||
| 虚幻引擎 | ✔️ | 4.19-4.23,5.0-5.3 | ✔️ | ❔ | |||
| 混合器 | ✔️ | ✔️ | 2.8-4.2 | ❔ | ✔️ | ❔ | |
| 搅拌器(背景) | ✔️ | ❔ | 3.1-4.2 | ❔ | ✔️ | ❔ | |
| 卡塔纳 | ✔️ | 7 | ❔ | ✔️ | ❔ | ||
| 3DS最大 | ✔️ | 2018-2020 | ❔ | ✔️ | ❔ | ||
| 药物画家 | ✔️ | ✔️ | ✔️ | 8.3 | ✔️ | ✔️ | ❔ |
| 物质设计师 | ✔️ | ✔️ | ✔️ | 2019.3,7.1,12.3 | ✔️ | ✔️ | ❔ |
| 勒索融合 | ✔️ | 9 | ❔ | ✔️ | ❔ | ||
| Cryengine沙箱 | ✔️ | 5.7 | ❔ | ✔️ | ❔ | ||
| 独立的python | ✔️ | 2.7(QT4),3.7-3.9(QT5) | ❔ | ✔️ | ❔ | ||
| Natron | ✔️ | 2.5 | ❔ | ✔️ | ❔ | ||
| Renderdoc | ✔️ | 1.33 | ❔ | ✔️ | ❔ |
*悬停在下划线的字段上,以查看任何额外的详细信息/问题。
某些Windows应用程序具有基于调度的COM接口,这将允许Python和应用程序之间的链接。有关如何连接到应用程序的示例,请参见Photoshop-Scripting-Python。
当前无法从这些应用程序内部启动VFXWindow 。