diff --git a/README.md b/README.md index 5aa2195..1beb6c3 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ if __name__ == '__main__': | 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 diff --git a/vfxwindow/__init__.py b/vfxwindow/__init__.py index bc2532e..5d2e6d1 100644 --- a/vfxwindow/__init__.py +++ b/vfxwindow/__init__.py @@ -78,7 +78,7 @@ def _setup_qapp(): elif software.isBlackmagicFusion(): from .fusion import FusionWindow as VFXWindow -elif importable('SandboxBridge') and 'Sandbox.exe' in sys.executable: +elif software.isCryEngine(): from .cryengine import CryWindow as VFXWindow else: diff --git a/vfxwindow/cryengine.py b/vfxwindow/cryengine.py index e2703bf..e5a63ee 100644 --- a/vfxwindow/cryengine.py +++ b/vfxwindow/cryengine.py @@ -5,11 +5,12 @@ import os import sys +from Qt import QtWidgets + import SandboxBridge from .abstract import getWindowSettings from .utils import setCoordinatesToScreen, hybridmethod -from .utils.Qt import QtWidgets from .standalone import StandaloneWindow @@ -103,15 +104,12 @@ def show(cls, self, *args, **kwargs): except (AttributeError, KeyError): docked = True - if docked: - # Unable to test this yet + # Apparently this should add the window to the "Tools" menu, + # but I couldn't figure it out so it's disabled for now + if False and docked: return SandboxBridge.register_window( window_type=cls, name=getattr(cls, 'WindowName', 'New Window'), - category='Test', - needs_menu_item=True, - menu_path='VFXWindow', - unique=False, ) kwargs['exec_'] = False diff --git a/vfxwindow/utils/software.py b/vfxwindow/utils/software.py index 5f995ab..81c1073 100644 --- a/vfxwindow/utils/software.py +++ b/vfxwindow/utils/software.py @@ -125,6 +125,11 @@ def __importable(programImport): r'(?:[fF]usion|fuscript)\.(?:bin|exe|app)$', ) +_CRYENGINE = \ +( + r'[sS]andbox\.(?:bin|exe|app)$', +) + def isMaya(): if any((re.search(pattern, sys.executable) for pattern in _MAYA)): @@ -219,3 +224,9 @@ def isBlackmagicFusion(): if any((re.search(pattern, sys.executable) for pattern in _BLACKMAGIC_FUSION)): return __importable('fusionscript') or __importable('PeyeonScript') return False + + +def isCryEngine(): + if any((re.search(pattern, sys.executable) for pattern in _CRYENGINE)): + return __importable('SandboxBridge') + return False