# VFXWindow
Qt Window class for designing tools to be compatible between multiple VFX programs.
The main purpose of the class is to integrate into the program UI, but it also contains helpful features such as safely dealing with callbacks and automatically saving the window position.
The intended usage is to make your window class inherit `VFXWindow` - which is an instance of `QMainWindow`. By calling `cls.show()`, it will launch the correct window type based on what program is loaded, and what settings were previously saved.
This is perfectly stable, but there is still plenty that needs improvement. Any help with extending existing application support or adding new applications is very much appreciated.
### Installation
pip install vfxwindow
### Basic Example:
```python
class MyWindow(VFXWindow):
WindowID = 'unique_window_id'
WindowName = 'My Window'
def __init__(self, parent=None, **kwargs):
super(MyWindow, self).__init__(parent, **kwargs)
# Setup window here
# Setup callbacks, but wait until the program is ready
self.deferred(self.newScene)
def newScene(self, *args):
"""Example: Delete and reapply callbacks after loading a new scene."""
self.removeCallbacks('sceneNewCallbacks')
if self.application == 'Maya':
self.addCallbackScene('kAfterNew', self.newScene, group='sceneNewCallbacks')
elif self.application == 'Nuke':
self.addCallbackOnCreate(self.newScene, nodeClass='Root', group='sceneNewCallbacks')
if __name__ == '__main__':
MyWindow.show()
```
### Support / Compatibility
✔️ Working / ❔ Untested / ❌ Not Working
| | Standard Window | Docked Window | Callbacks | Tested Versions | [Linux](# "Tested in Linux Mint.") | Windows | MacOs |
| ------------------ | -------- | -------- | -------- | -------- | -------- | --------- | ------- |
| Maya | ✔️ | [✔️](# "Uses `workspaceControl` or falls back to `dockControl` for pre Maya 2017, saves/restores location of window.") | ✔️ | [2011-2016](# "Docked windows use `dockControl`, tested lightly on 2016."), [2017+](# "Docked windows use `workspaceControl`.") | ✔️ | ✔️ | ❔ |
| Maya (Standalone) | ✔️ | | ✔️ | | ❔ | ✔️ | ❔ |
| Nuke | ✔️ | [✔️](# "Uses `registerWidgetAsPanel` to dock window in a panel, saves/restores location of panel only when docked (not floating).") | [✔️](# "Callbacks are only active while the window has focus. It is recommended to define a `checkForChanges()` method which will be run each time the callbacks get reactivated.") | 9-14 | ❔ | ✔️ | ❔ |
| Nuke (Terminal) | ✔️ | | ✔️ | | ❔ | ✔️ | ❔ |
| Houdini | ✔️ | ❌ | ❌ | 16-19 | ✔️ | ✔️ | ❔ |
| Unreal Engine | ✔️ | ❌ | ❌ | 4.19-4.23, 5.0-5.3 | [❌](# "Tested on UE5.") | ✔️ | ❔ |
| Blender | ✔️ | ❌ | ✔️ | 2.8-3.6 | ❔ | ✔️ | ❔ |
| 3ds Max | ✔️ | ❌ | ❌ | 2018-2020 | ❔ | [✔️](# "Tested previously but unable to confirm.") | ❔ |
| Substance Painter | ✔️ | [✔️](# "Uses `substance_painter.ui.add_dock_widget`, does not save/restore location of window.") | ❌ | 8.3 | ✔️ | ✔️ | ❔ |
| Substance Designer | ✔️ | [✔️](# "Uses `sd.getContext().getSDApplication().getQtForPythonUIMgr().newDockWidget`, does not save/restore location of window.") | ❌ | 2019.3, 7.1, 12.3 | ✔️ | ✔️ | ❔ |
| Blackmagic Fusion | ✔️ | ❌ | ❌ | 9 | ❔ | [✔️](# "Unable to read Fusion version, and causes recursion error if calling `show`/`hide`/`setVisible`.") | ❔ |
| CryEngine Sandbox | ✔️ | [❌](# "There's a `SandboxBridge.register_window` function, but I was not able to figure it out.") | ❌ | 5.7 | ❔ | [✔️](# "Causes recursion error if calling `show`/`hide`/`setVisible`.") | ❔ |
| Standalone Python | ✔️ | | | 2.7 (Qt4), 3.7-3.9 (Qt5) | ❔ | ✔️ | ❔ |
### Features
- Automatically save/restore window position
- Move window to screen if out of bounds (windows only)
- Keep track of callbacks to remove groups if required, and clean up on window close
- Keep track of signals to remove groups if required
- Display a popup message that forces control
- Set palette to that of another program
- Auto close if opening a duplicate window
- Close down all windows at once
- Create dialog windows automatically attached to the application (and return data)
### Running with Non-Python Applications
Certain Windows applications have dispatch based COM interface, which will allow a link between Python and the application. See [photoshop-scripting-python](https://github.com/lohriialo/photoshop-scripting-python) for an example on how to connect to an application.
Currently there is no way of launching `VFXWindow` from inside these applications.
### Special Thanks
- [Blue Zoo](https://www.blue-zoo.co.uk/) - I've been building this up while working there
- [Lior Ben Horin](https://gist.github.com/liorbenhorin): [Simple_MayaDockingClass.py](https://gist.github.com/liorbenhorin/69da10ec6f22c6d7b92deefdb4a4f475) - Used for Maya docking code
- [Fredrik Averpil](https://github.com/fredrikaverpil): [pyvfx-boilerplate](https://github.com/fredrikaverpil/pyvfx-boilerplate) - Used to help with palettes, Nuke, and pre-2017 Maya
- And a shoutout to anyone who has helped [contribute](https://github.com/huntfx/vfxwindow/graphs/contributors) to the module.
Raw data
{
"_id": null,
"home_page": "https://github.com/huntfx/vfxwindow",
"name": "vfxwindow",
"maintainer": null,
"docs_url": null,
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7",
"maintainer_email": null,
"keywords": "qt, pyside, pyside2, pyqt, pyqt4, pyqt5, gui, window, maya, mayapy, nuke, nukescripts, houdini, unreal, engine, ue4, blender, 3dsmax, 3ds, blackmagic, fusion, substance, designer, vfx, visualfx, fx, cgi, 3d",
"author": "Peter Hunt",
"author_email": "peter@huntfx.uk",
"download_url": "https://files.pythonhosted.org/packages/e9/4e/5480ecba3ff3f63a4687accd97ea0674df5af4192958071da6e703403dec/vfxwindow-1.9.0.tar.gz",
"platform": null,
"description": "# VFXWindow\r\nQt Window class for designing tools to be compatible between multiple VFX programs.\r\n\r\nThe main purpose of the class is to integrate into the program UI, but it also contains helpful features such as safely dealing with callbacks and automatically saving the window position.\r\n\r\nThe intended usage is to make your window class inherit `VFXWindow` - which is an instance of `QMainWindow`. By calling `cls.show()`, it will launch the correct window type based on what program is loaded, and what settings were previously saved.\r\n\r\nThis is perfectly stable, but there is still plenty that needs improvement. Any help with extending existing application support or adding new applications is very much appreciated.\r\n\r\n### Installation\r\n pip install vfxwindow\r\n\r\n### Basic Example:\r\n```python\r\nclass MyWindow(VFXWindow):\r\n WindowID = 'unique_window_id'\r\n WindowName = 'My Window'\r\n\r\n def __init__(self, parent=None, **kwargs):\r\n super(MyWindow, self).__init__(parent, **kwargs)\r\n # Setup window here\r\n\r\n # Setup callbacks, but wait until the program is ready\r\n self.deferred(self.newScene)\r\n\r\n def newScene(self, *args):\r\n \"\"\"Example: Delete and reapply callbacks after loading a new scene.\"\"\"\r\n self.removeCallbacks('sceneNewCallbacks')\r\n if self.application == 'Maya':\r\n self.addCallbackScene('kAfterNew', self.newScene, group='sceneNewCallbacks')\r\n elif self.application == 'Nuke':\r\n self.addCallbackOnCreate(self.newScene, nodeClass='Root', group='sceneNewCallbacks')\r\n\r\nif __name__ == '__main__':\r\n MyWindow.show()\r\n```\r\n\r\n### Support / Compatibility\r\n\u2714\ufe0f Working / \u2754 Untested / \u274c Not Working\r\n| | Standard Window | Docked Window | Callbacks | Tested Versions | [Linux](# \"Tested in Linux Mint.\") | Windows | MacOs |\r\n| ------------------ | -------- | -------- | -------- | -------- | -------- | --------- | ------- |\r\n| Maya | \u2714\ufe0f | [\u2714\ufe0f](# \"Uses `workspaceControl` or falls back to `dockControl` for pre Maya 2017, saves/restores location of window.\") | \u2714\ufe0f | [2011-2016](# \"Docked windows use `dockControl`, tested lightly on 2016.\"), [2017+](# \"Docked windows use `workspaceControl`.\") | \u2714\ufe0f | \u2714\ufe0f | \u2754 |\r\n| Maya (Standalone) | \u2714\ufe0f | | \u2714\ufe0f | | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Nuke | \u2714\ufe0f | [\u2714\ufe0f](# \"Uses `registerWidgetAsPanel` to dock window in a panel, saves/restores location of panel only when docked (not floating).\") | [\u2714\ufe0f](# \"Callbacks are only active while the window has focus. It is recommended to define a `checkForChanges()` method which will be run each time the callbacks get reactivated.\") | 9-14 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Nuke (Terminal) | \u2714\ufe0f | | \u2714\ufe0f | | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Houdini | \u2714\ufe0f | \u274c | \u274c | 16-19 | \u2714\ufe0f | \u2714\ufe0f | \u2754 |\r\n| Unreal Engine | \u2714\ufe0f | \u274c | \u274c | 4.19-4.23, 5.0-5.3 | [\u274c](# \"Tested on UE5.\") | \u2714\ufe0f | \u2754 |\r\n| Blender | \u2714\ufe0f | \u274c | \u2714\ufe0f | 2.8-3.6 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| 3ds Max | \u2714\ufe0f | \u274c | \u274c | 2018-2020 | \u2754 | [\u2714\ufe0f](# \"Tested previously but unable to confirm.\") | \u2754 |\r\n| Substance Painter | \u2714\ufe0f | [\u2714\ufe0f](# \"Uses `substance_painter.ui.add_dock_widget`, does not save/restore location of window.\") | \u274c | 8.3 | \u2714\ufe0f | \u2714\ufe0f | \u2754 |\r\n| Substance Designer | \u2714\ufe0f | [\u2714\ufe0f](# \"Uses `sd.getContext().getSDApplication().getQtForPythonUIMgr().newDockWidget`, does not save/restore location of window.\") | \u274c | 2019.3, 7.1, 12.3 | \u2714\ufe0f | \u2714\ufe0f | \u2754 |\r\n| Blackmagic Fusion | \u2714\ufe0f | \u274c | \u274c | 9 | \u2754 | [\u2714\ufe0f](# \"Unable to read Fusion version, and causes recursion error if calling `show`/`hide`/`setVisible`.\") | \u2754 |\r\n| CryEngine Sandbox | \u2714\ufe0f | [\u274c](# \"There's a `SandboxBridge.register_window` function, but I was not able to figure it out.\") | \u274c | 5.7 | \u2754 | [\u2714\ufe0f](# \"Causes recursion error if calling `show`/`hide`/`setVisible`.\") | \u2754 |\r\n| Standalone Python | \u2714\ufe0f | | | 2.7 (Qt4), 3.7-3.9 (Qt5) | \u2754 | \u2714\ufe0f | \u2754 |\r\n\r\n### Features\r\n - Automatically save/restore window position\r\n - Move window to screen if out of bounds (windows only)\r\n - Keep track of callbacks to remove groups if required, and clean up on window close\r\n - Keep track of signals to remove groups if required\r\n - Display a popup message that forces control\r\n - Set palette to that of another program\r\n - Auto close if opening a duplicate window\r\n - Close down all windows at once\r\n - Create dialog windows automatically attached to the application (and return data)\r\n\r\n### Running with Non-Python Applications\r\nCertain Windows applications have dispatch based COM interface, which will allow a link between Python and the application. See [photoshop-scripting-python](https://github.com/lohriialo/photoshop-scripting-python) for an example on how to connect to an application.\r\n\r\nCurrently there is no way of launching `VFXWindow` from inside these applications.\r\n\r\n### Special Thanks\r\n - [Blue Zoo](https://www.blue-zoo.co.uk/) - I've been building this up while working there\r\n - [Lior Ben Horin](https://gist.github.com/liorbenhorin): [Simple_MayaDockingClass.py](https://gist.github.com/liorbenhorin/69da10ec6f22c6d7b92deefdb4a4f475) - Used for Maya docking code\r\n - [Fredrik Averpil](https://github.com/fredrikaverpil): [pyvfx-boilerplate](https://github.com/fredrikaverpil/pyvfx-boilerplate) - Used to help with palettes, Nuke, and pre-2017 Maya\r\n - And a shoutout to anyone who has helped [contribute](https://github.com/huntfx/vfxwindow/graphs/contributors) to the module.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Qt window class for designing tools to be compatible between multiple VFX programs.",
"version": "1.9.0",
"project_urls": {
"Documentation": "https://github.com/huntfx/vfxwindow/wiki",
"Download": "https://github.com/huntfx/vfxwindow/archive/1.9.0.tar.gz",
"Homepage": "https://github.com/huntfx/vfxwindow",
"Issues": "https://github.com/huntfx/vfxwindow/issues",
"Source": "https://github.com/huntfx/vfxwindow"
},
"split_keywords": [
"qt",
" pyside",
" pyside2",
" pyqt",
" pyqt4",
" pyqt5",
" gui",
" window",
" maya",
" mayapy",
" nuke",
" nukescripts",
" houdini",
" unreal",
" engine",
" ue4",
" blender",
" 3dsmax",
" 3ds",
" blackmagic",
" fusion",
" substance",
" designer",
" vfx",
" visualfx",
" fx",
" cgi",
" 3d"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e94e5480ecba3ff3f63a4687accd97ea0674df5af4192958071da6e703403dec",
"md5": "5dfcd0c81d2f5561ca1a2ad0888e88b9",
"sha256": "532172130dea6c546739f4879f12ac17c012469a36e63782e3e9a91421c7568f"
},
"downloads": -1,
"filename": "vfxwindow-1.9.0.tar.gz",
"has_sig": false,
"md5_digest": "5dfcd0c81d2f5561ca1a2ad0888e88b9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7",
"size": 57453,
"upload_time": "2024-06-20T12:28:50",
"upload_time_iso_8601": "2024-06-20T12:28:50.348082Z",
"url": "https://files.pythonhosted.org/packages/e9/4e/5480ecba3ff3f63a4687accd97ea0674df5af4192958071da6e703403dec/vfxwindow-1.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-20 12:28:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "huntfx",
"github_project": "vfxwindow",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "Qt.py",
"specs": []
}
],
"lcname": "vfxwindow"
}