upgraded capture_displaymapper util and some cleanup

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>
monroegm-disable-blank-issue-2
Jonny Gallowy 4 years ago
parent 7da0913900
commit 6cc98f1802

@ -163,6 +163,7 @@ _LOGGER.debug('Invoking __init__.py for {0}.'.format({_PACKAGENAME}))
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# -------------------------------------------------------------------------
def get_datadir() -> pathlib.Path: def get_datadir() -> pathlib.Path:
""" """
persistent application data. persistent application data.

@ -10,9 +10,7 @@
"""Frame capture of the Displaymapper Passthrough (outputs .dds image)""" """Frame capture of the Displaymapper Passthrough (outputs .dds image)"""
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
import logging as _logging import logging as _logging
from env_bool import env_bool
# ------------------------------------------------------------------------
_MODULENAME = 'ColorGrading.capture_displaymapperpassthrough' _MODULENAME = 'ColorGrading.capture_displaymapperpassthrough'
import ColorGrading.initialize import ColorGrading.initialize
@ -27,25 +25,35 @@ _LOGGER.debug('Initializing: {0}.'.format({_MODULENAME}))
import azlmbr.bus import azlmbr.bus
import azlmbr.atom import azlmbr.atom
default_passtree = ["Root", # This requires the level to have the DisplayMapper component added
# and configured to 'Passthrough'
# but now we can capture the parent input
# so this is here for reference for how it previously worked
passtree_displaymapperpassthrough = ["Root",
"MainPipeline_0",
"MainPipeline",
"PostProcessPass",
"LightAdaptation",
"DisplayMapperPass",
"DisplayMapperPassthrough"]
# we can grad the parent pass input to the displaymapper directly
passtree_default = ["Root",
"MainPipeline_0", "MainPipeline_0",
"MainPipeline", "MainPipeline",
"PostProcessPass", "PostProcessPass",
"LightAdaptation", "LightAdaptation",
"DisplayMapperPass", "DisplayMapperPass"]
"DisplayMapperPassthrough"]
default_path = "FrameCapture\DisplayMapperPassthrough.dds"
# To Do: we should try to set display mapper to passthrough, default_path = "FrameCapture\DisplayMappeInput.dds"
# then back after capture?
# To Do: we can wrap this, to call from a PySide2 GUI # To Do: we can wrap this, to call from a PySide2 GUI
def capture(command="CapturePassAttachment", def capture(command="CapturePassAttachment",
passtree=default_passtree, passtree=passtree_default,
pass_type="Output", pass_type="Input",
output_path=default_path): output_path=default_path):
"""Writes frame capture into project cache"""
azlmbr.atom.FrameCaptureRequestBus(azlmbr.bus.Broadcast, azlmbr.atom.FrameCaptureRequestBus(azlmbr.bus.Broadcast,
command, command,
passtree, passtree,

@ -32,10 +32,7 @@ if DCCSI_GDEBUG:
DCCSI_LOGLEVEL = int(10) DCCSI_LOGLEVEL = int(10)
# set up logger with both console and file _logging # set up logger with both console and file _logging
if DCCSI_GDEBUG: _LOGGER = initialize_logger(_PACKAGENAME, log_to_file=DCCSI_GDEBUG, default_log_level=DCCSI_LOGLEVEL)
_LOGGER = initialize_logger(_PACKAGENAME, log_to_file=True, default_log_level=DCCSI_LOGLEVEL)
else:
_LOGGER = initialize_logger(_PACKAGENAME, log_to_file=False, default_log_level=DCCSI_LOGLEVEL)
_LOGGER.debug('Initializing: {0}.'.format({_MODULENAME})) _LOGGER.debug('Initializing: {0}.'.format({_MODULENAME}))
@ -46,7 +43,7 @@ if DCCSI_DEV_MODE:
APPDATA = get_datadir() # os APPDATA APPDATA = get_datadir() # os APPDATA
APPDATA_WING = Path(APPDATA, f"Wing Pro {DCCSI_WING_VERSION_MAJOR}").resolve() APPDATA_WING = Path(APPDATA, f"Wing Pro {DCCSI_WING_VERSION_MAJOR}").resolve()
if APPDATA_WING.exists(): if APPDATA_WING.exists():
site.addsitedir(pathlib.PureWindowsPath(APPDATA_WING).as_posix()) site.addsitedir(APPDATA_WING.resolve())
import wingdbstub as debugger import wingdbstub as debugger
try: try:
debugger.Ensure() debugger.Ensure()
@ -75,8 +72,7 @@ def start():
try: try:
_O3DE_DEV = Path(os.getenv('O3DE_DEV')) _O3DE_DEV = Path(os.getenv('O3DE_DEV'))
_O3DE_DEV = _O3DE_DEV.resolve() os.environ['O3DE_DEV'] = _O3DE_DEV.as_posix()
os.environ['O3DE_DEV'] = pathlib.PureWindowsPath(_O3DE_DEV).as_posix()
_LOGGER.debug(f'O3DE_DEV is: {_O3DE_DEV}') _LOGGER.debug(f'O3DE_DEV is: {_O3DE_DEV}')
except EnvironmentError as e: except EnvironmentError as e:
_LOGGER.error('O3DE engineroot not set or found') _LOGGER.error('O3DE engineroot not set or found')
@ -86,23 +82,22 @@ def start():
_TAG_LY_BUILD_PATH = os.getenv('TAG_LY_BUILD_PATH', 'build') _TAG_LY_BUILD_PATH = os.getenv('TAG_LY_BUILD_PATH', 'build')
_DEFAULT_BIN_PATH = Path(str(_O3DE_DEV), _TAG_LY_BUILD_PATH, 'bin', 'profile') _DEFAULT_BIN_PATH = Path(str(_O3DE_DEV), _TAG_LY_BUILD_PATH, 'bin', 'profile')
_O3DE_BIN_PATH = Path(os.getenv('O3DE_BIN_PATH', _DEFAULT_BIN_PATH)) _O3DE_BIN_PATH = Path(os.getenv('O3DE_BIN_PATH', _DEFAULT_BIN_PATH))
_O3DE_BIN_PATH = _O3DE_BIN_PATH.resolve() os.environ['O3DE_BIN_PATH'] = _O3DE_BIN_PATH.as_posix()
os.environ['O3DE_BIN_PATH'] = pathlib.PureWindowsPath(_O3DE_BIN_PATH).as_posix()
_LOGGER.debug(f'O3DE_BIN_PATH is: {_O3DE_BIN_PATH}') _LOGGER.debug(f'O3DE_BIN_PATH is: {_O3DE_BIN_PATH}')
site.addsitedir(pathlib.PureWindowsPath(_O3DE_BIN_PATH).as_posix()) site.addsitedir(_O3DE_BIN_PATH.resolve())
except EnvironmentError as e: except EnvironmentError as e:
_LOGGER.error('O3DE bin folder not set or found') _LOGGER.error('O3DE bin folder not set or found')
raise e raise e
if running_editor: if running_editor:
_O3DE_DEV = Path(os.getenv('O3DE_DEV', Path(azlmbr.paths.engroot))) _O3DE_DEV = Path(os.getenv('O3DE_DEV', Path(azlmbr.paths.engroot)))
os.environ['O3DE_DEV'] = pathlib.PureWindowsPath(_O3DE_DEV).as_posix() os.environ['O3DE_DEV'] = _O3DE_DEV.as_posix()
_LOGGER.debug(_O3DE_DEV) _LOGGER.debug(_O3DE_DEV)
_O3DE_BIN_PATH = Path(str(_O3DE_DEV),Path(azlmbr.paths.executableFolder)) _O3DE_BIN_PATH = Path(str(_O3DE_DEV),Path(azlmbr.paths.executableFolder))
_O3DE_BIN = Path(os.getenv('O3DE_BIN', _O3DE_BIN_PATH.resolve())) _O3DE_BIN = Path(os.getenv('O3DE_BIN', _O3DE_BIN_PATH.resolve()))
os.environ['O3DE_BIN'] = pathlib.PureWindowsPath(_O3DE_BIN).as_posix() os.environ['O3DE_BIN'] = _O3DE_BIN_PATH.as_posix()
_LOGGER.debug(_O3DE_BIN) _LOGGER.debug(_O3DE_BIN)

@ -34,15 +34,15 @@ SETLOCAL ENABLEDELAYEDEXPANSION
IF EXIST "%~dp0User_Env.bat" CALL %~dp0User_Env.bat IF EXIST "%~dp0User_Env.bat" CALL %~dp0User_Env.bat
:: Initialize env :: Initialize env
echo echo.
echo ... calling Env_Core.bat echo ... calling Env_Core.bat
CALL %~dp0\Env_Core.bat CALL %~dp0\Env_Core.bat
echo echo.
echo ... calling Env_Python.bat echo ... calling Env_Python.bat
CALL %~dp0\Env_Python.bat CALL %~dp0\Env_Python.bat
echo echo.
echo ... calling Env_Tools.bat echo ... calling Env_Tools.bat
CALL %~dp0\Env_Tools.bat CALL %~dp0\Env_Tools.bat

@ -27,37 +27,19 @@ echo ~ O3DE Color Grading Python Env ...
echo _____________________________________________________________________ echo _____________________________________________________________________
echo. echo.
:: Python Version
:: Ideally these are set to match the O3DE python distribution
:: <O3DE>\python\runtime
IF "%DCCSI_PY_VERSION_MAJOR%"=="" (set DCCSI_PY_VERSION_MAJOR=3)
echo DCCSI_PY_VERSION_MAJOR = %DCCSI_PY_VERSION_MAJOR%
:: PY version Major
IF "%DCCSI_PY_VERSION_MINOR%"=="" (set DCCSI_PY_VERSION_MINOR=7)
echo DCCSI_PY_VERSION_MINOR = %DCCSI_PY_VERSION_MINOR%
IF "%DCCSI_PY_VERSION_RELEASE%"=="" (set DCCSI_PY_VERSION_RELEASE=10)
echo DCCSI_PY_VERSION_RELEASE = %DCCSI_PY_VERSION_RELEASE%
:: shared location for 64bit python 3.7 DEV location
:: this defines a DCCsi sandbox for lib site-packages by version
:: <O3DE>\Gems\AtomLyIntegration\TechnicalArt\DccScriptingInterface\3rdParty\Python\Lib
set DCCSI_PYTHON_PATH=%DCCSIG_PATH%\3rdParty\Python
echo DCCSI_PYTHON_PATH = %DCCSI_PYTHON_PATH%
:: add access to a Lib location that matches the py version (example: 3.7.x)
:: switch this for other python versions like maya (2.7.x)
IF "%DCCSI_PYTHON_LIB_PATH%"=="" (set DCCSI_PYTHON_LIB_PATH=%DCCSI_PYTHON_PATH%\Lib\%DCCSI_PY_VERSION_MAJOR%.x\%DCCSI_PY_VERSION_MAJOR%.%DCCSI_PY_VERSION_MINOR%.x\site-packages)
echo DCCSI_PYTHON_LIB_PATH = %DCCSI_PYTHON_LIB_PATH%
:: add to the PATH
SET PATH=%DCCSI_PYTHON_LIB_PATH%;%PATH%
:: shared location for default O3DE python location :: shared location for default O3DE python location
set DCCSI_PYTHON_INSTALL=%O3DE_DEV%\Python set DCCSI_PYTHON_INSTALL=%O3DE_DEV%\Python
echo DCCSI_PYTHON_INSTALL = %DCCSI_PYTHON_INSTALL% echo DCCSI_PYTHON_INSTALL = %DCCSI_PYTHON_INSTALL%
:: Warning, many DCC tools (like Maya) include thier own versioned python interpretter.
:: Some apps may not operate correctly if PYTHONHOME is set/propogated.
:: This is definitely the case with Maya, doing so causes Maya to not boot.
FOR /F "tokens=* USEBACKQ" %%F IN (`%DCCSI_PYTHON_INSTALL%\python.cmd %DCCSI_PYTHON_INSTALL%\get_python_path.py`) DO (SET PYTHONHOME=%%F)
echo PYTHONHOME - is now the folder containing O3DE python executable
echo PYTHONHOME = %PYTHONHOME%
SET PYTHON=%PYTHONHOME%\python.exe
:: location for O3DE python 3.7 location :: location for O3DE python 3.7 location
set DCCSI_PY_BASE=%DCCSI_PYTHON_INSTALL%\python.cmd set DCCSI_PY_BASE=%DCCSI_PYTHON_INSTALL%\python.cmd
echo DCCSI_PY_BASE = %DCCSI_PY_BASE% echo DCCSI_PY_BASE = %DCCSI_PY_BASE%
@ -65,10 +47,7 @@ echo DCCSI_PY_BASE = %DCCSI_PY_BASE%
:: ide and debugger plug :: ide and debugger plug
set DCCSI_PY_DEFAULT=%DCCSI_PY_BASE% set DCCSI_PY_DEFAULT=%DCCSI_PY_BASE%
IF "%DCCSI_PY_REV%"=="" (set DCCSI_PY_REV=rev2) set DCCSI_PY_IDE=%PYTHONHOME%
IF "%DCCSI_PY_PLATFORM%"=="" (set DCCSI_PY_PLATFORM=windows)
set DCCSI_PY_IDE=%DCCSI_PYTHON_INSTALL%\runtime\python-%DCCSI_PY_VERSION_MAJOR%.%DCCSI_PY_VERSION_MINOR%.%DCCSI_PY_VERSION_RELEASE%-%DCCSI_PY_REV%-%DCCSI_PY_PLATFORM%\python
echo DCCSI_PY_IDE = %DCCSI_PY_IDE% echo DCCSI_PY_IDE = %DCCSI_PY_IDE%
:: Wing and other IDEs probably prefer access directly to the python.exe :: Wing and other IDEs probably prefer access directly to the python.exe
@ -91,11 +70,6 @@ SET PATH=%DCCSI_PYTHON_INSTALL%;%DCCSI_PY_IDE%;%DCCSI_PY_IDE_PACKAGES%;%DCCSI_PY
set PYTHONPATH=%DCCSIG_PATH%;%DCCSI_PYTHON_LIB_PATH%;%O3DE_BIN_PATH%;%DCCSI_COLORGRADING_SCRIPTS%;%DCCSI_FEATURECOMMON_SCRIPTS%;%PYTHONPATH% set PYTHONPATH=%DCCSIG_PATH%;%DCCSI_PYTHON_LIB_PATH%;%O3DE_BIN_PATH%;%DCCSI_COLORGRADING_SCRIPTS%;%DCCSI_FEATURECOMMON_SCRIPTS%;%PYTHONPATH%
echo PYTHONPATH = %PYTHONPATH% echo PYTHONPATH = %PYTHONPATH%
:: used for debugging in WingIDE (but needs to be here)
IF "%TAG_USERNAME%"=="" (set TAG_USERNAME=NOT_SET)
echo TAG_USERNAME = %TAG_USERNAME%
IF "%TAG_USERNAME%"=="NOT_SET" (echo Add TAG_USERNAME to User_Env.bat)
:: Set flag so we don't initialize dccsi environment twice :: Set flag so we don't initialize dccsi environment twice
SET O3DE_ENV_PY_INIT=1 SET O3DE_ENV_PY_INIT=1
GOTO END_OF_FILE GOTO END_OF_FILE

@ -25,11 +25,6 @@ SET TAG_LY_BUILD_PATH=build
SET DCCSI_GDEBUG=True SET DCCSI_GDEBUG=True
SET DCCSI_DEV_MODE=True SET DCCSI_DEV_MODE=True
:: set the your user name here for windows path
SET TAG_USERNAME=NOT_SET
SET DCCSI_PY_REV=rev1
SET DCCSI_PY_PLATFORM=windows
:: Set flag so we don't initialize dccsi environment twice :: Set flag so we don't initialize dccsi environment twice
SET O3DE_USER_ENV_INIT=1 SET O3DE_USER_ENV_INIT=1
GOTO END_OF_FILE GOTO END_OF_FILE

Loading…
Cancel
Save