Skip to content

Commit

Permalink
Update CryEngine support
Browse files Browse the repository at this point in the history
  • Loading branch information
huntfx committed Oct 23, 2023
1 parent 7642692 commit b9be366
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vfxwindow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 5 additions & 7 deletions vfxwindow/cryengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions vfxwindow/utils/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down Expand Up @@ -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

0 comments on commit b9be366

Please sign in to comment.