vfxwindow
ved PyMEL
複数のVFXプログラム間でツールを互換性があるように設計するためのQTウィンドウクラス。
クラスの主な目的は、プログラム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 ()working /❔intestedテストなし /動作していない
| 標準ウィンドウ | ドッキングされた窓 | コールバック | テスト済みバージョン | Linux | Windows | 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 max | ✔✔️ | 2018-2020 | ❔ | ✔✔️ | ❔ | ||
| 薬物画家 | ✔✔️ | ✔✔️ | ✔✔️ | 8.3 | ✔✔️ | ✔✔️ | ❔ |
| 物質設計者 | ✔✔️ | ✔✔️ | ✔✔️ | 2019.3、7.1、12.3 | ✔✔️ | ✔✔️ | ❔ |
| ブラックマジックフュージョン | ✔✔️ | 9 | ❔ | ✔✔️ | ❔ | ||
| クライエンジンサンドボックス | ✔✔️ | 5.7 | ❔ | ✔✔️ | ❔ | ||
| スタンドアロンのPython | ✔✔️ | 2.7(QT4)、3.7-3.9(QT5) | ❔ | ✔✔️ | ❔ | ||
| ナトロン | ✔✔️ | 2.5 | ❔ | ✔✔️ | ❔ | ||
| renderdoc | ✔✔️ | 1.33 | ❔ | ✔✔️ | ❔ |
*下線付きフィールドの上にホバーして、追加の詳細/問題を確認します。
特定のWindowsアプリケーションには、Pythonとアプリケーションの間のリンクが可能になるDispatchベースのCOMインターフェイスがあります。アプリケーションへの接続方法の例については、Photoshop-Scripting-Pythonを参照してください。
現在、これらのアプリケーション内からVFXWindowを起動する方法はありません。