Refactor DCCsi to work better with O3DE changes (#4226)

* moving files in refactor/re-org

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* dev env refactor/re-org

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* moving/re-org so we can deprate the SDK nomiclature

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* moving/re-org so we can deprate the SDK nomiclature

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Refactoring env so I can replace SDK with Tools folder

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* re-org and prune, from SKD to Tools

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Removing old .bat files from SDK

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* updated how to retreive PYTHONHOME

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Can't use/set PYTHONHOME with DCC Tools

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* small refactor

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* repaired a missed typo (causes error)

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Added missing EntityId.h include to FocusModeInterface.h

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* refactor additional LY to O3DE tags

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Some design scaffold file stubs

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* stubbing in scaffold file pattern

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Removal of corrupted prefabs

Signed-off-by: Benjamin Black <benblac@amazon.com>

* refactored config_utils to maintain py2.7 support for maya 2020

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* refactored config_utils to maintain py2.7 support for maya 2020

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* pruning and cleanup

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* .env is for local dev overrides

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* .env is for local dev overrides

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* clean up init and logging patterns

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Core refactoring, config.py functional standalone

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* cleaned up some bad logging, fixed up boostrap

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* fixed validation errors

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* fix logging issue, tiddy up

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* tiddy up maya for .bat bootstraping and launch

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* name stub, fix validation

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
Co-authored-by: Benjamin Black <benblac@amazon.com>
This commit is contained in:
Jonny Galloway
2021-10-21 19:03:49 -05:00
committed by GitHub
parent 50068bcae7
commit b779f358d0
197 changed files with 3779 additions and 3636 deletions
@@ -1,85 +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
:: Set up and run LY Python CMD prompt
:: Sets up the DccScriptingInterface_Env,
:: Puts you in the CMD within the dev environment
:: Set up window
TITLE Lumberyard DCC Scripting Interface Cmd
:: Use obvious color to prevent confusion (Grey with Yellow Text)
COLOR 8E
%~d0
cd %~dp0
:: Keep changes local
SETLOCAL enableDelayedExpansion
:: This maps up to the \Dev folder
IF "%DEV_REL_PATH%"=="" (set DEV_REL_PATH=..\..\..\..\..\..\..\..\..)
:: Change to root Lumberyard dev dir
:: Don't use the LY_DEV so we can test that ENVAR!!!
CD /d %DEV_REL_PATH%
set Rel_Dev=%CD%
echo Rel_Dev = %Rel_Dev%
:: Restore original directory
popd
set DCCSI_PYTHON_INSTALL=%Rel_Dev%\Tools\Python\3.7.5\windows
:: add to the PATH
SET PATH=%DCCSI_PYTHON_INSTALL%;%PATH%
:: dcc scripting interface gem path
set DCCSIG_PATH=%Rel_Dev%\Gems\AtomLyIntegration\TechnicalArt\DccScriptingInterface
echo DCCSIG_PATH = %DCCSIG_PATH%
:: add to the PATH
SET PATH=%DCCSIG_PATH%;%PATH%
:: Constant Vars (Global)
:: global debug (propogates)
IF "%DCCSI_GDEBUG%"=="" (set DCCSI_GDEBUG=false)
echo DCCSI_GDEBUG = %DCCSI_GDEBUG%
:: initiates debugger connection
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%
echo.
echo _____________________________________________________________________
echo.
echo ~ LY DCCsi, DCC Material Converter
echo _____________________________________________________________________
echo.
:: Change to root dir
CD /D %DCCSIG_PATH%
:: add to the PATH
SET PATH=%DCCSIG_PATH%;%PATH%
set PYTHONPATH=%DCCSIG_PATH%;%PYTHONPATH%
CALL %DCCSI_PYTHON_INSTALL%\python.exe "%DCCSIG_PATH%\SDK\Maya\Scripts\Python\kitbash_converter\standalone.py"
ENDLOCAL
:: Return to starting directory
POPD
:END_OF_FILE
exit /b 0
@@ -51,8 +51,8 @@ module_name = 'kitbash_converter.main'
log_file_path = os.path.join(settings.DCCSI_LOG_PATH, f'{module_name}.log')
_log_level = int(20)
_G_DEBUG = True
if _G_DEBUG:
_DCCSI_GDEBUG = True
if _DCCSI_GDEBUG:
_log_level = int(10)
from azpy.constants import FRMT_LOG_LONG
@@ -1,45 +0,0 @@
:: coding:utf-8
:: !/usr/bin/python
::
:: Copyright (c) Contributors to the Open 3D Engine Project.
:: For complete copyright and license terms please see the LICENSE at the root of this distribution.
::
:: SPDX-License-Identifier: Apache-2.0 OR MIT
::
::
@echo off
:: Set up and run LY Python CMD prompt
:: Sets up the DccScriptingInterface_Env,
:: Puts you in the CMD within the dev environment
:: Set up window
TITLE Lumberyard DCC Scripting Interface Cmd
:: Use obvious color to prevent confusion (Grey with Yellow Text)
COLOR 8E
%~d0
cd %~dp0
PUSHD %~dp0
:: Keep changes local
SETLOCAL enableDelayedExpansion
CALL %~dp0\Project_Env.bat
echo.
echo _____________________________________________________________________
echo.
echo ~ LY DCC Scripting Interface CMD ...
echo _____________________________________________________________________
echo.
:: Create command prompt with environment
CALL %windir%\system32\cmd.exe
ENDLOCAL
:: Return to starting directory
POPD
:END_OF_FILE
@@ -1,68 +0,0 @@
:: coding:utf-8
:: !/usr/bin/python
::
:: Copyright (c) Contributors to the Open 3D Engine Project.
:: For complete copyright and license terms please see the LICENSE at the root of this distribution.
::
:: SPDX-License-Identifier: Apache-2.0 OR MIT
::
::
@echo off
:: Launches maya with a bunch of local hooks for Lumberyard
:: ToDo: move all of this to a .json data driven boostrapping system
%~d0
cd %~dp0
PUSHD %~dp0
echo ________________________________
echo ~ calling PROJ_Env.bat
:: Keep changes local
SETLOCAL enableDelayedExpansion
:: 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
echo DCCSI_PY_VERSION_MINOR = %DCCSI_PY_VERSION_MINOR%
:: Maya Version
set MAYA_VERSION=2020
echo MAYA_VERSION = %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...
:::: Set Maya native project acess to this project
::set MAYA_PROJECT=%LY_PROJECT%
::echo MAYA_PROJECT = %MAYA_PROJECT%
:: DX11 Viewport
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" %*
) ELSE (
Where maya.exe 2> NUL
IF ERRORLEVEL 1 (
echo Maya.exe could not be found
pause
) ELSE (
start "" Maya.exe %*
)
)
:: Return to starting directory
POPD
:END_OF_FILE
exit /b 0
@@ -1,81 +0,0 @@
:: coding:utf-8
:: !/usr/bin/python
::
:: Copyright (c) Contributors to the Open 3D Engine Project.
:: For complete copyright and license terms please see the LICENSE at the root of this distribution.
::
:: SPDX-License-Identifier: Apache-2.0 OR MIT
::
::
@echo off
:: Launches Wing IDE and the DccScriptingInterface Project Files
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
@@ -1,72 +0,0 @@
:: coding:utf-8
:: !/usr/bin/python
::
:: Copyright (c) Contributors to the Open 3D Engine Project.
:: For complete copyright and license terms please see the LICENSE at the root of this distribution.
::
:: SPDX-License-Identifier: Apache-2.0 OR MIT
::
::
@echo off
:: Sets up environment for Lumberyard DCC tools and code access
:: 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
@@ -80,8 +80,8 @@ module_name = 'legacy_asset_converter.main'
log_file_path = os.path.join(settings.DCCSI_LOG_PATH, f'{module_name}.log')
_log_level = int(20)
_G_DEBUG = True
if _G_DEBUG:
_DCCSI_GDEBUG = True
if _DCCSI_GDEBUG:
_log_level = int(10)
from azpy.constants import FRMT_LOG_LONG
@@ -1,135 +0,0 @@
# -*- coding: utf-8 -*-
# !/usr/bin/python
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# -------------------------------------------------------------------------
import pymel.core as pmc
import sys
import types
def syspath():
print 'sys.path:'
for p in sys.path:
print ' ' + p
def info(obj):
"""Prints information about the object."""
lines = ['Info for %s' % obj.name(),
'Attributes:']
# Get the name of all attributes
for a in obj.listAttr():
lines.append(' ' + a.name())
lines.append('MEL type: %s' % obj.type())
lines.append('MRO:')
lines.extend([' ' + t.__name__ for t in type(obj).__mro__])
result = '\n'.join(lines)
print result
def _is_pymel(obj):
try: # (1)
module = obj.__module__ # (2)
except AttributeError: # (3)
try:
module = obj.__name__ # (4)
except AttributeError:
return None # (5)
return module.startswith('pymel') # (6)
def _py_to_helpstr(obj):
if isinstance(obj, basestring):
return 'search.html?q=%s' % (obj.replace(' ', '+'))
if not _is_pymel(obj):
return None
if isinstance(obj, types.ModuleType):
return ('generated/%(module)s.html#module-%(module)s' %
dict(module=obj.__name__))
if isinstance(obj, types.MethodType):
return ('generated/classes/%(module)s/'
'%(module)s.%(typename)s.html'
'#%(module)s.%(typename)s.%(methname)s' % dict(
module=obj.__module__,
typename=obj.im_class.__name__,
methname=obj.__name__))
if isinstance(obj, types.FunctionType):
return ('generated/functions/%(module)s/'
'%(module)s.%(funcname)s.html'
'#%(module)s.%(funcname)s' % dict(
module=obj.__module__,
funcname=obj.__name__))
if not isinstance(obj, type):
obj = type(obj)
return ('generated/classes/%(module)s/'
'%(module)s.%(typename)s.html'
'#%(module)s.%(typename)s' % dict(
module=obj.__module__,
typename=obj.__name__))
def test_py_to_helpstr():
def dotest(obj, ideal):
result = _py_to_helpstr(obj)
assert result == ideal, '%s != %s' % (result, ideal)
dotest('maya rocks', 'search.html?q=maya+rocks')
dotest(pmc.nodetypes,
'generated/pymel.core.nodetypes.html'
'#module-pymel.core.nodetypes')
dotest(pmc.nodetypes.Joint,
'generated/classes/pymel.core.nodetypes/'
'pymel.core.nodetypes.Joint.html'
'#pymel.core.nodetypes.Joint')
dotest(pmc.nodetypes.Joint(),
'generated/classes/pymel.core.nodetypes/'
'pymel.core.nodetypes.Joint.html'
'#pymel.core.nodetypes.Joint')
dotest(pmc.nodetypes.Joint().getTranslation,
'generated/classes/pymel.core.nodetypes/'
'pymel.core.nodetypes.Joint.html'
'#pymel.core.nodetypes.Joint.getTranslation')
dotest(pmc.joint,
'generated/functions/pymel.core.animation/'
'pymel.core.animation.joint.html'
'#pymel.core.animation.joint')
dotest(object(), None)
dotest(10, None)
dotest([], None)
dotest(sys, None)
def test_py_to_helpstrFAIL():
assert 1 == 2, '1 != 2'
import webbrowser # (1)
HELP_ROOT_URL = ('http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/PyMel/')# (2)
def pmhelp(obj): # (3)
"""Gives help for a pymel or python object.
If obj is not a PyMEL object, use Python's built-in
`help` function.
If obj is a string, open a web browser to a search in the
PyMEL help for the string.
Otherwise, open a web browser to the page for the object.
"""
tail = _py_to_helpstr(obj)
if tail is None:
help(obj) # (4)
else:
webbrowser.open(HELP_ROOT_URL + tail) # (5)
if __name__ == '__main__':
test_py_to_helpstr()
print 'Tests ran successfully.'
@@ -23,7 +23,7 @@ def returnStubDir(stub):
break
if (len(tail) == 0):
path = ""
if _G_DEBUG:
if _DCCSI_GDEBUG:
print('~ Debug Message: I was not able to find the '
'path to that file (stub) in a walk-up from currnet path')
break
@@ -24,7 +24,7 @@ def returnStubDir(stub, start_path):
break
if (len(tail) == 0):
path = ""
if _G_DEBUG:
if _DCCSI_GDEBUG:
print('~ Debug Message: I was not able to find the '
'path to that file (stub) in a walk-up from currnet path')
break