From 28b18a33bd170e2e482c6ca35532cd005eb27bc4 Mon Sep 17 00:00:00 2001 From: Jonny Galloway Date: Wed, 15 Sep 2021 16:55:14 -0500 Subject: [PATCH] Atom/gallowj/clean up atom content (#4151) * Update the atom content to make best practice (latest conventions) Signed-off-by: Jonny Gallowy * file tweaks cleanup Signed-off-by: Jonny Gallowy * correct license headers Signed-off-by: Jonny Gallowy --- Gems/AtomContent/.gitignore | 8 ++ .../ReferenceMaterials/Launch_WingIDE-7-1.bat | 79 ------------- .../ReferenceMaterials/LyProjectRootStub | 0 .../ReferenceMaterials/Project_Env.bat | 70 ----------- .../{ => Tools}/Launch_Cmd.bat | 18 ++- .../Launch_Maya.bat} | 10 +- .../ReferenceMaterials/Tools/Project_Env.bat | 110 ++++++++++++++++++ .../Tools/User_Env.bat.template | 42 +++++++ Gems/AtomContent/ReferenceMaterials/gem.json | 10 +- Gems/AtomContent/Sponza/Project_Env.bat | 72 ------------ Gems/AtomContent/Sponza/Tools/Launch_Cmd.bat | 16 +-- .../Launch_Maya_2020.bat => Launch_Maya.bat} | 36 +++--- .../Sponza/Tools/Maya/Scripts/stub | 0 Gems/AtomContent/Sponza/Tools/Project_Env.bat | 110 ++++++++++++++++++ .../Sponza/Tools/User_Env.bat.template | 42 +++++++ Gems/AtomContent/Sponza/User_env.bat.template | 1 - .../Launchers/Windows/Env_Maya.bat | 2 +- .../azpy/config_utils.py | 32 ++++- 18 files changed, 383 insertions(+), 275 deletions(-) create mode 100644 Gems/AtomContent/.gitignore delete mode 100644 Gems/AtomContent/ReferenceMaterials/Launch_WingIDE-7-1.bat delete mode 100644 Gems/AtomContent/ReferenceMaterials/LyProjectRootStub delete mode 100644 Gems/AtomContent/ReferenceMaterials/Project_Env.bat rename Gems/AtomContent/ReferenceMaterials/{ => Tools}/Launch_Cmd.bat (72%) rename Gems/AtomContent/ReferenceMaterials/{Launch_Maya_2020.bat => Tools/Launch_Maya.bat} (82%) create mode 100644 Gems/AtomContent/ReferenceMaterials/Tools/Project_Env.bat create mode 100644 Gems/AtomContent/ReferenceMaterials/Tools/User_Env.bat.template delete mode 100644 Gems/AtomContent/Sponza/Project_Env.bat rename Gems/AtomContent/Sponza/Tools/{Maya/Launch_Maya_2020.bat => Launch_Maya.bat} (63%) delete mode 100644 Gems/AtomContent/Sponza/Tools/Maya/Scripts/stub create mode 100644 Gems/AtomContent/Sponza/Tools/Project_Env.bat create mode 100644 Gems/AtomContent/Sponza/Tools/User_Env.bat.template delete mode 100644 Gems/AtomContent/Sponza/User_env.bat.template diff --git a/Gems/AtomContent/.gitignore b/Gems/AtomContent/.gitignore new file mode 100644 index 0000000000..174c2dd972 --- /dev/null +++ b/Gems/AtomContent/.gitignore @@ -0,0 +1,8 @@ +_savebackup/ +.mayaSwatches/ +*.swatches +[Bb]uild/ +[Cc]ache/ +[Uu]ser/ +[Uu]ser_Env.bat +.maya_data/ \ No newline at end of file diff --git a/Gems/AtomContent/ReferenceMaterials/Launch_WingIDE-7-1.bat b/Gems/AtomContent/ReferenceMaterials/Launch_WingIDE-7-1.bat deleted file mode 100644 index c9b380ad64..0000000000 --- a/Gems/AtomContent/ReferenceMaterials/Launch_WingIDE-7-1.bat +++ /dev/null @@ -1,79 +0,0 @@ -@echo off -:: Launches Wing IDE and the DccScriptingInterface Project Files - -REM -REM Copyright (c) Contributors to the Open 3D Engine Project. -REM For complete copyright and license terms please see the LICENSE at the root of this distribution. -REM -REM SPDX-License-Identifier: Apache-2.0 OR MIT -REM -REM - -echo. -echo _____________________________________________________________________ -echo. -echo ~ Setting up LY DCCsi WingIDE Dev Env... -echo _____________________________________________________________________ -echo. - -:: Store current dir -%~d0 -cd %~dp0 -PUSHD %~dp0 - -:: Keep changes local -SETLOCAL enableDelayedExpansion - -SET ABS_PATH=%~dp0 -echo Current Dir, %ABS_PATH% - -:: WingIDE version Major -SET WING_VERSION_MAJOR=7 -echo WING_VERSION_MAJOR = %WING_VERSION_MAJOR% - -:: WingIDE version Major -SET WING_VERSION_MINOR=1 -echo WING_VERSION_MINOR = %WING_VERSION_MINOR% - -:: note the changed path from IDE to Pro -set WINGHOME=%PROGRAMFILES(X86)%\Wing Pro %WING_VERSION_MAJOR%.%WING_VERSION_MINOR% -echo WINGHOME = %WINGHOME% - -CALL %~dp0\Project_Env.bat - -echo. -echo _____________________________________________________________________ -echo. -echo ~ WingIDE Version %WING_VERSION_MAJOR%.%WING_VERSION_MINOR% -echo _____________________________________________________________________ -echo. - -SET WING_PROJ=%DCCSIG_PATH%\Solutions\.wing\DCCsi_%WING_VERSION_MAJOR%x.wpr -echo WING_PROJ = %WING_PROJ% - -echo. -echo _____________________________________________________________________ -echo. -echo ~ Launching %LY_PROJECT% project in WingIDE %WING_VERSION_MAJOR%.%WING_VERSION_MINOR% ... -echo _____________________________________________________________________ -echo. - - -IF EXIST "%WINGHOME%\bin\wing.exe" ( - start "" "%WINGHOME%\bin\wing.exe" "%WING_PROJ%" -) ELSE ( - Where wing.exe 2> NUL - IF ERRORLEVEL 1 ( - echo wing.exe could not be found - pause - ) ELSE ( - start "" wing.exe "%WING_PROJ%" - ) -) - -ENDLOCAL - -:: Return to starting directory -POPD - -:END_OF_FILE diff --git a/Gems/AtomContent/ReferenceMaterials/LyProjectRootStub b/Gems/AtomContent/ReferenceMaterials/LyProjectRootStub deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Gems/AtomContent/ReferenceMaterials/Project_Env.bat b/Gems/AtomContent/ReferenceMaterials/Project_Env.bat deleted file mode 100644 index 6612ca5399..0000000000 --- a/Gems/AtomContent/ReferenceMaterials/Project_Env.bat +++ /dev/null @@ -1,70 +0,0 @@ -@echo off -:: Sets up environment for Lumberyard DCC tools and code access - -REM -REM Copyright (c) Contributors to the Open 3D Engine Project. -REM For complete copyright and license terms please see the LICENSE at the root of this distribution. -REM -REM SPDX-License-Identifier: Apache-2.0 OR MIT -REM -REM - -:: Store current dir -%~d0 -cd %~dp0 -PUSHD %~dp0 - -for %%a in (.) do set LY_PROJECT=%%~na - -echo. -echo _____________________________________________________________________ -echo. -echo ~ Setting up LY DSI PROJECT Environment ... -echo _____________________________________________________________________ -echo. - -echo LY_PROJECT = %LY_PROJECT% - -:: Put you project env vars and overrides here - -:: chanhe the relative path up to dev -set DEV_REL_PATH=../../.. -set ABS_PATH=%~dp0 - -:: Override the default maya version -set MAYA_VERSION=2020 -echo MAYA_VERSION = %MAYA_VERSION% - -set LY_PROJECT_PATH=%ABS_PATH% -echo LY_PROJECT_PATH = %LY_PROJECT_PATH% - -:: Change to root Lumberyard dev dir -CD /d %LY_PROJECT_PATH%\%DEV_REL_PATH% -set LY_DEV=%CD% -echo LY_DEV = %LY_DEV% - -CALL %LY_DEV%\Gems\AtomLyIntegration\TechnicalArt\DccScriptingInterface\Launchers\Windows\Env.bat - -rem :: Constant Vars (Global) -rem SET LYPY_GDEBUG=0 -rem echo LYPY_GDEBUG = %LYPY_GDEBUG% -rem SET LYPY_DEV_MODE=0 -rem echo LYPY_DEV_MODE = %LYPY_DEV_MODE% -rem SET LYPY_DEBUGGER=WING -rem echo LYPY_DEBUGGER = %LYPY_DEBUGGER% - -:: Restore original directory -popd - -:: Change to root dir -CD /D %ABS_PATH% - -:: if the user has set up a custom env call it -IF EXIST "%~dp0User_Env.bat" CALL %~dp0User_Env.bat - -GOTO END_OF_FILE - -:: Return to starting directory -POPD - -:END_OF_FILE diff --git a/Gems/AtomContent/ReferenceMaterials/Launch_Cmd.bat b/Gems/AtomContent/ReferenceMaterials/Tools/Launch_Cmd.bat similarity index 72% rename from Gems/AtomContent/ReferenceMaterials/Launch_Cmd.bat rename to Gems/AtomContent/ReferenceMaterials/Tools/Launch_Cmd.bat index 8ec894c21f..d100c9ddc7 100644 --- a/Gems/AtomContent/ReferenceMaterials/Launch_Cmd.bat +++ b/Gems/AtomContent/ReferenceMaterials/Tools/Launch_Cmd.bat @@ -1,21 +1,19 @@ -:: Need to set up - @echo off REM -REM Copyright (c) Contributors to the Open 3D Engine Project. -REM For complete copyright and license terms please see the LICENSE at the root of this distribution. -REM +REM Copyright (c) Contributors to the Open 3D Engine Project +REM REM SPDX-License-Identifier: Apache-2.0 OR MIT +REM For complete copyright and license terms please see the LICENSE at the root of this distribution. REM REM -:: Set up and run LY Python CMD prompt -:: Sets up the DccScriptingInterface_Env, +:: Set up and start a O3DE CMD prompt +:: Sets up the current (DCC) Project_Env, :: Puts you in the CMD within the dev environment :: Set up window -TITLE Lumberyard DCC Scripting Interface Cmd +TITLE O3DE Asset Gem Cmd :: Use obvious color to prevent confusion (Grey with Yellow Text) COLOR 8E @@ -31,7 +29,7 @@ CALL %~dp0\Project_Env.bat echo. echo _____________________________________________________________________ echo. -echo ~ LY DCC Scripting Interface CMD ... +echo ~ O3DE Asset Gem CMD ... echo _____________________________________________________________________ echo. @@ -43,4 +41,4 @@ ENDLOCAL :: Return to starting directory POPD -:END_OF_FILE +:END_OF_FILE \ No newline at end of file diff --git a/Gems/AtomContent/ReferenceMaterials/Launch_Maya_2020.bat b/Gems/AtomContent/ReferenceMaterials/Tools/Launch_Maya.bat similarity index 82% rename from Gems/AtomContent/ReferenceMaterials/Launch_Maya_2020.bat rename to Gems/AtomContent/ReferenceMaterials/Tools/Launch_Maya.bat index 1dc504e684..b9a6b399f3 100644 --- a/Gems/AtomContent/ReferenceMaterials/Launch_Maya_2020.bat +++ b/Gems/AtomContent/ReferenceMaterials/Tools/Launch_Maya.bat @@ -22,22 +22,22 @@ echo ~ calling PROJ_Env.bat SETLOCAL enableDelayedExpansion :: PY version Major -set DCCSI_PY_VERSION_MAJOR=2 +IF "%DCCSI_PY_VERSION_MAJOR%"=="" (set DCCSI_PY_VERSION_MAJOR=2) echo DCCSI_PY_VERSION_MAJOR = %DCCSI_PY_VERSION_MAJOR% :: PY version Major -set DCCSI_PY_VERSION_MINOR=7 +IF "%DCCSI_PY_VERSION_MINOR%"=="" (set DCCSI_PY_VERSION_MINOR=7) echo DCCSI_PY_VERSION_MINOR = %DCCSI_PY_VERSION_MINOR% :: Maya Version -set MAYA_VERSION=2020 -echo MAYA_VERSION = %MAYA_VERSION% +IF "%DCCSI_MAYA_VERSION%"=="" (set DCCSI_MAYA_VERSION=2020) +echo DCCSI_MAYA_VERSION = %DCCSI_MAYA_VERSION% :: if a local customEnv.bat exists, run it IF EXIST "%~dp0Project_Env.bat" CALL %~dp0Project_Env.bat echo ________________________________ -echo Launching Maya %MAYA_VERSION% for Lumberyard... +echo Launching Maya %DCCSI_MAYA_VERSION% for Lumberyard... :::: Set Maya native project acess to this project ::set MAYA_PROJECT=%LY_PROJECT% diff --git a/Gems/AtomContent/ReferenceMaterials/Tools/Project_Env.bat b/Gems/AtomContent/ReferenceMaterials/Tools/Project_Env.bat new file mode 100644 index 0000000000..6e2c8b5914 --- /dev/null +++ b/Gems/AtomContent/ReferenceMaterials/Tools/Project_Env.bat @@ -0,0 +1,110 @@ +@echo off + +REM +REM Copyright (c) Contributors to the Open 3D Engine Project +REM +REM SPDX-License-Identifier: Apache-2.0 OR MIT +REM For complete copyright and license terms please see the LICENSE at the root of this distribution. +REM +REM + +:: Sets up environment for O3DE DCC tools and code access + +:: Set up window +TITLE O3DE Asset Gem +:: Use obvious color to prevent confusion (Grey with Yellow Text) +COLOR 8E + +:: Skip initialization if already completed +IF "%O3DE_PROJ_ENV_INIT%"=="1" GOTO :END_OF_FILE + +:: Store current dir +%~d0 +cd %~dp0 +PUSHD %~dp0 + +:: Put you project env vars and overrides in this file + +:: chanhe the relative path up to dev +set ABS_PATH=%~dp0 + +:: project name as a str tag +IF "%LY_PROJECT_NAME%"=="" ( + for %%I in ("%~dp0.") do for %%J in ("%%~dpI.") do set LY_PROJECT_NAME=%%~nxJ + ) + +echo. +echo _____________________________________________________________________ +echo. +echo ~ Setting up O3DE %LY_PROJECT_NAME% Environment ... +echo _____________________________________________________________________ +echo. +echo LY_PROJECT_NAME = %LY_PROJECT_NAME% + +:: if the user has set up a custom env call it +:: this should allow the user to locally +:: set env hooks like LY_DEV or LY_PROJECT +IF EXIST "%~dp0User_Env.bat" CALL %~dp0User_Env.bat +echo LY_DEV = %LY_DEV% + +:: Constant Vars (Global) +:: global debug flag (propogates) +:: The intent here is to set and globally enter a debug mode +IF "%DCCSI_GDEBUG%"=="" (set DCCSI_GDEBUG=false) +echo DCCSI_GDEBUG = %DCCSI_GDEBUG% +:: initiates earliest debugger connection +:: we support attaching to WingIDE... PyCharm and VScode in the future +IF "%DCCSI_DEV_MODE%"=="" (set DCCSI_DEV_MODE=false) +echo DCCSI_DEV_MODE = %DCCSI_DEV_MODE% +:: sets debugger, options: WING, PYCHARM +IF "%DCCSI_GDEBUGGER%"=="" (set DCCSI_GDEBUGGER=WING) +echo DCCSI_GDEBUGGER = %DCCSI_GDEBUGGER% +:: Default level logger will handle +:: Override this to control the setting +:: CRITICAL:50 +:: ERROR:40 +:: WARNING:30 +:: INFO:20 +:: DEBUG:10 +:: NOTSET:0 +IF "%DCCSI_LOGLEVEL%"=="" (set DCCSI_LOGLEVEL=20) +echo DCCSI_LOGLEVEL = %DCCSI_LOGLEVEL% + +:: Override the default maya version +IF "%DCCSI_MAYA_VERSION%"=="" (set DCCSI_MAYA_VERSION=2020) +echo DCCSI_MAYA_VERSION = %DCCSI_MAYA_VERSION% + +:: LY_PROJECT is ideally treated as a full path in the env launchers +:: do to changes in o3de, external engine/project/gem folder structures, etc. +IF "%LY_PROJECT%"=="" ( + for %%i in ("%~dp0..") do set "LY_PROJECT=%%~fi" + ) +echo LY_PROJECT = %LY_PROJECT% + +:: this is here for archaic reasons, WILL DEPRECATE +IF "%LY_PROJECT_PATH%"=="" (set LY_PROJECT_PATH=%LY_PROJECT%) +echo LY_PROJECT_PATH = %LY_PROJECT_PATH% + +:: Change to root Lumberyard dev dir +:: You must set this in a User_Env.bat to match youe engine repo location! +IF "%LY_DEV%"=="" (set LY_DEV=C:\Depot\o3de-engine) +echo LY_DEV = %LY_DEV% + +CALL %LY_DEV%\Gems\AtomLyIntegration\TechnicalArt\DccScriptingInterface\Launchers\Windows\Env_Maya.bat + +:: Restore original directory +popd + +:: Change to root dir +CD /D %ABS_PATH% + +::ENDLOCAL + +:: Set flag so we don't initialize dccsi environment twice +SET O3DE_PROJ_ENV_INIT=1 +GOTO END_OF_FILE + +:: Return to starting directory +POPD + +:END_OF_FILE diff --git a/Gems/AtomContent/ReferenceMaterials/Tools/User_Env.bat.template b/Gems/AtomContent/ReferenceMaterials/Tools/User_Env.bat.template new file mode 100644 index 0000000000..d108f30a5b --- /dev/null +++ b/Gems/AtomContent/ReferenceMaterials/Tools/User_Env.bat.template @@ -0,0 +1,42 @@ +@echo off + +REM +REM Copyright (c) Contributors to the Open 3D Engine Project +REM +REM SPDX-License-Identifier: Apache-2.0 OR MIT +REM For complete copyright and license terms please see the LICENSE at the root of this distribution. +REM +REM + +:: copy this file, rename to User_Env.bat (remove .template) +:: use this file to override any local properties that differ from base + +:: Skip initialization if already completed +IF "%O3DE_USER_ENV_INIT%"=="1" GOTO :END_OF_FILE + +:: Store current dir +%~d0 +cd %~dp0 +PUSHD %~dp0 + +SET O3DE_DEV=C:\Depot\o3de-engine +::SET OCIO_APPS=C:\Depot\o3de-engine\Tools\ColorGrading\ocio\build\src\apps +SET TAG_LY_BUILD_PATH=build +SET DCCSI_GDEBUG=True +SET DCCSI_DEV_MODE=True + +set DCCSI_MAYA_VERSION=2020 + +:: 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 O3DE_USER_ENV_INIT=1 +GOTO END_OF_FILE + +:: Return to starting directory +POPD + +:END_OF_FILE \ No newline at end of file diff --git a/Gems/AtomContent/ReferenceMaterials/gem.json b/Gems/AtomContent/ReferenceMaterials/gem.json index d66c2fa1db..9e145c20cc 100644 --- a/Gems/AtomContent/ReferenceMaterials/gem.json +++ b/Gems/AtomContent/ReferenceMaterials/gem.json @@ -1,11 +1,11 @@ { "gem_name": "ReferenceMaterials", - "display_name": "ReferenceMaterials", - "license": "Apache-2.0 Or MIT", - "origin": "Open 3D Engine - o3de.org", + "display_name": "PBR Reference Materials", + "license": "Code, text, data files: Apache-2.0 Or MIT, assets/content/images: CC BY 4.0", + "origin": "https://github.com/aws-lumberyard-dev/o3de.git", "type": "Asset", "summary": "Atom Asset Gem with a library of reference materials for StandardPBR (and others in the future)", "canonical_tags": ["Gem"], - "user_tags": ["Assets"], - "requirements": "" + "user_tags": ["Assets", "PBR", "Materials"], + "icon_path": "preview.png" } diff --git a/Gems/AtomContent/Sponza/Project_Env.bat b/Gems/AtomContent/Sponza/Project_Env.bat deleted file mode 100644 index 74b70a2320..0000000000 --- a/Gems/AtomContent/Sponza/Project_Env.bat +++ /dev/null @@ -1,72 +0,0 @@ -@echo off -REM -REM Copyright (c) Contributors to the Open 3D Engine Project. -REM For complete copyright and license terms please see the LICENSE at the root of this distribution. -REM -REM SPDX-License-Identifier: Apache-2.0 OR MIT -REM -REM - -:: Store current dir -%~d0 -cd %~dp0 -PUSHD %~dp0 - -:: This is a legacy envar which is being migrated to LY_PROJECT_NAME -for %%a in (.) do set LY_PROJECT=%%~na - -echo. -echo _____________________________________________________________________ -echo. -echo ~ Setting up LY DSI PROJECT Environment ... -echo _____________________________________________________________________ -echo. - -echo LY_PROJECT = %LY_PROJECT% - -set LY_PROJECT_NAME=%LY_PROJECT% -echo LY_PROJECT_NAME = %LY_PROJECT_NAME% - -:: Put you project env vars and overrides here - -:: chanhe the relative path up to dev -set DEV_REL_PATH=../../.. -set ABS_PATH=%~dp0 - -:: Override the default maya version -set MAYA_VERSION=2020 -echo MAYA_VERSION = %MAYA_VERSION% - -set LY_PROJECT_PATH=%ABS_PATH% -echo LY_PROJECT_PATH = %LY_PROJECT_PATH% - -:: Change to root Lumberyard dev dir -CD /d %LY_PROJECT_PATH%\%DEV_REL_PATH% -set LY_DEV=%CD% -echo LY_DEV = %LY_DEV% - -CALL %LY_DEV%\Gems\AtomLyIntegration\TechnicalArt\DccScriptingInterface\Launchers\Windows\Env_Maya.bat - -rem :: Constant Vars (Global) -rem SET LYPY_GDEBUG=0 -rem echo LYPY_GDEBUG = %LYPY_GDEBUG% -rem SET LYPY_DEV_MODE=0 -rem echo LYPY_DEV_MODE = %LYPY_DEV_MODE% -rem SET LYPY_DEBUGGER=WING -rem echo LYPY_DEBUGGER = %LYPY_DEBUGGER% - -:: Restore original directory -popd - -:: Change to root dir -CD /D %ABS_PATH% - -:: if the user has set up a custom env call it -IF EXIST "%~dp0User_Env.bat" CALL %~dp0User_Env.bat - -GOTO END_OF_FILE - -:: Return to starting directory -POPD - -:END_OF_FILE diff --git a/Gems/AtomContent/Sponza/Tools/Launch_Cmd.bat b/Gems/AtomContent/Sponza/Tools/Launch_Cmd.bat index 2636b3dea4..99c2c12c51 100644 --- a/Gems/AtomContent/Sponza/Tools/Launch_Cmd.bat +++ b/Gems/AtomContent/Sponza/Tools/Launch_Cmd.bat @@ -1,19 +1,19 @@ @echo off + +REM +REM Copyright (c) Contributors to the Open 3D Engine Project REM -REM Copyright (c) Contributors to the Open 3D Engine Project. -REM For complete copyright and license terms please see the LICENSE at the root of this distribution. -REM REM SPDX-License-Identifier: Apache-2.0 OR MIT +REM For complete copyright and license terms please see the LICENSE at the root of this distribution. REM REM -@echo off -:: Set up and run LY Python CMD prompt -:: Sets up the DccScriptingInterface_Env, +:: Set up and start a O3DE CMD prompt +:: Sets up the current (DCC) Project_Env, :: Puts you in the CMD within the dev environment :: Set up window -TITLE Lumberyard DCC Scripting Interface Cmd +TITLE O3DE DCC Scripting Interface Cmd :: Use obvious color to prevent confusion (Grey with Yellow Text) COLOR 8E @@ -24,7 +24,7 @@ PUSHD %~dp0 :: Keep changes local SETLOCAL enableDelayedExpansion -CALL %~dp0\..\Project_Env.bat +CALL %~dp0\Project_Env.bat echo. echo _____________________________________________________________________ diff --git a/Gems/AtomContent/Sponza/Tools/Maya/Launch_Maya_2020.bat b/Gems/AtomContent/Sponza/Tools/Launch_Maya.bat similarity index 63% rename from Gems/AtomContent/Sponza/Tools/Maya/Launch_Maya_2020.bat rename to Gems/AtomContent/Sponza/Tools/Launch_Maya.bat index 53344d527e..d774adf79b 100644 --- a/Gems/AtomContent/Sponza/Tools/Maya/Launch_Maya_2020.bat +++ b/Gems/AtomContent/Sponza/Tools/Launch_Maya.bat @@ -1,4 +1,5 @@ @echo off + REM REM Copyright (c) Contributors to the Open 3D Engine Project. REM For complete copyright and license terms please see the LICENSE at the root of this distribution. @@ -7,11 +8,6 @@ REM SPDX-License-Identifier: Apache-2.0 OR MIT REM REM -:: Launches maya wityh a bunch of local hooks for Lumberyard -:: ToDo: move all of this to a .json data driven boostrapping system - -@echo off - %~d0 cd %~dp0 PUSHD %~dp0 @@ -23,22 +19,22 @@ echo ~ calling PROJ_Env.bat SETLOCAL enableDelayedExpansion :: PY version Major -set DCCSI_PY_VERSION_MAJOR=2 +IF "%DCCSI_PY_VERSION_MAJOR%"=="" (set DCCSI_PY_VERSION_MAJOR=2) echo DCCSI_PY_VERSION_MAJOR = %DCCSI_PY_VERSION_MAJOR% :: PY version Major -set DCCSI_PY_VERSION_MINOR=7 +IF "%DCCSI_PY_VERSION_MINOR%"=="" (set DCCSI_PY_VERSION_MINOR=7) echo DCCSI_PY_VERSION_MINOR = %DCCSI_PY_VERSION_MINOR% :: Maya Version -set MAYA_VERSION=2020 -echo MAYA_VERSION = %MAYA_VERSION% +IF "%DCCSI_MAYA_VERSION%"=="" (set DCCSI_MAYA_VERSION=2020) +echo DCCSI_MAYA_VERSION = %DCCSI_MAYA_VERSION% :: if a local customEnv.bat exists, run it -IF EXIST "%~dp0..\..\Project_Env.bat" CALL %~dp0..\..\Project_Env.bat +IF EXIST "%~dp0Project_Env.bat" CALL %~dp0Project_Env.bat echo ________________________________ -echo Launching Maya %MAYA_VERSION% for Lumberyard... +echo Launching Maya %DCCSI_MAYA_VERSION% for Lumberyard... :::: Set Maya native project acess to this project ::set MAYA_PROJECT=%LY_PROJECT% @@ -49,15 +45,15 @@ Set MAYA_VP2_DEVICE_OVERRIDE = VirtualDeviceDx11 :: Default to the right version of Maya if we can detect it... and launch IF EXIST "%MAYA_LOCATION%\bin\Maya.exe" ( - start "" "%MAYA_LOCATION%\bin\Maya.exe" %* + start "" "%MAYA_LOCATION%\bin\Maya.exe" %* ) ELSE ( - Where maya.exe 2> NUL - IF ERRORLEVEL 1 ( - echo Maya.exe could not be found - pause - ) ELSE ( - start "" Maya.exe %* - ) + Where maya.exe 2> NUL + IF ERRORLEVEL 1 ( + echo Maya.exe could not be found + pause + ) ELSE ( + start "" Maya.exe %* + ) ) :: Return to starting directory @@ -65,4 +61,4 @@ POPD :END_OF_FILE -exit /b 0 \ No newline at end of file +exit /b 0 diff --git a/Gems/AtomContent/Sponza/Tools/Maya/Scripts/stub b/Gems/AtomContent/Sponza/Tools/Maya/Scripts/stub deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Gems/AtomContent/Sponza/Tools/Project_Env.bat b/Gems/AtomContent/Sponza/Tools/Project_Env.bat new file mode 100644 index 0000000000..6e2c8b5914 --- /dev/null +++ b/Gems/AtomContent/Sponza/Tools/Project_Env.bat @@ -0,0 +1,110 @@ +@echo off + +REM +REM Copyright (c) Contributors to the Open 3D Engine Project +REM +REM SPDX-License-Identifier: Apache-2.0 OR MIT +REM For complete copyright and license terms please see the LICENSE at the root of this distribution. +REM +REM + +:: Sets up environment for O3DE DCC tools and code access + +:: Set up window +TITLE O3DE Asset Gem +:: Use obvious color to prevent confusion (Grey with Yellow Text) +COLOR 8E + +:: Skip initialization if already completed +IF "%O3DE_PROJ_ENV_INIT%"=="1" GOTO :END_OF_FILE + +:: Store current dir +%~d0 +cd %~dp0 +PUSHD %~dp0 + +:: Put you project env vars and overrides in this file + +:: chanhe the relative path up to dev +set ABS_PATH=%~dp0 + +:: project name as a str tag +IF "%LY_PROJECT_NAME%"=="" ( + for %%I in ("%~dp0.") do for %%J in ("%%~dpI.") do set LY_PROJECT_NAME=%%~nxJ + ) + +echo. +echo _____________________________________________________________________ +echo. +echo ~ Setting up O3DE %LY_PROJECT_NAME% Environment ... +echo _____________________________________________________________________ +echo. +echo LY_PROJECT_NAME = %LY_PROJECT_NAME% + +:: if the user has set up a custom env call it +:: this should allow the user to locally +:: set env hooks like LY_DEV or LY_PROJECT +IF EXIST "%~dp0User_Env.bat" CALL %~dp0User_Env.bat +echo LY_DEV = %LY_DEV% + +:: Constant Vars (Global) +:: global debug flag (propogates) +:: The intent here is to set and globally enter a debug mode +IF "%DCCSI_GDEBUG%"=="" (set DCCSI_GDEBUG=false) +echo DCCSI_GDEBUG = %DCCSI_GDEBUG% +:: initiates earliest debugger connection +:: we support attaching to WingIDE... PyCharm and VScode in the future +IF "%DCCSI_DEV_MODE%"=="" (set DCCSI_DEV_MODE=false) +echo DCCSI_DEV_MODE = %DCCSI_DEV_MODE% +:: sets debugger, options: WING, PYCHARM +IF "%DCCSI_GDEBUGGER%"=="" (set DCCSI_GDEBUGGER=WING) +echo DCCSI_GDEBUGGER = %DCCSI_GDEBUGGER% +:: Default level logger will handle +:: Override this to control the setting +:: CRITICAL:50 +:: ERROR:40 +:: WARNING:30 +:: INFO:20 +:: DEBUG:10 +:: NOTSET:0 +IF "%DCCSI_LOGLEVEL%"=="" (set DCCSI_LOGLEVEL=20) +echo DCCSI_LOGLEVEL = %DCCSI_LOGLEVEL% + +:: Override the default maya version +IF "%DCCSI_MAYA_VERSION%"=="" (set DCCSI_MAYA_VERSION=2020) +echo DCCSI_MAYA_VERSION = %DCCSI_MAYA_VERSION% + +:: LY_PROJECT is ideally treated as a full path in the env launchers +:: do to changes in o3de, external engine/project/gem folder structures, etc. +IF "%LY_PROJECT%"=="" ( + for %%i in ("%~dp0..") do set "LY_PROJECT=%%~fi" + ) +echo LY_PROJECT = %LY_PROJECT% + +:: this is here for archaic reasons, WILL DEPRECATE +IF "%LY_PROJECT_PATH%"=="" (set LY_PROJECT_PATH=%LY_PROJECT%) +echo LY_PROJECT_PATH = %LY_PROJECT_PATH% + +:: Change to root Lumberyard dev dir +:: You must set this in a User_Env.bat to match youe engine repo location! +IF "%LY_DEV%"=="" (set LY_DEV=C:\Depot\o3de-engine) +echo LY_DEV = %LY_DEV% + +CALL %LY_DEV%\Gems\AtomLyIntegration\TechnicalArt\DccScriptingInterface\Launchers\Windows\Env_Maya.bat + +:: Restore original directory +popd + +:: Change to root dir +CD /D %ABS_PATH% + +::ENDLOCAL + +:: Set flag so we don't initialize dccsi environment twice +SET O3DE_PROJ_ENV_INIT=1 +GOTO END_OF_FILE + +:: Return to starting directory +POPD + +:END_OF_FILE diff --git a/Gems/AtomContent/Sponza/Tools/User_Env.bat.template b/Gems/AtomContent/Sponza/Tools/User_Env.bat.template new file mode 100644 index 0000000000..d108f30a5b --- /dev/null +++ b/Gems/AtomContent/Sponza/Tools/User_Env.bat.template @@ -0,0 +1,42 @@ +@echo off + +REM +REM Copyright (c) Contributors to the Open 3D Engine Project +REM +REM SPDX-License-Identifier: Apache-2.0 OR MIT +REM For complete copyright and license terms please see the LICENSE at the root of this distribution. +REM +REM + +:: copy this file, rename to User_Env.bat (remove .template) +:: use this file to override any local properties that differ from base + +:: Skip initialization if already completed +IF "%O3DE_USER_ENV_INIT%"=="1" GOTO :END_OF_FILE + +:: Store current dir +%~d0 +cd %~dp0 +PUSHD %~dp0 + +SET O3DE_DEV=C:\Depot\o3de-engine +::SET OCIO_APPS=C:\Depot\o3de-engine\Tools\ColorGrading\ocio\build\src\apps +SET TAG_LY_BUILD_PATH=build +SET DCCSI_GDEBUG=True +SET DCCSI_DEV_MODE=True + +set DCCSI_MAYA_VERSION=2020 + +:: 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 O3DE_USER_ENV_INIT=1 +GOTO END_OF_FILE + +:: Return to starting directory +POPD + +:END_OF_FILE \ No newline at end of file diff --git a/Gems/AtomContent/Sponza/User_env.bat.template b/Gems/AtomContent/Sponza/User_env.bat.template deleted file mode 100644 index 99bc7a951d..0000000000 --- a/Gems/AtomContent/Sponza/User_env.bat.template +++ /dev/null @@ -1 +0,0 @@ -set LY_DEV=C:\Depot\o3de-engine \ No newline at end of file diff --git a/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/Launchers/Windows/Env_Maya.bat b/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/Launchers/Windows/Env_Maya.bat index f3d9aaec69..cceaa80b75 100644 --- a/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/Launchers/Windows/Env_Maya.bat +++ b/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/Launchers/Windows/Env_Maya.bat @@ -27,7 +27,7 @@ IF "%DCCSI_PY_VERSION_MINOR%"=="" (set DCCSI_PY_VERSION_MINOR=7) IF "%DCCSI_PY_VERSION_RELEASE%"=="" (set DCCSI_PY_VERSION_RELEASE=11) :: Default Maya Version -IF "%DCCSI_MAYA_VERSION%"=="" (set DCCSI_MAYA_VERSION=2020) +IF "%DCCSI_MAYA_VERSION%"=="" (set DCCSI_MAYA_VERSION=%MAYA_VERSION%) :: Initialize env CALL %~dp0\Env_Core.bat diff --git a/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/config_utils.py b/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/config_utils.py index 4baf68d85e..2df85cbfaa 100755 --- a/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/config_utils.py +++ b/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/config_utils.py @@ -7,15 +7,16 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT # # -# -- This line is 75 characters ------------------------------------------- +# note: this module should reamin py2.7 compatible (Maya) so no f'strings +# -------------------------------------------------------------------------- import sys import os import re import site import logging as _logging +# ------------------------------------------------------------------------- + -from pathlib import Path # note: we provide this in py2.7 -# so using it here suggests some boostrapping has occured before using azpy # -------------------------------------------------------------------------- _PACKAGENAME = 'azpy.config_utils' @@ -28,8 +29,31 @@ _LOGGER.debug('Initializing: {0}.'.format({_PACKAGENAME})) __all__ = ['get_os', 'return_stub', 'get_stub_check_path', 'get_dccsi_config', 'get_current_project'] +# ------------------------------------------------------------------------- -# note: this module should reamin py2.7 compatible (Maya) so no f'strings + +# ------------------------------------------------------------------------- +# just a quick check to ensure what paths have code access +_G_DEBUG = False # enable for debug prints +if _G_DEBUG: + known_paths = list() + for p in sys.path: + known_paths.append(p) + _LOGGER.debug(known_paths) + +# this import can fail in Maya 2020 (and earlier) stuck on py2.7 +# wrapped in a try, to trap and providing messaging to help user correct +try: + from pathlib import Path # note: we provide this in py2.7 + # so using it here suggests some boostrapping has occured before using azpy +except Exception as e: + _LOGGER.warning('Maya 2020 and below, use py2.7') + _LOGGER.warning('py2.7 does not include pathlib') + _LOGGER.warning('Try installing the O3DE DCCsi py2.7 requirements.txt') + _LOGGER.warning("See instructions: 'C:\\< your o3de engine >\\Gems\\AtomLyIntegration\\TechnicalArt\\DccScriptingInterface\\SDK\Maya\\readme.txt'") + _LOGGER.warning("Other code in this module with fail!!!") + _LOGGER.error(e) + pass # fail gracefully, note: code accesing Path will fail! # -------------------------------------------------------------------------