vfxwindow


Namevfxwindow JSON
Version 1.10.2 PyPI version JSON
download
home_pagehttps://github.com/huntfx/vfxwindow
SummaryQt window class for designing tools to be compatible between multiple VFX programs.
upload_time2025-07-18 10:22:02
maintainerNone
docs_urlNone
authorPeter Hunt
requires_python!=3.0.*,!=3.1.*,!=3.2.*,>=2.7
licenseMIT
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 natron
VCS
bugtrack_url
requirements Qt.py
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
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.load', self.afterSceneChange)  # All apps have callback support for 'file.load'
        if self.application == 'Maya':  # Maya supports before/after callbacks
            self.callbacks.add('file.new.before', self.beforeSceneChange)
            self.callbacks.add('file.new', self.afterSceneChange)  # Also mapped to 'file.new.after'
            self.callbacks.add('file.load.before', self.beforeSceneChange)
        elif self.application == 'Nuke':
            self.callbacks.add('node.create', self.sceneChanged, nodeClass='Root')  # Pass in a parameter
            self.callbacks.add('file.close', self.beforeSceneChange)
        elif self.application == 'Substance':  # Matches "Substance Painter" and "Substance Designer"
            self.callbacks.add('file.new', self.afterSceneChange)
            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.create', self.mayaNodeAdded, nodeType='dependNode')
        if self.application == 'Nuke':
            self.callbacks['scene'].add('node.create', 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()
```

### 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 a docked 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-4.2 | ❔ | ✔️ | ❔ |
| Blender (Background) | ✔️ | | ❔ | 3.1-4.2 | ❔ | ✔️ | ❔ |
| Katana             | ✔️ | ❌ | ❌ | 7 | ❔ | [✔️](# "Unable to catch close events when the user presses the X, meaning the position can't be saved and callbacks can't be implemented") | ❔ |
| 3ds Max            | ✔️ | ❌ | ❌ | 2018-2020 | ❔ | ✔️ | ❔ |
| 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) | ❔ | ✔️ | ❔ |
| Natron             | ✔️ | [❌](# "Potentially possible, but not yet implemented.") | ❌ | 2.5 | ❔ | ✔️ | ❔ |
| Gaffer             |️ ️✔️ | ❌ | ❌ | 1.5.6.0 | ❔ | ✔️ | ❔ |
| RenderDoc          | [✔️](# "Only runs in the interactive shell, not the script editor.") | ❌ | ❌ | 1.33 | ❔ | [✔️](# "Causes recursion error if calling `show`/`hide`, and crashes when calling `setVisible`.") | ❔ |

<sub>* Hover over underlined fields to see any extra details/issues.</sub>

### Features
 - Automatically save/restore window position
 - Automatically dock window to application (if supported)
 - Move window to screen if out of bounds (Windows only)
 - Register application specific callbacks to be cleaned up on window close
 - Keep track of signals to remove groups if required
 - Set palette to that of another program
 - Auto close if opening a duplicate window
 - Close down all windows at once

### 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.

### Requirements
 - [Qt.py](https://github.com/mottosso/Qt.py)

### Resources Used
 - [Simple_MayaDockingClass.py](https://gist.github.com/liorbenhorin/69da10ec6f22c6d7b92deefdb4a4f475) - Used for Maya docking code
 - [pyvfx-boilerplate](https://github.com/fredrikaverpil/pyvfx-boilerplate) - Used to help with palettes, Nuke, and pre-2017 Maya

            

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, natron",
    "author": "Peter Hunt",
    "author_email": "peter@huntfx.uk",
    "download_url": "https://files.pythonhosted.org/packages/50/30/15a09b49e038b6985a46ca1e6e69412833f1cd4d452fcd5534695f702520/vfxwindow-1.10.2.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\nfrom Qt import QtWidgets\r\nfrom vfxwindow import VFXWindow\r\n\r\nclass MyWindow(VFXWindow):\r\n    \"\"\"Test window to show off some features.\"\"\"\r\n\r\n    WindowID = 'vfx.window.test'\r\n    WindowName = 'My Window'\r\n    WindowDockable = True\r\n\r\n    def __init__(self, parent=None, **kwargs):\r\n        super(MyWindow, self).__init__(parent, **kwargs)\r\n        # Setup widgets/build UI here as you normally would\r\n        self.setCentralWidget(QtWidgets.QWidget())\r\n\r\n        # Setup callbacks\r\n        self.callbacks.add('file.load', self.afterSceneChange)  # All apps have callback support for 'file.load'\r\n        if self.application == 'Maya':  # Maya supports before/after callbacks\r\n            self.callbacks.add('file.new.before', self.beforeSceneChange)\r\n            self.callbacks.add('file.new', self.afterSceneChange)  # Also mapped to 'file.new.after'\r\n            self.callbacks.add('file.load.before', self.beforeSceneChange)\r\n        elif self.application == 'Nuke':\r\n            self.callbacks.add('node.create', self.sceneChanged, nodeClass='Root')  # Pass in a parameter\r\n            self.callbacks.add('file.close', self.beforeSceneChange)\r\n        elif self.application == 'Substance':  # Matches \"Substance Painter\" and \"Substance Designer\"\r\n            self.callbacks.add('file.new', self.afterSceneChange)\r\n            self.callbacks.add('file.close', self.beforeSceneChange)\r\n\r\n        # Wait until the program is ready before triggering the new scene method\r\n        self.deferred(self.afterSceneChange)\r\n\r\n    def afterSceneChange(self, *args):\r\n        \"\"\"Create the scene specific callbacks.\r\n        These are being created in a callback \"group\".\r\n        Subgroups are also supported.\r\n\r\n        Even though the callback is the same, the signatures can differ.\r\n        See '/vfxwindow/<app>/callbacks.py' for the relevant signatures.\r\n        \"\"\"\r\n        if self.application == 'Maya':\r\n            self.callbacks['scene'].add('node.create', self.mayaNodeAdded, nodeType='dependNode')\r\n        if self.application == 'Nuke':\r\n            self.callbacks['scene'].add('node.create', self.nukeNodeAdded)\r\n\r\n    def beforeSceneChange(self, *args):\r\n        \"\"\"Delete the scene specific callbacks.\"\"\"\r\n        self.callbacks['scene'].delete()\r\n\r\n    def mayaNodeAdded(self, node, clientData):\r\n        \"\"\"Print out the node that was added in Maya.\"\"\"\r\n        import maya.api.OpenMaya as om2\r\n        print('Node was added: {}'.format(om2.MFnDependencyNode(node).name()))\r\n\r\n    def nukeNodeAdded(self):\r\n        \"\"\"Print out the node that was added in Nuke.\"\"\"\r\n        import nuke\r\n        node = nuke.thisNode()\r\n        print('Node was added: {}'.format(node.name() or 'Root'))\r\n\r\n    def checkForChanges(self):\r\n        \"\"\"Update the UI if it is has been in a \"paused\" state.\r\n\r\n        This is needed for Nuke and Substance Designer/Painter, because\r\n        there's no way to detect if the window is closed or just hidden.\r\n        For safety all callbacks will get paused, and upon unpausing,\r\n        this method will be run to allow the window to correctly update.\r\n        \"\"\"\r\n        self.beforeSceneChange()\r\n        self.afterSceneChange()\r\n\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 a docked 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 | \u2714\ufe0f | 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-4.2 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Blender (Background) | \u2714\ufe0f | | \u2754 | 3.1-4.2 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Katana             | \u2714\ufe0f | \u274c | \u274c | 7 | \u2754 | [\u2714\ufe0f](# \"Unable to catch close events when the user presses the X, meaning the position can't be saved and callbacks can't be implemented\") | \u2754 |\r\n| 3ds Max            | \u2714\ufe0f | \u274c | \u274c | 2018-2020 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Substance Painter  | \u2714\ufe0f | [\u2714\ufe0f](# \"Uses `substance_painter.ui.add_dock_widget`, does not save/restore location of window.\") | \u2714\ufe0f | 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.\") | \u2714\ufe0f | 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| Natron             | \u2714\ufe0f | [\u274c](# \"Potentially possible, but not yet implemented.\") | \u274c | 2.5 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| Gaffer             |\ufe0f \ufe0f\u2714\ufe0f | \u274c | \u274c | 1.5.6.0 | \u2754 | \u2714\ufe0f | \u2754 |\r\n| RenderDoc          | [\u2714\ufe0f](# \"Only runs in the interactive shell, not the script editor.\") | \u274c | \u274c | 1.33 | \u2754 | [\u2714\ufe0f](# \"Causes recursion error if calling `show`/`hide`, and crashes when calling `setVisible`.\") | \u2754 |\r\n\r\n<sub>* Hover over underlined fields to see any extra details/issues.</sub>\r\n\r\n### Features\r\n - Automatically save/restore window position\r\n - Automatically dock window to application (if supported)\r\n - Move window to screen if out of bounds (Windows only)\r\n - Register application specific callbacks to be cleaned up on window close\r\n - Keep track of signals to remove groups if required\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\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### Requirements\r\n - [Qt.py](https://github.com/mottosso/Qt.py)\r\n\r\n### Resources Used\r\n - [Simple_MayaDockingClass.py](https://gist.github.com/liorbenhorin/69da10ec6f22c6d7b92deefdb4a4f475) - Used for Maya docking code\r\n - [pyvfx-boilerplate](https://github.com/fredrikaverpil/pyvfx-boilerplate) - Used to help with palettes, Nuke, and pre-2017 Maya\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Qt window class for designing tools to be compatible between multiple VFX programs.",
    "version": "1.10.2",
    "project_urls": {
        "Documentation": "https://github.com/huntfx/vfxwindow/wiki",
        "Download": "https://github.com/huntfx/vfxwindow/archive/1.10.2.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",
        " natron"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "503015a09b49e038b6985a46ca1e6e69412833f1cd4d452fcd5534695f702520",
                "md5": "c1a43b949e77be101bb790a0548ef92f",
                "sha256": "c2a6771fde41504c95c9869b26122a26fed4b46e62645da1094bc54607d8ad5d"
            },
            "downloads": -1,
            "filename": "vfxwindow-1.10.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c1a43b949e77be101bb790a0548ef92f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7",
            "size": 87378,
            "upload_time": "2025-07-18T10:22:02",
            "upload_time_iso_8601": "2025-07-18T10:22:02.629943Z",
            "url": "https://files.pythonhosted.org/packages/50/30/15a09b49e038b6985a46ca1e6e69412833f1cd4d452fcd5534695f702520/vfxwindow-1.10.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 10:22:02",
    "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"
}
        
Elapsed time: 0.88327s