คลาสหน้าต่าง 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 ()✔ทำงาน / ❔ไม่ได้ทดสอบ / ไม่ทำงาน
| หน้าต่างมาตรฐาน | หน้าต่างเชื่อมต่อ | การโทรกลับ | เวอร์ชันทดสอบ | ลินเวกซ์ | หน้าต่าง | แม็กอส | |
|---|---|---|---|---|---|---|---|
| มายา | 2011-2016, 2017+ | ||||||
| มายา (สแตนด์อโลน) | |||||||
| นุก | 9-14 | ||||||
| Nuke (เทอร์มินัล) | |||||||
| ฮูดินี่ | 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 | ||||||
| ฟิวชั่น Blackmagic | 9 | ||||||
| กล่องทราย cryengine | 5.7 | ||||||
| งูหลามแบบสแตนด์อโลน | 2.7 (QT4), 3.7-3.9 (QT5) | ||||||
| Natron | 2.5 | ||||||
| RenderDoc | 1.33 |
* โฮเวอร์เหนือฟิลด์ที่ขีดเส้นใต้เพื่อดูรายละเอียด/ปัญหาเพิ่มเติมใด ๆ
แอปพลิเคชัน Windows บางตัวมีอินเทอร์เฟซ COM ตามการส่งซึ่งจะอนุญาตให้ลิงก์ระหว่าง Python และแอปพลิเคชัน ดู photoshop-scripting-python สำหรับตัวอย่างเกี่ยวกับวิธีการเชื่อมต่อกับแอปพลิเคชัน
ขณะนี้ไม่มีวิธีเปิด VFXWindow จากภายในแอปพลิเคชันเหล่านี้