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 。