Skip to content

Commit

Permalink
Add VS engine API check to modules/GUI.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ermo committed Aug 18, 2022
1 parent b39a2b9 commit bf4cfe2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions modules/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,34 @@ def __init__(self,screenX,screenY,marginX=None,marginY=None):
self.keyTarget = None
Base.GlobalKeyPython('#\nfrom GUI import *\nGUIRootSingleton.keyEvent()\n')

# VS Engine API version check ported verbatim from:
# https://github.com/vegastrike/Assets-Production/blob/master/modules/GUI.py
hasVersion = hasattr(VS, 'EngineVersion')
# get the engine version tuple in a displayable format
# if it needs to be compared, then use the original tuple version
ev = (
VS.EngineVersion().GetVersion()
if hasVersion
else (0, 7, 0, 'unknown') # 0.7.x was the last version without this API
)
engineVersion = '.'.join(
[
str(i)
for i in ev
]
)

apiVersion = (
VS.EngineVersion().GetAssetAPIVersion()
if hasVersion
else 0
)

trace(TRACE_WARNING, "::: What's in VS object %s :::" %(dir(VS)))
trace(TRACE_WARNING, "::: Engine Version {0} :::".format(engineVersion))
trace(TRACE_WARNING, "::: Asset API Version {0} :::".format(apiVersion))
# end VS Engine API version check

def setScreenDimensions(self,screenX,screenY):
self.screenX=screenX
self.screenY=screenY
Expand Down

0 comments on commit bf4cfe2

Please sign in to comment.