Merge remote-tracking branch 'origin/development' into sc-editor-asset-redux

Signed-off-by: carlitosan <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
carlitosan
2021-12-02 14:17:35 -08:00
3323 changed files with 90625 additions and 60443 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
---
name: ar_bug_report.md
name: Automated Review bug report
about: Create a bug for a an issue found in the Automated Review
title: 'AR Bug Report'
labels: 'needs-triage,kind/bug,kind/automation'
+1 -1
View File
@@ -3,7 +3,7 @@
.vscode/
__pycache__
AssetProcessorTemp/**
[Bb]uild/**
[Bb]uild/
[Oo]ut/**
CMakeUserPresets.json
[Cc]ache/
@@ -1,78 +0,0 @@
#
# 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 script loads every level in a game project and exports them. You will be prompted with the standard
Check-Out/Overwrite/Cancel dialog for each level.
This is useful when there is a version update to a file that requires re-exporting.
"""
import sys, os
import azlmbr.legacy.general as general
import azlmbr.legacy.checkout_dialog as checkout_dialog
class CheckOutDialogEnableAll:
"""
Helper class to wrap enabling the "Apply to all" checkbox in the CheckOutDialog.
Guarantees that the old setting will be restored.
To use, do:
with CheckOutDialogEnableAll():
# your code here
"""
def __init__(self):
self.old_setting = False
def __enter__(self):
self.old_setting = checkout_dialog.enable_for_all(True)
print(self.old_setting)
def __exit__(self, type, value, traceback):
checkout_dialog.enable_for_all(self.old_setting)
level_list = []
def is_in_special_folder(file_full_path):
if file_full_path.find("_savebackup") >= 0:
return True
if file_full_path.find("_autobackup") >= 0:
return True
if file_full_path.find("_hold") >= 0:
return True
if file_full_path.find("_tmpresize") >= 0:
return True
return False
game_folder = general.get_game_folder()
# Recursively search every directory in the game project for files ending with .cry and .ly
for root, dirs, files in os.walk(game_folder):
for file in files:
if file.endswith(".cry") or file.endswith(".ly"):
# The engine expects the full path of the .cry file
file_full_path = os.path.abspath(os.path.join(root, file))
# Exclude files in special directories
if not is_in_special_folder(file_full_path):
level_list.append(file_full_path)
# make the checkout dialog enable the 'Apply to all' checkbox
with CheckOutDialogEnableAll():
# For each valid .cry file found, open it in the editor and export it
for level in level_list:
if not isinstance(level, str):
# general.open_level_no_prompt expects the file path in utf8 format
level = level.encode("utf-8")
general.open_level_no_prompt(level)
general.export_to_engine()
-40
View File
@@ -1,40 +0,0 @@
#
# 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
#
#
'''
Generates a 50% lod for the selected model
@argument name="Lod Percentage", type="string", default="50.0f"
'''
import sys
import time
percentage = float(sys.argv[1])
selectedcgf = lodtools.getselected()
selectedmaterial = lodtools.getselectedmaterial()
loadedmodel = lodtools.loadcgf(selectedcgf)
loadedmaterial = lodtools.loadmaterial(selectedmaterial)
if loadedmodel == True and loadedmaterial == True:
lodtools.generatelodchain()
finished = 0.0
while finished >= 0.0:
finished = lodtools.generatetick()
print 'Lod Chain Generation progress: ' + str(finished)
time.sleep(1)
if finished == 1.0:
break
lodtools.createlod(1,percentage)
lodtools.generatematerials(1,512,512)
lodtools.savetextures(1)
lodtools.savesettings()
lodtools.reloadmodel()
-116
View File
@@ -1,116 +0,0 @@
#
# 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 script shows basic usage of LuaSymbolsReporterBus,
# Which can be used to report all symbols available for
# game scripting with Lua.
import sys
import os
import azlmbr.bus as azbus
import azlmbr.script as azscript
import azlmbr.legacy.general as azgeneral
def _dump_class_symbol(class_symbol: azlmbr.script.LuaClassSymbol):
print(f"** {class_symbol}")
print("Properties:")
for property_symbol in class_symbol.properties:
print(f" - {property_symbol}")
print("Methods:")
for method_symbol in class_symbol.methods:
print(f" - {method_symbol}")
def _dump_lua_classes():
class_symbols = azscript.LuaSymbolsReporterBus(azbus.Broadcast,
"GetListOfClasses")
print("======== Classes ==========")
sorted_classes_by_named = sorted(class_symbols, key=lambda class_symbol: class_symbol.name)
for class_symbol in sorted_classes_by_named:
_dump_class_symbol(class_symbol)
print("\n\n")
def _dump_lua_globals():
global_properties = azscript.LuaSymbolsReporterBus(azbus.Broadcast,
"GetListOfGlobalProperties")
print("======== Global Properties ==========")
sorted_properties_by_name = sorted(global_properties, key=lambda symbol: symbol.name)
for property_symbol in sorted_properties_by_name:
print(f"- {property_symbol}")
print("\n\n")
global_functions = azscript.LuaSymbolsReporterBus(azbus.Broadcast,
"GetListOfGlobalFunctions")
print("======== Global Functions ==========")
sorted_functions_by_name = sorted(global_functions, key=lambda symbol: symbol.name)
for function_symbol in sorted_functions_by_name:
print(f"- {function_symbol}")
print("\n\n")
def _dump_lua_ebus(ebus_symbol: azlmbr.script.LuaEBusSymbol):
print(f">> {ebus_symbol}")
sorted_senders = sorted(ebus_symbol.senders, key=lambda symbol: symbol.name)
for sender in sorted_senders:
print(f" - {sender}")
print("\n")
def _dump_lua_ebuses():
ebuses = azscript.LuaSymbolsReporterBus(azbus.Broadcast,
"GetListOfEBuses")
print("======== Ebus List ==========")
sorted_ebuses_by_name = sorted(ebuses, key=lambda symbol: symbol.name)
for ebus_symbol in sorted_ebuses_by_name:
_dump_lua_ebus(ebus_symbol)
print("\n\n")
class WhatToDo:
DumpClasses = "c"
DumpGlobals = "g"
DumpEBuses = "e"
if __name__ == "__main__":
redirecting_stdout = False
orig_stdout = sys.stdout
if len(sys.argv) > 1:
output_file_name = sys.argv[1]
if not os.path.isabs(output_file_name):
game_root_path = os.path.normpath(azgeneral.get_game_folder())
output_file_name = os.path.join(game_root_path, output_file_name)
try:
file_obj = open(output_file_name, 'wt')
sys.stdout = file_obj
redirecting_stdout = True
except Exception as e:
print(f"Failed to open {output_file_name}: {e}")
sys.exit(-1)
what_to_do = [action.lower() for action in sys.argv[2:]]
# If the user did not specify what to do, then let's dump
# all the symbols.
if len(what_to_do) < 1:
what_to_do = [WhatToDo.DumpClasses, WhatToDo.DumpGlobals, WhatToDo.DumpEBuses]
for action in what_to_do:
if action == WhatToDo.DumpClasses:
_dump_lua_classes()
elif action == WhatToDo.DumpGlobals:
_dump_lua_globals()
elif action == WhatToDo.DumpEBuses:
_dump_lua_ebuses()
if redirecting_stdout:
sys.stdout.close()
sys.stdout = orig_stdout
print(f" Lua Symbols Are available in: {output_file_name}")
-14
View File
@@ -1,14 +0,0 @@
#
# 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
#
#
objects = general.get_all_objects("", "") # Get the name list of all objects in the level.
# If there is any object with the geometry file of "objects\\default\\primitive_box.cgf",
# change it to "objects\\default\\primitive_cube.cgf".
for obj in objects:
geometry_file = general.get_entity_geometry_file(obj)
if geometry_file == "objects\\default\\primitive_box.cgf":
general.set_entity_geometry_file(obj, "objects\\default\\primitive_cube.cgf")
@@ -1,14 +0,0 @@
#
# 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
#
#
objects = general.get_all_objects("AnimObject", "") # Get the name list of all anim objects in the level.
general.clear_selection()
# If there is any object with the geometry file whose name contains "\\story\\", select it
for obj in objects:
geometry_file = general.get_entity_geometry_file(obj)
if geometry_file.find("\\story\\") != -1:
general.select_object(obj)
@@ -1,508 +0,0 @@
#
# 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 __future__
import time, re, os, sys, itertools, ast
import azlmbr.legacy.general as general
global ctrlFile
ctrlFile = 'setState.txt'
global logfile
logfile = 'Editor.log'
global HIDDEN_MASK_PREFIX
HIDDEN_MASK_PREFIX= 'hidden_mask_for_'
global HIDDEN_MASK_PREFIX_LENGTH
HIDDEN_MASK_PREFIX_LENGTH = len(HIDDEN_MASK_PREFIX)
def getLogList(logfile):
logList = [x for x in open(logfile, 'r')]
return logList
def getCheckList(ctrlFile):
try:
with open(ctrlFile):
stateList = open(ctrlFile, 'r')
except:
open(ctrlFile, 'w').close()
stateList = open(ctrlFile, 'r')
checkList = [x for x in stateList]
return checkList
#Store/Restore CVars default values -----------------------------------------------------------------#
if 'CVARS' not in globals():
CVARS = {}
def saveDefaultValue(cVars, value):
if cVars not in CVARS:
CVARS[cVars] = value
def restoreDefaultValue(cVars):
if cVars not in CVARS:
return
defaultValue = CVARS[cVars]
del CVARS[cVars]
if cVars.startswith(HIDDEN_MASK_PREFIX):
type = cVars[HIDDEN_MASK_PREFIX_LENGTH:]
general.set_hidemask(type, defaultValue)
else:
general.set_cvar(cVars, defaultValue)
#toggle CVars--------------------------------------------------------------------#
def updateCvars(cVars, value):
saveDefaultValue(cVars, value)
general.set_cvar(cVars, value)
def toggleCvarsRestartCheck(log, state, mode, cVars, onValue, offValue, ctrlFile):
if log in state:
toggleCvarsV(mode, cVars, onValue, offValue, ctrlFile)
else:
stateList = open(ctrlFile, 'w')
stateList.write(log)
stateList = open(ctrlFile, 'r')
toggleCvarsV(mode, cVars, onValue, offValue, ctrlFile)
def toggleCvarsV(mode, cVars, onValue, offValue, ctrlFile):
stateList = open(ctrlFile, 'r')
setState = [x for x in enumerate(stateList)]
blankCheck = [x for x in setState]
getList = [x for x in stateList]
if blankCheck == []:
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str("%s,{'%s': %s}" % (mode, cVars, offValue))+'\n'))
general.set_cvar(cVars, offValue)
else:
stateList = open(ctrlFile, 'r')
checkFor = str([x for x in stateList])
if mode not in str(checkFor):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
getList.insert(1, str("%s,{'%s': %s}\n" % (mode, cVars , offValue)))
print (str("{'%s': %s}\n" % (cVars , offValue)))
stateList = open(ctrlFile, 'w')
stateList.write(''.join(getList))
general.set_cvar(cVars, offValue)
else:
stateList = open(ctrlFile, 'r')
for d in enumerate(stateList):
values = d[1].split(',')
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
if mode in values[0]:
getDict = ast.literal_eval(values[1])
getState = getDict.get(cVars)
if getState == offValue:
getDict[cVars] = onValue
joinStr = [mode,",",str(getDict), '\n']
newLine = ''.join(joinStr)
print (getDict)
getList[d[0]] = newLine
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.set_cvar(cVars, onValue)
else:
getDict[cVars] = offValue
joinStr = [mode,",",str(getDict), '\n']
newLine = ''.join(joinStr)
print (getDict)
getList[d[0]] = newLine
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.set_cvar(cVars, offValue)
def toggleCvarsValue(mode, cVars, onValue, offValue):
currentValue = general.get_cvar(cVars)
if type(onValue) is str:
saveDefaultValue(cVars, currentValue)
elif type(onValue) is int:
saveDefaultValue(cVars, int(currentValue))
elif type(onValue) is float:
saveDefaultValue(cVars, float(currentValue))
else:
general.log('Failed to store default value for {0}'.format(cVars))
if currentValue == str(onValue):
general.set_cvar(cVars, offValue)
else:
general.set_cvar(cVars, onValue)
#toggleConsol--------------------------------------------------------------------#
def toggleConsolRestartCheck(log,state, mode, onValue, offValue, ctrlFile):
if log in state:
toggleConsolV(mode, onValue, offValue, ctrlFile)
else:
stateList = open(ctrlFile, 'w')
stateList.write(log)
stateList = open(ctrlFile, 'r')
toggleConsolV(mode, onValue, offValue, ctrlFile)
def toggleConsolV(mode, onValue, offValue):
stateList = open(ctrlFile, 'r')
setState = [x for x in enumerate(stateList)]
blankCheck = [x for x in setState]
getList = [x for x in stateList]
onOffList = [onValue, offValue]
if blankCheck == []:
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str("%s,'%s'" % (mode, offValue))+'\n'))
general.run_console(offValue)
else:
stateList = open(ctrlFile, 'r')
checkFor = str([x for x in stateList])
if mode not in str(checkFor):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
getList.insert(1, str("%s,'%s'\n" % (mode, offValue)))
print (str("{'%s': %s}\n" % (cVars , offValue)))
stateList = open(ctrlFile, 'w')
stateList.write(''.join(getList))
general.run_console(onValue)
else:
stateList = open(ctrlFile, 'r')
for d in enumerate(stateList):
values = d[1].split(',')
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
if mode in values[0]:
getDict = values[1]
off = ["'",str(offValue),"'", '\n']
joinoff = ''.join(off)
if values[1] == joinoff:
getDict = onValue
joinStr = [mode,",","'",getDict,"'", '\n']
newLine = ''.join(joinStr)
print (getDict)
getList[d[0]] = str(newLine)
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.run_console(onValue)
else:
getDict = offValue
joinStr = [mode,",","'",getDict,"'", '\n']
newLine = ''.join(joinStr)
print (getDict)
getList[d[0]] = str(newLine)
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.run_console(offValue)
def toggleConsolValue(log, state, mode, onValue, offValue):
logList = getLogList(logfile)
checkList = getCheckList(ctrlFile)
toggleConsolRestartCheck(logList[1],checkList, mode, onValue, offValue, ctrlFile)
#cycleCvars----------------------------------------------------------------------#
def cycleCvarsRestartCheck(log, state, mode, cVars, cycleList, ctrlFile):
if log in state:
cycleCvarsV(mode, cVars, cycleList, ctrlFile)
else:
stateList = open(ctrlFile, 'w')
stateList.write(log)
stateList = open(ctrlFile, 'r')
cycleCvarsV(mode, cVars, cycleList, ctrlFile)
def cycleCvarsV(mode, cVars, cycleList, ctrlFile):
stateList = open(ctrlFile, 'r')
setState = [x for x in enumerate(stateList)]
blankCheck = [x for x in setState]
getList = [x for x in stateList]
if blankCheck == []:
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str("%s,{'%s': %s}" % (mode, cVars, cycleList[1]))+'\n'))
general.set_cvar(cVars, cycleList[1])
else:
stateList = open(ctrlFile, 'r')
checkFor = str([x for x in stateList])
if mode not in str(checkFor):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
getList.insert(1, str("%s,{'%s': %s}\n" % (mode, cVars , cycleList[1])))
stateList = open(ctrlFile, 'w')
stateList.write(''.join(getList))
general.set_cvar(cVars, cycleList[1])
else:
stateList = open(ctrlFile, 'r')
for d in enumerate(stateList):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
values = d[1].split(',')
if mode in values[0]:
getDict = ast.literal_eval(values[1])
getState = getDict.get(cVars)
cycleL = [x for x in enumerate(cycleList)]
for x in cycleL:
if getState == x[1]:
number = [n[1] for n in cycleL]
getMax = max(number)
nextNum = x[0]+1
if nextNum > getMax:
getDict[cVars] = cycleList[0]
joinStr = [mode,",",str(getDict), '\n']
newLine = ''.join(joinStr)
getList[d[0]] = newLine
print (getDict)
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.set_cvar(cVars, cycleList[0])
else:
getDict[cVars] = cycleList[x[0]+1]
joinStr = [mode,",",str(getDict), '\n']
newLine = ''.join(joinStr)
getList[d[0]] = newLine
print (getDict)
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.set_cvar(cVars, cycleList[x[0]+1])
def cycleCvarsValue(log, state, mode, cVars, cycleList):
logList = getLogList(logfile)
checkList = getCheckList(ctrlFile)
cycleCvarsRestartCheck(logList[1],checkList, mode, cVars, cycleList, ctrlFile)
def cycleCvarsFloatValue(cVars, cycleList):
currentValueAsString = general.get_cvar(cVars)
try:
currentValue = float(currentValueAsString)
except:
currentValue = -1.0
saveDefaultValue(cVars, currentValue)
# make sure we sort the list in ascending fashion
cycleList = sorted(cycleList)
# find out what the next closest index is
newIndex = 0
for x in cycleList:
if (currentValue < x):
break
newIndex = newIndex + 1
# loop around, if we need to
if newIndex >= len(cycleList):
newIndex = 0
general.set_cvar(cVars, cycleList[newIndex])
def cycleCvarsIntValue(cVars, cycleList):
currentValueAsString = general.get_cvar(cVars)
try:
currentValue = int(currentValueAsString)
except:
currentValue = 0
saveDefaultValue(cVars, currentValue)
# find out what index we're on already
# default to -1 so that when we increment to the next, we'll be at 0
newIndex = -1
for x in cycleList:
if (currentValue == x):
break
newIndex = newIndex + 1
# move to the next item
newIndex = newIndex + 1
# validate
if newIndex >= len(cycleList):
newIndex = 0
general.set_cvar(cVars, cycleList[newIndex])
#cycleConsol----------------------------------------------------------------------#
def cycleConsolRestartCheck(log, state, mode, cycleList, ctrlFile):
if log in state:
cycleConsolV(mode, cycleList, ctrlFile)
else:
stateList = open(ctrlFile, 'w')
stateList.write(log)
stateList = open(ctrlFile, 'r')
cycleConsolV(mode, cycleList, ctrlFile)
def cycleConsolV(mode, cycleList, ctrlFile):
stateList = open(ctrlFile, 'r')
setState = [x for x in enumerate(stateList)]
blankCheck = [x for x in setState]
getList = [x for x in stateList]
if blankCheck == []:
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str("%s,'%s'" % (mode, cycleList[0]))+'\n'))
general.run_console(cycleList[0])
else:
stateList = open(ctrlFile, 'r')
checkFor = str([x for x in stateList])
if mode not in str(checkFor):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
getList.insert(1, str("%s,'%s'\n" % (mode, cycleList[0])))
stateList = open(ctrlFile, 'w')
stateList.write(''.join(getList))
general.run_console(cycleList[0])
else:
stateList = open(ctrlFile, 'r')
for d in enumerate(stateList):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
values = d[1].split(',')
if mode in values[0]:
newValue = ''.join(values[1].split('\n'))
cycleL = [e for e in enumerate(cycleList)]
getDict = ''.join(values[1].split('\n'))
for x in cycleL:
if newValue in "'%s'" % x[1]:
number = [n[0] for n in cycleL]
getMax = max(number)
nextNum = x[0]+1
if nextNum > getMax:
getDict = '%s' % cycleList[0]
joinStr = [mode,",","'",getDict,"'", '\n']
newLine = ''.join(joinStr)
getList[d[0]] = newLine
print (getDict)
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.run_console(getDict)
else:
getDict = '%s' % cycleList[x[0]+1]
joinStr = [mode,",","'",getDict,"'", '\n']
newLine = ''.join(joinStr)
getList[d[0]] = newLine
print (getDict)
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
general.run_console(getDict)
def cycleConsolValue(mode, cycleList):
logList = getLogList(logfile)
checkList = getCheckList(ctrlFile)
cycleConsolRestartCheck(logList[1],checkList, mode, cycleList, ctrlFile)
def toggleHideMaskValues(type):
cVars = "%s%s" % (HIDDEN_MASK_PREFIX, type)
currentValue = general.get_hidemask(type)
saveDefaultValue(cVars, int(currentValue))
if (currentValue):
general.set_hidemask(type, 0)
else:
general.set_hidemask(type, 1)
#toggleHide------------------------------------------------------------------------#
def toggleHideRestartCheck(log, state, mode, type, onValue, offValue, ctrlFile):
if log in state:
toggleHideByT(mode, type, onValue, offValue, ctrlFile)
else:
stateList = open(ctrlFile, 'w')
stateList.write(log)
stateList = open(ctrlFile, 'r')
toggleHideByT(mode, type, onValue, offValue, ctrlFile)
def toggleHideByType(mode, type, onValue, offValue):
logList = getLogList(logfile)
checkList = getCheckList(ctrlFile)
toggleHideRestartCheck(logList[1],checkList, mode, type, onValue, offValue, ctrlFile)
def toggleHideByT(mode, type, onValue, offValue, ctrlFile):
stateList = open(ctrlFile, 'r')
setState = [x for x in enumerate(stateList)]
blankCheck = [x for x in setState]
getList = [x for x in stateList]
if blankCheck == []:
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str("%s,{'%s': %s}" % (mode, type, offValue))+'\n'))
hideByType(type)
else:
stateList = open(ctrlFile, 'r')
checkFor = str([x for x in stateList])
if mode not in str(checkFor):
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
getList.insert(1, str("%s,{'%s': %s}\n" % (mode, type , offValue)))
print (str("{'%s': %s}\n" % (type , offValue)))
stateList = open(ctrlFile, 'w')
stateList.write(''.join(getList))
hideByType(type)
else:
stateList = open(ctrlFile, 'r')
for d in enumerate(stateList):
values = d[1].split(',')
stateList = open(ctrlFile, 'r')
getList = [x for x in stateList]
if mode in values[0]:
getDict = ast.literal_eval(values[1])
getState = getDict.get(type)
if getState == offValue:
getDict[type] = onValue
joinStr = [mode,",",str(getDict), '\n']
newLine = ''.join(joinStr)
print (getDict)
getList[d[0]] = newLine
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
unHideByType(type)
else:
getDict[type] = offValue
joinStr = [mode,",",str(getDict), '\n']
newLine = ''.join(joinStr)
print (getDict)
getList[d[0]] = newLine
stateList = open(ctrlFile, 'w')
stateList.write(''.join(str(''.join(getList))))
hideByType(type)
def hideByType(type):
typeList = general.get_all_objects(str(type), "")
for x in typeList:
general.hide_object(x)
def unHideByType(type):
typeList = general.get_all_objects(str(type), "")
for x in typeList:
general.unhide_object(x)
@@ -62164,7 +62164,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_NAME">
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_NAME</source>
<comment>Simple Type: EntityID C++ Type: const EntityId&amp;</comment>
<translation type="unfinished">Entity</translation>
<translation type="unfinished">EntityID</translation>
</message>
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_TOOLTIP">
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGADDED_OUTPUT0_TOOLTIP</source>
@@ -62202,7 +62202,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_NAME">
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_NAME</source>
<comment>Simple Type: EntityID C++ Type: const EntityId&amp;</comment>
<translation type="unfinished">Entity</translation>
<translation type="unfinished">EntityId</translation>
</message>
<message id="HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_TOOLTIP">
<source>HANDLER_TAGGLOBALNOTIFICATIONBUS_ONENTITYTAGREMOVED_OUTPUT0_TOOLTIP</source>
@@ -81852,7 +81852,7 @@ The element is removed from its current parent and added as a child of the new p
<message id="HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_NAME">
<source>HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_NAME</source>
<comment>Simple Type: EntityID C++ Type: const EntityId&amp;</comment>
<translation type="unfinished">Entity</translation>
<translation type="unfinished">EntityID</translation>
</message>
<message id="HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_TOOLTIP">
<source>HANDLER_SPAWNERCOMPONENTNOTIFICATIONBUS_ONENTITYSPAWNED_OUTPUT1_TOOLTIP</source>
@@ -89198,7 +89198,7 @@ The element is removed from its current parent and added as a child of the new p
<message id="HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_NAME">
<source>HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_NAME</source>
<comment>Simple Type: EntityID C++ Type: const EntityId&amp;</comment>
<translation type="unfinished">Entity</translation>
<translation type="unfinished">EntityID</translation>
</message>
<message id="HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_TOOLTIP">
<source>HANDLER_ENTITYBUS_ONENTITYACTIVATED_OUTPUT0_TOOLTIP</source>
@@ -89236,7 +89236,7 @@ The element is removed from its current parent and added as a child of the new p
<message id="HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_NAME">
<source>HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_NAME</source>
<comment>Simple Type: EntityID C++ Type: const EntityId&amp;</comment>
<translation type="unfinished">Entity</translation>
<translation type="unfinished">EntityID</translation>
</message>
<message id="HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_TOOLTIP">
<source>HANDLER_ENTITYBUS_ONENTITYDEACTIVATED_OUTPUT0_TOOLTIP</source>
@@ -145,7 +145,7 @@
<Class name="float" field="ProjectorNearPlane" type="{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}" value="0.0000000" specializationTypeId="{EA2C3E90-AFBE-44D4-A90D-FAAF79BAF93D}"/>
<Class name="AzFramework::SimpleAssetReference&lt;LmbrCentral::TextureAsset&gt;" field="ProjectorTexture" type="{68E92460-5C0C-4031-9620-6F1A08763243}" version="1" specializationTypeId="{68E92460-5C0C-4031-9620-6F1A08763243}">
<Class name="SimpleAssetReferenceBase" field="BaseClass1" type="{E16CA6C5-5C78-4AD9-8E9B-F8C1FB4D1DB8}" version="1" specializationTypeId="{E16CA6C5-5C78-4AD9-8E9B-F8C1FB4D1DB8}">
<Class name="AZStd::string" field="AssetPath" type="{EF8FF807-DDEE-4EB0-B678-4CA3A2C490A4}" value="engineassets/textures/defaults/spot_default.dds" specializationTypeId="{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9}"/>
<Class name="AZStd::string" field="AssetPath" type="{EF8FF807-DDEE-4EB0-B678-4CA3A2C490A4}" value="" specializationTypeId="{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9}"/>
</Class>
</Class>
<Class name="AzFramework::SimpleAssetReference&lt;LmbrCentral::MaterialAsset&gt;" field="ProjectorMaterial" type="{B7B8ECC7-FF89-4A76-A50E-4C6CA2B6E6B4}" version="1" specializationTypeId="{B7B8ECC7-FF89-4A76-A50E-4C6CA2B6E6B4}">
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cf441215a769562f88aa20711aee68dadcbf02597d1e2270547055e8e6aec6a3
size 77
@@ -1,178 +0,0 @@
----------------------------------------------------------------------------------------------------
--
-- 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
--
--
--
----------------------------------------------------------------------------------------------------
Script.ReloadScript("scripts/Utils/EntityUtils.lua")
GeomCache =
{
Properties = {
geomcacheFile = "EngineAssets/GeomCaches/defaultGeomCache.cax",
bPlaying = 0,
fStartTime = 0,
bLooping = 0,
objectStandIn = "",
materialStandInMaterial = "",
objectFirstFrameStandIn = "",
materialFirstFrameStandInMaterial = "",
objectLastFrameStandIn = "",
materialLastFrameStandInMaterial = "",
fStandInDistance = 0,
fStreamInDistance = 0,
Physics = {
bPhysicalize = 0,
}
},
Editor={
Icon = "animobject.bmp",
IconOnTop = 1,
},
bPlaying = 0,
currentTime = 0,
precacheTime = 0,
bPrecachedOutputTriggered = false,
}
function GeomCache:OnLoad(table)
self.currentTime = table.currentTime;
end
function GeomCache:OnSave(table)
table.currentTime = self.currentTime;
end
function GeomCache:OnSpawn()
self.currentTime = self.Properties.fStartTime;
self:SetFromProperties();
end
function GeomCache:OnReset()
self.currentTime = self.Properties.fStartTime;
self.bPrecachedOutputTriggered = true;
self:SetFromProperties();
end
function GeomCache:SetFromProperties()
local Properties = self.Properties;
if (Properties.geomcacheFile == "") then
do return end;
end
self:LoadGeomCache(0, Properties.geomcacheFile);
self.bPlaying = Properties.bPlaying;
if (self.bPlaying == 0) then
self.currentTime = Properties.fStartTime;
end
self:SetGeomCachePlaybackTime(self.currentTime);
self:SetGeomCacheParams(Properties.bLooping, Properties.objectStandIn, Properties.materialStandInMaterial, Properties.objectFirstFrameStandIn,
Properties.materialFirstFrameStandInMaterial, Properties.objectLastFrameStandIn, Properties.materialLastFrameStandInMaterial,
Properties.fStandInDistance, Properties.fStreamInDistance);
self:SetGeomCacheStreaming(false, 0);
if (Properties.Physics.bPhysicalize == 1) then
local tempPhysParams = EntityCommon.TempPhysParams;
self:Physicalize(0, PE_ARTICULATED, tempPhysParams);
end
self:Activate(1);
end
function GeomCache:PhysicalizeThis()
local Physics = self.Properties.Physics;
EntityCommon.PhysicalizeRigid(self, 0, Physics, false);
end
function GeomCache:OnUpdate(dt)
if (self.bPlaying == 1) then
self:SetGeomCachePlaybackTime(self.currentTime);
end
if (self:IsGeomCacheStreaming() and not self.bPrecachedOutputTriggered) then
local precachedTime = self:GetGeomCachePrecachedTime();
if (precachedTime >= self.precacheTime) then
self:ActivateOutput("Precached", true);
self.bPrecachedOutputTriggered = true;
end
end
if (self.bPlaying == 1) then
self.currentTime = self.currentTime + dt;
end
end
function GeomCache:OnPropertyChange()
self:SetFromProperties();
end
function GeomCache:Event_Start(sender, val)
self.bPlaying = 1;
end
function GeomCache:Event_Stop(sender, value)
self.bPlaying = 0;
end
function GeomCache:Event_SetTime(sender, value)
self.currentTime = value;
end
function GeomCache:Event_StartStreaming(sender, value)
self.bPrecachedOutputTriggered = false;
self:SetGeomCacheStreaming(true, self.currentTime);
end
function GeomCache:Event_StopStreaming(sender, value)
self:SetGeomCacheStreaming(false, 0);
end
function GeomCache:Event_PrecacheTime(sender, value)
self.precacheTime = value;
end
function GeomCache:Event_Hide(sender, value)
self:Hide(1);
end
function GeomCache:Event_Unhide(sender, value)
self:Hide(0);
end
function GeomCache:Event_StopDrawing(sender, value)
self:SetGeomCacheDrawing(false);
end
function GeomCache:Event_StartDrawing(sender, value)
self:SetGeomCacheDrawing(true);
end
GeomCache.FlowEvents =
{
Inputs =
{
Start = { GeomCache.Event_Start, "any" },
Stop = { GeomCache.Event_Stop, "any" },
SetTime = { GeomCache.Event_SetTime, "float" },
StartStreaming = { GeomCache.Event_StartStreaming, "any" },
StopStreaming = { GeomCache.Event_StopStreaming, "any" },
PrecacheTime = { GeomCache.Event_PrecacheTime, "float" },
Hide = { GeomCache.Event_Hide, "any" },
Unhide = { GeomCache.Event_Unhide, "any" },
StopDrawing = { GeomCache.Event_StopDrawing, "any" },
StartDrawing = { GeomCache.Event_StartDrawing, "any" },
},
Outputs =
{
Precached = "bool",
},
}
+2 -1
View File
@@ -8,11 +8,12 @@
if(NOT PROJECT_NAME)
cmake_minimum_required(VERSION 3.20)
include(cmake/CompilerSettings.cmake)
project(AutomatedTesting
LANGUAGES C CXX
VERSION 1.0.0.0
)
include(EngineFinder.cmake OPTIONAL)
include(cmake/EngineFinder.cmake OPTIONAL)
find_package(o3de REQUIRED)
o3de_initialize()
else()
+124
View File
@@ -0,0 +1,124 @@
#
# 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 os, traceback, binascii, sys, json, pathlib, logging
import azlmbr.math
import azlmbr.bus
from scene_helpers import *
#
# SceneAPI Processor
#
def update_manifest(scene):
import uuid
import azlmbr.scene as sceneApi
import azlmbr.scene.graph
from scene_api import scene_data as sceneData
graph = sceneData.SceneGraph(scene.graph)
# Get a list of all the mesh nodes, as well as all the nodes
mesh_name_list, all_node_paths = get_mesh_node_names(graph)
mesh_name_list.sort(key=lambda node: str.casefold(node.get_path()))
scene_manifest = sceneData.SceneManifest()
clean_filename = scene.sourceFilename.replace('.', '_')
# Compute the filename of the scene file
source_basepath = scene.watchFolder
source_relative_path = os.path.dirname(os.path.relpath(clean_filename, source_basepath))
source_filename_only = os.path.basename(clean_filename)
created_entities = []
previous_entity_id = azlmbr.entity.InvalidEntityId
first_mesh = True
# Make a list of mesh node paths
mesh_path_list = list(map(lambda node: node.get_path(), mesh_name_list))
# Assume the first mesh is the main mesh
main_mesh = mesh_name_list[0]
mesh_path = main_mesh.get_path()
# Create a unique mesh group name using the filename + node name
mesh_group_name = '{}_{}'.format(source_filename_only, main_mesh.get_name())
# Remove forbidden filename characters from the name since this will become a file on disk later
mesh_group_name = "".join(char for char in mesh_group_name if char not in "|<>:\"/?*\\")
# Add the MeshGroup to the manifest and give it a unique ID
mesh_group = scene_manifest.add_mesh_group(mesh_group_name)
mesh_group['id'] = '{' + str(uuid.uuid5(uuid.NAMESPACE_DNS, source_filename_only + mesh_path)) + '}'
# Set our current node as the only node that is included in this MeshGroup
scene_manifest.mesh_group_select_node(mesh_group, mesh_path)
# Explicitly remove all other nodes to prevent implicit inclusions
for node in mesh_path_list:
if node != mesh_path:
scene_manifest.mesh_group_unselect_node(mesh_group, node)
# Create a LOD rule
lod_rule = scene_manifest.mesh_group_add_lod_rule(mesh_group)
# Loop all the mesh nodes after the first
for x in mesh_path_list[1:]:
# Add a new LOD level
lod = scene_manifest.lod_rule_add_lod(lod_rule)
# Select the current mesh for this LOD level
scene_manifest.lod_select_node(lod, x)
# Unselect every other mesh for this LOD level
for y in mesh_path_list:
if y != x:
scene_manifest.lod_unselect_node(lod, y)
# Create an editor entity
entity_id = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "CreateEditorReadyEntity", mesh_group_name)
# Add an EditorMeshComponent to the entity
editor_mesh_component = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "GetOrAddComponentByTypeName", entity_id, "AZ::Render::EditorMeshComponent")
# Set the ModelAsset assetHint to the relative path of the input asset + the name of the MeshGroup we just created + the azmodel extension
# The MeshGroup we created will be output as a product in the asset's path named mesh_group_name.azmodel
# The assetHint will be converted to an AssetId later during prefab loading
json_update = json.dumps({
"Controller": { "Configuration": { "ModelAsset": {
"assetHint": os.path.join(source_relative_path, mesh_group_name) + ".azmodel" }}}
});
# Apply the JSON above to the component we created
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, editor_mesh_component, json_update)
if not result:
raise RuntimeError("UpdateComponentForEntity failed for Mesh component")
create_prefab(scene_manifest, source_filename_only, [entity_id])
# Convert the manifest to a JSON string and return it
new_manifest = scene_manifest.export()
return new_manifest
sceneJobHandler = None
def on_update_manifest(args):
try:
scene = args[0]
return update_manifest(scene)
except RuntimeError as err:
print (f'ERROR - {err}')
log_exception_traceback()
except:
log_exception_traceback()
global sceneJobHandler
sceneJobHandler = None
# try to create SceneAPI handler for processing
try:
import azlmbr.scene as sceneApi
if (sceneJobHandler == None):
sceneJobHandler = sceneApi.ScriptBuildingNotificationBusHandler()
sceneJobHandler.connect()
sceneJobHandler.add_callback('OnUpdateManifest', on_update_manifest)
except:
sceneJobHandler = None
@@ -0,0 +1,95 @@
"""
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 traceback, logging, json
from typing import Tuple, List
import azlmbr.bus
from scene_api import scene_data as sceneData
from scene_api.scene_data import SceneGraphName
def log_exception_traceback():
"""
Outputs an exception stacktrace.
"""
data = traceback.format_exc()
logger = logging.getLogger('python')
logger.error(data)
def sanitize_name_for_disk(name: str):
"""
Removes illegal filename characters from a string.
:param name: String to clean.
:return: Name with illegal characters removed.
"""
return "".join(char for char in name if char not in "|<>:\"/?*\\")
def get_mesh_node_names(scene_graph: sceneData.SceneGraph) -> Tuple[List[SceneGraphName], List[str]]:
"""
Returns a tuple of all the mesh nodes as well as all the node paths
:param scene_graph: Scene graph to search
:return: Tuple of [Mesh Nodes, All Node Paths]
"""
import azlmbr.scene as sceneApi
import azlmbr.scene.graph
mesh_data_list = []
node = scene_graph.get_root()
children = []
paths = []
while node.IsValid():
# store children to process after siblings
if scene_graph.has_node_child(node):
children.append(scene_graph.get_node_child(node))
node_name = sceneData.SceneGraphName(scene_graph.get_node_name(node))
paths.append(node_name.get_path())
# store any node that has mesh data content
node_content = scene_graph.get_node_content(node)
if node_content.CastWithTypeName('MeshData'):
if scene_graph.is_node_end_point(node) is False:
if len(node_name.get_path()):
mesh_data_list.append(sceneData.SceneGraphName(scene_graph.get_node_name(node)))
# advance to next node
if scene_graph.has_node_sibling(node):
node = scene_graph.get_node_sibling(node)
elif children:
node = children.pop()
else:
node = azlmbr.scene.graph.NodeIndex()
return mesh_data_list, paths
def create_prefab(scene_manifest: sceneData.SceneManifest, prefab_name: str, entities: list) -> None:
prefab_filename = prefab_name + ".prefab"
created_template_id = azlmbr.prefab.PrefabSystemScriptingBus(azlmbr.bus.Broadcast, "CreatePrefab", entities,
prefab_filename)
if created_template_id is None or created_template_id == azlmbr.prefab.InvalidTemplateId:
raise RuntimeError("CreatePrefab {} failed".format(prefab_filename))
# Convert the prefab to a JSON string
output = azlmbr.prefab.PrefabLoaderScriptingBus(azlmbr.bus.Broadcast, "SaveTemplateToString", created_template_id)
if output is not None and output.IsSuccess():
json_string = output.GetValue()
uuid = azlmbr.math.Uuid_CreateRandom().ToString()
json_result = json.loads(json_string)
# Add a PrefabGroup to the manifest and store the JSON on it
scene_manifest.add_prefab_group(prefab_name, uuid, json_result)
else:
raise RuntimeError(
"SaveTemplateToString failed for template id {}, prefab {}".format(created_template_id, prefab_filename))
@@ -5,55 +5,16 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
import os, traceback, binascii, sys, json, pathlib
import azlmbr.math
import azlmbr.bus
import azlmbr.math
from scene_helpers import *
#
# SceneAPI Processor
#
def log_exception_traceback():
exc_type, exc_value, exc_tb = sys.exc_info()
data = traceback.format_exception(exc_type, exc_value, exc_tb)
print(str(data))
def get_mesh_node_names(sceneGraph):
import azlmbr.scene as sceneApi
import azlmbr.scene.graph
from scene_api import scene_data as sceneData
meshDataList = []
node = sceneGraph.get_root()
children = []
paths = []
while node.IsValid():
# store children to process after siblings
if sceneGraph.has_node_child(node):
children.append(sceneGraph.get_node_child(node))
nodeName = sceneData.SceneGraphName(sceneGraph.get_node_name(node))
paths.append(nodeName.get_path())
# store any node that has mesh data content
nodeContent = sceneGraph.get_node_content(node)
if nodeContent.CastWithTypeName('MeshData'):
if sceneGraph.is_node_end_point(node) is False:
if (len(nodeName.get_path())):
meshDataList.append(sceneData.SceneGraphName(sceneGraph.get_node_name(node)))
# advance to next node
if sceneGraph.has_node_sibling(node):
node = sceneGraph.get_node_sibling(node)
elif children:
node = children.pop()
else:
node = azlmbr.scene.graph.NodeIndex()
return meshDataList, paths
def add_material_component(entity_id):
# Create an override AZ::Render::EditorMaterialComponent
editor_material_component = azlmbr.entity.EntityUtilityBus(
@@ -64,24 +25,24 @@ def add_material_component(entity_id):
# this fills out the material asset to a known product AZMaterial asset relative path
json_update = json.dumps({
"Controller": { "Configuration": { "materials": [
{
"Key": {},
"Value": { "MaterialAsset":{
"assetHint": "materials/basic_grey.azmaterial"
}}
}]
}}
});
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, editor_material_component, json_update)
"Controller": {"Configuration": {"materials": [
{
"Key": {},
"Value": {"MaterialAsset": {
"assetHint": "materials/basic_grey.azmaterial"
}}
}]
}}
})
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id,
editor_material_component, json_update)
if not result:
raise RuntimeError("UpdateComponentForEntity for editor_material_component failed")
def update_manifest(scene):
import json
import uuid, os
import azlmbr.scene as sceneApi
import azlmbr.scene.graph
from scene_api import scene_data as sceneData
@@ -89,9 +50,9 @@ def update_manifest(scene):
# Get a list of all the mesh nodes, as well as all the nodes
mesh_name_list, all_node_paths = get_mesh_node_names(graph)
scene_manifest = sceneData.SceneManifest()
clean_filename = scene.sourceFilename.replace('.', '_')
# Compute the filename of the scene file
source_basepath = scene.watchFolder
source_relative_path = os.path.dirname(os.path.relpath(clean_filename, source_basepath))
@@ -108,31 +69,39 @@ def update_manifest(scene):
# Create a unique mesh group name using the filename + node name
mesh_group_name = '{}_{}'.format(source_filename_only, mesh_name.get_name())
# Remove forbidden filename characters from the name since this will become a file on disk later
mesh_group_name = "".join(char for char in mesh_group_name if char not in "|<>:\"/?*\\")
mesh_group_name = sanitize_name_for_disk(mesh_group_name)
# Add the MeshGroup to the manifest and give it a unique ID
mesh_group = scene_manifest.add_mesh_group(mesh_group_name)
mesh_group['id'] = '{' + str(uuid.uuid5(uuid.NAMESPACE_DNS, source_filename_only + mesh_path)) + '}'
# Set our current node as the only node that is included in this MeshGroup
scene_manifest.mesh_group_select_node(mesh_group, mesh_path)
scene_manifest.mesh_group_add_comment(mesh_group, "Hello World")
# Explicitly remove all other nodes to prevent implicit inclusions
for node in all_node_paths:
if node != mesh_path:
scene_manifest.mesh_group_unselect_node(mesh_group, node)
scene_manifest.mesh_group_add_cloth_rule(mesh_group, mesh_path, "Col0", 1, "Col0", 2, "Col0", 2, 3)
scene_manifest.mesh_group_add_advanced_mesh_rule(mesh_group, True, False, True, "Col0")
scene_manifest.mesh_group_add_skin_rule(mesh_group, 3, 0.002)
scene_manifest.mesh_group_add_tangent_rule(mesh_group, 1, 0)
# Create an editor entity
entity_id = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "CreateEditorReadyEntity", mesh_group_name)
# Add an EditorMeshComponent to the entity
editor_mesh_component = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "GetOrAddComponentByTypeName", entity_id, "AZ::Render::EditorMeshComponent")
# Set the ModelAsset assetHint to the relative path of the input asset + the name of the MeshGroup we just created + the azmodel extension
# The MeshGroup we created will be output as a product in the asset's path named mesh_group_name.azmodel
# The assetHint will be converted to an AssetId later during prefab loading
editor_mesh_component = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "GetOrAddComponentByTypeName",
entity_id, "AZ::Render::EditorMeshComponent")
# Set the ModelAsset assetHint to the relative path of the input asset + the name of the MeshGroup we just
# created + the azmodel extension The MeshGroup we created will be output as a product in the asset's path
# named mesh_group_name.azmodel The assetHint will be converted to an AssetId later during prefab loading
json_update = json.dumps({
"Controller": { "Configuration": { "ModelAsset": {
"assetHint": os.path.join(source_relative_path, mesh_group_name) + ".azmodel" }}}
});
"Controller": {"Configuration": {"ModelAsset": {
"assetHint": os.path.join(source_relative_path, mesh_group_name) + ".azmodel"}}}
})
# Apply the JSON above to the component we created
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, editor_mesh_component, json_update)
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id,
editor_mesh_component, json_update)
if not result:
raise RuntimeError("UpdateComponentForEntity failed for Mesh component")
@@ -143,17 +112,19 @@ def update_manifest(scene):
add_material_component(entity_id)
# Get the transform component
transform_component = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "GetOrAddComponentByTypeName", entity_id, "27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0")
transform_component = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "GetOrAddComponentByTypeName",
entity_id, "27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0")
# Set this entity to be a child of the last entity we created
# This is just an example of how to do parenting and isn't necessarily useful to parent everything like this
if previous_entity_id is not None:
transform_json = json.dumps({
"Parent Entity" : previous_entity_id.to_json()
});
"Parent Entity": previous_entity_id.to_json()
})
# Apply the JSON update
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, transform_component, transform_json)
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id,
transform_component, transform_json)
if not result:
raise RuntimeError("UpdateComponentForEntity failed for Transform component")
@@ -165,37 +136,23 @@ def update_manifest(scene):
created_entities.append(entity_id)
# Create a prefab with all our entities
prefab_filename = source_filename_only + ".prefab"
created_template_id = azlmbr.prefab.PrefabSystemScriptingBus(azlmbr.bus.Broadcast, "CreatePrefab", created_entities, prefab_filename)
if created_template_id == azlmbr.prefab.InvalidTemplateId:
raise RuntimeError("CreatePrefab {} failed".format(prefab_filename))
# Convert the prefab to a JSON string
output = azlmbr.prefab.PrefabLoaderScriptingBus(azlmbr.bus.Broadcast, "SaveTemplateToString", created_template_id)
if output.IsSuccess():
jsonString = output.GetValue()
uuid = azlmbr.math.Uuid_CreateRandom().ToString()
jsonResult = json.loads(jsonString)
# Add a PrefabGroup to the manifest and store the JSON on it
scene_manifest.add_prefab_group(source_filename_only, uuid, jsonResult)
else:
raise RuntimeError("SaveTemplateToString failed for template id {}, prefab {}".format(created_template_id, prefab_filename))
create_prefab(scene_manifest, source_filename_only, created_entities)
# Convert the manifest to a JSON string and return it
new_manifest = scene_manifest.export()
return new_manifest
sceneJobHandler = None
def on_update_manifest(args):
try:
scene = args[0]
return update_manifest(scene)
except RuntimeError as err:
print (f'ERROR - {err}')
print(f'ERROR - {err}')
log_exception_traceback()
except:
log_exception_traceback()
@@ -203,10 +160,12 @@ def on_update_manifest(args):
global sceneJobHandler
sceneJobHandler = None
# try to create SceneAPI handler for processing
try:
import azlmbr.scene as sceneApi
if (sceneJobHandler == None):
if sceneJobHandler is None:
sceneJobHandler = sceneApi.ScriptBuildingNotificationBusHandler()
sceneJobHandler.connect()
sceneJobHandler.add_callback('OnUpdateManifest', on_update_manifest)
@@ -13,4 +13,29 @@
<NetworkInput Type="float" Name="FwdBack" Init="0.0f" ExposeToScript="true"/>
<NetworkInput Type="float" Name="LeftRight" Init="0.0f" ExposeToScript="true"/>
<RemoteProcedure Name="AutonomousToAuthority" InvokeFrom="Autonomous" HandleOn="Authority" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" >
<Param Type="float" Name="SomeFloat" />
</RemoteProcedure>
<RemoteProcedure Name="AutonomousToAuthorityNoParams" InvokeFrom="Autonomous" HandleOn="Authority" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" />
<RemoteProcedure Name="AuthorityToAutonomous" InvokeFrom="Authority" HandleOn="Autonomous" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" >
<Param Type="float" Name="SomeFloat" />
</RemoteProcedure>
<RemoteProcedure Name="AuthorityToAutonomousNoParams" InvokeFrom="Authority" HandleOn="Autonomous" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" />
<RemoteProcedure Name="AuthorityToClient" InvokeFrom="Authority" HandleOn="Client" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" >
<Param Type="float" Name="SomeFloat" />
</RemoteProcedure>
<RemoteProcedure Name="AuthorityToClientNoParams" InvokeFrom="Authority" HandleOn="Client" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" />
<RemoteProcedure Name="ServerToAuthority" InvokeFrom="Server" HandleOn="Authority" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" >
<Param Type="float" Name="SomeFloat" />
</RemoteProcedure>
<RemoteProcedure Name="ServerToAuthorityNoParam" InvokeFrom="Server" HandleOn="Authority" IsPublic="false" IsReliable="false" GenerateEventBindings="true" Description="" />
</Component>
@@ -54,6 +54,7 @@ set(ENABLED_GEMS
AWSMetrics
PrefabBuilder
AudioSystem
Terrain
Profiler
Multiplayer
)
@@ -14,6 +14,7 @@ from datetime import datetime
import ly_test_tools.log.log_monitor
from AWS.common import constants
from AWS.common.resource_mappings import AWS_RESOURCE_MAPPINGS_ACCOUNT_ID_KEY
from .aws_metrics_custom_thread import AWSMetricsThread
# fixture imports
@@ -200,6 +201,59 @@ class TestAWSMetricsWindows(object):
for thread in operational_threads:
thread.join()
@pytest.mark.parametrize('level', ['AWS/Metrics'])
def test_realtime_and_batch_analytics_no_global_accountid(self,
level: str,
launcher: pytest.fixture,
asset_processor: pytest.fixture,
workspace: pytest.fixture,
aws_utils: pytest.fixture,
resource_mappings: pytest.fixture,
aws_metrics_utils: pytest.fixture):
"""
Verify that the metrics events are sent to CloudWatch and S3 for analytics.
"""
# Remove top-level account ID from resource mappings
resource_mappings.clear_select_keys([AWS_RESOURCE_MAPPINGS_ACCOUNT_ID_KEY])
# Start Kinesis analytics application on a separate thread to avoid blocking the test.
kinesis_analytics_application_thread = AWSMetricsThread(target=update_kinesis_analytics_application_status,
args=(aws_metrics_utils, resource_mappings, True))
kinesis_analytics_application_thread.start()
log_monitor = setup(launcher, asset_processor)
# Kinesis analytics application needs to be in the running state before we start the game launcher.
kinesis_analytics_application_thread.join()
launcher.args = ['+LoadLevel', level]
launcher.args.extend(['-rhi=null'])
start_time = datetime.utcnow()
with launcher.start(launch_ap=False):
monitor_metrics_submission(log_monitor)
# Verify that real-time analytics metrics are delivered to CloudWatch.
aws_metrics_utils.verify_cloud_watch_delivery(
AWS_METRICS_FEATURE_NAME,
'TotalLogins',
[],
start_time)
logger.info('Real-time metrics are sent to CloudWatch.')
# Run time-consuming operations on separate threads to avoid blocking the test.
operational_threads = list()
operational_threads.append(
AWSMetricsThread(target=query_metrics_from_s3,
args=(aws_metrics_utils, resource_mappings)))
operational_threads.append(
AWSMetricsThread(target=verify_operational_metrics,
args=(aws_metrics_utils, resource_mappings, start_time)))
operational_threads.append(
AWSMetricsThread(target=update_kinesis_analytics_application_status,
args=(aws_metrics_utils, resource_mappings, False)))
for thread in operational_threads:
thread.start()
for thread in operational_threads:
thread.join()
@pytest.mark.parametrize('level', ['AWS/Metrics'])
def test_unauthorized_user_request_rejected(self,
level: str,
@@ -12,6 +12,7 @@ import pytest
import ly_test_tools.log.log_monitor
from AWS.common import constants
from AWS.common.resource_mappings import AWS_RESOURCE_MAPPINGS_ACCOUNT_ID_KEY
# fixture imports
from assetpipeline.ap_fixtures.asset_processor_fixture import asset_processor
@@ -70,6 +71,41 @@ class TestAWSClientAuthWindows(object):
halt_on_unexpected=True,
)
assert result, 'Anonymous credentials fetched successfully.'
@pytest.mark.parametrize('level', ['AWS/ClientAuth'])
def test_anonymous_credentials_no_global_accountid(self,
level: str,
launcher: pytest.fixture,
resource_mappings: pytest.fixture,
workspace: pytest.fixture,
asset_processor: pytest.fixture
):
"""
Test to verify AWS Cognito Identity pool anonymous authorization.
Setup: Updates resource mapping file using existing CloudFormation stacks.
Tests: Getting credentials when no credentials are configured
Verification: Log monitor looks for success credentials log.
"""
# Remove top-level account ID from resource mappings
resource_mappings.clear_select_keys([AWS_RESOURCE_MAPPINGS_ACCOUNT_ID_KEY])
asset_processor.start()
asset_processor.wait_for_idle()
file_to_monitor = os.path.join(launcher.workspace.paths.project_log(), constants.GAME_LOG_NAME)
log_monitor = ly_test_tools.log.log_monitor.LogMonitor(launcher=launcher, log_file_path=file_to_monitor)
launcher.args = ['+LoadLevel', level]
launcher.args.extend(['-rhi=null'])
with launcher.start(launch_ap=False):
result = log_monitor.monitor_log_for_lines(
expected_lines=['(Script) - Success anonymous credentials'],
unexpected_lines=['(Script) - Fail anonymous credentials'],
halt_on_unexpected=True,
)
assert result, 'Anonymous credentials fetched successfully.'
def test_password_signin_credentials(self,
launcher: pytest.fixture,
@@ -18,6 +18,7 @@ import ly_test_tools.environment.process_utils as process_utils
import ly_test_tools.o3de.asset_processor_utils as asset_processor_utils
from AWS.common import constants
from AWS.common.resource_mappings import AWS_RESOURCE_MAPPINGS_ACCOUNT_ID_KEY
# fixture imports
from assetpipeline.ap_fixtures.asset_processor_fixture import asset_processor
@@ -141,3 +142,51 @@ class TestAWSCoreAWSResourceInteraction(object):
'The expected file wasn\'t successfully downloaded.'
# clean up the file directories.
shutil.rmtree(s3_download_dir)
@pytest.mark.parametrize('expected_lines', [
['(Script) - [S3] Head object request is done',
'(Script) - [S3] Head object success: Object example.txt is found.',
'(Script) - [S3] Get object success: Object example.txt is downloaded.',
'(Script) - [Lambda] Completed Invoke',
'(Script) - [Lambda] Invoke success: {"statusCode": 200, "body": {}}',
'(Script) - [DynamoDB] Results finished']])
@pytest.mark.parametrize('unexpected_lines', [
['(Script) - [S3] Head object error: No response body.',
'(Script) - [S3] Get object error: Request validation failed, output file directory doesn\'t exist.',
'(Script) - Request validation failed, output file miss full path.',
'(Script) - ']])
def test_scripting_behavior_no_global_accountid(self,
level: str,
launcher: pytest.fixture,
workspace: pytest.fixture,
asset_processor: pytest.fixture,
resource_mappings: pytest.fixture,
aws_utils: pytest.fixture,
expected_lines: typing.List[str],
unexpected_lines: typing.List[str]):
"""
Setup: Updates resource mapping file using existing CloudFormation stacks.
Tests: Interact with AWS S3, DynamoDB and Lambda services.
Verification: Script canvas nodes can communicate with AWS services successfully.
"""
resource_mappings.clear_select_keys([AWS_RESOURCE_MAPPINGS_ACCOUNT_ID_KEY])
log_monitor, s3_download_dir = setup(launcher, asset_processor)
write_test_data_to_dynamodb_table(resource_mappings, aws_utils)
launcher.args = ['+LoadLevel', level]
launcher.args.extend(['-rhi=null'])
with launcher.start(launch_ap=False):
result = log_monitor.monitor_log_for_lines(
expected_lines=expected_lines,
unexpected_lines=unexpected_lines,
halt_on_unexpected=True
)
assert result, "Expected lines weren't found."
assert os.path.exists(os.path.join(s3_download_dir, 'output.txt')), \
'The expected file wasn\'t successfully downloaded.'
# clean up the file directories.
shutil.rmtree(s3_download_dir)
@@ -102,3 +102,17 @@ class ResourceMappings:
def get_resource_name_id(self, resource_key: str):
return self._resource_mappings[AWS_RESOURCE_MAPPINGS_KEY][resource_key]['Name/ID']
def clear_select_keys(self, resource_keys=None) -> None:
"""
Clears values from select resource mapping keys.
:param resource_keys: list of keys to clear out
"""
with open(self._resource_mapping_file_path) as file_content:
resource_mappings = json.load(file_content)
for key in resource_keys:
resource_mappings[key] = ''
with open(self._resource_mapping_file_path, 'w') as file_content:
json.dump(resource_mappings, file_content, indent=4)
@@ -13,6 +13,8 @@ from ly_test_tools.o3de.editor_test import EditorSharedTest, EditorTestSuite
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
class TestAutomation(EditorTestSuite):
enable_prefab_system = False
@pytest.mark.test_case_id("C36525657")
class AtomEditorComponents_BloomAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_BloomAdded as test_module
@@ -61,10 +63,18 @@ class TestAutomation(EditorTestSuite):
class AtomEditorComponents_HDRColorGradingAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_HDRColorGradingAdded as test_module
@pytest.mark.test_case_id("C32078116")
class AtomEditorComponents_HDRiSkyboxAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_HDRiSkyboxAdded as test_module
@pytest.mark.test_case_id("C32078117")
class AtomEditorComponents_LightAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module
@pytest.mark.test_case_id("C36525662")
class AtomEditorComponents_LookModificationAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_LookModificationAdded as test_module
@pytest.mark.test_case_id("C32078123")
class AtomEditorComponents_MaterialAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_MaterialAdded as test_module
@@ -104,6 +104,7 @@ class TestAllComponentsIndepthTests(object):
halt_on_unexpected=True,
cfg_args=[level],
null_renderer=False,
enable_prefab_system=False,
)
similarity_threshold = 0.99
@@ -158,6 +159,7 @@ class TestAllComponentsIndepthTests(object):
halt_on_unexpected=True,
cfg_args=[level],
null_renderer=False,
enable_prefab_system=False,
)
similarity_threshold = 0.99
@@ -205,6 +207,7 @@ class TestPerformanceBenchmarkSuite(object):
halt_on_unexpected=True,
cfg_args=[level],
null_renderer=False,
enable_prefab_system=False,
)
aggregator = BenchmarkDataAggregator(workspace, logger, 'periodic')
@@ -242,5 +245,6 @@ class TestMaterialEditor(object):
halt_on_unexpected=False,
null_renderer=False,
cfg_args=[cfg_args],
log_file_name="MaterialEditor.log"
log_file_name="MaterialEditor.log",
enable_prefab_system=False,
)
@@ -23,6 +23,8 @@ class TestAutomation(EditorTestSuite):
# Remove -autotest_mode from global_extra_cmdline_args since we need rendering for these tests.
global_extra_cmdline_args = ["-BatchMode"] # Default is ["-BatchMode", "-autotest_mode"]
enable_prefab_system = False
@pytest.mark.test_case_id("C34603773")
class AtomGPU_BasicLevelSetup_SetsUpLevel(EditorSharedTest):
use_null_renderer = False # Default is True
@@ -85,6 +85,7 @@ class TestAtomEditorComponentsMain(object):
halt_on_unexpected=True,
null_renderer=True,
cfg_args=cfg_args,
enable_prefab_system=False,
)
@@ -155,5 +156,6 @@ class TestMaterialEditorBasicTests(object):
halt_on_unexpected=True,
null_renderer=True,
log_file_name="MaterialEditor.log",
enable_prefab_system=False,
)
@@ -172,8 +172,7 @@ def create_basic_atom_level(level_name):
entity_position=default_position,
components=["HDRi Skybox", "Global Skylight (IBL)"],
parent_id=default_level.id)
global_skylight_asset_path = os.path.join(
"LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage")
global_skylight_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
global_skylight_asset_value = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", global_skylight_asset_path, math.Uuid(), False)
global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_asset_value)
@@ -57,11 +57,13 @@ class AtomComponentProperties:
def camera(property: str = 'name') -> str:
"""
Camera component properties.
- 'Field of view': Sets the value for the camera's FOV (Field of View) in degrees, i.e. 60.0
:param property: From the last element of the property tree path. Default 'name' for component name string.
:return: Full property path OR component name if no property specified.
"""
properties = {
'name': 'Camera',
'Field of view': 'Controller|Configuration|Field of view'
}
return properties[property]
@@ -147,11 +149,14 @@ class AtomComponentProperties:
def display_mapper(property: str = 'name') -> str:
"""
Display Mapper component properties.
- 'LDR color Grading LUT' is the Low Definition Range (LDR) color grading for Look-up Textures (LUT) which is
an Asset.id value corresponding to a lighting asset file.
:param property: From the last element of the property tree path. Default 'name' for component name string.
:return: Full property path OR component name if no property specified.
"""
properties = {
'name': 'Display Mapper',
'LDR color Grading LUT': 'Controller|Configuration|LDR color Grading LUT',
}
return properties[property]
@@ -202,11 +207,13 @@ class AtomComponentProperties:
def grid(property: str = 'name') -> str:
"""
Grid component properties.
- 'Secondary Grid Spacing': The spacing value for the secondary grid, i.e. 1.0
:param property: From the last element of the property tree path. Default 'name' for component name string.
:return: Full property path OR component name if no property specified.
"""
properties = {
'name': 'Grid',
'Secondary Grid Spacing': 'Controller|Configuration|Secondary Grid Spacing',
}
return properties[property]
@@ -231,11 +238,13 @@ class AtomComponentProperties:
def hdri_skybox(property: str = 'name') -> str:
"""
HDRi Skybox component properties.
- 'Cubemap Texture': Asset.id for the cubemap texture to set.
:param property: From the last element of the property tree path. Default 'name' for component name string.
:return: Full property path OR component name if no property specified.
"""
properties = {
'name': 'HDRi Skybox',
'Cubemap Texture': 'Controller|Configuration|Cubemap Texture',
}
return properties[property]
@@ -259,12 +268,16 @@ class AtomComponentProperties:
Look Modification component properties. Requires PostFX Layer component.
- 'requires' a list of component names as strings required by this component.
Use editor_entity_utils EditorEntity.add_components(list) to add this list of requirements.\n
- 'Enable look modification' Toggle active state of the component True/False
- 'Color Grading LUT' Asset.id for the LUT used for affecting level look.
:param property: From the last element of the property tree path. Default 'name' for component name string.
:return: Full property path OR component name if no property specified.
"""
properties = {
'name': 'Look Modification',
'requires': [AtomComponentProperties.postfx_layer()],
'Enable look modification': 'Controller|Configuration|Enable look modification',
'Color Grading LUT': 'Controller|Configuration|Color Grading LUT',
}
return properties[property]
@@ -274,12 +287,14 @@ class AtomComponentProperties:
Material component properties. Requires one of Actor OR Mesh component.
- 'requires' a list of component names as strings required by this component.
Only one of these is required at a time for this component.\n
- 'Material Asset': the material Asset.id of the material.
:param property: From the last element of the property tree path. Default 'name' for component name string.
:return: Full property path OR component name if no property specified.
"""
properties = {
'name': 'Material',
'requires': [AtomComponentProperties.actor(), AtomComponentProperties.mesh()],
'Material Asset': 'Default Material|Material Asset',
}
return properties[property]
@@ -378,7 +393,7 @@ class AtomComponentProperties:
'name': 'PostFX Shape Weight Modifier',
'requires': [AtomComponentProperties.postfx_layer()],
'shapes': ['Axis Aligned Box Shape', 'Box Shape', 'Capsule Shape', 'Compound Shape', 'Cylinder Shape',
'Disk Shape', 'Polygon Prism Shape', 'Quad Shape', 'Sphere Shape', 'Vegetation Reference Shape'],
'Disk Shape', 'Polygon Prism Shape', 'Quad Shape', 'Sphere Shape', 'Shape Reference'],
}
return properties[property]
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:954d7d0df47c840a24e313893800eb3126d0c0d47c3380926776b51833778db7
oid sha256:aee1fd4d5264e5ef1676b507409ce70af6358cf1ff368d9aeb17f7b2597dfbca
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e81c19128f42ba362a2d5f3ccf159dfbc942d67ceeb1ac8c21f295a6fd9d2ce5
oid sha256:d4787cdafbcc2fe71c1cb3f1da53a249db839a9df539a9e88be43ccd6d8e4d6a
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5e20801213e065b6ea8c95ede81c23faa9b6dc70a2002dc5bced293e1bed989f
oid sha256:5fac5bf41c9b16b6fbd762868e5cf514376af92d6ef7ebb9e819f024f1a3e1a7
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e250f812e594e5152bf2d6f23caa8b53b78276bfdf344d7a8d355dd96cb995c0
oid sha256:7a23969670499524725535e8be7428b55b6f3e887cc24e2e903f7ea821a6d1a5
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:95be359041f8291c74b335297a4dfe9902a180510f24a181b15e1a5ba4d3b024
oid sha256:2f1f4d8865c56ed7f96f339c39e5feb4e0dbc6c6a8b4a7843b4166381b06b00d
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07e09d3eb5bf0cee3d9b3752aaad40f3ead1dcc5ddd837a6226fadde55d57274
oid sha256:5d4ee5641e19eef08dd6b93d2f4054a1aae2165325416ed2cbf0b8243f2c0b06
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:118e43e4b915e262726183467cc4b82f244565213fea5b6bfe02be07f0851ab1
oid sha256:55c8f0d1790bb12660b7557630efca297b2a1b59e6c93167a2563da79e0a8255
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dc2ce3256a6552975962c9e113c52c1a22bf3817d417151f6f60640dd568e0fa
oid sha256:082ff368b621e12b083d96562a0889b11a1d683767a74296cbe6d8732830e9e8
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:287d98890b35427688999760f9d066bcbff1a3bc9001534241dc212b32edabd8
oid sha256:78cc62d89782899747875b41abee57c2efdfacf4c8af6511c88f82d76eaae4ca
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66e91c92c868167c850078cd91714db47e10a96e23cc30191994486bd79c353f
oid sha256:3d6719326f4dacae278d1723090ce1182193b793f250963af8be4b2c298e8841
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d950d173f5101820c5e18205401ca08ce5feeff2302ac2920b292750d86a8fa4
oid sha256:9e492bb394fb18fb117f8a5b61cd2789922f9d6e88fc83189b5b6d59ffb1c3ef
size 6220817
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72eddb7126eae0c839b933886e0fb69d78229f72d49ef13199de28df2b7879db
oid sha256:caca85f7728f660daae36afc81d681ba2de2377c516eb3c637599de5c94012aa
size 6220817
@@ -5,6 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
class Tests:
camera_creation = (
"Camera Entity successfully created",
@@ -39,6 +40,9 @@ class Tests:
is_hidden = (
"Entity is hidden",
"Entity was not hidden")
ldr_color_grading_lut = (
"LDR color Grading LUT asset set",
"LDR color Grading LUT asset could not be set")
entity_deleted = (
"Entity deleted",
"Entity was not deleted")
@@ -71,16 +75,19 @@ def AtomEditorComponents_DisplayMapper_AddedToEntity():
5) Enter/Exit game mode.
6) Test IsHidden.
7) Test IsVisible.
8) Delete Display Mapper entity.
9) UNDO deletion.
10) REDO deletion.
11) Look for errors and asserts.
8) Set LDR color Grading LUT asset.
9) Delete Display Mapper entity.
10) UNDO deletion.
11) REDO deletion.
12) Look for errors and asserts.
:return: None
"""
import os
import azlmbr.legacy.general as general
from editor_python_test_tools.asset_utils import Asset
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper
from Atom.atom_utils.atom_constants import AtomComponentProperties
@@ -97,7 +104,7 @@ def AtomEditorComponents_DisplayMapper_AddedToEntity():
Report.critical_result(Tests.display_mapper_creation, display_mapper_entity.exists())
# 2. Add Display Mapper component to Display Mapper entity.
display_mapper_entity.add_component(AtomComponentProperties.display_mapper())
display_mapper_component = display_mapper_entity.add_component(AtomComponentProperties.display_mapper())
Report.critical_result(
Tests.display_mapper_component,
display_mapper_entity.has_component(AtomComponentProperties.display_mapper()))
@@ -140,19 +147,29 @@ def AtomEditorComponents_DisplayMapper_AddedToEntity():
general.idle_wait_frames(1)
Report.result(Tests.is_visible, display_mapper_entity.is_visible() is True)
# 8. Delete Display Mapper entity.
# 8. Set LDR color Grading LUT asset.
display_mapper_asset_path = os.path.join("TestData", "test.lightingpreset.azasset")
display_mapper_asset = Asset.find_asset_by_path(display_mapper_asset_path, False)
display_mapper_component.set_component_property_value(
AtomComponentProperties.display_mapper("LDR color Grading LUT"), display_mapper_asset.id)
Report.result(
Tests.ldr_color_grading_lut,
display_mapper_component.get_component_property_value(
AtomComponentProperties.display_mapper("LDR color Grading LUT")) == display_mapper_asset.id)
# 9. Delete Display Mapper entity.
display_mapper_entity.delete()
Report.result(Tests.entity_deleted, not display_mapper_entity.exists())
# 9. UNDO deletion.
# 10. UNDO deletion.
general.undo()
Report.result(Tests.deletion_undo, display_mapper_entity.exists())
# 10. REDO deletion.
# 11. REDO deletion.
general.redo()
Report.result(Tests.deletion_redo, not display_mapper_entity.exists())
# 11. Look for errors and asserts.
# 12. Look for errors and asserts.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
@@ -151,7 +151,7 @@ def AtomEditorComponents_GlobalSkylightIBL_AddedToEntity():
Report.result(Tests.is_visible, global_skylight_entity.is_visible() is True)
# 8. Set the Diffuse Image asset on the Global Skylight (IBL) entity.
diffuse_image_path = os.path.join("LightingPresets", "greenwich_park_02_4k_iblskyboxcm.exr.streamingimage")
diffuse_image_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
diffuse_image_asset = Asset.find_asset_by_path(diffuse_image_path, False)
global_skylight_component.set_component_property_value(
AtomComponentProperties.global_skylight('Diffuse Image'), diffuse_image_asset.id)
@@ -161,7 +161,7 @@ def AtomEditorComponents_GlobalSkylightIBL_AddedToEntity():
AtomComponentProperties.global_skylight('Diffuse Image')))
# 9. Set the Specular Image asset on the Global Light (IBL) entity.
specular_image_path = os.path.join("LightingPresets", "greenwich_park_02_4k_iblskyboxcm.exr.streamingimage")
specular_image_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
specular_image_asset = Asset.find_asset_by_path(specular_image_path, False)
global_skylight_component.set_component_property_value(
AtomComponentProperties.global_skylight('Specular Image'), specular_image_asset.id)
@@ -0,0 +1,177 @@
"""
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
"""
class Tests:
creation_undo = (
"UNDO Entity creation success",
"UNDO Entity creation failed")
creation_redo = (
"REDO Entity creation success",
"REDO Entity creation failed")
hdri_skybox_entity_creation = (
"HDRi Skybox successfully created",
"HDRi Skybox failed to be created")
hdri_skybox_component = (
"Entity has an HDRi Skybox component",
"Entity failed to find HDRi Skybox component")
cubemap_property_set = (
"Cubemap property set on HDRi Skybox component",
"Couldn't set Cubemap property on HDRi Skybox component")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
exit_game_mode = (
"Exited game mode",
"Couldn't exit game mode")
is_visible = (
"Entity is visible",
"Entity was not visible")
is_hidden = (
"Entity is hidden",
"Entity was not hidden")
entity_deleted = (
"Entity deleted",
"Entity was not deleted")
deletion_undo = (
"UNDO deletion success",
"UNDO deletion failed")
deletion_redo = (
"REDO deletion success",
"REDO deletion failed")
def AtomEditorComponents_HDRiSkybox_AddedToEntity():
"""
Summary:
Tests the HDRi Skybox component can be added to an entity and has the expected functionality.
Test setup:
- Wait for Editor idle loop.
- Open the "Base" level.
Expected Behavior:
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
Creation and deletion undo/redo should also work.
Test Steps:
1) Create an HDRi Skybox with no components.
2) Add an HDRi Skybox component to HDRi Skybox.
3) UNDO the entity creation and component addition.
4) REDO the entity creation and component addition.
5) Enter/Exit game mode.
6) Test IsHidden.
7) Test IsVisible.
8) Delete HDRi Skybox.
9) UNDO deletion.
10) REDO deletion.
11) Look for errors.
:return: None
"""
import os
import azlmbr.legacy.general as general
from editor_python_test_tools.asset_utils import Asset
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper
from Atom.atom_utils.atom_constants import AtomComponentProperties
with Tracer() as error_tracer:
# Test setup begins.
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
TestHelper.init_idle()
TestHelper.open_level("", "Base")
# Test steps begin.
# 1. Create an HDRi Skybox with no components.
hdri_skybox_entity = EditorEntity.create_editor_entity(
AtomComponentProperties.hdri_skybox())
Report.critical_result(Tests.hdri_skybox_entity_creation,
hdri_skybox_entity.exists())
# 2. Add an HDRi Skybox component to HDRi Skybox.
hdri_skybox_component = hdri_skybox_entity.add_component(
AtomComponentProperties.hdri_skybox())
Report.critical_result(
Tests.hdri_skybox_component,
hdri_skybox_entity.has_component(AtomComponentProperties.hdri_skybox()))
# 3. UNDO the entity creation and component addition.
# -> UNDO component addition.
general.undo()
# -> UNDO naming entity.
general.undo()
# -> UNDO selecting entity.
general.undo()
# -> UNDO entity creation.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.creation_undo, not hdri_skybox_entity.exists())
# 4. REDO the entity creation and component addition.
# -> REDO entity creation.
general.redo()
# -> REDO selecting entity.
general.redo()
# -> REDO naming entity.
general.redo()
# -> REDO component addition.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, hdri_skybox_entity.exists())
# 5. Set Cubemap Texture on HDRi Skybox component.
skybox_cubemap_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
skybox_cubemap_material_asset = Asset.find_asset_by_path(skybox_cubemap_asset_path, False)
hdri_skybox_component.set_component_property_value(
AtomComponentProperties.hdri_skybox('Cubemap Texture'), skybox_cubemap_material_asset.id)
get_cubemap_property = hdri_skybox_component.get_component_property_value(
AtomComponentProperties.hdri_skybox('Cubemap Texture'))
Report.result(Tests.cubemap_property_set, get_cubemap_property == skybox_cubemap_material_asset.id)
# 6. Enter/Exit game mode.
TestHelper.enter_game_mode(Tests.enter_game_mode)
general.idle_wait_frames(1)
TestHelper.exit_game_mode(Tests.exit_game_mode)
# 7. Test IsHidden.
hdri_skybox_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, hdri_skybox_entity.is_hidden() is True)
# 8. Test IsVisible.
hdri_skybox_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, hdri_skybox_entity.is_visible() is True)
# 9. Delete hdri_skybox entity.
hdri_skybox_entity.delete()
Report.result(Tests.entity_deleted, not hdri_skybox_entity.exists())
# 10. UNDO deletion.
general.undo()
Report.result(Tests.deletion_undo, hdri_skybox_entity.exists())
# 11. REDO deletion.
general.redo()
Report.result(Tests.deletion_redo, not hdri_skybox_entity.exists())
# 12. Look for errors or asserts.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in error_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(AtomEditorComponents_HDRiSkybox_AddedToEntity)
@@ -0,0 +1,211 @@
"""
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
"""
class Tests:
creation_undo = (
"UNDO Entity creation success",
"UNDO Entity creation failed")
creation_redo = (
"REDO Entity creation success",
"REDO Entity creation failed")
look_modification_creation = (
"Look Modification Entity successfully created",
"Look Modification Entity failed to be created")
look_modification_component = (
"Entity has a Look Modification component",
"Entity failed to find Look Modification component")
look_modification_disabled = (
"Look Modification component disabled",
"Look Modification component was not disabled")
postfx_layer_component = (
"Entity has a PostFX Layer component",
"Entity did not have an PostFX Layer component")
look_modification_enabled = (
"Look Modification component enabled",
"Look Modification component was not enabled")
enable_look_modification_parameter_enabled = (
"Enable look modification parameter enabled",
"Enable look modification parameter was not enabled")
color_grading_lut_set = (
"Entity has the Color Grading LUT set",
"Entity did not the Color Grading LUT set")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
exit_game_mode = (
"Exited game mode",
"Couldn't exit game mode")
is_visible = (
"Entity is visible",
"Entity was not visible")
is_hidden = (
"Entity is hidden",
"Entity was not hidden")
entity_deleted = (
"Entity deleted",
"Entity was not deleted")
deletion_undo = (
"UNDO deletion success",
"UNDO deletion failed")
deletion_redo = (
"REDO deletion success",
"REDO deletion failed")
def AtomEditorComponents_LookModification_AddedToEntity():
"""
Summary:
Tests the Look Modification component can be added to an entity and has the expected functionality.
Test setup:
- Wait for Editor idle loop.
- Open the "Base" level.
Expected Behavior:
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
Creation and deletion undo/redo should also work.
Test Steps:
1) Create an Look Modification entity with no components.
2) Add Look Modification component to Look Modification entity.
3) UNDO the entity creation and component addition.
4) REDO the entity creation and component addition.
5) Verify Look Modification component not enabled.
6) Add PostFX Layer component since it is required by the Look Modification component.
7) Verify Look Modification component is enabled.
8) Enable the "Enable Look Modification" parameter.
9) Add LUT asset to the Color Grading LUT parameter.
9) Enter/Exit game mode.
10) Test IsHidden.
11) Test IsVisible.
12) Delete Look Modification entity.
13) UNDO deletion.
14) REDO deletion.
15) Look for errors.
:return: None
"""
import os
import azlmbr.legacy.general as general
from editor_python_test_tools.asset_utils import Asset
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper
from Atom.atom_utils.atom_constants import AtomComponentProperties
with Tracer() as error_tracer:
# Test setup begins.
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
TestHelper.init_idle()
TestHelper.open_level("", "Base")
# Test steps begin.
# 1. Create an Look Modification entity with no components.
look_modification_entity = EditorEntity.create_editor_entity(AtomComponentProperties.look_modification())
Report.critical_result(Tests.look_modification_creation, look_modification_entity.exists())
# 2. Add Look Modification component to Look Modification entity.
look_modification_component = look_modification_entity.add_component(
AtomComponentProperties.look_modification())
Report.critical_result(
Tests.look_modification_component,
look_modification_entity.has_component(AtomComponentProperties.look_modification()))
# 3. UNDO the entity creation and component addition.
# -> UNDO component addition.
general.undo()
# -> UNDO naming entity.
general.undo()
# -> UNDO selecting entity.
general.undo()
# -> UNDO entity creation.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.creation_undo, not look_modification_entity.exists())
# 4. REDO the entity creation and component addition.
# -> REDO entity creation.
general.redo()
# -> REDO selecting entity.
general.redo()
# -> REDO naming entity.
general.redo()
# -> REDO component addition.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, look_modification_entity.exists())
# 5. Verify Look Modification component not enabled.
Report.result(Tests.look_modification_disabled, not look_modification_component.is_enabled())
# 6. Add PostFX Layer component since it is required by the Look Modification component.
look_modification_entity.add_component(AtomComponentProperties.postfx_layer())
Report.result(
Tests.postfx_layer_component,
look_modification_entity.has_component(AtomComponentProperties.postfx_layer()))
# 7. Verify Look Modification component is enabled.
Report.result(Tests.look_modification_enabled, look_modification_component.is_enabled())
# 8. Enable the "Enable look modification" parameter.
look_modification_component.set_component_property_value(
AtomComponentProperties.look_modification('Enable look modification'), True)
Report.result(Tests.enable_look_modification_parameter_enabled,
look_modification_component.get_component_property_value(
AtomComponentProperties.look_modification('Enable look modification')) is True)
# 9. Set the Color Grading LUT asset on the Look Modification entity.
color_grading_lut_path = os.path.join("ColorGrading", "TestData", "Photoshop", "inv-Log2-48nits",
"test_3dl_32_lut.azasset")
color_grading_lut_asset = Asset.find_asset_by_path(color_grading_lut_path, False)
look_modification_component.set_component_property_value(
AtomComponentProperties.look_modification('Color Grading LUT'), color_grading_lut_asset.id)
Report.result(
Tests.color_grading_lut_set,
color_grading_lut_asset.id == look_modification_component.get_component_property_value(
AtomComponentProperties.look_modification('Color Grading LUT')))
# 10. Enter/Exit game mode.
TestHelper.enter_game_mode(Tests.enter_game_mode)
general.idle_wait_frames(1)
TestHelper.exit_game_mode(Tests.exit_game_mode)
# 11. Test IsHidden.
look_modification_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, look_modification_entity.is_hidden() is True)
# 12. Test IsVisible.
look_modification_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, look_modification_entity.is_visible() is True)
# 13. Delete Look Modification entity.
look_modification_entity.delete()
Report.result(Tests.entity_deleted, not look_modification_entity.exists())
# 14. UNDO deletion.
general.undo()
Report.result(Tests.deletion_undo, look_modification_entity.exists())
# 15. REDO deletion.
general.redo()
Report.result(Tests.deletion_redo, not look_modification_entity.exists())
# 16. Look for errors and asserts.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in error_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(AtomEditorComponents_LookModification_AddedToEntity)
@@ -6,30 +6,70 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# fmt: off
class Tests :
camera_component_added = ("Camera component was added", "Camera component wasn't added")
camera_fov_set = ("Camera component FOV property set", "Camera component FOV property wasn't set")
directional_light_component_added = ("Directional Light component added", "Directional Light component wasn't added")
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
global_skylight_component_added = ("Global Skylight (IBL) component added", "Global Skylight (IBL) component wasn't added")
global_skylight_diffuse_image_set = ("Global Skylight Diffuse Image property set", "Global Skylight Diffuse Image property wasn't set")
global_skylight_specular_image_set = ("Global Skylight Specular Image property set", "Global Skylight Specular Image property wasn't set")
ground_plane_material_asset_set = ("Ground Plane Material Asset was set", "Ground Plane Material Asset wasn't set")
ground_plane_material_component_added = ("Ground Plane Material component added", "Ground Plane Material component wasn't added")
ground_plane_mesh_asset_set = ("Ground Plane Mesh Asset property was set", "Ground Plane Mesh Asset property wasn't set")
hdri_skybox_component_added = ("HDRi Skybox component added", "HDRi Skybox component wasn't added")
hdri_skybox_cubemap_texture_set = ("HDRi Skybox Cubemap Texture property set", "HDRi Skybox Cubemap Texture property wasn't set")
mesh_component_added = ("Mesh component added", "Mesh component wasn't added")
no_assert_occurred = ("No asserts detected", "Asserts were detected")
no_error_occurred = ("No errors detected", "Errors were detected")
secondary_grid_spacing = ("Secondary Grid Spacing set", "Secondary Grid Spacing not set")
sphere_material_component_added = ("Sphere Material component added", "Sphere Material component wasn't added")
sphere_material_set = ("Sphere Material Asset was set", "Sphere Material Asset wasn't set")
sphere_mesh_asset_set = ("Sphere Mesh Asset was set", "Sphere Mesh Asset wasn't set")
viewport_set = ("Viewport set to correct size", "Viewport not set to correct size")
# fmt: on
class Tests:
camera_component_added = (
"Camera component was added",
"Camera component wasn't added")
camera_fov_set = (
"Camera component FOV property set",
"Camera component FOV property wasn't set")
directional_light_component_added = (
"Directional Light component added",
"Directional Light component wasn't added")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
exit_game_mode = (
"Exited game mode",
"Couldn't exit game mode")
global_skylight_component_added = (
"Global Skylight (IBL) component added",
"Global Skylight (IBL) component wasn't added")
global_skylight_diffuse_image_set = (
"Global Skylight Diffuse Image property set",
"Global Skylight Diffuse Image property wasn't set")
global_skylight_specular_image_set = (
"Global Skylight Specular Image property set",
"Global Skylight Specular Image property wasn't set")
ground_plane_material_asset_set = (
"Ground Plane Material Asset was set",
"Ground Plane Material Asset wasn't set")
ground_plane_material_component_added = (
"Ground Plane Material component added",
"Ground Plane Material component wasn't added")
ground_plane_mesh_asset_set = (
"Ground Plane Mesh Asset property was set",
"Ground Plane Mesh Asset property wasn't set")
hdri_skybox_component_added = (
"HDRi Skybox component added",
"HDRi Skybox component wasn't added")
hdri_skybox_cubemap_texture_set = (
"HDRi Skybox Cubemap Texture property set",
"HDRi Skybox Cubemap Texture property wasn't set")
mesh_component_added = (
"Mesh component added",
"Mesh component wasn't added")
no_assert_occurred = (
"No asserts detected",
"Asserts were detected")
no_error_occurred = (
"No errors detected",
"Errors were detected")
secondary_grid_spacing = (
"Secondary Grid Spacing set",
"Secondary Grid Spacing not set")
sphere_material_component_added = (
"Sphere Material component added",
"Sphere Material component wasn't added")
sphere_material_set = (
"Sphere Material Asset was set",
"Sphere Material Asset wasn't set")
sphere_mesh_asset_set = (
"Sphere Mesh Asset was set",
"Sphere Mesh Asset wasn't set")
viewport_set = (
"Viewport set to correct size",
"Viewport not set to correct size")
def AtomGPU_BasicLevelSetup_SetsUpLevel():
@@ -77,19 +117,17 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
import os
from math import isclose
import azlmbr.asset as asset
import azlmbr.bus as bus
import azlmbr.legacy.general as general
import azlmbr.math as math
import azlmbr.paths
from editor_python_test_tools.asset_utils import Asset
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper as helper
from editor_python_test_tools.utils import Report, Tracer, TestHelper
from Atom.atom_utils.atom_constants import AtomComponentProperties
from Atom.atom_utils.screenshot_utils import ScreenshotHelper
MATERIAL_COMPONENT_NAME = "Material"
MESH_COMPONENT_NAME = "Mesh"
SCREENSHOT_NAME = "AtomBasicLevelSetup"
SCREEN_WIDTH = 1280
SCREEN_HEIGHT = 720
@@ -98,24 +136,24 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
def initial_viewport_setup(screen_width, screen_height):
general.set_viewport_size(screen_width, screen_height)
general.update_viewport()
result = isclose(
a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) and isclose(
a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1)
return result
TestHelper.wait_for_condition(
function=lambda: isclose(a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1)
and isclose(a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1),
timeout_in_seconds=4.0
)
with Tracer() as error_tracer:
# Test setup begins.
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
helper.init_idle()
helper.open_level("", "Base")
TestHelper.init_idle()
TestHelper.open_level("", "Base")
# Test steps begin.
# 1. Close error windows and display helpers then update the viewport size.
helper.close_error_windows()
helper.close_display_helpers()
TestHelper.close_error_windows()
TestHelper.close_display_helpers()
initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT)
general.update_viewport()
Report.critical_result(Tests.viewport_set, initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT))
# 2. Create Default Level Entity.
default_level_entity_name = "Default Level"
@@ -123,168 +161,167 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
math.Vector3(0.0, 0.0, 0.0), default_level_entity_name)
# 3. Create Grid Entity as a child entity of the Default Level Entity.
grid_name = "Grid"
grid_entity = EditorEntity.create_editor_entity(grid_name, default_level_entity.id)
grid_entity = EditorEntity.create_editor_entity(AtomComponentProperties.grid(), default_level_entity.id)
# 4. Add Grid component to Grid Entity and set Secondary Grid Spacing.
grid_component = grid_entity.add_component(grid_name)
secondary_grid_spacing_property = "Controller|Configuration|Secondary Grid Spacing"
grid_component = grid_entity.add_component(AtomComponentProperties.grid())
secondary_grid_spacing_value = 1.0
grid_component.set_component_property_value(secondary_grid_spacing_property, secondary_grid_spacing_value)
grid_component.set_component_property_value(
AtomComponentProperties.grid('Secondary Grid Spacing'), secondary_grid_spacing_value)
secondary_grid_spacing_set = grid_component.get_component_property_value(
secondary_grid_spacing_property) == secondary_grid_spacing_value
AtomComponentProperties.grid('Secondary Grid Spacing')) == secondary_grid_spacing_value
Report.result(Tests.secondary_grid_spacing, secondary_grid_spacing_set)
# 5. Create Global Skylight (IBL) Entity as a child entity of the Default Level Entity.
global_skylight_name = "Global Skylight (IBL)"
global_skylight_entity = EditorEntity.create_editor_entity(global_skylight_name, default_level_entity.id)
global_skylight_entity = EditorEntity.create_editor_entity(
AtomComponentProperties.global_skylight(), default_level_entity.id)
# 6. Add HDRi Skybox component to the Global Skylight (IBL) Entity.
hdri_skybox_name = "HDRi Skybox"
hdri_skybox_component = global_skylight_entity.add_component(hdri_skybox_name)
Report.result(Tests.hdri_skybox_component_added, global_skylight_entity.has_component(hdri_skybox_name))
hdri_skybox_component = global_skylight_entity.add_component(AtomComponentProperties.hdri_skybox())
Report.result(Tests.hdri_skybox_component_added, global_skylight_entity.has_component(
AtomComponentProperties.hdri_skybox()))
# 7. Add Global Skylight (IBL) component to the Global Skylight (IBL) Entity.
global_skylight_component = global_skylight_entity.add_component(global_skylight_name)
Report.result(Tests.global_skylight_component_added, global_skylight_entity.has_component(global_skylight_name))
global_skylight_component = global_skylight_entity.add_component(AtomComponentProperties.global_skylight())
Report.result(Tests.global_skylight_component_added, global_skylight_entity.has_component(
AtomComponentProperties.global_skylight()))
# 8. Set the Cubemap Texture property of the HDRi Skybox component.
global_skylight_image_asset_path = os.path.join(
"LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage")
global_skylight_image_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", global_skylight_image_asset_path, math.Uuid(), False)
hdri_skybox_cubemap_texture_property = "Controller|Configuration|Cubemap Texture"
global_skylight_image_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
global_skylight_image_asset = Asset.find_asset_by_path(global_skylight_image_asset_path, False)
hdri_skybox_component.set_component_property_value(
hdri_skybox_cubemap_texture_property, global_skylight_image_asset)
AtomComponentProperties.hdri_skybox('Cubemap Texture'), global_skylight_image_asset.id)
Report.result(
Tests.hdri_skybox_cubemap_texture_set,
hdri_skybox_component.get_component_property_value(
hdri_skybox_cubemap_texture_property) == global_skylight_image_asset)
AtomComponentProperties.hdri_skybox('Cubemap Texture')) == global_skylight_image_asset.id)
# 9. Set the Diffuse Image property of the Global Skylight (IBL) component.
# Re-use the same image that was used in the previous test step.
global_skylight_diffuse_image_property = "Controller|Configuration|Diffuse Image"
global_skylight_diffuse_image_asset_path = os.path.join(
"LightingPresets", "default_iblskyboxcm_ibldiffuse.exr.streamingimage")
global_skylight_diffuse_image_asset = Asset.find_asset_by_path(global_skylight_diffuse_image_asset_path, False)
global_skylight_component.set_component_property_value(
global_skylight_diffuse_image_property, global_skylight_image_asset)
AtomComponentProperties.global_skylight('Diffuse Image'), global_skylight_diffuse_image_asset.id)
Report.result(
Tests.global_skylight_diffuse_image_set,
global_skylight_component.get_component_property_value(
global_skylight_diffuse_image_property) == global_skylight_image_asset)
AtomComponentProperties.global_skylight('Diffuse Image')) == global_skylight_diffuse_image_asset.id)
# 10. Set the Specular Image property of the Global Skylight (IBL) component.
# Re-use the same image that was used in the previous test step.
global_skylight_specular_image_property = "Controller|Configuration|Specular Image"
global_skylight_specular_image_asset_path = os.path.join(
"LightingPresets", "default_iblskyboxcm_iblspecular.exr.streamingimage")
global_skylight_specular_image_asset = Asset.find_asset_by_path(
global_skylight_specular_image_asset_path, False)
global_skylight_component.set_component_property_value(
global_skylight_specular_image_property, global_skylight_image_asset)
AtomComponentProperties.global_skylight('Specular Image'), global_skylight_specular_image_asset.id)
global_skylight_specular_image_set = global_skylight_component.get_component_property_value(
global_skylight_specular_image_property)
AtomComponentProperties.global_skylight('Specular Image'))
Report.result(
Tests.global_skylight_specular_image_set, global_skylight_specular_image_set == global_skylight_image_asset)
Tests.global_skylight_specular_image_set,
global_skylight_specular_image_set == global_skylight_specular_image_asset.id)
# 11. Create a Ground Plane Entity with a Material component that is a child entity of the Default Level Entity.
ground_plane_name = "Ground Plane"
ground_plane_entity = EditorEntity.create_editor_entity(ground_plane_name, default_level_entity.id)
ground_plane_material_component = ground_plane_entity.add_component(MATERIAL_COMPONENT_NAME)
ground_plane_material_component = ground_plane_entity.add_component(AtomComponentProperties.material())
Report.result(
Tests.ground_plane_material_component_added, ground_plane_entity.has_component(MATERIAL_COMPONENT_NAME))
Tests.ground_plane_material_component_added,
ground_plane_entity.has_component(AtomComponentProperties.material()))
# 12. Set the Material Asset property of the Material component for the Ground Plane Entity.
ground_plane_entity.set_local_uniform_scale(32.0)
ground_plane_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_chrome.azmaterial")
ground_plane_material_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", ground_plane_material_asset_path, math.Uuid(), False)
ground_plane_material_asset_property = "Default Material|Material Asset"
ground_plane_material_asset = Asset.find_asset_by_path(ground_plane_material_asset_path, False)
ground_plane_material_component.set_component_property_value(
ground_plane_material_asset_property, ground_plane_material_asset)
AtomComponentProperties.material('Material Asset'), ground_plane_material_asset.id)
Report.result(
Tests.ground_plane_material_asset_set,
ground_plane_material_component.get_component_property_value(
ground_plane_material_asset_property) == ground_plane_material_asset)
AtomComponentProperties.material('Material Asset')) == ground_plane_material_asset.id)
# 13. Add the Mesh component to the Ground Plane Entity and set the Mesh component Mesh Asset property.
ground_plane_mesh_component = ground_plane_entity.add_component(MESH_COMPONENT_NAME)
Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(MESH_COMPONENT_NAME))
ground_plane_mesh_asset_path = os.path.join("Objects", "plane.azmodel")
ground_plane_mesh_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", ground_plane_mesh_asset_path, math.Uuid(), False)
ground_plane_mesh_asset_property = "Controller|Configuration|Mesh Asset"
ground_plane_mesh_component = ground_plane_entity.add_component(AtomComponentProperties.mesh())
Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(AtomComponentProperties.mesh()))
ground_plane_mesh_asset_path = os.path.join("TestData", "Objects", "plane.azmodel")
ground_plane_mesh_asset = Asset.find_asset_by_path(ground_plane_mesh_asset_path, False)
ground_plane_mesh_component.set_component_property_value(
ground_plane_mesh_asset_property, ground_plane_mesh_asset)
AtomComponentProperties.mesh('Mesh Asset'), ground_plane_mesh_asset.id)
Report.result(
Tests.ground_plane_mesh_asset_set,
ground_plane_mesh_component.get_component_property_value(
ground_plane_mesh_asset_property) == ground_plane_mesh_asset)
AtomComponentProperties.mesh('Mesh Asset')) == ground_plane_mesh_asset.id)
# 14. Create a Directional Light Entity as a child entity of the Default Level Entity.
directional_light_name = "Directional Light"
directional_light_entity = EditorEntity.create_editor_entity_at(
math.Vector3(0.0, 0.0, 10.0), directional_light_name, default_level_entity.id)
math.Vector3(0.0, 0.0, 10.0), AtomComponentProperties.directional_light(), default_level_entity.id)
# 15. Add Directional Light component to Directional Light Entity and set entity rotation.
directional_light_entity.add_component(directional_light_name)
directional_light_entity.add_component(AtomComponentProperties.directional_light())
directional_light_entity_rotation = math.Vector3(DEGREE_RADIAN_FACTOR * -90.0, 0.0, 0.0)
directional_light_entity.set_local_rotation(directional_light_entity_rotation)
Report.result(
Tests.directional_light_component_added, directional_light_entity.has_component(directional_light_name))
Tests.directional_light_component_added, directional_light_entity.has_component(
AtomComponentProperties.directional_light()))
# 16. Create a Sphere Entity as a child entity of the Default Level Entity then add a Material component.
sphere_entity = EditorEntity.create_editor_entity_at(
math.Vector3(0.0, 0.0, 1.0), "Sphere", default_level_entity.id)
sphere_material_component = sphere_entity.add_component(MATERIAL_COMPONENT_NAME)
Report.result(Tests.sphere_material_component_added, sphere_entity.has_component(MATERIAL_COMPONENT_NAME))
sphere_material_component = sphere_entity.add_component(AtomComponentProperties.material())
Report.result(Tests.sphere_material_component_added, sphere_entity.has_component(
AtomComponentProperties.material()))
# 17. Set the Material Asset property of the Material component for the Sphere Entity.
sphere_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_brass_polished.azmaterial")
sphere_material_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", sphere_material_asset_path, math.Uuid(), False)
sphere_material_asset_property = "Default Material|Material Asset"
sphere_material_component.set_component_property_value(sphere_material_asset_property, sphere_material_asset)
sphere_material_asset = Asset.find_asset_by_path(sphere_material_asset_path, False)
sphere_material_component.set_component_property_value(
AtomComponentProperties.material('Material Asset'), sphere_material_asset.id)
Report.result(Tests.sphere_material_set, sphere_material_component.get_component_property_value(
sphere_material_asset_property) == sphere_material_asset)
AtomComponentProperties.material('Material Asset')) == sphere_material_asset.id)
# 18. Add Mesh component to Sphere Entity and set the Mesh Asset property for the Mesh component.
sphere_mesh_component = sphere_entity.add_component(MESH_COMPONENT_NAME)
sphere_mesh_component = sphere_entity.add_component(AtomComponentProperties.mesh())
sphere_mesh_asset_path = os.path.join("Models", "sphere.azmodel")
sphere_mesh_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", sphere_mesh_asset_path, math.Uuid(), False)
sphere_mesh_asset_property = "Controller|Configuration|Mesh Asset"
sphere_mesh_component.set_component_property_value(sphere_mesh_asset_property, sphere_mesh_asset)
sphere_mesh_asset = Asset.find_asset_by_path(sphere_mesh_asset_path, False)
sphere_mesh_component.set_component_property_value(
AtomComponentProperties.mesh('Mesh Asset'), sphere_mesh_asset.id)
Report.result(Tests.sphere_mesh_asset_set, sphere_mesh_component.get_component_property_value(
sphere_mesh_asset_property) == sphere_mesh_asset)
AtomComponentProperties.mesh('Mesh Asset')) == sphere_mesh_asset.id)
# 19. Create a Camera Entity as a child entity of the Default Level Entity then add a Camera component.
camera_name = "Camera"
camera_entity = EditorEntity.create_editor_entity_at(
math.Vector3(5.5, -12.0, 9.0), camera_name, default_level_entity.id)
camera_component = camera_entity.add_component(camera_name)
Report.result(Tests.camera_component_added, camera_entity.has_component(camera_name))
math.Vector3(5.5, -12.0, 9.0), AtomComponentProperties.camera(), default_level_entity.id)
camera_component = camera_entity.add_component(AtomComponentProperties.camera())
Report.result(Tests.camera_component_added, camera_entity.has_component(AtomComponentProperties.camera()))
# 20. Set the Camera Entity rotation value and set the Camera component Field of View value.
camera_entity_rotation = math.Vector3(
DEGREE_RADIAN_FACTOR * -27.0, DEGREE_RADIAN_FACTOR * -12.0, DEGREE_RADIAN_FACTOR * 25.0)
camera_entity.set_local_rotation(camera_entity_rotation)
camera_fov_property = "Controller|Configuration|Field of view"
camera_fov_value = 60.0
camera_component.set_component_property_value(camera_fov_property, camera_fov_value)
camera_component.set_component_property_value(AtomComponentProperties.camera('Field of view'), camera_fov_value)
azlmbr.camera.EditorCameraViewRequestBus(azlmbr.bus.Event, "ToggleCameraAsActiveView", camera_entity.id)
Report.result(Tests.camera_fov_set, camera_component.get_component_property_value(
camera_fov_property) == camera_fov_value)
AtomComponentProperties.camera('Field of view')) == camera_fov_value)
# 21. Enter game mode.
helper.enter_game_mode(Tests.enter_game_mode)
helper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0)
TestHelper.enter_game_mode(Tests.enter_game_mode)
TestHelper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0)
# 22. Take screenshot.
ScreenshotHelper(general.idle_wait_frames).capture_screenshot_blocking(f"{SCREENSHOT_NAME}.ppm")
# 23. Exit game mode.
helper.exit_game_mode(Tests.exit_game_mode)
helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0)
TestHelper.exit_game_mode(Tests.exit_game_mode)
TestHelper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0)
# 24. Look for errors.
helper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
Report.result(Tests.no_assert_occurred, not error_tracer.has_asserts)
Report.result(Tests.no_error_occurred, not error_tracer.has_errors)
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in error_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
@@ -106,8 +106,7 @@ def run():
components=["HDRi Skybox", "Global Skylight (IBL)"],
parent_id=default_level.id
)
global_skylight_image_asset_path = os.path.join(
"LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage")
global_skylight_image_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage")
global_skylight_image_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", global_skylight_image_asset_path, math.Uuid(), False)
global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_image_asset)
@@ -23,28 +23,28 @@ from base import TestAutomationBase
class TestAutomation(TestAutomationBase):
def test_ActorSplitsAfterCollision(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterCollision as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ActorSplitsAfterRadialDamage(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterRadialDamage as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ActorSplitsAfterCapsuleDamage(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterCapsuleDamage as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ActorSplitsAfterImpactSpreadDamage(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterImpactSpreadDamage as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ActorSplitsAfterShearDamage(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterShearDamage as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ActorSplitsAfterTriangleDamage(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterTriangleDamage as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ActorSplitsAfterStressDamage(self, request, workspace, editor, launcher_platform):
from .tests import Blast_ActorSplitsAfterStressDamage as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@@ -56,6 +56,9 @@ add_subdirectory(streaming)
## Smoke ##
add_subdirectory(smoke)
## Terrain ##
add_subdirectory(Terrain)
## AWS ##
add_subdirectory(AWS)
@@ -51,5 +51,6 @@ class TestComponentAssetListAutomation(object):
editor,
"ComponentUpdateListProperty_test_case.py",
expected_lines=expected_lines,
cfg_args=[level]
cfg_args=[level],
enable_prefab_system=False,
)
@@ -67,30 +67,6 @@ if (editor.EditorToolsApplicationRequestBus(bus.Broadcast, 'GetCurrentLevelName'
if(general.get_num_selected() == 0):
print("clear_selection works")
general.hide_all_objects()
if(general.is_object_hidden(objs_list[1])):
print("hide_all_objects works")
general.unhide_object(objs_list[1])
if not(general.is_object_hidden(objs_list[1])):
print("unhide_object works")
general.hide_object(objs_list[1])
if(general.is_object_hidden(objs_list[1])):
print("hide_object works")
general.unhide_all_objects()
general.freeze_object(objs_list[1])
if(general.is_object_frozen(objs_list[1])):
print("freeze_object works")
general.unfreeze_object(objs_list[1])
position = general.get_position(objs_list[1])
px1, py1, pz1 = fetch_vector3_parts(position)
general.set_position(objs_list[1], px1 + 10, py1 - 4, pz1 + 3)
@@ -26,9 +26,9 @@ INSTALL
It is recommended to set up these these tools with O3DE's CMake build commands.
Assuming CMake is already setup on your operating system, below are some sample build commands:
cd /path/to/od3e/
mkdir windows_vs2019
cd windows_vs2019
cmake .. -G "Visual Studio 16 2019" -A x64 -T host=x64 -DLY_3RDPARTY_PATH="%3RDPARTYPATH%" -DLY_PROJECTS=AutomatedTesting
mkdir windows
cd windows
cmake .. -G "Visual Studio 16 2019" -DLY_PROJECTS=AutomatedTesting
To manually install the project in development mode using your own installed Python interpreter:
cd /path/to/od3e/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools
@@ -132,6 +132,7 @@ class EditorEntity:
def __init__(self, id: azlmbr.entity.EntityId):
self.id: azlmbr.entity.EntityId = id
self.components: List[EditorComponent] = []
# Creation functions
@classmethod
@@ -279,7 +280,7 @@ class EditorEntity:
), f"Failure: Could not add component: '{new_comp.get_component_name()}' to entity: '{self.get_name()}'"
new_comp.id = add_component_outcome.GetValue()[0]
components.append(new_comp)
self.components.append(new_comp)
return components
def get_components_of_type(self, component_names: list) -> List[EditorComponent]:
@@ -458,3 +459,14 @@ class EditorEntity:
"""
new_translation = convert_to_azvector3(new_translation)
azlmbr.components.TransformBus(azlmbr.bus.Event, "SetLocalTranslation", self.id, new_translation)
# Use this only when prefab system is enabled as it will fail otherwise.
def focus_on_owning_prefab(self) -> None:
"""
Focuses on the owning prefab instance of the given entity.
:param entity: The entity used to fetch the owning prefab to focus on.
"""
assert self.id.isValid(), "A valid entity id is required to focus on its owning prefab."
focus_prefab_result = azlmbr.prefab.PrefabFocusPublicRequestBus(bus.Broadcast, "FocusOnOwningPrefab", self.id)
assert focus_prefab_result.IsSuccess(), f"Prefab operation 'FocusOnOwningPrefab' failed. Error: {focus_prefab_result.GetError()}"
@@ -57,6 +57,10 @@ def add_level_component(component_name):
level_component_list, entity.EntityType().Level)
level_component_outcome = editor.EditorLevelComponentAPIBus(bus.Broadcast, 'AddComponentsOfType',
[level_component_type_ids_list[0]])
if not level_component_outcome.IsSuccess():
print('Failed to add {} level component'.format(component_name))
return None
level_component = level_component_outcome.GetValue()[0]
return level_component
@@ -29,7 +29,7 @@ def teardown_editor(editor):
def launch_and_validate_results(request, test_directory, editor, editor_script, expected_lines, unexpected_lines=[],
halt_on_unexpected=False, run_python="--runpythontest", auto_test_mode=True, null_renderer=True, cfg_args=[],
timeout=300, log_file_name="Editor.log"):
timeout=300, log_file_name="Editor.log", enable_prefab_system=True):
"""
Runs the Editor with the specified script, and monitors for expected log lines.
:param request: Special fixture providing information of the requesting test function.
@@ -45,17 +45,22 @@ def launch_and_validate_results(request, test_directory, editor, editor_script,
:param cfg_args: Additional arguments for CFG, such as LevelName.
:param timeout: Length of time for test to run. Default is 60.
:param log_file_name: Name of the log file created by the editor. Defaults to 'Editor.log'
:param enable_prefab_system: Flag to determine whether to use new prefab system or use deprecated slice system. Defaults to True.
"""
test_case = os.path.join(test_directory, editor_script)
request.addfinalizer(lambda: teardown_editor(editor))
logger.debug("Running automated test: {}".format(editor_script))
editor.args.extend(["--skipWelcomeScreenDialog", "--regset=/Amazon/Settings/EnableSourceControl=false",
"--regset=/Amazon/Preferences/EnablePrefabSystem=false", run_python, test_case,
run_python, test_case,
f"--pythontestcase={request.node.name}", "--runpythonargs", " ".join(cfg_args)])
if auto_test_mode:
editor.args.extend(["--autotest_mode"])
if null_renderer:
editor.args.extend(["-rhi=Null"])
if enable_prefab_system:
editor.args.extend(["--regset=/Amazon/Preferences/EnablePrefabSystem=true"])
else:
editor.args.extend(["--regset=/Amazon/Preferences/EnablePrefabSystem=false"])
with editor.start():
@@ -34,6 +34,38 @@ class TestHelper:
# JIRA: SPEC-2880
# general.idle_wait_frames(1)
@staticmethod
def create_level(level_name: str) -> bool:
"""
:param level_name: The name of the level to be created
:return: True if ECreateLevelResult returns 0, False otherwise with logging to report reason
"""
Report.info(f"Creating level {level_name}")
# Use these hardcoded values to pass expected values for old terrain system until new create_level API is
# available
heightmap_resolution = 1024
heightmap_meters_per_pixel = 1
terrain_texture_resolution = 4096
use_terrain = False
result = general.create_level_no_prompt(level_name, heightmap_resolution, heightmap_meters_per_pixel,
terrain_texture_resolution, use_terrain)
# Result codes are ECreateLevelResult defined in CryEdit.h
if result == 1:
Report.info(f"{level_name} level already exists")
elif result == 2:
Report.info("Failed to create directory")
elif result == 3:
Report.info("Directory length is too long")
elif result != 0:
Report.info("Unknown error, failed to create level")
else:
Report.info(f"{level_name} level created successfully")
return result == 0
@staticmethod
def open_level(directory : str, level : str):
# type: (str, str) -> None
@@ -23,7 +23,6 @@ from base import TestAutomationBase
class TestAutomation(TestAutomationBase):
def _run_prefab_test(self, request, workspace, editor, test_module, batch_mode=True, autotest_mode=True):
self._run_test(request, workspace, editor, test_module,
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"],
batch_mode=batch_mode,
autotest_mode=autotest_mode)
@@ -24,7 +24,6 @@ from base import TestAutomationBase
class TestAutomation(TestAutomationBase):
def _run_prefab_test(self, request, workspace, editor, test_module, batch_mode=True, autotest_mode=True):
self._run_test(request, workspace, editor, test_module,
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"],
batch_mode=batch_mode,
autotest_mode=autotest_mode)
@@ -25,8 +25,8 @@ class TestAutomation(TestAutomationBase):
def test_NvCloth_AddClothSimulationToMesh(self, request, workspace, editor, launcher_platform):
from .tests import NvCloth_AddClothSimulationToMesh as test_module
self._run_test(request, workspace, editor, test_module, use_null_renderer = self.use_null_renderer)
self._run_test(request, workspace, editor, test_module, use_null_renderer = self.use_null_renderer, enable_prefab_system=False)
def test_NvCloth_AddClothSimulationToActor(self, request, workspace, editor, launcher_platform):
from .tests import NvCloth_AddClothSimulationToActor as test_module
self._run_test(request, workspace, editor, test_module, use_null_renderer = self.use_null_renderer)
self._run_test(request, workspace, editor, test_module, use_null_renderer = self.use_null_renderer, enable_prefab_system=False)
@@ -26,158 +26,158 @@ class TestAutomation(TestAutomationBase):
r"AutomatedTesting\Levels\Physics\Material_LibraryCrudOperationsReflectOnRagdollBones")
def test_Material_LibraryCrudOperationsReflectOnRagdollBones(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryCrudOperationsReflectOnRagdollBones as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Material_RagdollBones(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_RagdollBones as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("c15308221_material_componentsinsyncwithlibrary.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_ComponentsInSyncWithLibrary")
def test_Material_ComponentsInSyncWithLibrary(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_ComponentsInSyncWithLibrary as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# BUG: LY-107723")
def test_ScriptCanvas_SetKinematicTargetTransform(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_SetKinematicTargetTransform as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Failing, PhysXTerrain
@fm.file_revert("c4925579_material_addmodifydeleteonterrain.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_LibraryCrudOperationsReflectOnTerrain")
def test_Material_LibraryCrudOperationsReflectOnTerrain(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryCrudOperationsReflectOnTerrain as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Failing, PhysXTerrain
def test_Terrain_TerrainTexturePainterWorks(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_TerrainTexturePainterWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Failing, PhysXTerrain
def test_Material_CanBeAssignedToTerrain(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_CanBeAssignedToTerrain as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Failing, PhysXTerrain
def test_Material_DefaultLibraryConsistentOnAllFeatures(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_DefaultLibraryConsistentOnAllFeatures as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Failing, PhysXTerrain
@fm.file_revert("all_ones_1.physmaterial", r"AutomatedTesting\Levels\Physics\Material_DefaultMaterialLibraryChangesWork")
@fm.file_override("default.physxconfiguration", "Material_DefaultMaterialLibraryChangesWork.physxconfiguration", "AutomatedTesting")
def test_Material_DefaultMaterialLibraryChangesWork(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_DefaultMaterialLibraryChangesWork as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Collider_SameCollisionGroupSameLayerCollide(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_SameCollisionGroupSameLayerCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Ragdoll_OldRagdollSerializationNoErrors(self, request, workspace, editor, launcher_platform):
from .tests.ragdoll import Ragdoll_OldRagdollSerializationNoErrors as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_override("default.physxconfiguration", "ScriptCanvas_OverlapNode.physxconfiguration")
def test_ScriptCanvas_OverlapNode(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_OverlapNode as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Material_StaticFriction(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_StaticFriction as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("c4888315_material_addmodifydeleteoncollider.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_LibraryCrudOperationsReflectOnCollider")
def test_Material_LibraryCrudOperationsReflectOnCollider(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryCrudOperationsReflectOnCollider as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("c15563573_material_addmodifydeleteoncharactercontroller.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_LibraryCrudOperationsReflectOnCharacterController")
def test_Material_LibraryCrudOperationsReflectOnCharacterController(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryCrudOperationsReflectOnCharacterController as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("c4888315_material_addmodifydeleteoncollider.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_LibraryCrudOperationsReflectOnCollider")
def test_Material_LibraryCrudOperationsReflectOnCollider(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryCrudOperationsReflectOnCollider as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("c15563573_material_addmodifydeleteoncharactercontroller.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_LibraryCrudOperationsReflectOnCharacterController")
def test_Material_LibraryCrudOperationsReflectOnCharacterController(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryCrudOperationsReflectOnCharacterController as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("c4044455_material_librarychangesinstantly.physmaterial",
r"AutomatedTesting\Levels\Physics\C4044455_Material_LibraryChangesInstantly")
def test_Material_LibraryChangesReflectInstantly(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryChangesReflectInstantly as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@fm.file_revert("Material_LibraryUpdatedAcrossLevels.physmaterial",
r"AutomatedTesting\Levels\Physics\Material_LibraryUpdatedAcrossLevels")
def test_Material_LibraryUpdatedAcrossLevels(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryUpdatedAcrossLevels as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_RigidBody_LinearDampingAffectsMotion(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_LinearDampingAffectsMotion as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_CollisionAgainstRigidBody(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_CollisionAgainstRigidBody as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ShapeCollider_CylinderShapeCollides(self, request, workspace, editor, launcher_platform):
from .tests.collider import ShapeCollider_CylinderShapeCollides as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Physics_WorldBodyBusWorksOnEditorComponents(self, request, workspace, editor, launcher_platform):
from .tests import Physics_WorldBodyBusWorksOnEditorComponents as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Collider_PxMeshErrorIfNoMesh(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_PxMeshErrorIfNoMesh as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_ImpulsesBoxShapedRigidBody(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ImpulsesBoxShapedRigidBody as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_SpawnSecondTerrainComponentWarning(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_SpawnSecondTerrainComponentWarning as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_AddPhysTerrainComponent(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_AddPhysTerrainComponent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_CanAddMultipleTerrainComponents(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_CanAddMultipleTerrainComponents as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_MultipleTerrainComponentsWarning(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_MultipleTerrainComponentsWarning as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_MultipleTerrainComponentsWarning(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_MultipleTerrainComponentsWarning as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_HighValuesDirectionAxesWorkWithNoError(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_HighValuesDirectionAxesWorkWithNoError as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Terrain_MultipleResolutionsValid(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_MultipleResolutionsValid as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_SmallMagnitudeDeviationOnLargeForces(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_SmallMagnitudeDeviationOnLargeForces as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@@ -30,33 +30,33 @@ class TestAutomation(TestAutomationBase):
def test_RigidBody_EnablingGravityWorksUsingNotificationsPoC(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_EnablingGravityWorksUsingNotificationsPoC as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_LocalSpaceForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_LocalSpaceForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_DynamicFriction.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_DynamicFriction(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_DynamicFriction as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_SameCollisionGroupDiffLayersCollide(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_SameCollisionGroupDiffLayersCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_CharacterController_SwitchLevels(self, request, workspace, editor, launcher_platform):
from .tests.character_controller import CharacterController_SwitchLevels as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Ragdoll_AddPhysxRagdollComponentWorks(self, request, workspace, editor, launcher_platform):
from .tests.ragdoll import Ragdoll_AddPhysxRagdollComponentWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ScriptCanvas_MultipleRaycastNode(self, request, workspace, editor, launcher_platform):
@@ -64,43 +64,43 @@ class TestAutomation(TestAutomationBase):
# Fixme: This test previously relied on unexpected lines log reading with is now not supported.
# Now the log reading must be done inside the test, preferably with the Tracer() utility
# unexpected_lines = ["Assert"] + test_module.Lines.unexpected
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Collider_DiffCollisionGroupDiffCollidingLayersNotCollide.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Collider_DiffCollisionGroupDiffCollidingLayersNotCollide(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_DiffCollisionGroupDiffCollidingLayersNotCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Joints_HingeLeadFollowerCollide(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_HingeLeadFollowerCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_PxMeshConvexMeshCollides(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_PxMeshConvexMeshCollides as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ShapeCollider_CylinderShapeCollides(self, request, workspace, editor, launcher_platform):
from .tests.shape_collider import ShapeCollider_CylinderShapeCollides as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_C15425929_Undo_Redo(self, request, workspace, editor, launcher_platform):
from .tests import Physics_UndoRedoWorksOnEntityWithPhysComponents as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@pytest.mark.GROUP_tick
@pytest.mark.xfail(reason="Test still under development.")
def test_Tick_InterpolatedRigidBodyMotionIsSmooth(self, request, workspace, editor, launcher_platform):
from .tests.tick import Tick_InterpolatedRigidBodyMotionIsSmooth as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@pytest.mark.GROUP_tick
@pytest.mark.xfail(reason="Test still under development.")
def test_Tick_CharacterGameplayComponentMotionIsSmooth(self, request, workspace, editor, launcher_platform):
from .tests.tick import Tick_CharacterGameplayComponentMotionIsSmooth as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@@ -59,9 +59,6 @@ class EditorSingleTest_WithFileOverrides(EditorSingleTest):
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomationWithPrefabSystemEnabled(EditorTestSuite):
global_extra_cmdline_args = ['-BatchMode', '-autotest_mode',
'extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]']
@staticmethod
def get_number_parallel_editors():
return 16
@@ -81,6 +78,8 @@ class TestAutomationWithPrefabSystemEnabled(EditorTestSuite):
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomation(EditorTestSuite):
enable_prefab_system = False
@staticmethod
def get_number_parallel_editors():
return 16
@@ -31,223 +31,223 @@ class TestAutomation(TestAutomationBase):
@revert_physics_config
def test_Terrain_NoPhysTerrainComponentNoCollision(self, request, workspace, editor, launcher_platform):
from .tests.terrain import Terrain_NoPhysTerrainComponentNoCollision as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_InitialLinearVelocity(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_InitialLinearVelocity as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_StartGravityEnabledWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_StartGravityEnabledWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_KinematicModeWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_KinematicModeWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_LinearDampingForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_LinearDampingForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_SimpleDragForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_SimpleDragForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_CapsuleShapedForce(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_CapsuleShapedForce as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ImpulsesCapsuleShapedRigidBody(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ImpulsesCapsuleShapedRigidBody as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_MomentOfInertiaManualSetting(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_MomentOfInertiaManualSetting as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_COM_ManualSettingWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_COM_ManualSettingWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_AddRigidBodyComponent(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_AddRigidBodyComponent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_SplineForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_SplineForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_RestitutionCombine.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_RestitutionCombine(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_RestitutionCombine as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_FrictionCombine.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_FrictionCombine(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_FrictionCombine as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_ColliderPositionOffset(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_ColliderPositionOffset as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_AngularDampingAffectsRotation(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_AngularDampingAffectsRotation as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Physics_VerifyColliderRigidBodyMeshAndTerrainWorkTogether(self, request, workspace, editor, launcher_platform):
from .tests import Physics_VerifyColliderRigidBodyMeshAndTerrainWorkTogether as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_MultipleForcesInSameComponentCombineForces(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_MultipleForcesInSameComponentCombineForces as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ImpulsesPxMeshShapedRigidBody(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ImpulsesPxMeshShapedRigidBody as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ScriptCanvas_TriggerEvents(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_TriggerEvents as test_module
# FIXME: expected_lines = test_module.LogLines.expected_lines
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ZeroPointForceDoesNothing(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ZeroPointForceDoesNothing as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ZeroWorldSpaceForceDoesNothing(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ZeroWorldSpaceForceDoesNothing as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ZeroLinearDampingDoesNothing(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ZeroLinearDampingDoesNothing as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_MovingForceRegionChangesNetForce(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_MovingForceRegionChangesNetForce as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ScriptCanvas_CollisionEvents(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_CollisionEvents as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_DirectionHasNoAffectOnTotalForce(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_DirectionHasNoAffectOnTotalForce as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_StartAsleepWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_StartAsleepWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_SliceFileInstantiates(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_SliceFileInstantiates as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ZeroLocalSpaceForceDoesNothing(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ZeroLocalSpaceForceDoesNothing as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ZeroSimpleDragForceDoesNothing(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ZeroSimpleDragForceDoesNothing as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_COM_ComputingWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_COM_ComputingWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_MassDifferentValuesWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_MassDifferentValuesWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_RestitutionCombinePriorityOrder.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_RestitutionCombinePriorityOrder(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_RestitutionCombinePriorityOrder as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_SplineRegionWithModifiedTransform(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_SplineRegionWithModifiedTransform as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ScriptCanvas_ShapeCast(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_ShapeCast as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_InitialAngularVelocity(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_InitialAngularVelocity as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ZeroSplineForceDoesNothing(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ZeroSplineForceDoesNothing as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Physics_DynamicSliceWithPhysNotSpawnsStaticSlice(self, request, workspace, editor, launcher_platform):
from .tests import Physics_DynamicSliceWithPhysNotSpawnsStaticSlice as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_PositionOffset(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_PositionOffset as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_FrictionCombinePriorityOrder.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_FrictionCombinePriorityOrder(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_FrictionCombinePriorityOrder as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@pytest.mark.xfail(
reason="Something with the CryRenderer disabling is causing this test to fail now.")
@revert_physics_config
def test_Ragdoll_LevelSwitchDoesNotCrash(self, request, workspace, editor, launcher_platform):
from .tests.ragdoll import Ragdoll_LevelSwitchDoesNotCrash as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_MultipleComponentsCombineForces(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_MultipleComponentsCombineForces as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Marking the test as an expected failure due to sporadic failure on Automated Review: LYN-2580
# The test still runs, but a failure of the test doesn't result in the test run failing
@@ -258,102 +258,102 @@ class TestAutomation(TestAutomationBase):
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_PerFaceMaterialGetsCorrectMaterial(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_PerFaceMaterialGetsCorrectMaterial as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@pytest.mark.xfail(
reason="This test will sometimes fail as the ball will continue to roll before the timeout is reached.")
@revert_physics_config
def test_RigidBody_SleepWhenBelowKineticThreshold(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_SleepWhenBelowKineticThreshold as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_COM_NotIncludesTriggerShapes(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_COM_NotIncludesTriggerShapes as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Material_NoEffectIfNoColliderShape(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_NoEffectIfNoColliderShape as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_TriggerPassThrough(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_TriggerPassThrough as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_SetGravityWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_SetGravityWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_CharacterController.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_CharacterController(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_CharacterController as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Material_EmptyLibraryUsesDefault(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_EmptyLibraryUsesDefault as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_NoQuiverOnHighLinearDampingForce(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_NoQuiverOnHighLinearDampingForce as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_RigidBody_ComputeInertiaWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_ComputeInertiaWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ScriptCanvas_PostPhysicsUpdate(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_PostPhysicsUpdate as test_module
# Fixme: unexpected_lines = ["Assert"] + test_module.Lines.unexpected
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Collider_NoneCollisionGroupSameLayerNotCollide.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Collider_NoneCollisionGroupSameLayerNotCollide(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_NoneCollisionGroupSameLayerNotCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Collider_SameCollisionGroupSameCustomLayerCollide.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Collider_SameCollisionGroupSameCustomLayerCollide(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_SameCollisionGroupSameCustomLayerCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxdefaultsceneconfiguration.setreg','ScriptCanvas_PostUpdateEvent.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_ScriptCanvas_PostUpdateEvent(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_PostUpdateEvent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Material_Restitution.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Material_Restitution(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_Restitution as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxdefaultsceneconfiguration.setreg', 'ScriptCanvas_PreUpdateEvent.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_ScriptCanvas_PreUpdateEvent(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_PreUpdateEvent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_PxMeshShapedForce(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_PxMeshShapedForce as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
# Marking the Test as expected to fail using the xfail decorator due to sporadic failure on Automated Review: SPEC-3146
# The test still runs, but a failure of the test doesn't result in the test run failing
@@ -361,176 +361,173 @@ class TestAutomation(TestAutomationBase):
@revert_physics_config
def test_RigidBody_MaxAngularVelocityWorks(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_MaxAngularVelocityWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Joints_HingeSoftLimitsConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_HingeSoftLimitsConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Joints_BallSoftLimitsConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_BallSoftLimitsConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Joints_BallLeadFollowerCollide(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_BallLeadFollowerCollide as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Collider_AddingNewGroupWorks.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Collider_AddingNewGroupWorks(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_AddingNewGroupWorks as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ShapeCollider_InactiveWhenNoShapeComponent(self, request, workspace, editor, launcher_platform):
from .tests.shape_collider import ShapeCollider_InactiveWhenNoShapeComponent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_CheckDefaultShapeSettingIsPxMesh(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_CheckDefaultShapeSettingIsPxMesh as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ShapeCollider_LargeNumberOfShapeCollidersWontCrashEditor(self, request, workspace, editor, launcher_platform):
from .tests.shape_collider import ShapeCollider_LargeNumberOfShapeCollidersWontCrashEditor as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_SphereShapeEditing(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_SphereShapeEditing as test_module
self._run_test(request, workspace, editor, test_module,
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"])
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_Collider_BoxShapeEditing(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_BoxShapeEditing as test_module
self._run_test(request, workspace, editor, test_module,
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"])
self._run_test(request, workspace, editor, test_module)
@revert_physics_config
def test_Collider_CapsuleShapeEditing(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_CapsuleShapeEditing as test_module
self._run_test(request, workspace, editor, test_module,
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"])
self._run_test(request, workspace, editor, test_module)
def test_ForceRegion_WithNonTriggerColliderWarning(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_WithNonTriggerColliderWarning as test_module
# Fixme: expected_lines = ["[Warning] (PhysX Force Region) - Please ensure collider component marked as trigger exists in entity"]
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_WorldSpaceForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_WorldSpaceForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_PointForceOnRigidBodies(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_PointForceOnRigidBodies as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_SphereShapedForce(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_SphereShapedForce as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_ForceRegion_RotationalOffset(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_RotationalOffset as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Material_LibraryClearingAssignsDefault(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_LibraryClearingAssignsDefault as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Collider_AddColliderComponent(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_AddColliderComponent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@pytest.mark.xfail(
reason="This will fail due to this issue ATOM-15487.")
def test_Collider_PxMeshAutoAssignedWhenModifyingRenderMeshComponent(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_PxMeshAutoAssignedWhenModifyingRenderMeshComponent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Collider_PxMeshAutoAssignedWhenAddingRenderMeshComponent(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_PxMeshAutoAssignedWhenAddingRenderMeshComponent as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Collider_MultipleSurfaceSlots(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_MultipleSurfaceSlots as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Collider_PxMeshNotAutoAssignedWhenNoPhysicsFbx(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_PxMeshNotAutoAssignedWhenNoPhysicsFbx as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_RigidBody_EnablingGravityWorksPoC(self, request, workspace, editor, launcher_platform):
from .tests.rigid_body import RigidBody_EnablingGravityWorksPoC as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
@fm.file_override('physxsystemconfiguration.setreg','Collider_CollisionGroupsWorkflow.setreg_override',
'AutomatedTesting/Registry', search_subdirs=True)
def test_Collider_CollisionGroupsWorkflow(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_CollisionGroupsWorkflow as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Collider_ColliderRotationOffset(self, request, workspace, editor, launcher_platform):
from .tests.collider import Collider_ColliderRotationOffset as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ForceRegion_ParentChildForcesCombineForces(self, request, workspace, editor, launcher_platform):
from .tests.force_region import ForceRegion_ParentChildForcesCombineForces as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_ShapeCollider_CanBeAddedWitNoWarnings(self, request, workspace, editor, launcher_platform):
from .tests.shape_collider import ShapeCollider_CanBeAddedWitNoWarnings as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Physics_UndoRedoWorksOnEntityWithPhysComponents(self, request, workspace, editor, launcher_platform):
from .tests import Physics_UndoRedoWorksOnEntityWithPhysComponents as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_Fixed2BodiesConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_Fixed2BodiesConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_Hinge2BodiesConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_Hinge2BodiesConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_Ball2BodiesConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_Ball2BodiesConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_FixedBreakable(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_FixedBreakable as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_HingeBreakable(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_HingeBreakable as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_BallBreakable(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_BallBreakable as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_HingeNoLimitsConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_HingeNoLimitsConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_BallNoLimitsConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_BallNoLimitsConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_Joints_GlobalFrameConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_GlobalFrameConstrained as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@revert_physics_config
def test_Material_DefaultLibraryUpdatedAcrossLevels(self, request, workspace, editor, launcher_platform):
@@ -540,7 +537,7 @@ class TestAutomation(TestAutomationBase):
search_subdirs=True)
def levels_before(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_DefaultLibraryUpdatedAcrossLevels_before as test_module_0
self._run_test(request, workspace, editor, test_module_0)
self._run_test(request, workspace, editor, test_module_0, enable_prefab_system=False)
# File override replaces the previous physxconfiguration file with another where the only difference is the default material library
@fm.file_override("physxsystemconfiguration.setreg",
@@ -549,7 +546,7 @@ class TestAutomation(TestAutomationBase):
search_subdirs=True)
def levels_after(self, request, workspace, editor, launcher_platform):
from .tests.material import Material_DefaultLibraryUpdatedAcrossLevels_after as test_module_1
self._run_test(request, workspace, editor, test_module_1)
self._run_test(request, workspace, editor, test_module_1, enable_prefab_system=False)
levels_before(self, request, workspace, editor, launcher_platform)
levels_after(self, request, workspace, editor, launcher_platform)
@@ -32,7 +32,7 @@ class TestAutomation(TestAutomationBase):
def test_ScriptCanvas_GetCollisionNameReturnsName(self, request, workspace, editor, launcher_platform):
from .tests.script_canvas import ScriptCanvas_GetCollisionNameReturnsName as test_module
# Fixme: expected_lines=["Layer Name: Right"]
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
## Seems to be flaky, need to investigate
def test_ScriptCanvas_GetCollisionNameReturnsNothingWhenHasToggledLayer(self, request, workspace, editor, launcher_platform):
@@ -42,4 +42,4 @@ class TestAutomation(TestAutomationBase):
# Fixme: for group in collision_groups:
# Fixme: unexpected_lines.append(f"GroupName: {group}")
# Fixme: expected_lines=["GroupName: "]
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@@ -30,11 +30,11 @@ class TestUtils(TestAutomationBase):
expected_lines = []
unexpected_lines = ["Assert"]
self._run_test(request, workspace, editor, physmaterial_editor_test_module, expected_lines, unexpected_lines)
self._run_test(request, workspace, editor, physmaterial_editor_test_module, expected_lines, unexpected_lines, enable_prefab_system=False)
def test_UtilTest_Tracer_PicksErrorsAndWarnings(self, request, workspace, launcher_platform, editor):
from .utils import UtilTest_Tracer_PicksErrorsAndWarnings as testcase_module
self._run_test(request, workspace, editor, testcase_module, [], [])
self._run_test(request, workspace, editor, testcase_module, [], [], enable_prefab_system=False)
def test_FileManagement_FindingFiles(self, workspace, launcher_platform):
"""
@@ -263,4 +263,4 @@ class TestUtils(TestAutomationBase):
expected_lines = []
unexpected_lines = ["Assert"]
self._run_test(request, workspace, editor, test_module, expected_lines, unexpected_lines)
self._run_test(request, workspace, editor, test_module, expected_lines, unexpected_lines, enable_prefab_system=False)
@@ -218,6 +218,7 @@ class FileManagement:
src_file_path = os.path.join(src_path, src_file)
if os.path.exists(target_file_path):
fs.unlock_file(target_file_path)
os.makedirs(target_path, exist_ok=True)
shutil.copyfile(src_file_path, target_file_path)
@staticmethod
@@ -12,7 +12,6 @@ import pytest
import os
import sys
from ly_test_tools import LAUNCHERS
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
from base import TestAutomationBase
@@ -24,42 +23,49 @@ class TestAutomation(TestAutomationBase):
def _run_prefab_test(self, request, workspace, editor, test_module, batch_mode=True, autotest_mode=True):
self._run_test(request, workspace, editor, test_module,
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"],
batch_mode=batch_mode,
autotest_mode=autotest_mode)
def test_PrefabLevel_OpensLevelWithEntities(self, request, workspace, editor, launcher_platform):
from .tests import PrefabLevel_OpensLevelWithEntities as test_module
def test_OpenLevel_ContainingTwoEntities(self, request, workspace, editor, launcher_platform):
from Prefab.tests.open_level import OpenLevel_ContainingTwoEntities as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_PrefabBasicWorkflow_CreatePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreatePrefab as test_module
def test_CreatePrefab_WithSingleEntity(self, request, workspace, editor, launcher_platform):
from Prefab.tests.create_prefab import CreatePrefab_WithSingleEntity as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_PrefabBasicWorkflow_InstantiatePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_InstantiatePrefab as test_module
def test_InstantiatePrefab_ContainingASingleEntity(self, request, workspace, editor, launcher_platform):
from Prefab.tests.instantiate_prefab import InstantiatePrefab_ContainingASingleEntity as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_PrefabBasicWorkflow_CreateAndDeletePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreateAndDeletePrefab as test_module
def test_DeletePrefab_ContainingASingleEntity(self, request, workspace, editor, launcher_platform):
from Prefab.tests.delete_prefab import DeletePrefab_ContainingASingleEntity as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_PrefabBasicWorkflow_CreateAndReparentPrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreateAndReparentPrefab as test_module
def test_ReparentPrefab_UnderAnotherPrefab(self, request, workspace, editor, launcher_platform):
from Prefab.tests.reparent_prefab import ReparentPrefab_UnderAnotherPrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)
def test_PrefabBasicWorkflow_CreateReparentAndDetachPrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreateReparentAndDetachPrefab as test_module
def test_DetachPrefab_UnderAnotherPrefab(self, request, workspace, editor, launcher_platform):
from Prefab.tests.detach_prefab import DetachPrefab_UnderAnotherPrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)
def test_PrefabBasicWorkflow_CreateAndDuplicatePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreateAndDuplicatePrefab as test_module
def test_DuplicatePrefab_ContainingASingleEntity(self, request, workspace, editor, launcher_platform):
from Prefab.tests.duplicate_prefab import DuplicatePrefab_ContainingASingleEntity as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_PrefabComplexWorflow_CreatePrefabOfChildEntity(self, request, workspace, editor, launcher_platform):
from .tests import PrefabComplexWorflow_CreatePrefabOfChildEntity as test_module
def test_CreatePrefab_UnderAnEntity(self, request, workspace, editor, launcher_platform):
from Prefab.tests.create_prefab import CreatePrefab_UnderAnEntity as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)
def test_PrefabComplexWorflow_CreatePrefabInsidePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabComplexWorflow_CreatePrefabInsidePrefab as test_module
def test_CreatePrefab_UnderAnotherPrefab(self, request, workspace, editor, launcher_platform):
from Prefab.tests.create_prefab import CreatePrefab_UnderAnotherPrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)
def test_DeleteEntity_UnderAnotherPrefab(self, request, workspace, editor, launcher_platform):
from Prefab.tests.delete_entity import DeleteEntity_UnderAnotherPrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)
def test_DeleteEntity_UnderLevelPrefab(self, request, workspace, editor, launcher_platform):
from Prefab.tests.delete_entity import DeleteEntity_UnderLevelPrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)
@@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabComplexWorflow_CreatePrefabOfChildEntity():
def CreatePrefab_UnderAnEntity():
"""
Test description:
- Creates two entities, parent and child. Child entity has Parent entity as its parent.
@@ -18,7 +18,7 @@ def PrefabComplexWorflow_CreatePrefabOfChildEntity():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -49,4 +49,4 @@ def PrefabComplexWorflow_CreatePrefabOfChildEntity():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabComplexWorflow_CreatePrefabOfChildEntity)
Report.start_test(CreatePrefab_UnderAnEntity)
@@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabComplexWorflow_CreatePrefabInsidePrefab():
def CreatePrefab_UnderAnotherPrefab():
"""
Test description:
- Creates an entity with a physx collider
@@ -17,7 +17,7 @@ def PrefabComplexWorflow_CreatePrefabInsidePrefab():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -54,4 +54,4 @@ def PrefabComplexWorflow_CreatePrefabInsidePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabComplexWorflow_CreatePrefabInsidePrefab)
Report.start_test(CreatePrefab_UnderAnotherPrefab)
@@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_CreatePrefab():
def CreatePrefab_WithSingleEntity():
CAR_PREFAB_FILE_NAME = 'car_prefab'
@@ -13,7 +13,7 @@ def PrefabBasicWorkflow_CreatePrefab():
from editor_python_test_tools.utils import Report
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -26,4 +26,4 @@ def PrefabBasicWorkflow_CreatePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabBasicWorkflow_CreatePrefab)
Report.start_test(CreatePrefab_WithSingleEntity)
@@ -0,0 +1,52 @@
"""
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
"""
def DeleteEntity_UnderAnotherPrefab():
"""
Test description:
- Creates an entity.
- Creates a prefab out of the above entity.
- Focuses on the created prefab and destroys the entity within.
Checks that the entity is correctly destroyed.
"""
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
PREFAB_FILE_NAME = 'some_prefab'
# Creates a new entity at the root level
entity = EditorEntity.create_editor_entity()
assert entity.id.IsValid(), "Couldn't create entity."
# Asserts if prefab creation doesn't succeed
child_prefab, child_instance = Prefab.create_prefab([entity], PREFAB_FILE_NAME)
child_entity_ids_inside_prefab = child_instance.get_direct_child_entities()
assert len(
child_entity_ids_inside_prefab) == 1, f"{len(child_entity_ids_inside_prefab)} entities found inside prefab" \
f" when there should have been just 1 entity"
child_entity_inside_prefab = child_entity_ids_inside_prefab[0]
child_entity_inside_prefab.focus_on_owning_prefab()
child_entity_inside_prefab.delete()
# Wait till prefab propagation finishes before validating entity deletion.
azlmbr.legacy.general.idle_wait_frames(1)
child_entity_ids_inside_prefab = child_instance.get_direct_child_entities()
assert len(
child_entity_ids_inside_prefab) == 0, f"{len(child_entity_ids_inside_prefab)} entities found inside prefab" \
f" when there should have been 0 entities"
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(DeleteEntity_UnderAnotherPrefab)
@@ -0,0 +1,37 @@
"""
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
"""
def DeleteEntity_UnderLevelPrefab():
"""
Test description:
- Creates an entity.
- Destroys the created entity.
Checks that the entity is correctly destroyed.
"""
from editor_python_test_tools.editor_entity_utils import EditorEntity
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
# Creates a new Entity at the root level
# Asserts if creation didn't succeed
entity = EditorEntity.create_editor_entity_at((100.0, 100.0, 100.0), name = "TestEntity")
assert entity.id.IsValid(), "Couldn't create entity"
level_container_entity = EditorEntity(entity.get_parent_id())
entity.delete()
# Wait till prefab propagation finishes before validating entity deletion.
azlmbr.legacy.general.idle_wait_frames(1)
level_container_child_entities_count = len(level_container_entity.get_children_ids())
assert level_container_child_entities_count == 0, f"The level still has {level_container_child_entities_count}" \
f" children when it should have 0."
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(DeleteEntity_UnderLevelPrefab)
@@ -5,14 +5,14 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_CreateAndDeletePrefab():
def DeletePrefab_ContainingASingleEntity():
CAR_PREFAB_FILE_NAME = 'car_prefab'
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -29,4 +29,4 @@ def PrefabBasicWorkflow_CreateAndDeletePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabBasicWorkflow_CreateAndDeletePrefab)
Report.start_test(DeletePrefab_ContainingASingleEntity)
@@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_CreateReparentAndDetachPrefab():
def DetachPrefab_UnderAnotherPrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
WHEEL_PREFAB_FILE_NAME = 'wheel_prefab'
@@ -18,7 +18,7 @@ def PrefabBasicWorkflow_CreateReparentAndDetachPrefab():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -48,4 +48,4 @@ def PrefabBasicWorkflow_CreateReparentAndDetachPrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabBasicWorkflow_CreateReparentAndDetachPrefab)
Report.start_test(DetachPrefab_UnderAnotherPrefab)
@@ -5,14 +5,14 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_CreateAndDuplicatePrefab():
def DuplicatePrefab_ContainingASingleEntity():
CAR_PREFAB_FILE_NAME = 'car_prefab'
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -29,4 +29,4 @@ def PrefabBasicWorkflow_CreateAndDuplicatePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabBasicWorkflow_CreateAndDuplicatePrefab)
Report.start_test(DuplicatePrefab_ContainingASingleEntity)
@@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_InstantiatePrefab():
def InstantiatePrefab_ContainingASingleEntity():
from azlmbr.math import Vector3
@@ -15,7 +15,7 @@ def PrefabBasicWorkflow_InstantiatePrefab():
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -30,4 +30,4 @@ def PrefabBasicWorkflow_InstantiatePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabBasicWorkflow_InstantiatePrefab)
Report.start_test(InstantiatePrefab_ContainingASingleEntity)
@@ -14,7 +14,7 @@ class Tests():
# fmt:on
def PrefabLevel_OpensLevelWithEntities():
def OpenLevel_ContainingTwoEntities():
"""
Opens the level that contains 2 entities, "EmptyEntity" and "EntityWithPxCollider".
This test makes sure that both entities exist after opening the level and that:
@@ -70,4 +70,4 @@ def PrefabLevel_OpensLevelWithEntities():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabLevel_OpensLevelWithEntities)
Report.start_test(OpenLevel_ContainingTwoEntities)
@@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_CreateAndReparentPrefab():
def ReparentPrefab_UnderAnotherPrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
WHEEL_PREFAB_FILE_NAME = 'wheel_prefab'
@@ -18,7 +18,7 @@ def PrefabBasicWorkflow_CreateAndReparentPrefab():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.prefab_utils import Prefab
import PrefabTestUtils as prefab_test_utils
import Prefab.tests.PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@@ -45,4 +45,4 @@ def PrefabBasicWorkflow_CreateAndReparentPrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(PrefabBasicWorkflow_CreateAndReparentPrefab)
Report.start_test(ReparentPrefab_UnderAnotherPrefab)
@@ -8,42 +8,54 @@ import azlmbr.bus
import azlmbr.asset
import azlmbr.editor
import azlmbr.math
import azlmbr.legacy.general
def raise_and_stop(msg):
print (msg)
print('Starting mock asset tests')
handler = azlmbr.editor.EditorEventBusHandler()
def on_notify_editor_initialized(args):
# These tests are meant to check that the test_asset.mock source asset turned into
# a test_asset.mock_asset product asset via the Python asset builder system
mockAssetType = azlmbr.math.Uuid_CreateString('{9274AD17-3212-4651-9F3B-7DCCB080E467}', 0)
mockAssetPath = 'gem/pythontests/pythonassetbuilder/test_asset.mock_asset'
assetId = azlmbr.asset.AssetCatalogRequestBus(azlmbr.bus.Broadcast, 'GetAssetIdByPath', mockAssetPath, mockAssetType, False)
if (assetId.is_valid() is False):
print(f'Mock AssetId is not valid! Got {assetId.to_string()} instead')
else:
print(f'Mock AssetId is valid!')
assetIdString = assetId.to_string()
if (assetIdString.endswith(':528cca58') is False):
print(f'Mock AssetId {assetIdString} has unexpected sub-id for {mockAssetPath}!')
else:
print(f'Mock AssetId has expected sub-id for {mockAssetPath}!')
print ('Mock asset exists')
# These tests detect if the geom_group.fbx file turns into a number of azmodel product assets
def test_azmodel_product(generatedModelAssetPath):
azModelAssetType = azlmbr.math.Uuid_CreateString('{2C7477B6-69C5-45BE-8163-BCD6A275B6D8}', 0)
assetId = azlmbr.asset.AssetCatalogRequestBus(azlmbr.bus.Broadcast, 'GetAssetIdByPath', generatedModelAssetPath, azModelAssetType, False)
assetIdString = assetId.to_string()
if (assetId.is_valid()):
print(f'AssetId found for asset ({generatedModelAssetPath}) found')
else:
print(f'Asset at path {generatedModelAssetPath} has unexpected asset ID ({assetIdString})!')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_z_positive_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_z_negative_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_y_positive_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_y_negative_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_x_positive_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_x_negative_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_center_1.azmodel')
# clear up notification handler
global handler
handler.disconnect()
handler = None
print('Finished mock asset tests')
azlmbr.editor.EditorToolsApplicationRequestBus(azlmbr.bus.Broadcast, 'ExitNoPrompt')
# These tests are meant to check that the test_asset.mock source asset turned into
# a test_asset.mock_asset product asset via the Python asset builder system
mockAssetType = azlmbr.math.Uuid_CreateString('{9274AD17-3212-4651-9F3B-7DCCB080E467}', 0)
mockAssetPath = 'gem/pythontests/pythonassetbuilder/test_asset.mock_asset'
assetId = azlmbr.asset.AssetCatalogRequestBus(azlmbr.bus.Broadcast, 'GetAssetIdByPath', mockAssetPath, mockAssetType, False)
if (assetId.is_valid() is False):
raise_and_stop(f'Mock AssetId is not valid! Got {assetId.to_string()} instead')
assetIdString = assetId.to_string()
if (assetIdString.endswith(':528cca58') is False):
raise_and_stop(f'Mock AssetId {assetIdString} has unexpected sub-id for {mockAssetPath}!')
print ('Mock asset exists')
# These tests detect if the geom_group.fbx file turns into a number of azmodel product assets
def test_azmodel_product(generatedModelAssetPath):
azModelAssetType = azlmbr.math.Uuid_CreateString('{2C7477B6-69C5-45BE-8163-BCD6A275B6D8}', 0)
assetId = azlmbr.asset.AssetCatalogRequestBus(azlmbr.bus.Broadcast, 'GetAssetIdByPath', generatedModelAssetPath, azModelAssetType, False)
assetIdString = assetId.to_string()
if (assetId.is_valid()):
print(f'AssetId found for asset ({generatedModelAssetPath}) found')
else:
raise_and_stop(f'Asset at path {generatedModelAssetPath} has unexpected asset ID ({assetIdString})!')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_z_positive_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_z_negative_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_y_positive_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_y_negative_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_x_positive_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_x_negative_1.azmodel')
test_azmodel_product('gem/pythontests/pythonassetbuilder/geom_group_fbx_cube_100cm_center_1.azmodel')
azlmbr.editor.EditorToolsApplicationRequestBus(azlmbr.bus.Broadcast, 'ExitNoPrompt')
handler.connect()
handler.add_callback('NotifyEditorInitialized', on_notify_editor_initialized)
@@ -0,0 +1,24 @@
#
# 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
#
#
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_pytest(
NAME AutomatedTesting::TerrainTests_Main
TEST_SUITE main
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Terrain
)
endif()
@@ -0,0 +1,89 @@
"""
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
"""
#fmt: off
class Tests():
create_test_entity = ("Entity created successfully", "Failed to create Entity")
add_axis_aligned_box_shape = ("Axis Aligned Box Shape component added", "Failed to add Axis Aligned Box Shape component")
add_terrain_collider = ("Terrain Physics Heightfield Collider component added", "Failed to add a Terrain Physics Heightfield Collider component")
box_dimensions_changed = ("Aabb dimensions changed successfully", "Failed change Aabb dimensions")
configuration_changed = ("Terrain size changed successfully", "Failed terrain size change")
#fmt: on
def TerrainPhysicsCollider_ChangesSizeWithAxisAlignedBoxShapeChanges():
"""
Summary:
Test aspects of the Terrain Physics Heightfield Collider through the BehaviorContext and the Property Tree.
Test Steps:
Expected Behavior:
The Editor is stable there are no warnings or errors.
Test Steps:
1) Load the base level
2) Create test entity
3) Start the Tracer to catch any errors and warnings
4) Add the Axis Aligned Box Shape and Terrain Physics Heightfield Collider components
5) Change the Axis Aligned Box Shape dimensions
6) Check the Heightfield provider is returning the correct size
7) Verify there are no errors and warnings in the logs
:return: None
"""
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.utils import Report, Tracer
import azlmbr.legacy.general as general
import azlmbr.physics as physics
import azlmbr.math as azmath
import azlmbr.bus as bus
import sys
import math
SET_BOX_X_SIZE = 5.0
SET_BOX_Y_SIZE = 6.0
EXPECTED_COLUMN_SIZE = SET_BOX_X_SIZE + 1
EXPECTED_ROW_SIZE = SET_BOX_Y_SIZE + 1
helper.init_idle()
# 1) Load the level
helper.open_level("", "Base")
# 2) Create test entity
test_entity = EditorEntity.create_editor_entity("TestEntity")
Report.result(Tests.create_test_entity, test_entity.id.IsValid())
# 3) Start the Tracer to catch any errors and warnings
with Tracer() as section_tracer:
# 4) Add the Axis Aligned Box Shape and Terrain Physics Heightfield Collider components
aaBoxShape_component = test_entity.add_component("Axis Aligned Box Shape")
Report.result(Tests.add_axis_aligned_box_shape, test_entity.has_component("Axis Aligned Box Shape"))
terrainPhysics_component = test_entity.add_component("Terrain Physics Heightfield Collider")
Report.result(Tests.add_terrain_collider, test_entity.has_component("Terrain Physics Heightfield Collider"))
# 5) Change the Axis Aligned Box Shape dimensions
aaBoxShape_component.set_component_property_value("Axis Aligned Box Shape|Box Configuration|Dimensions", azmath.Vector3(SET_BOX_X_SIZE, SET_BOX_Y_SIZE, 1.0))
add_check = aaBoxShape_component.get_component_property_value("Axis Aligned Box Shape|Box Configuration|Dimensions") == azmath.Vector3(SET_BOX_X_SIZE, SET_BOX_Y_SIZE, 1.0)
Report.result(Tests.box_dimensions_changed, add_check)
# 6) Check the Heightfield provider is returning the correct size
columns = physics.HeightfieldProviderRequestsBus(bus.Broadcast, "GetHeightfieldGridColumns")
rows = physics.HeightfieldProviderRequestsBus(bus.Broadcast, "GetHeightfieldGridRows")
Report.result(Tests.configuration_changed, math.isclose(columns, EXPECTED_COLUMN_SIZE) and math.isclose(rows, EXPECTED_ROW_SIZE))
helper.wait_for_condition(lambda: section_tracer.has_errors or section_tracer.has_asserts, 1.0)
for error_info in section_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in section_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(TerrainPhysicsCollider_ChangesSizeWithAxisAlignedBoxShapeChanges)
@@ -0,0 +1,164 @@
"""
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
"""
#fmt: off
class Tests():
create_terrain_spawner_entity = ("Terrain_spawner_entity created successfully", "Failed to create terrain_spawner_entity")
create_height_provider_entity = ("Height_provider_entity created successfully", "Failed to create height_provider_entity")
create_test_ball = ("Ball created successfully", "Failed to create Ball")
box_dimensions_changed = ("Aabb dimensions changed successfully", "Failed change Aabb dimensions")
shape_changed = ("Shape changed successfully", "Failed Shape change")
entity_added = ("Entity added successfully", "Failed Entity add")
frequency_changed = ("Frequency changed successfully", "Failed Frequency change")
shape_set = ("Shape set to Sphere successfully", "Failed to set Sphere shape")
test_collision = ("Ball collided with terrain", "Ball failed to collide with terrain")
no_errors_and_warnings_found = ("No errors and warnings found", "Found errors and warnings")
#fmt: on
def Terrain_SupportsPhysics():
"""
Summary:
Test aspects of the TerrainHeightGradientList through the BehaviorContext and the Property Tree.
Test Steps:
Expected Behavior:
The Editor is stable there are no warnings or errors.
Test Steps:
1) Load the base level
2) Create 2 test entities, one parent at 512.0, 512.0, 50.0 and one child at the default position and add the required components
2a) Create a ball at 600.0, 600.0, 46.0 - This position is not too high over the heightfield so will collide in a reasonable time
3) Start the Tracer to catch any errors and warnings
4) Change the Axis Aligned Box Shape dimensions
5) Set the Vegetation Shape reference to TestEntity1
6) Set the FastNoise gradient frequency to 0.01
7) Set the Gradient List to TestEntity2
8) Set the PhysX Collider to Sphere mode
9) Disable and Enable the Terrain Gradient List so that it is recognised
10) Enter game mode and test if the ball hits the heightfield within 3 seconds
11) Verify there are no errors and warnings in the logs
:return: None
"""
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import TestHelper as helper, Report
from editor_python_test_tools.utils import Report, Tracer
import editor_python_test_tools.hydra_editor_utils as hydra
import azlmbr.math as azmath
import azlmbr.legacy.general as general
import azlmbr.bus as bus
import azlmbr.editor as editor
import math
SET_BOX_X_SIZE = 1024.0
SET_BOX_Y_SIZE = 1024.0
SET_BOX_Z_SIZE = 100.0
helper.init_idle()
# 1) Load the level
helper.open_level("", "Base")
helper.wait_for_condition(lambda: general.get_current_level_name() == "Base", 2.0)
#1a) Load the level components
hydra.add_level_component("Terrain World")
hydra.add_level_component("Terrain World Renderer")
# 2) Create 2 test entities, one parent at 512.0, 512.0, 50.0 and one child at the default position and add the required components
entity1_components_to_add = ["Axis Aligned Box Shape", "Terrain Layer Spawner", "Terrain Height Gradient List", "Terrain Physics Heightfield Collider", "PhysX Heightfield Collider"]
entity2_components_to_add = ["Shape Reference", "Gradient Transform Modifier", "FastNoise Gradient"]
ball_components_to_add = ["Sphere Shape", "PhysX Collider", "PhysX Rigid Body"]
terrain_spawner_entity = hydra.Entity("TestEntity1")
terrain_spawner_entity.create_entity(azmath.Vector3(512.0, 512.0, 50.0), entity1_components_to_add)
Report.result(Tests.create_terrain_spawner_entity, terrain_spawner_entity.id.IsValid())
height_provider_entity = hydra.Entity("TestEntity2")
height_provider_entity.create_entity(azmath.Vector3(0.0, 0.0, 0.0), entity2_components_to_add,terrain_spawner_entity.id)
Report.result(Tests.create_height_provider_entity, height_provider_entity.id.IsValid())
# 2a) Create a ball at 600.0, 600.0, 46.0 - This position is not too high over the heightfield so will collide in a reasonable time
ball = hydra.Entity("Ball")
ball.create_entity(azmath.Vector3(600.0, 600.0, 46.0), ball_components_to_add)
Report.result(Tests.create_test_ball, ball.id.IsValid())
# Give everything a chance to finish initializing.
general.idle_wait_frames(1)
# 3) Start the Tracer to catch any errors and warnings
with Tracer() as section_tracer:
# 4) Change the Axis Aligned Box Shape dimensions
box_dimensions = azmath.Vector3(SET_BOX_X_SIZE, SET_BOX_Y_SIZE, SET_BOX_Z_SIZE)
terrain_spawner_entity.get_set_test(0, "Axis Aligned Box Shape|Box Configuration|Dimensions", box_dimensions)
box_shape_dimensions = hydra.get_component_property_value(terrain_spawner_entity.components[0], "Axis Aligned Box Shape|Box Configuration|Dimensions")
Report.result(Tests.box_dimensions_changed, box_dimensions == box_shape_dimensions)
# 5) Set the Vegetaion Shape reference to TestEntity1
height_provider_entity.get_set_test(0, "Configuration|Shape Entity Id", terrain_spawner_entity.id)
entityId = hydra.get_component_property_value(height_provider_entity.components[0], "Configuration|Shape Entity Id")
Report.result(Tests.shape_changed, entityId == terrain_spawner_entity.id)
# 6) Set the FastNoise Gradient frequency to 0.01
Frequency = 0.01
height_provider_entity.get_set_test(2, "Configuration|Frequency", Frequency)
FrequencyVal = hydra.get_component_property_value(height_provider_entity.components[2], "Configuration|Frequency")
Report.result(Tests.frequency_changed, math.isclose(Frequency, FrequencyVal, abs_tol = 0.00001))
# 7) Set the Gradient List to TestEntity2
propertyTree = hydra.get_property_tree(terrain_spawner_entity.components[2])
propertyTree.add_container_item("Configuration|Gradient Entities", 0, height_provider_entity.id)
checkID = propertyTree.get_container_item("Configuration|Gradient Entities", 0)
Report.result(Tests.entity_added, checkID.GetValue() == height_provider_entity.id)
# 8) Set the PhysX Collider to Sphere mode
shape = 0
hydra.get_set_test(ball, 1, "Shape Configuration|Shape", shape)
setShape = hydra.get_component_property_value(ball.components[1], "Shape Configuration|Shape")
Report.result(Tests.shape_set, shape == setShape)
# 9) Disable and Enable the Terrain Gradient List so that it is recognised
editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [terrain_spawner_entity.components[2]])
general.enter_game_mode()
general.idle_wait_frames(1)
# 10) Enter game mode and test if the ball hits the heightfield within 3 seconds
TIMEOUT = 3.0
class Collider:
id = general.find_game_entity("Ball")
touched_ground = False
terrain_id = general.find_game_entity("TestEntity1")
def on_collision_begin(args):
other_id = args[0]
if other_id.Equal(terrain_id):
Report.info("Touched ground")
Collider.touched_ground = True
handler = azlmbr.physics.CollisionNotificationBusHandler()
handler.connect(Collider.id)
handler.add_callback("OnCollisionBegin", on_collision_begin)
helper.wait_for_condition(lambda: Collider.touched_ground, TIMEOUT)
Report.result(Tests.test_collision, Collider.touched_ground)
general.exit_game_mode()
# 11) Verify there are no errors and warnings in the logs
helper.wait_for_condition(lambda: section_tracer.has_errors or section_tracer.has_asserts, 1.0)
for error_info in section_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in section_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Terrain_SupportsPhysics)
@@ -0,0 +1,29 @@
"""
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 suite consists of all test cases that are passing and have been verified.
import pytest
import os
import sys
from ly_test_tools import LAUNCHERS
from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSharedTest
@pytest.mark.SUITE_main
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
class TestAutomation(EditorTestSuite):
enable_prefab_system = False
class test_AxisAlignedBoxShape_ConfigurationWorks(EditorSharedTest):
from .EditorScripts import TerrainPhysicsCollider_ChangesSizeWithAxisAlignedBoxShapeChanges as test_module
class test_Terrain_SupportsPhysics(EditorSharedTest):
from .EditorScripts import Terrain_SupportsPhysics as test_module
@@ -0,0 +1,6 @@
"""
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
"""
@@ -24,12 +24,12 @@ from base import TestAutomationBase
class TestAutomation(TestAutomationBase):
def test_WhiteBox_AddComponentToEntity(self, request, workspace, editor, launcher_platform):
from .tests import WhiteBox_AddComponentToEntity as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_WhiteBox_SetDefaultShape(self, request, workspace, editor, launcher_platform):
from .tests import WhiteBox_SetDefaultShape as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
def test_WhiteBox_SetInvisible(self, request, workspace, editor, launcher_platform):
from .tests import WhiteBox_SetInvisible as test_module
self._run_test(request, workspace, editor, test_module)
self._run_test(request, workspace, editor, test_module, enable_prefab_system=False)
@@ -183,23 +183,26 @@ def ap_missing_dependency_fixture(request, workspace, ap_setup_fixture) -> Any:
:return: None
"""
logger.info(f"Searching output for expected dependencies for product {product}")
sorted_expected = sorted(expected_dependencies)
# Check dependencies found either in the log or console output
for product_name, missing_deps in self.extract_missing_dependencies_from_output(log_output).items():
if product in product_name:
sorted_missing = sorted(missing_deps)
# fmt:off
assert sorted(missing_deps) == sorted(expected_dependencies), \
assert sorted_expected == sorted_missing, \
f"Missing dependencies for '{product_name}' did not match expected. Expected: " \
f"{expected_dependencies}, Actual: {missing_deps}"
f"{sorted_expected}, Actual: {sorted_missing}"
# fmt:on
# Check dependencies found in Database
for product_name, missing_deps in self.extract_missing_dependencies_from_database(product,
platforms).items():
if product.replace("\\", "/") in product_name:
sorted_missing = sorted(missing_deps)
# fmt:off
assert sorted(expected_dependencies) == sorted(missing_deps), \
f"Product '{product_name}' expected missing dependencies: {expected_dependencies}; " \
f"actual missing dependencies {missing_deps}"
assert sorted_expected == sorted_missing, \
f"Product '{product_name}' expected missing dependencies: {sorted_expected}; " \
f"actual missing dependencies {sorted_missing}"
# fmt:on
def __getitem__(self, item: str) -> object:
@@ -4,7 +4,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
A fixture for Setting Up Asset Processor Batch workspace for tests in lmbr_test
A fixture for Setting Up Asset Processor Batch workspace for tests
"""
# Import builtin libraries
@@ -4,7 +4,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
A fixture for using the Asset Processor in lmbr_test, this will stop the asset processor after every test via
A fixture for using the Asset Processor, this will stop the asset processor after every test via
the teardown. Using the fixture at class level will stop the asset processor after the suite completes.
Using the fixture at test level will stop asset processor after the test completes. Calling this fixture as a test argument will still run the teardown to stop the Asset Processor.
"""
@@ -15,6 +15,7 @@ import logging
# Import LyTestTools
import ly_test_tools.o3de.asset_processor as asset_processor_commands
import ly_test_tools.o3de.asset_processor_utils
logger = logging.getLogger(__name__)
@@ -36,5 +37,8 @@ def asset_processor(request: pytest.fixture, workspace: pytest.fixture) -> asset
ap.stop()
request.addfinalizer(teardown)
for n in ly_test_tools.o3de.asset_processor_utils.processList:
assert not ly_test_tools.o3de.asset_processor_utils.check_ap_running(n), f"{n} process did not shutdown correctly."
return ap
@@ -158,7 +158,7 @@ def bundler_batch_setup_fixture(request, workspace, asset_processor, timeout) ->
else:
cmd.append(f"--{key}")
if append_defaults:
cmd.append(f"--project-path={os.path.join(workspace.paths.engine_root(), workspace.project)}")
cmd.append(f"--project-path={workspace.paths.project()}")
return cmd
# ******
@@ -103,6 +103,19 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
AZ::AssetBundlerBatch
)
ly_add_pytest(
NAME AssetPipelineTests.BundleMode
PATH ${CMAKE_CURRENT_LIST_DIR}/bundle_mode_tests.py
EXCLUDE_TEST_RUN_TARGET_FROM_IDE
TEST_SERIAL
TEST_SUITE periodic
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
AZ::AssetBundlerBatch
Legacy::Editor
AutomatedTesting.Assets
)
ly_add_pytest(
NAME AssetPipelineTests.AssetBuilder
PATH ${CMAKE_CURRENT_LIST_DIR}/asset_builder_tests.py
@@ -88,214 +88,6 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
bundler_batch_helper.call_bundles(help="")
bundler_batch_helper.call_bundleSeed(help="")
@pytest.mark.BAT
@pytest.mark.assetpipeline
@pytest.mark.test_case_id("C16877175")
@pytest.mark.skip("'animations/animationeditorfiles/sample1.animgraph' missing, needs investigation")
def test_WindowsAndMac_CreateAssetList_DependenciesCorrect(self, workspace, bundler_batch_helper):
r"""
Tests that an asset list created maps dependencies correctly.
testdependencieslevel\level.pak and lists of known dependencies are used for validation
Test Steps:
1. Create an asset list from the level.pak
2. Create Lists of expected assets in the level.pak
3. Add lists of expected assets to a single list
4. Compare list of expected assets to actual assets
"""
helper = bundler_batch_helper
# Create the asset list file
helper.call_assetLists(
addSeed=r"levels\testdependencieslevel\level.pak",
assetListFile=helper['asset_info_file_request']
)
assert os.path.isfile(helper["asset_info_file_result"])
# Lists of known relative locations of assets
default_level_assets = [
"engineassets/texturemsg/defaultnouvs.dds",
"engineassets/texturemsg/defaultnouvs.dds.1",
"engineassets/texturemsg/defaultnouvs.dds.2",
"engineassets/texturemsg/defaultnouvs.dds.3",
"engineassets/texturemsg/defaultnouvs.dds.4",
"engineassets/texturemsg/defaultnouvs.dds.5",
"engineassets/texturemsg/defaultnouvs.dds.6",
"engineassets/texturemsg/defaultnouvs.dds.7",
"engineassets/texturemsg/defaultnouvs_ddn.dds",
"engineassets/texturemsg/defaultnouvs_ddn.dds.1",
"engineassets/texturemsg/defaultnouvs_ddn.dds.2",
"engineassets/texturemsg/defaultnouvs_ddn.dds.3",
"engineassets/texturemsg/defaultnouvs_ddn.dds.4",
"engineassets/texturemsg/defaultnouvs_ddn.dds.5",
"engineassets/texturemsg/defaultnouvs_spec.dds",
"engineassets/texturemsg/defaultnouvs_spec.dds.1",
"engineassets/texturemsg/defaultnouvs_spec.dds.2",
"engineassets/texturemsg/defaultnouvs_spec.dds.3",
"engineassets/texturemsg/defaultnouvs_spec.dds.4",
"engineassets/texturemsg/defaultnouvs_spec.dds.5",
"engineassets/textures/defaults/16_grey.dds",
"engineassets/textures/cubemap/default_level_cubemap.dds",
"engineassets/textures/cubemap/default_level_cubemap.dds.1",
"engineassets/textures/cubemap/default_level_cubemap.dds.2",
"engineassets/textures/cubemap/default_level_cubemap.dds.3",
"engineassets/textures/cubemap/default_level_cubemap.dds.4",
"engineassets/textures/cubemap/default_level_cubemap_diff.dds",
"engineassets/materials/water/ocean_default.mtl",
"engineassets/textures/defaults/spot_default.dds",
"engineassets/textures/defaults/spot_default.dds.1",
"engineassets/textures/defaults/spot_default.dds.2",
"engineassets/textures/defaults/spot_default.dds.3",
"engineassets/textures/defaults/spot_default.dds.4",
"engineassets/textures/defaults/spot_default.dds.5",
"materials/material_terrain_default.mtl",
"textures/skys/night/half_moon.dds",
"textures/skys/night/half_moon.dds.1",
"textures/skys/night/half_moon.dds.2",
"textures/skys/night/half_moon.dds.3",
"textures/skys/night/half_moon.dds.4",
"textures/skys/night/half_moon.dds.5",
"textures/skys/night/half_moon.dds.6",
"engineassets/materials/sky/sky.mtl",
"levels/testdependencieslevel/level.pak",
"levels/testdependencieslevel/terrain/cover.ctc",
"levels/testdependencieslevel/terraintexture.pak",
]
sequence_material_cube_assets = [
"textures/test_texture_sequence/test_texture_sequence000.dds",
"textures/test_texture_sequence/test_texture_sequence001.dds",
"textures/test_texture_sequence/test_texture_sequence002.dds",
"textures/test_texture_sequence/test_texture_sequence003.dds",
"textures/test_texture_sequence/test_texture_sequence004.dds",
"textures/test_texture_sequence/test_texture_sequence005.dds",
"objects/_primitives/_box_1x1.cgf",
"materials/test_texture_sequence.mtl",
"objects/_primitives/_box_1x1.mtl",
"textures/_primitives/middle_gray_checker.dds",
"textures/_primitives/middle_gray_checker.dds.1",
"textures/_primitives/middle_gray_checker.dds.2",
"textures/_primitives/middle_gray_checker.dds.3",
"textures/_primitives/middle_gray_checker.dds.4",
"textures/_primitives/middle_gray_checker.dds.5",
"textures/_primitives/middle_gray_checker_ddn.dds",
"textures/_primitives/middle_gray_checker_ddn.dds.1",
"textures/_primitives/middle_gray_checker_ddn.dds.2",
"textures/_primitives/middle_gray_checker_ddn.dds.3",
"textures/_primitives/middle_gray_checker_ddn.dds.4",
"textures/_primitives/middle_gray_checker_ddn.dds.5",
"textures/_primitives/middle_gray_checker_spec.dds",
"textures/_primitives/middle_gray_checker_spec.dds.1",
"textures/_primitives/middle_gray_checker_spec.dds.2",
"textures/_primitives/middle_gray_checker_spec.dds.3",
"textures/_primitives/middle_gray_checker_spec.dds.4",
"textures/_primitives/middle_gray_checker_spec.dds.5",
]
character_with_simplified_material_assets = [
"objects/characters/jack/jack.actor",
"objects/characters/jack/jack.mtl",
"objects/characters/jack/textures/jack_diff.dds",
"objects/characters/jack/textures/jack_diff.dds.1",
"objects/characters/jack/textures/jack_diff.dds.2",
"objects/characters/jack/textures/jack_diff.dds.3",
"objects/characters/jack/textures/jack_diff.dds.4",
"objects/characters/jack/textures/jack_diff.dds.5",
"objects/characters/jack/textures/jack_diff.dds.6",
"objects/characters/jack/textures/jack_diff.dds.7",
"objects/characters/jack/textures/jack_spec.dds",
"objects/characters/jack/textures/jack_spec.dds.1",
"objects/characters/jack/textures/jack_spec.dds.2",
"objects/characters/jack/textures/jack_spec.dds.3",
"objects/characters/jack/textures/jack_spec.dds.4",
"objects/characters/jack/textures/jack_spec.dds.5",
"objects/characters/jack/textures/jack_spec.dds.6",
"objects/characters/jack/textures/jack_spec.dds.7",
"objects/default/editorprimitive.mtl",
"engineassets/textures/grey.dds",
"animations/animationeditorfiles/sample0.animgraph",
"animations/motions/jack_death_fall_back_zup.motion",
"animations/animationeditorfiles/sample1.animgraph",
"animations/animationeditorfiles/sample0.motionset",
"animations/motions/rin_jump.motion",
"animations/animationeditorfiles/sample1.motionset",
"animations/motions/rin_idle.motion",
"animations/motions/jack_idle_aim_zup.motion",
]
spawner_assets = [
"slices/sphere.dynamicslice",
"objects/default/primitive_sphere.cgf",
"test1.luac",
"test2.luac",
]
ui_canvas_assets = [
"fonts/vera.ttf",
"fonts/vera.font",
"scriptcanvas/mainmenu.scriptcanvas_compiled",
"fonts/vera.fontfamily",
"ui/canvas/start.uicanvas",
"fonts/vera-italic.font",
"ui/textureatlas/sample.texatlasidx",
"fonts/vera-bold-italic.ttf",
"fonts/vera-bold.font",
"ui/textures/prefab/button_normal.dds",
"ui/textures/prefab/button_normal.sprite",
"fonts/vera-italic.ttf",
"ui/textureatlas/sample.dds",
"fonts/vera-bold-italic.font",
"fonts/vera-bold.ttf",
"ui/textures/prefab/button_disabled.dds",
"ui/textures/prefab/button_disabled.sprite",
]
wwise_and_atl_assets = [
"libs/gameaudio/wwise/levels/testdependencieslevel/test_dependencies_level.xml",
"sounds/wwise/test_bank3.bnk",
"sounds/wwise/test_bank4.bnk",
"sounds/wwise/test_bank5.bnk",
"sounds/wwise/test_bank1.bnk",
"sounds/wwise/init.bnk",
"sounds/wwise/499820003.wem",
"sounds/wwise/196049145.wem",
]
particle_library_assets = [
"libs/particles/milestone2particles.xml",
"textures/milestone2/particles/fx_launchermuzzlering_01.dds",
"textures/milestone2/particles/fx_launchermuzzlering_01.dds.1",
"textures/milestone2/particles/fx_launchermuzzlering_01.dds.2",
"textures/milestone2/particles/fx_launchermuzzlering_01.dds.3",
"textures/milestone2/particles/fx_launchermuzzlering_01.dds.4",
"textures/milestone2/particles/fx_launchermuzzlering_01.dds.5",
"textures/milestone2/particles/fx_sparkstreak_01.dds",
"textures/milestone2/particles/fx_launchermuzzlefront_01.dds",
"textures/milestone2/particles/fx_launchermuzzlefront_01.dds.1",
"textures/milestone2/particles/fx_launchermuzzlefront_01.dds.2",
"textures/milestone2/particles/fx_launchermuzzlefront_01.dds.3",
"textures/milestone2/particles/fx_launchermuzzlefront_01.dds.4",
"textures/milestone2/particles/fx_launchermuzzlefront_01.dds.5",
]
lens_flares_library_assets = ["libs/flares/flares.xml", "textures/lights/flare01.dds"]
expected_assets_list = default_level_assets
expected_assets_list.extend(sequence_material_cube_assets)
expected_assets_list.extend(character_with_simplified_material_assets)
expected_assets_list.extend(spawner_assets)
expected_assets_list.extend(ui_canvas_assets)
expected_assets_list.extend(wwise_and_atl_assets)
expected_assets_list.extend(particle_library_assets)
expected_assets_list.extend(lens_flares_library_assets) # All expected assets
# Get actual calculated dependencies from the asset list created
actual_assets_list = []
for rel_path in helper.get_asset_relative_paths(helper["asset_info_file_result"]):
actual_assets_list.append(rel_path)
assert sorted(actual_assets_list) == sorted(expected_assets_list)
@pytest.mark.BAT
@pytest.mark.assetpipeline
@@ -310,9 +102,9 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
3. Read and store contents of asset list into memory
4. Attempt to create a new asset list in without using --allowOverwrites
5. Verify that Asset Bundler returns false
6. Verify that file contents of the orignally created asset list did not change from what was stored in memory
6. Verify that file contents of the originally created asset list did not change from what was stored in memory
7. Attempt to create a new asset list without debug while allowing overwrites
8. Verify that file contents of the orignally created asset list changed from what was stored in memory
8. Verify that file contents of the originally created asset list changed from what was stored in memory
"""
helper = bundler_batch_helper
seed_list = os.path.join(workspace.paths.engine_root(), "Assets", "Engine", "SeedAssetList.seed") # Engine seed list
@@ -919,7 +711,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# Extra arguments for pattern comparison
cmd.extend([f"--filePatternType={pattern_type}", f"--filePattern={pattern}"])
if workspace.project:
cmd.append(f'--project-path={project_name}')
cmd.append(f'--project-path={workspace.paths.project()}')
return cmd
# End generate_compare_command()
@@ -960,7 +752,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
output_mac_asset_list = helper.platform_file_name(last_output_arg, platform)
# Build execution command
cmd = generate_compare_command(platform_arg, workspace.project)
cmd = generate_compare_command(platform_arg, workspace.paths.project())
# Execute command
subprocess.check_call(cmd)
@@ -995,7 +787,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
f"--comparisonRulesFile={rule_file}",
f"--comparisonType={args[1]}",
r"--addComparison",
f"--project-path={workspace.project}",
f"--project-path={workspace.paths.project()}",
]
if args[1] == "4":
# If pattern comparison, append a few extra arguments
@@ -1117,7 +909,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
"--addDefaultSeedListFiles",
"--platform=pc",
"--print",
f"--project-path={workspace.project}"
f"--project-path={workspace.paths.project()}"
],
universal_newlines=True,
)
@@ -1189,7 +981,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# Make sure file gets deleted on teardown
request.addfinalizer(lambda: fs.delete([bundle_result_path], True, False))
bundles_folder = os.path.join(workspace.paths.engine_root(), workspace.project, "Bundles")
bundles_folder = os.path.join(workspace.paths.project(), "Bundles")
level_pak = r"levels\testdependencieslevel\level.pak"
bundle_request_path = os.path.join(bundles_folder, "bundle.pak")
bundle_result_path = os.path.join(bundles_folder,
@@ -1243,23 +1035,64 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
2. Verify file was created
3. Verify that only the expected assets are present in the created asset list
"""
expected_assets = [
expected_assets = sorted([
"ui/canvases/lyshineexamples/animation/multiplesequences.uicanvas",
"ui/textures/prefab/button_normal.sprite"
]
"ui/textures/prefab/button_disabled.tif.streamingimage",
"ui/textures/prefab/tooltip_sliced.tif.streamingimage",
"ui/textures/prefab/button_normal.tif.streamingimage"
])
# Printing these lists out can save a step in debugging if this test fails on Jenkins.
logger.info(f"expected_assets: {expected_assets}")
skip_assets = sorted([
"ui/scripts/lyshineexamples/animation/multiplesequences.luac",
"ui/scripts/lyshineexamples/unloadthiscanvasbutton.luac",
"fonts/vera.fontfamily",
"fonts/vera-italic.font",
"fonts/vera.font",
"fonts/vera-bold.font",
"fonts/vera-bold-italic.font",
"fonts/vera-italic.ttf",
"fonts/vera.ttf",
"fonts/vera-bold.ttf",
"fonts/vera-bold-italic.ttf"
])
logger.info(f"skip_assets: {skip_assets}")
expected_and_skip_assets = sorted(expected_assets + skip_assets)
# Printing both together to make it quick to compare the results in the logs for a test failure on Jenkins
logger.info(f"expected_and_skip_assets: {expected_and_skip_assets}")
# First, generate an asset info file without skipping, to get a list that can be used as a baseline to verify
# the files were actually skipped, and not just missing.
bundler_batch_helper.call_assetLists(
assetListFile=bundler_batch_helper['asset_info_file_request'],
addSeed="ui/canvases/lyshineexamples/animation/multiplesequences.uicanvas"
)
assert os.path.isfile(bundler_batch_helper["asset_info_file_result"])
assets_in_no_skip_list = []
for rel_path in bundler_batch_helper.get_asset_relative_paths(bundler_batch_helper["asset_info_file_result"]):
assets_in_no_skip_list.append(rel_path)
assets_in_no_skip_list = sorted(assets_in_no_skip_list)
logger.info(f"assets_in_no_skip_list: {assets_in_no_skip_list}")
assert assets_in_no_skip_list == expected_and_skip_assets
# Now generate an asset info file using the skip command, and verify the skip files are not in the list.
bundler_batch_helper.call_assetLists(
assetListFile=bundler_batch_helper['asset_info_file_request'],
addSeed="ui/canvases/lyshineexamples/animation/multiplesequences.uicanvas",
skip="ui/textures/prefab/button_disabled.sprite,ui/scripts/lyshineexamples/animation/multiplesequences.luac,"
"ui/textures/prefab/tooltip_sliced.sprite,ui/scripts/lyshineexamples/unloadthiscanvasbutton.luac,fonts/vera.fontfamily,fonts/vera-italic.font,"
"fonts/vera.font,fonts/vera-bold.font,fonts/vera-bold-italic.font,fonts/vera-italic.ttf,fonts/vera.ttf,fonts/vera-bold.ttf,fonts/vera-bold-italic.ttf"
allowOverwrites="",
skip=','.join(skip_assets)
)
assert os.path.isfile(bundler_batch_helper["asset_info_file_result"])
assets_in_list = []
for rel_path in bundler_batch_helper.get_asset_relative_paths(bundler_batch_helper["asset_info_file_result"]):
assets_in_list.append(rel_path)
assets_in_list = sorted(assets_in_list)
logger.info(f"assets_in_list: {assets_in_list}")
assert assets_in_list == expected_assets
assert sorted(assets_in_list) == sorted(expected_assets)
@pytest.mark.BAT
@pytest.mark.assetpipeline
@@ -0,0 +1,20 @@
"""
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 azlmbr.bus
import azlmbr.editor
import azlmbr.legacy.general
import sys
# Print out the passed in bundle_path, so the outer test can verify this was sent in correctly
bundle_path = sys.argv[1]
print('Bundle mode test running with path {}'.format(sys.argv[1]))
# Turn on bundle mode. This will trigger some printouts that the outer test logic will validate.
azlmbr.legacy.general.set_cvar_integer("sys_report_files_not_found_in_paks", 1)
azlmbr.legacy.general.run_console(f"loadbundles {bundle_path}")
azlmbr.editor.EditorToolsApplicationRequestBus(azlmbr.bus.Broadcast, 'ExitNoPrompt')
@@ -0,0 +1,93 @@
"""
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 os
import pytest
import logging
import sys
import time
pytest.importorskip('ly_test_tools')
import ly_test_tools.environment.file_system as fs
import ly_test_tools.environment.waiter as waiter
import ly_test_tools.log.log_monitor
from ..ap_fixtures.asset_processor_fixture import asset_processor as asset_processor
from ..ap_fixtures.bundler_batch_setup_fixture import bundler_batch_setup_fixture as bundler_batch_helper
from ..ap_fixtures.timeout_option_fixture import timeout_option_fixture as timeout
@pytest.mark.SUITE_periodic
@pytest.mark.parametrize('launcher_platform', ['windows_editor'])
@pytest.mark.parametrize('project', ['AutomatedTesting'])
@pytest.mark.parametrize('level', ['auto_test'])
class TestBundleMode(object):
def test_bundle_mode_with_levels_mounts_bundles_correctly(self, request, editor, level, launcher_platform,
asset_processor, workspace, bundler_batch_helper):
level_pak = os.path.join("levels", level, "level.pak")
bundles_folder = os.path.join(workspace.paths.project(), "Bundles")
bundle_request_path = os.path.join(bundles_folder, "bundle.pak")
bundle_result_path = os.path.join(bundles_folder,
bundler_batch_helper.platform_file_name(
"bundle.pak", workspace.asset_processor_platform))
# Create target 'Bundles' folder if it doesn't exist
if not os.path.exists(bundles_folder):
os.mkdir(bundles_folder)
# Delete target bundle file if it already exists
if os.path.exists(bundle_result_path):
fs.delete([bundle_result_path], True, False)
# Make asset list file to use in the bundle
bundler_batch_helper.call_assetLists(
addSeed=level_pak,
assetListFile=bundler_batch_helper["asset_info_file_request"],
)
# Make bundle in <project_folder>/Bundles
bundler_batch_helper.call_bundles(
assetListFile=bundler_batch_helper["asset_info_file_result"],
outputBundlePath=bundle_request_path,
maxSize="2048",
)
# Ensure the bundle was created
assert os.path.exists(bundle_result_path), f"Bundle was not created at location: {bundle_result_path}"
# The editor flips the slash direction in some of the printouts
bundle_result_path_editor_separator = bundle_result_path.replace('\\', '/')
expected_lines = [
# A beginning of test printout can help debug where failures occur, if this line is missing
# then the Editor didn't launch, didn't run the Python test, or didn't pass in the right parameter
f'Bundle mode test running with path {bundles_folder}',
# These printouts happen in response to the loadbundles call, and verify this bundle is actually loaded
f"[CONSOLE] Executing console command 'loadbundles {bundles_folder}'",
f'(BundlingSystem) - Loading bundles from {bundles_folder} of type .pak',
f'(Archive) - Opening archive file {bundle_result_path_editor_separator}',
]
unexpected_lines = []
timeout = 180
halt_on_unexpected = False
test_directory = os.path.join(os.path.dirname(__file__))
test_file = os.path.join(test_directory, 'bundle_mode_in_editor_tests.py')
editor.args.extend(['-NullRenderer', '-rhi=Null', "--skipWelcomeScreenDialog",
"--autotest_mode", "--runpythontest", test_file, "--runpythonargs", bundles_folder])
with editor.start(launch_ap=True):
editor_log_file = os.path.join(editor.workspace.paths.project_log(), 'Editor.log')
log_monitor = ly_test_tools.log.log_monitor.LogMonitor(editor, editor_log_file)
waiter.wait_for(
lambda: editor.is_alive(),
timeout,
exc=("Log file '{}' was never opened by another process.".format(editor_log_file)),
interval=1)
log_monitor.monitor_log_for_lines(expected_lines, unexpected_lines, halt_on_unexpected, timeout)
# Delete the bundle created and used in this test
fs.delete([bundle_result_path], True, False)
@@ -120,31 +120,29 @@ class TestsMissingDependencies_WindowsAndMac(object):
# Relative path to the txt file with missing dependencies
expected_product = f"testassets\\validuuidsnotdependency.txt"
self._asset_processor.add_source_folder_assets(f"{self._workspace.project}\\Objects\\LumberTank")
self._asset_processor.add_source_folder_assets(f"{self._workspace.project}\\Objects\\Characters\\Jack")
# Expected missing dependencies
expected_dependencies = [
# String Asset #
('1CB10C43F3245B93A294C602ADEF95F9:[0', '{1CB10C43-F324-5B93-A294-C602ADEF95F9}:0'),
# InvalidAssetIdNoReport.txt
('E68A85B0-131D-5A82-B2D5-BC58EE4062AE', '{E68A85B0-131D-5A82-B2D5-BC58EE4062AE}:0'),
# InvalidRelativePathsNoReport.txt
('B3EF12DD306C520EB0A8A6B0D031A195', '{B3EF12DD-306C-520E-B0A8-A6B0D031A195}:0'),
# SelfReferenceUUID.txt
('33bcee02F3225688ABEE534F6058593F', '{33BCEE02-F322-5688-ABEE-534F6058593F}:0'),
('345E5C660D6254FF8D0F7C8EE66A2249', '{345E5C66-0D62-54FF-8D0F-7C8EE66A2249}:3e8'),
('345E5C660D6254FF8D0F7C8EE66A2249', '{345E5C66-0D62-54FF-8D0F-7C8EE66A2249}:3ea'),
('345E5C660D6254FF8D0F7C8EE66A2249', '{345E5C66-0D62-54FF-8D0F-7C8EE66A2249}:3eb'),
('37108522F50459499CD6C8D47A960CF1', '{37108522-F504-5949-9CD6-C8D47A960CF1}:3e8'),
('37108522F50459499CD6C8D47A960CF1', '{37108522-F504-5949-9CD6-C8D47A960CF1}:3ea'),
('37108522F50459499CD6C8D47A960CF1', '{37108522-F504-5949-9CD6-C8D47A960CF1}:3eb'),
('6BDE282B49C957F7B0714B26579BCA9A', '{6BDE282B-49C9-57F7-B071-4B26579BCA9A}:0'),
('747D31D71E62553592226173C49CF97E', '{747D31D7-1E62-5535-9222-6173C49CF97E}:1'),
('747D31D71E62553592226173C49CF97E', '{747D31D7-1E62-5535-9222-6173C49CF97E}:2'),
('A26C73D1837E5AE59E68F916FA7C3699', '{A26C73D1-837E-5AE5-9E68-F916FA7C3699}:3e8'),
('A26C73D1837E5AE59E68F916FA7C3699', '{A26C73D1-837E-5AE5-9E68-F916FA7C3699}:3ea'),
('A26C73D1837E5AE59E68F916FA7C3699', '{A26C73D1-837E-5AE5-9E68-F916FA7C3699}:3eb'),
('B076CDDC-14DF-50F4-A5E9-7518ABB3E851', '{B076CDDC-14DF-50F4-A5E9-7518ABB3E851}:0'),
('C67BEA9F-09FF-59AA-A7F0-A52B8F987508', '{C67BEA9F-09FF-59AA-A7F0-A52B8F987508}:3e8'),
('C67BEA9F-09FF-59AA-A7F0-A52B8F987508', '{C67BEA9F-09FF-59AA-A7F0-A52B8F987508}:3ea'),
('C67BEA9F-09FF-59AA-A7F0-A52B8F987508', '{C67BEA9F-09FF-59AA-A7F0-A52B8F987508}:3eb'),
('C67BEA9F-09FF-59AA-A7F0-A52B8F987508', '{C67BEA9F-09FF-59AA-A7F0-A52B8F987508}:3ec'),
('D92C4661C8985E19BD3597CB2318CFA6:[0', '{D92C4661-C898-5E19-BD35-97CB2318CFA6}:0'),
# SelfReferencePath.txt
('DD587FBE-16C8-5B98-AE3C-A9F8750B2692', '{DD587FBE-16C8-5B98-AE3C-A9F8750B2692}:0'),
# InvalidUUIDNoReport.txt
('837412DF-D05F-576D-81AA-ACF360463749', '{837412DF-D05F-576D-81AA-ACF360463749}:0'),
# MaxIteration31Deep.txt
('3F642A0FDC825696A70A1DA5709744DF', '{3F642A0F-DC82-5696-A70A-1DA5709744DF}:0'),
# OnlyMatchesCorrectLengthUUIDs.txt
('2545AD8B-1B9B-5F93-859D-D8DC1DC2B480', '{2545AD8B-1B9B-5F93-859D-D8DC1DC2B480}:0'),
# WildcardScanTest1.txt
('1CB10C43F3245B93A294C602ADEF95F9:[0', '{1CB10C43-F324-5B93-A294-C602ADEF95F9}:0'),
# RelativeProductPathsNotDependencies.txt
('B772953CA08A5D209491530E87D11504:[0', '{B772953C-A08A-5D20-9491-530E87D11504}:0'),
# WildcardScanTest2.txt
('D92C4661C8985E19BD3597CB2318CFA6', '{D92C4661-C898-5E19-BD35-97CB2318CFA6}:0'),
]
self.do_missing_dependency_test(expected_product, expected_dependencies,
"%ValidUUIDsNotDependency.txt")
@@ -187,8 +185,11 @@ class TestsMissingDependencies_WindowsAndMac(object):
# Expected missing dependencies
expected_dependencies = [
# String Asset #
('2ef92b8D044E5C278E2BB1AC0374A4E7:1003', '{2EF92B8D-044E-5C27-8E2B-B1AC0374A4E7}:3eb'),
# _dev_Red.tif
('2ef92b8D044E5C278E2BB1AC0374A4E7:1000', '{2EF92B8D-044E-5C27-8E2B-B1AC0374A4E7}:3e8'),
# _dev_Purple.tif
('A2482826-053D-5634-A27B-084B1326AAE5}:[1002', '{A2482826-053D-5634-A27B-084B1326AAE5}:3ea'),
# _dev_White.tif
('D83B36F1-61A6-5001-B191-4D0CE282E236}-1002', '{D83B36F1-61A6-5001-B191-4D0CE282E236}:3ea'),
]
@@ -237,11 +238,10 @@ class TestsMissingDependencies_WindowsAndMac(object):
expected_dependencies = [
# String Asset #
('TestAssets\\WildcardScanTest1.txt', '{1CB10C43-F324-5B93-A294-C602ADEF95F9}:0'),
('libs/particles/milestone2PARTICLES.XML', '{6BDE282B-49C9-57F7-B071-4B26579BCA9A}:0'),
('TESTASSETS/ReportONEmISSINGdEPENDENCY.tXT', '{BE5E2373-245E-59E4-B4C6-7370EEAA2EFD}:0'),
('textures/_dev_Purple.tif', '{A2482826-053D-5634-A27B-084B1326AAE5}:3e8'),
('textures/_dev_Purple.tif', '{A2482826-053D-5634-A27B-084B1326AAE5}:3ea'),
('textures/_dev_Purple.tif', '{A2482826-053D-5634-A27B-084B1326AAE5}:3eb'),
('project.json', '{B076CDDC-14DF-50F4-A5E9-7518ABB3E851}:0'),
('TestAssets/InvalidAssetIdNoReport.txt', '{E68A85B0-131D-5A82-B2D5-BC58EE4062AE}:0'),
('TestAssets/RelativeProductPathsNotDependencies.txt', '{B772953C-A08A-5D20-9491-530E87D11504}:0'),
]
@@ -282,29 +282,31 @@ class TestsMissingDependencies_WindowsAndMac(object):
2. Set the expected missing dependencies
3. Execute test
"""
self._asset_processor.add_source_folder_assets(f"Gems\\LyShineExamples\\Assets\\UI\\Fonts\\LyShineExamples")
self._asset_processor.add_scan_folder(f"Gems\\LyShineExamples\\Assets")
# Relative path to the txt file with missing dependencies as product paths
expected_product = f"testassets\\relativeproductpathsnotdependencies.txt"
expected_dependencies = [
# String Asset #
('materials/floor_tile.mtl', '{0EFF5E4A-F544-5D87-8696-6DDFA62D6063}:0'),
('materials/am_grass1.mtl', '{1151F14D-38A6-5579-888A-BE3139882E68}:0'),
('2ef92b8D044E5C278E2BB1AC0374A4E7:1002', '{2EF92B8D-044E-5C27-8E2B-B1AC0374A4E7}:3ea'),
('textures/milestone2/ama_grey_02.tif.streamingimage', '{3EE80AAD-EB9C-56BD-9E9C-65410578998C}:3e8'),
('ui/milestone2menu.uicanvas', '{445D9AF3-6CA5-5281-82A9-5C570BCD1DB8}:0'),
('libs/particles/milestone2particles.xml', '{6BDE282B-49C9-57F7-B071-4B26579BCA9A}:0'),
('textures/_dev_yellow_light.tif.1002.imagemipchain', '{6C40868F-3FC1-5115-96EA-DD0A9E33DEE4}:3ea'),
('textures\\\\_dev_tan.tif.streamingimage', '{8F2BCEF5-C8CE-5B80-8103-8C1D694D012C}:3e8'),
('materials/am_rockground.mtl', '{A1DA3D05-A020-5BB5-A608-C4812B7BD733}:0'),
('textures/_dev_purple.tif.streamingimage', '{A2482826-053D-5634-A27B-084B1326AAE5}:3e8'),
('A2482826-053D-5634-A27B-084B1326AAE5}:[1002', '{A2482826-053D-5634-A27B-084B1326AAE5}:3ea'),
('project.json', '{B076CDDC-14DF-50F4-A5E9-7518ABB3E851}:0'),
('CEAA362B4E505BCEB827CB92EF40A50E', '{CEAA362B-4E50-5BCE-B827-CB92EF40A50E}:1'),
('CEAA362B4E505BCEB827CB92EF40A50E', '{CEAA362B-4E50-5BCE-B827-CB92EF40A50E}:2'),
('textures\\_dev_stucco.tif.streamingimage', '{70114D85-D712-5AEB-A816-8FE3A37087AF}:3e8'),
('textures\\\\_dev_tan.tif.streamingimage', '{8F2BCEF5-C8CE-5B80-8103-8C1D694D012C}:3e8'),
('TEXTURES/_DEV_WHITE.tif.streamingimage', '{D83B36F1-61A6-5001-B191-4D0CE282E236}:3e8'),
('textures/_dev_yellow_light.tif.1002.imagemipchain', '{6C40868F-3FC1-5115-96EA-DD0A9E33DEE4}:3ea'),
('textures/_dev_woodland.tif.1002.imagemipchain', '{F3DD193C-5845-569C-A974-AA338B30CF86}:3ea'),
('textures/_dev_woodland.tif.streamingimage', '{F3DD193C-5845-569C-A974-AA338B30CF86}:3e8'),
('textures/_dev_yellow_light.tif.streamingimage', '{6C40868F-3FC1-5115-96EA-DD0A9E33DEE4}:3e8'),
('textures/_dev_yellow_med.tif.1002.imagemipchain', '{BB4DFF57-52BD-525B-9628-68232E31802C}:3ea'),
('textures/lights/flare01.tif.streamingimage', '{D8E49CC4-C743-5F31-A1EC-4AA89163B8F5}:3e8'),
# SelfReferenceUUID.txt
('33BCEE02-F322-5688-ABEE-534F6058593F', '{33BCEE02-F322-5688-ABEE-534F6058593F}:0'),
('textures/test_texture_sequence/test_texture_sequence000.png.streamingimage', '{6CC90BEE-0A9F-57A8-9013-7C1D643C0E8E}:3e8'),
# _dev_red.tif.streamingimage
('2ef92b8D044E5C278E2BB1AC0374A4E7:1002', '{2EF92B8D-044E-5C27-8E2B-B1AC0374A4E7}:3ea'),
# SelfReferenceAssetID.txt
('785A05D2-483E-5B43-A2B9-92ACDAE6E938', '{785A05D2-483E-5B43-A2B9-92ACDAE6E938}:0'),
('textures/test_texture_sequence/test_texture_sequence001.png.streamingimage', '{8A8A37DD-01B9-5D70-92E4-925E2C0FE826}:3e8'),
# _dev_purple.tif.1002.imagemipchain
('A2482826-053D-5634-A27B-084B1326AAE5}:[1002', '{A2482826-053D-5634-A27B-084B1326AAE5}:3ea'),
('textures/_dev_purple_glass.tif.1002.imagemipchain', '{2FCDD831-77D1-5BE1-A4C8-CA47E4F89F19}:3ea'),
]
self.do_missing_dependency_test(expected_product, expected_dependencies,
@@ -52,7 +52,7 @@ class TestAutomationBase:
cls._kill_ly_processes()
def _run_test(self, request, workspace, editor, testcase_module, extra_cmdline_args=[], batch_mode=True,
autotest_mode=True, use_null_renderer=True):
autotest_mode=True, use_null_renderer=True, enable_prefab_system=True):
test_starttime = time.time()
self.logger = logging.getLogger(__name__)
errors = []
@@ -97,6 +97,11 @@ class TestAutomationBase:
pycmd += ["-BatchMode"]
if autotest_mode:
pycmd += ["-autotest_mode"]
if enable_prefab_system:
pycmd += ["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]
else:
pycmd += ["--regset=/Amazon/Preferences/EnablePrefabSystem=false"]
pycmd += extra_cmdline_args
editor.args.extend(pycmd) # args are added to the WinLauncher start command
editor.start(backupFiles = False, launch_ap = False)
@@ -165,7 +170,7 @@ class TestAutomationBase:
for line in f.readlines():
error_str += f"|{log_basename}| {line}"
except Exception as ex:
error_str += "-- No log available --"
error_str += f"-- No log available ({ex})--"
pytest.fail(error_str)
@@ -7,60 +7,6 @@
#
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_FOUNDATION_TEST_SUPPORTED)
ly_add_pytest(
NAME AutomatedTesting::EditorTests_Main
TEST_SUITE main
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py
PYTEST_MARKS "not REQUIRES_gpu"
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Editor
)
ly_add_pytest(
NAME AutomatedTesting::EditorTests_Main_GPU
TEST_SUITE main
TEST_SERIAL
TEST_REQUIRES gpu
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py
PYTEST_MARKS "REQUIRES_gpu"
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Editor
)
ly_add_pytest(
NAME AutomatedTesting::EditorTests_Periodic
TEST_SUITE periodic
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Periodic.py
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Editor
)
ly_add_pytest(
NAME AutomatedTesting::EditorTests_Sandbox
TEST_SUITE sandbox
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox.py
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Editor
)
ly_add_pytest(
NAME AutomatedTesting::EditorTests_Main_Optimized
@@ -62,7 +62,7 @@ def AssetBrowser_SearchFiltering():
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
def verify_files_appeared(model, allowed_asset_extentions, parent_index=QtCore.QModelIndex()):
def verify_files_appeared(model, allowed_asset_extensions, parent_index=QtCore.QModelIndex()):
indexes = [parent_index]
while len(indexes) > 0:
parent_index = indexes.pop(0)
@@ -71,7 +71,7 @@ def AssetBrowser_SearchFiltering():
cur_data = cur_index.data(Qt.DisplayRole)
if (
"." in cur_data
and (cur_data.lower().split(".")[-1] not in allowed_asset_extentions)
and (cur_data.lower().split(".")[-1] not in allowed_asset_extensions)
and not cur_data[-1] == ")"
):
Report.info(f"Incorrect file found: {cur_data}")
@@ -94,16 +94,21 @@ def AssetBrowser_SearchFiltering():
Report.info("Asset Browser is already open")
editor_window = pyside_utils.get_editor_main_window()
app = QtWidgets.QApplication.instance()
# 3) Type the name of an asset in the search bar and make sure only one asset is filtered in Asset browser
# 3) Type the name of an asset in the search bar and make sure it is filtered to and selectable
asset_browser = editor_window.findChild(QtWidgets.QDockWidget, "Asset Browser")
search_bar = asset_browser.findChild(QtWidgets.QLineEdit, "textSearch")
search_bar.setText("cedar.fbx")
asset_browser_tree = asset_browser.findChild(QtWidgets.QTreeView, "m_assetBrowserTreeViewWidget")
model_index = pyside_utils.find_child_by_pattern(asset_browser_tree, "cedar.fbx")
pyside_utils.item_view_index_mouse_click(asset_browser_tree, model_index)
asset_browser_table = asset_browser.findChild(QtWidgets.QTreeView, "m_assetBrowserTableViewWidget")
found = await pyside_utils.wait_for_condition(lambda: pyside_utils.find_child_by_pattern(asset_browser_table, "cedar.fbx"), 5.0)
if found:
model_index = pyside_utils.find_child_by_pattern(asset_browser_table, "cedar.fbx")
else:
Report.result(Tests.asset_filtered, found)
pyside_utils.item_view_index_mouse_click(asset_browser_table, model_index)
is_filtered = await pyside_utils.wait_for_condition(
lambda: asset_browser_tree.indexBelow(asset_browser_tree.currentIndex()) == QtCore.QModelIndex(), 5.0)
lambda: asset_browser_table.currentIndex() == model_index, 5.0)
Report.result(Tests.asset_filtered, is_filtered)
# 4) Click the "X" in the search bar.
@@ -84,8 +84,8 @@ def AssetBrowser_TreeNavigation():
# 3) Collapse all files initially
main_window = editor_window.findChild(QtWidgets.QMainWindow)
asset_browser = pyside_utils.find_child_by_hierarchy(main_window, ..., "Asset Browser")
tree = pyside_utils.find_child_by_hierarchy(asset_browser, ..., "m_assetBrowserTreeViewWidget")
asset_browser = pyside_utils.find_child_by_pattern(main_window, text="Asset Browser", type=QtWidgets.QDockWidget)
tree = pyside_utils.find_child_by_pattern(asset_browser, "m_assetBrowserTreeViewWidget")
scroll_area = tree.findChild(QtWidgets.QWidget, "qt_scrollarea_vcontainer")
scroll_bar = scroll_area.findChild(QtWidgets.QScrollBar)
tree.collapseAll()
@@ -140,13 +140,13 @@ def Docking_BasicDockedTools():
# 2.5,6) Send a console command.
console_line_edit = console.findChild(QtWidgets.QLineEdit, "lineEdit")
console_line_edit.setText("t_Scale 2")
console_line_edit.setText("t_simulationTickScale 2")
QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter)
general.get_cvar("t_Scale")
Report.result(Tests.docked_console_works, general.get_cvar("t_Scale") == "2")
general.get_cvar("t_simulationTickScale")
Report.result(Tests.docked_console_works, general.get_cvar("t_simulationTickScale") == "2")
# Reset the altered cvar
console_line_edit.setText("t_Scale 1")
console_line_edit.setText("t_simulationTickScale 1")
QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter)
run_test()

Some files were not shown because too many files have changed in this diff Show More