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:
+9
@@ -0,0 +1,9 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
This folder resprents a Mock Tool - currently just a scaffold (not implemented)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
This folder is for tool resources - this file is a resource stub.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
print('Not Implemented')
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
print('Not Implemented')
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"default": {
|
||||
"DCCSI_GDEBUG": true,
|
||||
"SPDX-LICENSE-IDENTIFIER": "Apache-2.0 OR MIT",
|
||||
"COPYWRITE":"Copyright (c) Contributors to the Open 3D Engine Project.",
|
||||
"COPYWRITE_MSG":"For complete copyright and license terms please see the LICENSE at the root of this distribution."
|
||||
},
|
||||
"development": {
|
||||
"DCCSI_GDEBUG": true,
|
||||
"TEST_RULE": "/dccsi_with_json",
|
||||
"MESSAGE": "The O3DE DCCsi manages dynamic configuration and settings with dynaconf",
|
||||
"DYNACONF_HELP": "https://dynaconf.readthedocs.io/"
|
||||
},
|
||||
"production": {
|
||||
"DCCSI_GDEBUG": false
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9c34bbeafae5c5b62d3571ac9eee295fff12ac0744f81375f53a3faf2c5095e4
|
||||
size 286400
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# -- This line is 75 characters -------------------------------------------
|
||||
|
||||
import OpenImageIO as oiio
|
||||
|
||||
def convert(src):
|
||||
try:
|
||||
rgba = oiio.ImageBuf(src)
|
||||
spec = get_image_spec(rgba)
|
||||
|
||||
# Normal output ------>
|
||||
rgb = oiio.ImageBufAlgo.channels(rgba, (0, 1, 2))
|
||||
normal_output = src.replace('ddna', 'Normal')
|
||||
|
||||
# Roughness output ------>
|
||||
alpha = oiio.ImageBufAlgo.channels(rgba, (3,))
|
||||
roughness = oiio.ImageBufAlgo.invert(alpha)
|
||||
roughness_output = normal_output.replace('Normal', 'Roughness')
|
||||
|
||||
write_image(rgba, normal_output, spec['format'])
|
||||
write_image(roughness, roughness_output, spec['format'])
|
||||
# logging.info('Output Normal Map: {}'.format(normal_output))
|
||||
# logging.info('Output Roughness Map: {}'.format(roughness_output))
|
||||
|
||||
except Exception as e:
|
||||
logging.info('OIIO error in image conversion: {}'.format(e))
|
||||
return None
|
||||
|
||||
def get_image_spec(target_image):
|
||||
spec = target_image.spec()
|
||||
info = {'resolution': (spec.width, spec.height, spec.x, spec.y), 'channels': spec.channelnames,
|
||||
'format': str(spec.format)}
|
||||
if spec.channelformats :
|
||||
info['channelformats'] = str(spec.channelformats)
|
||||
info['alpha channel'] = str(spec.alpha_channel)
|
||||
info['z channel'] = str(spec.z_channel)
|
||||
info['deep'] = str(spec.deep)
|
||||
for i in range(len(spec.extra_attribs)):
|
||||
if type(spec.extra_attribs[i].value) == str:
|
||||
info[spec.extra_attribs[i].name] = spec.extra_attribs[i].value
|
||||
else:
|
||||
info[spec.extra_attribs[i].name] = spec.extra_attribs[i].value
|
||||
return info
|
||||
|
||||
def write_image(image, filename, image_format):
|
||||
if not image.has_error:
|
||||
image.set_write_format(image_format)
|
||||
image.write(filename)
|
||||
if image.has_error:
|
||||
print("Error writing", filename, ":", image.geterror())
|
||||
|
||||
###########################################################################
|
||||
# Main Code Block, runs this script as main (testing)
|
||||
# -------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
# run a test
|
||||
convert('AA_Gun_01_ddna.tif')
|
||||
# validate()
|
||||
Reference in New Issue
Block a user