Merge branch 'main' into ly-as-sdk/LYN-2948

# Conflicts:
#	CMakeLists.txt
#	Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.h
#	Gems/AtomLyIntegration/AtomViewportDisplayInfo/gem.json
#	cmake/LYWrappers.cmake
#	cmake/SettingsRegistry.cmake
#	scripts/o3de/tests/unit_test_current_project.py
main
pappeste 5 years ago
commit f1b688f435

@ -1 +1 @@
/autooptimizefile=0 /preset=AlbedoWithGenericAlpha /reduce="es3:2,ios:2,osx_gl:0,pc:0,provo:0" /autooptimizefile=0 /preset=AlbedoWithGenericAlpha /reduce="android:2,ios:2,mac:0,pc:0,provo:0"

@ -1 +1 @@
/autooptimizefile=0 /preset=Albedo /reduce="es3:3,ios:3,osx_gl:0,pc:0,provo:0" /autooptimizefile=0 /preset=Albedo /reduce="android:3,ios:3,mac:0,pc:0,provo:0"

@ -34,10 +34,10 @@ def ap_all_platforms_setup_fixture(request, workspace, ap_setup_fixture) -> Dict
# Specific platform cache locations # Specific platform cache locations
resources["pc_cache_location"] = os.path.join(cache_dir, "pc") resources["pc_cache_location"] = os.path.join(cache_dir, "pc")
resources["es3_cache_location"] = os.path.join(cache_dir, "es3") resources["android_cache_location"] = os.path.join(cache_dir, "android")
resources["ios_cache_location"] = os.path.join(cache_dir, "ios") resources["ios_cache_location"] = os.path.join(cache_dir, "ios")
resources["osx_gl_cache_location"] = os.path.join(cache_dir, "osx_gl") resources["mac_cache_location"] = os.path.join(cache_dir, "mac")
resources["provo_cache_location"] = os.path.join(cache_dir, "provo") resources["provo_cache_location"] = os.path.join(cache_dir, "provo")
resources["all_platforms"] = ["pc", "es3", "ios", "osx_gl", "provo"] resources["all_platforms"] = ["pc", "android", "ios", "mac", "provo"]
return resources return resources

@ -54,7 +54,7 @@ def bundler_batch_setup_fixture(request, workspace, asset_processor, timeout) ->
platforms = [platform.strip() for platform in platforms.split(",")] platforms = [platform.strip() for platform in platforms.split(",")]
else: else:
# No commandline argument provided, default to mac and pc # No commandline argument provided, default to mac and pc
platforms = ["pc", "osx_gl"] platforms = ["pc", "mac"]
class BundlerBatchFixture: class BundlerBatchFixture:
""" """
@ -241,11 +241,11 @@ def bundler_batch_setup_fixture(request, workspace, asset_processor, timeout) ->
def get_platform_flag(self, platform_name: str) -> int: def get_platform_flag(self, platform_name: str) -> int:
if (platform_name == "pc"): if (platform_name == "pc"):
return 1 return 1
elif (platform_name == "es3"): elif (platform_name == "android"):
return 2 return 2
elif (platform_name == "ios"): elif (platform_name == "ios"):
return 4 return 4
elif (platform_name == "osx_gl"): elif (platform_name == "mac"):
return 8 return 8
elif (platform_name == "server"): elif (platform_name == "server"):
return 128 return 128

@ -460,9 +460,9 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
""" """
helper = bundler_batch_helper helper = bundler_batch_helper
# fmt:off # fmt:off
assert "pc" in helper["platforms"] and "osx_gl" in helper["platforms"], \ assert "pc" in helper["platforms"] and "mac" in helper["platforms"], \
"This test requires both PC and MAC platforms to be enabled. " \ "This test requires both PC and MAC platforms to be enabled. " \
"Please rerun with commandline option: '--bundle_platforms=pc,osx_gl'" "Please rerun with commandline option: '--bundle_platforms=pc,mac'"
# fmt:on # fmt:on
seed_list = os.path.join(workspace.paths.engine_root(), "Engine", "SeedAssetList.seed") # Engine seed list seed_list = os.path.join(workspace.paths.engine_root(), "Engine", "SeedAssetList.seed") # Engine seed list
@ -502,7 +502,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
for bundle_file in bundle_files.values(): for bundle_file in bundle_files.values():
assert os.path.isfile(bundle_file) assert os.path.isfile(bundle_file)
# This asset is created on osx_gl platform but not on windows # This asset is created on mac platform but not on windows
file_to_check = b"engineassets/shading/defaultprobe_cm.dds.5" # [use byte str because file is in binary] file_to_check = b"engineassets/shading/defaultprobe_cm.dds.5" # [use byte str because file is in binary]
# Extract the delta catalog file from pc archive. {file_to_check} SHOULD NOT be present for PC # Extract the delta catalog file from pc archive. {file_to_check} SHOULD NOT be present for PC
@ -512,11 +512,11 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
f"{file_to_check} was found in DeltaCatalog.xml in pc bundle file {bundle_files['pc']}" f"{file_to_check} was found in DeltaCatalog.xml in pc bundle file {bundle_files['pc']}"
# fmt:on # fmt:on
# Extract the delta catalog file from osx_gl archive. {file_to_check} SHOULD be present for MAC # Extract the delta catalog file from mac archive. {file_to_check} SHOULD be present for MAC
file_contents = helper.extract_file_content(bundle_files["osx_gl"], "DeltaCatalog.xml") file_contents = helper.extract_file_content(bundle_files["mac"], "DeltaCatalog.xml")
# fmt:off # fmt:off
assert file_to_check in file_contents, \ assert file_to_check in file_contents, \
f"{file_to_check} was not found in DeltaCatalog.xml in darwin bundle file {bundle_files['osx_gl']}" f"{file_to_check} was not found in DeltaCatalog.xml in darwin bundle file {bundle_files['mac']}"
# fmt:on # fmt:on
# Gather checksums for first set of bundles # Gather checksums for first set of bundles
@ -613,7 +613,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
helper.call_seeds( helper.call_seeds(
seedListFile=helper["seed_list_file"], seedListFile=helper["seed_list_file"],
addSeed=test_asset, addSeed=test_asset,
platform="pc,osx_gl", platform="pc,mac",
) )
# Validate both mac and pc are activated for seed # Validate both mac and pc are activated for seed
@ -626,7 +626,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
helper.call_seeds( helper.call_seeds(
seedListFile=helper["seed_list_file"], seedListFile=helper["seed_list_file"],
removePlatformFromSeeds="", removePlatformFromSeeds="",
platform="osx_gl", platform="mac",
) )
# Validate only pc platform for seed. Save file contents to variable # Validate only pc platform for seed. Save file contents to variable
all_lines = check_seed_platform(helper["seed_list_file"], test_asset, helper["platform_values"]["pc"]) all_lines = check_seed_platform(helper["seed_list_file"], test_asset, helper["platform_values"]["pc"])
@ -646,7 +646,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
helper.call_seeds( helper.call_seeds(
seedListFile=helper["seed_list_file"], seedListFile=helper["seed_list_file"],
addPlatformToSeeds="", addPlatformToSeeds="",
platform="osx_gl", platform="mac",
) )
# Validate Mac platform was added back on. Save file contents # Validate Mac platform was added back on. Save file contents
# fmt:off # fmt:off
@ -670,7 +670,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
helper.call_seeds( helper.call_seeds(
seedListFile=helper["seed_list_file"], seedListFile=helper["seed_list_file"],
removeSeed=test_asset, removeSeed=test_asset,
platform="pc,osx_gl", platform="pc,mac",
) )
# Validate seed was removed from file # Validate seed was removed from file
@ -697,9 +697,9 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
env = ap_setup_fixture env = ap_setup_fixture
# fmt:off # fmt:off
assert "pc" in helper["platforms"] and "osx_gl" in helper["platforms"], \ assert "pc" in helper["platforms"] and "mac" in helper["platforms"], \
"This test requires both PC and MAC platforms to be enabled. " \ "This test requires both PC and MAC platforms to be enabled. " \
"Please rerun with commandline option: '--bundle_platforms=pc,osx_gl'" "Please rerun with commandline option: '--bundle_platforms=pc,mac'"
# fmt:on # fmt:on
# Test assets arranged in common lists: six (0-5) .txt files and .dat files # Test assets arranged in common lists: six (0-5) .txt files and .dat files
@ -717,16 +717,16 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
file_platforms = { file_platforms = {
"txtfile_0.txt": "pc", "txtfile_0.txt": "pc",
"txtfile_1.txt": "pc", "txtfile_1.txt": "pc",
"txtfile_2.txt": "pc,osx_gl", "txtfile_2.txt": "pc,mac",
"txtfile_3.txt": "pc,osx_gl", "txtfile_3.txt": "pc,mac",
"txtfile_4.txt": "osx_gl", "txtfile_4.txt": "mac",
"txtfile_5.txt": "osx_gl", "txtfile_5.txt": "mac",
"datfile_0.dat": "pc", "datfile_0.dat": "pc",
"datfile_1.dat": "pc", "datfile_1.dat": "pc",
"datfile_2.dat": "pc,osx_gl", "datfile_2.dat": "pc,mac",
"datfile_3.dat": "pc,osx_gl", "datfile_3.dat": "pc,mac",
"datfile_4.dat": "osx_gl", "datfile_4.dat": "mac",
"datfile_5.dat": "osx_gl", "datfile_5.dat": "mac",
} }
# Comparison rules files and their associated 'comparisonType' flags # Comparison rules files and their associated 'comparisonType' flags
@ -741,7 +741,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# Get our test assets ready and processed # Get our test assets ready and processed
utils.prepare_test_assets(env["tests_dir"], "C16877178", env["project_test_assets_dir"]) utils.prepare_test_assets(env["tests_dir"], "C16877178", env["project_test_assets_dir"])
asset_processor.batch_process(timeout=timeout, fastscan=False, platforms="pc,osx_gl") asset_processor.batch_process(timeout=timeout, fastscan=False, platforms="pc,mac")
# *** Some helper functions *** # # *** Some helper functions *** #
@ -759,7 +759,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
helper.call_assetLists( helper.call_assetLists(
assetListFile=os.path.join(helper["test_dir"], asset_list_file_name), assetListFile=os.path.join(helper["test_dir"], asset_list_file_name),
seedListFile=os.path.join(helper["test_dir"], seed_file_name), seedListFile=os.path.join(helper["test_dir"], seed_file_name),
platform="pc,osx_gl", platform="pc,mac",
) )
def get_platform_assets(asset_name_list: List[str]) -> Dict[str, List[str]]: def get_platform_assets(asset_name_list: List[str]) -> Dict[str, List[str]]:
@ -769,7 +769,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
for asset_name in asset_name_list: for asset_name in asset_name_list:
if "pc" in file_platforms[asset_name]: if "pc" in file_platforms[asset_name]:
win_assets.append(asset_name) win_assets.append(asset_name)
if "osx_gl" in file_platforms[asset_name]: if "mac" in file_platforms[asset_name]:
mac_assets.append(asset_name) mac_assets.append(asset_name)
return {"win": win_assets, "mac": mac_assets} return {"win": win_assets, "mac": mac_assets}
@ -798,7 +798,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# Get platform result file names # Get platform result file names
win_asset_list_file = helper.platform_file_name(request_file, platforms["pc"]) win_asset_list_file = helper.platform_file_name(request_file, platforms["pc"])
mac_asset_list_file = helper.platform_file_name(request_file, platforms["osx_gl"]) mac_asset_list_file = helper.platform_file_name(request_file, platforms["mac"])
# Get expected platforms for each asset in asset_names # Get expected platforms for each asset in asset_names
platform_files = get_platform_assets(asset_names) platform_files = get_platform_assets(asset_names)
@ -879,14 +879,14 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# fmt:on # fmt:on
# End verify_asset_list_contents() # End verify_asset_list_contents()
def run_compare_command_and_verify(platform_arg: str, expect_pc_output: bool, expect_osx_gl_output: bool) -> None: def run_compare_command_and_verify(platform_arg: str, expect_pc_output: bool, expect_mac_output: bool) -> None:
# Expected asset list to equal result of comparison # Expected asset list to equal result of comparison
expected_pc_asset_list = None expected_pc_asset_list = None
expected_osx_gl_asset_list = None expected_mac_asset_list = None
# Last output file. Use this for comparison to 'expected' # Last output file. Use this for comparison to 'expected'
output_pc_asset_list = None output_pc_asset_list = None
output_osx_gl_asset_list = None output_mac_asset_list = None
# Add the platform to the file name to match what the Bundler will create # Add the platform to the file name to match what the Bundler will create
last_output_arg = output_arg.split(",")[-1] last_output_arg = output_arg.split(",")[-1]
@ -895,10 +895,10 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
expected_pc_asset_list = os.path.join(helper["test_dir"], helper.platform_file_name(expected_asset_list, platform)) expected_pc_asset_list = os.path.join(helper["test_dir"], helper.platform_file_name(expected_asset_list, platform))
output_pc_asset_list = helper.platform_file_name(last_output_arg, platform) output_pc_asset_list = helper.platform_file_name(last_output_arg, platform)
if expect_osx_gl_output: if expect_mac_output:
platform = platforms["osx_gl"] platform = platforms["mac"]
expected_osx_gl_asset_list = os.path.join(helper["test_dir"], helper.platform_file_name(expected_asset_list, platform)) expected_mac_asset_list = os.path.join(helper["test_dir"], helper.platform_file_name(expected_asset_list, platform))
output_osx_gl_asset_list = helper.platform_file_name(last_output_arg, platform) output_mac_asset_list = helper.platform_file_name(last_output_arg, platform)
# Build execution command # Build execution command
cmd = generate_compare_command(platform_arg) cmd = generate_compare_command(platform_arg)
@ -911,15 +911,15 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
verify_asset_list_contents(expected_pc_asset_list, output_pc_asset_list) verify_asset_list_contents(expected_pc_asset_list, output_pc_asset_list)
fs.delete([output_pc_asset_list], True, True) fs.delete([output_pc_asset_list], True, True)
if expect_osx_gl_output: if expect_mac_output:
verify_asset_list_contents(expected_osx_gl_asset_list, output_osx_gl_asset_list) verify_asset_list_contents(expected_mac_asset_list, output_mac_asset_list)
fs.delete([output_osx_gl_asset_list], True, True) fs.delete([output_mac_asset_list], True, True)
# End run_compare_command_and_verify() # End run_compare_command_and_verify()
# Generate command, run and validate for each platform # Generate command, run and validate for each platform
run_compare_command_and_verify("pc", True, False) run_compare_command_and_verify("pc", True, False)
run_compare_command_and_verify("osx_gl", False, True) run_compare_command_and_verify("mac", False, True)
run_compare_command_and_verify("pc,osx_gl", True, True) run_compare_command_and_verify("pc,mac", True, True)
#run_compare_command_and_verify(None, True, True) #run_compare_command_and_verify(None, True, True)
# End compare_and_check() # End compare_and_check()

@ -102,7 +102,7 @@ class TestsAssetProcessorBatch_AllPlatforms(object):
def test_RunAPBatch_TwoPlatforms_ExitCodeZero(self, asset_processor): def test_RunAPBatch_TwoPlatforms_ExitCodeZero(self, asset_processor):
asset_processor.create_temp_asset_root() asset_processor.create_temp_asset_root()
asset_processor.enable_asset_processor_platform("pc") asset_processor.enable_asset_processor_platform("pc")
asset_processor.enable_asset_processor_platform("osx_gl") asset_processor.enable_asset_processor_platform("mac")
result, _ = asset_processor.batch_process() result, _ = asset_processor.batch_process()
assert result, "AP Batch failed" assert result, "AP Batch failed"

@ -39,4 +39,19 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
COMPONENT COMPONENT
Editor Editor
) )
ly_add_pytest(
NAME AutomatedTesting::EditorTests_Sandbox
TEST_SUITE sandbox
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}
PYTEST_MARKS "SUITE_sandbox"
TIMEOUT 1500
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Editor
)
endif() endif()

@ -39,7 +39,7 @@ class TestDocking(object):
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
@pytest.mark.test_case_id("C6376081") @pytest.mark.test_case_id("C6376081")
@pytest.mark.SUITE_periodic @pytest.mark.SUITE_sandbox
def test_Docking_BasicDockedTools(self, request, editor, level, launcher_platform): def test_Docking_BasicDockedTools(self, request, editor, level, launcher_platform):
expected_lines = [ expected_lines = [
"The tools are all docked together in a tabbed widget", "The tools are all docked together in a tabbed widget",

@ -39,7 +39,7 @@ class TestMenus(object):
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
@pytest.mark.test_case_id("C16780783", "C2174438") @pytest.mark.test_case_id("C16780783", "C2174438")
@pytest.mark.SUITE_periodic @pytest.mark.SUITE_sandbox
def test_Menus_EditMenuOptions_Work(self, request, editor, level, launcher_platform): def test_Menus_EditMenuOptions_Work(self, request, editor, level, launcher_platform):
expected_lines = [ expected_lines = [
"Undo Action triggered", "Undo Action triggered",
@ -113,7 +113,7 @@ class TestMenus(object):
) )
@pytest.mark.test_case_id("C16780778") @pytest.mark.test_case_id("C16780778")
@pytest.mark.SUITE_periodic @pytest.mark.SUITE_sandbox
def test_Menus_FileMenuOptions_Work(self, request, editor, level, launcher_platform): def test_Menus_FileMenuOptions_Work(self, request, editor, level, launcher_platform):
expected_lines = [ expected_lines = [
"New Level Action triggered", "New Level Action triggered",

@ -13,22 +13,21 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
## DynVeg ## ## DynVeg ##
# Temporarily moving all tests to periodic suite - SPEC-6553 ly_add_pytest(
#ly_add_pytest( NAME AutomatedTesting::DynamicVegetationTests_Main
# NAME AutomatedTesting::DynamicVegetationTests_Main TEST_SERIAL
# TEST_SERIAL TEST_SUITE main
# TEST_SUITE main PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg
# PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark"
# PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark" TIMEOUT 1500
# TIMEOUT 1500 RUNTIME_DEPENDENCIES
# RUNTIME_DEPENDENCIES AZ::AssetProcessor
# AZ::AssetProcessor Legacy::Editor
# Legacy::Editor AutomatedTesting.GameLauncher
# AutomatedTesting.GameLauncher AutomatedTesting.Assets
# AutomatedTesting.Assets COMPONENT
# COMPONENT LargeWorlds
# LargeWorlds )
#)
ly_add_pytest( ly_add_pytest(
@ -137,21 +136,21 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
LargeWorlds LargeWorlds
) )
## LandscapeCanvas ## ## LandscapeCanvas ##
# Temporarily moving all tests to periodic suite - SPEC-6553
#ly_add_pytest( ly_add_pytest(
# NAME AutomatedTesting::LandscapeCanvasTests_Main NAME AutomatedTesting::LandscapeCanvasTests_Main
# TEST_SERIAL TEST_SERIAL
# TEST_SUITE main TEST_SUITE main
# PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas
# PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark" PYTEST_MARKS "not SUITE_sandbox and not SUITE_periodic and not SUITE_benchmark"
# TIMEOUT 1500 TIMEOUT 1500
# RUNTIME_DEPENDENCIES RUNTIME_DEPENDENCIES
# AZ::AssetProcessor AZ::AssetProcessor
# Legacy::Editor Legacy::Editor
# AutomatedTesting.Assets AutomatedTesting.Assets
# COMPONENT COMPONENT
# LargeWorlds LargeWorlds
#) )
ly_add_pytest( ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Periodic NAME AutomatedTesting::LandscapeCanvasTests_Periodic

@ -41,7 +41,7 @@ class TestDynamicSliceInstanceSpawner(object):
return console return console
@pytest.mark.test_case_id("C28851763") @pytest.mark.test_case_id("C28851763")
@pytest.mark.SUITE_periodic @pytest.mark.SUITE_main
@pytest.mark.dynveg_area @pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
def test_DynamicSliceInstanceSpawner_DynamicSliceSpawnerWorks(self, request, editor, level, workspace, project, def test_DynamicSliceInstanceSpawner_DynamicSliceSpawnerWorks(self, request, editor, level, workspace, project,

@ -37,7 +37,7 @@ class TestEmptyInstanceSpawner(object):
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
@pytest.mark.test_case_id("C28851762") @pytest.mark.test_case_id("C28851762")
@pytest.mark.SUITE_periodic @pytest.mark.SUITE_main
@pytest.mark.dynveg_area @pytest.mark.dynveg_area
def test_EmptyInstanceSpawner_EmptySpawnerWorks(self, request, editor, level, launcher_platform): def test_EmptyInstanceSpawner_EmptySpawnerWorks(self, request, editor, level, launcher_platform):
cfg_args = [level] cfg_args = [level]

@ -118,7 +118,7 @@ class TestGraphComponentSync(object):
@pytest.mark.test_case_id('C15987206') @pytest.mark.test_case_id('C15987206')
@pytest.mark.SUITE_main @pytest.mark.SUITE_main
def test_LandscapeCanvas_GradientMixerNodeConstruction(self, request, editor, level, launcher_platform): def test_LandscapeCanvas_GradientMixer_NodeConstruction(self, request, editor, level, launcher_platform):
""" """
Verifies a Gradient Mixer can be setup in Landscape Canvas and all references are property set. Verifies a Gradient Mixer can be setup in Landscape Canvas and all references are property set.
""" """
@ -141,7 +141,7 @@ class TestGraphComponentSync(object):
@pytest.mark.test_case_id('C21333743') @pytest.mark.test_case_id('C21333743')
@pytest.mark.SUITE_periodic @pytest.mark.SUITE_periodic
def test_LandscapeCanvas_LayerBlenderNodeConstruction(self, request, editor, level, launcher_platform): def test_LandscapeCanvas_LayerBlender_NodeConstruction(self, request, editor, level, launcher_platform):
""" """
Verifies a Layer Blender can be setup in Landscape Canvas and all references are property set. Verifies a Layer Blender can be setup in Landscape Canvas and all references are property set.
""" """

@ -1 +1 @@
/autooptimizefile=0 /M=50,50,0,50,50,50 /preset=NormalsWithSmoothness /reduce="es3:1,ios:1,osx_gl:0,pc:0,provo:0" /autooptimizefile=0 /M=50,50,0,50,50,50 /preset=NormalsWithSmoothness /reduce="android:1,ios:1,mac:0,pc:0,provo:0"

@ -114,6 +114,10 @@ endif()
# Post-processing # Post-processing
################################################################################ ################################################################################
# The following steps have to be done after all targets are registered: # The following steps have to be done after all targets are registered:
# Defer generation of the StaticModules.inl file which is needed to create the AZ::Module derived class in monolithic
# builds until after all the targets are known
ly_delayed_generate_static_modules_inl()
# 1. Add any dependencies registered via ly_enable_gems # 1. Add any dependencies registered via ly_enable_gems
ly_enable_gems_delayed() ly_enable_gems_delayed()

@ -125,7 +125,7 @@ enum ESystemConfigPlatform
{ {
CONFIG_INVALID_PLATFORM = 0, CONFIG_INVALID_PLATFORM = 0,
CONFIG_PC = 1, CONFIG_PC = 1,
CONFIG_OSX_GL = 2, CONFIG_MAC = 2,
CONFIG_OSX_METAL = 3, CONFIG_OSX_METAL = 3,
CONFIG_ANDROID = 4, CONFIG_ANDROID = 4,
CONFIG_IOS = 5, CONFIG_IOS = 5,

@ -729,7 +729,7 @@ protected: // -------------------------------------------------------------
CCmdLine* m_pCmdLine; CCmdLine* m_pCmdLine;
string m_currentLanguageAudio; string m_currentLanguageAudio;
string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_es3.cfg or system_android_opengl.cfg or system_windows_pc.cfg string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_android.cfg or system_windows_pc.cfg
std::vector< std::pair<CTimeValue, float> > m_updateTimes; std::vector< std::pair<CTimeValue, float> > m_updateTimes;

@ -244,7 +244,7 @@ public class LumberyardActivity extends NativeActivity
boolean useMainObb = GetBooleanResource("use_main_obb"); boolean useMainObb = GetBooleanResource("use_main_obb");
boolean usePatchObb = GetBooleanResource("use_patch_obb"); boolean usePatchObb = GetBooleanResource("use_patch_obb");
if (IsBootstrapInAPK() && (useMainObb || usePatchObb)) if (AreAssetsInAPK() && (useMainObb || usePatchObb))
{ {
Log.d(TAG, "Using OBB expansion files for game assets"); Log.d(TAG, "Using OBB expansion files for game assets");
@ -421,12 +421,12 @@ public class LumberyardActivity extends NativeActivity
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
private boolean IsBootstrapInAPK() private boolean AreAssetsInAPK()
{ {
try try
{ {
InputStream bootstrap = getAssets().open("bootstrap.cfg", AssetManager.ACCESS_UNKNOWN); InputStream engine = getAssets().open("engine.json", AssetManager.ACCESS_UNKNOWN);
bootstrap.close(); engine.close();
return true; return true;
} }
catch (IOException exception) catch (IOException exception)

@ -148,7 +148,7 @@ namespace AZ
} }
} }
AZ_Assert(false, "Failed to locate the bootstrap.cfg path"); AZ_Assert(false, "Failed to locate the engine.json path");
return nullptr; return nullptr;
} }

@ -73,8 +73,8 @@ namespace AZ
//! \return The pointer position of the relative asset path //! \return The pointer position of the relative asset path
AZ::IO::FixedMaxPath StripApkPrefix(const char* filePath); AZ::IO::FixedMaxPath StripApkPrefix(const char* filePath);
//! Searches application storage and the APK for bootstrap.cfg. Will return nullptr //! Searches application storage and the APK for engine.json. Will return nullptr
//! if bootstrap.cfg is not found. //! if engine.json is not found.
const char* FindAssetsDirectory(); const char* FindAssetsDirectory();
//! Calls into Java to show the splash screen on the main UI (Java) thread //! Calls into Java to show the splash screen on the main UI (Java) thread

@ -462,8 +462,6 @@ namespace AZ
// for the application root. // for the application root.
CalculateAppRoot(); CalculateAppRoot();
// Merge the bootstrap.cfg file into the Settings Registry as soon as the OSAllocator has been created.
SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(*m_settingsRegistry);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {}); SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands); SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry); SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry);

@ -126,17 +126,16 @@ namespace AZ
m_offsets.fill(1); // Halton sequences start at index 1. m_offsets.fill(1); // Halton sequences start at index 1.
m_increments.fill(1); // By default increment by 1 between each number. m_increments.fill(1); // By default increment by 1 between each number.
} }
//! Returns a Halton sequence in an array of N length //! Fills a provided container from begin to end with a Halton sequence.
template<uint32_t N> //! Entries are expected to be, or implicitly converted to, AZStd::array<float, Dimensions>.
AZStd::array<AZStd::array<float, Dimensions>, N> GetHaltonSequence() template<typename Iterator>
void FillHaltonSequence(Iterator begin, Iterator end)
{ {
AZStd::array<AZStd::array<float, Dimensions>, N> result;
AZStd::array<uint32_t, Dimensions> indices = m_offsets; AZStd::array<uint32_t, Dimensions> indices = m_offsets;
// Generator that returns the Halton number for all bases for a single entry. // Generator that returns the Halton number for all bases for a single entry.
auto f = [&] () auto f = [&]()
{ {
AZStd::array<float, Dimensions> item; AZStd::array<float, Dimensions> item;
for (auto d = 0; d < Dimensions; ++d) for (auto d = 0; d < Dimensions; ++d)
@ -147,12 +146,20 @@ namespace AZ
return item; return item;
}; };
AZStd::generate(result.begin(), result.end(), f); AZStd::generate(begin, end, f);
}
//! Returns a Halton sequence in an array of N length.
template<uint32_t N>
AZStd::array<AZStd::array<float, Dimensions>, N> GetHaltonSequence()
{
AZStd::array<AZStd::array<float, Dimensions>, N> result;
FillHaltonSequence(result.begin(), result.end());
return result; return result;
} }
//! Sets the offsets per dimension to start generating a sequence from. //! Sets the offsets per dimension to start generating a sequence from.
//! By default, there is no offset (offset of 0 corresponds to starting at index 1) //! By default, there is no offset (offset of 0 corresponds to starting at index 1).
void SetOffsets(AZStd::array<uint32_t, Dimensions> offsets) void SetOffsets(AZStd::array<uint32_t, Dimensions> offsets)
{ {
m_offsets = offsets; m_offsets = offsets;

@ -19,7 +19,7 @@ namespace AZ
{ {
inline namespace PlatformDefaults inline namespace PlatformDefaults
{ {
static const char* PlatformNames[PlatformId::NumPlatformIds] = { PlatformPC, PlatformES3, PlatformIOS, PlatformOSX, PlatformProvo, PlatformSalem, PlatformJasper, PlatformServer, PlatformAll, PlatformAllClient }; static const char* PlatformNames[PlatformId::NumPlatformIds] = { PlatformPC, PlatformAndroid, PlatformIOS, PlatformMac, PlatformProvo, PlatformSalem, PlatformJasper, PlatformServer, PlatformAll, PlatformAllClient };
const char* PlatformIdToPalFolder(AZ::PlatformId platform) const char* PlatformIdToPalFolder(AZ::PlatformId platform)
{ {
@ -31,11 +31,11 @@ namespace AZ
{ {
case AZ::PC: case AZ::PC:
return "PC"; return "PC";
case AZ::ES3: case AZ::ANDROID_ID:
return "Android"; return "Android";
case AZ::IOS: case AZ::IOS:
return "iOS"; return "iOS";
case AZ::OSX: case AZ::MAC:
return "Mac"; return "Mac";
case AZ::PROVO: case AZ::PROVO:
return "Provo"; return "Provo";
@ -66,11 +66,11 @@ namespace AZ
} }
else if (osPlatform == PlatformCodeNameMac) else if (osPlatform == PlatformCodeNameMac)
{ {
return PlatformOSX; return PlatformMac;
} }
else if (osPlatform == PlatformCodeNameAndroid) else if (osPlatform == PlatformCodeNameAndroid)
{ {
return PlatformES3; return PlatformAndroid;
} }
else if (osPlatform == PlatformCodeNameiOS) else if (osPlatform == PlatformCodeNameiOS)
{ {
@ -207,13 +207,13 @@ namespace AZ
platformCodes.emplace_back(PlatformCodeNameWindows); platformCodes.emplace_back(PlatformCodeNameWindows);
platformCodes.emplace_back(PlatformCodeNameLinux); platformCodes.emplace_back(PlatformCodeNameLinux);
break; break;
case PlatformId::ES3: case PlatformId::ANDROID_ID:
platformCodes.emplace_back(PlatformCodeNameAndroid); platformCodes.emplace_back(PlatformCodeNameAndroid);
break; break;
case PlatformId::IOS: case PlatformId::IOS:
platformCodes.emplace_back(PlatformCodeNameiOS); platformCodes.emplace_back(PlatformCodeNameiOS);
break; break;
case PlatformId::OSX: case PlatformId::MAC:
platformCodes.emplace_back(PlatformCodeNameMac); platformCodes.emplace_back(PlatformCodeNameMac);
break; break;
case PlatformId::PROVO: case PlatformId::PROVO:

@ -27,9 +27,9 @@ namespace AZ
inline namespace PlatformDefaults inline namespace PlatformDefaults
{ {
constexpr char PlatformPC[] = "pc"; constexpr char PlatformPC[] = "pc";
constexpr char PlatformES3[] = "es3"; constexpr char PlatformAndroid[] = "android";
constexpr char PlatformIOS[] = "ios"; constexpr char PlatformIOS[] = "ios";
constexpr char PlatformOSX[] = "osx_gl"; constexpr char PlatformMac[] = "mac";
constexpr char PlatformProvo[] = "provo"; constexpr char PlatformProvo[] = "provo";
constexpr char PlatformSalem[] = "salem"; constexpr char PlatformSalem[] = "salem";
constexpr char PlatformJasper[] = "jasper"; constexpr char PlatformJasper[] = "jasper";
@ -54,9 +54,9 @@ namespace AZ
AZ_ENUM_WITH_UNDERLYING_TYPE(PlatformId, int, AZ_ENUM_WITH_UNDERLYING_TYPE(PlatformId, int,
(Invalid, -1), (Invalid, -1),
PC, PC,
ES3, ANDROID_ID,
IOS, IOS,
OSX, MAC,
PROVO, PROVO,
SALEM, SALEM,
JASPER, JASPER,
@ -73,9 +73,9 @@ namespace AZ
{ {
Platform_NONE = 0x00, Platform_NONE = 0x00,
Platform_PC = 1 << PlatformId::PC, Platform_PC = 1 << PlatformId::PC,
Platform_ES3 = 1 << PlatformId::ES3, Platform_ANDROID = 1 << PlatformId::ANDROID_ID,
Platform_IOS = 1 << PlatformId::IOS, Platform_IOS = 1 << PlatformId::IOS,
Platform_OSX = 1 << PlatformId::OSX, Platform_MAC = 1 << PlatformId::MAC,
Platform_PROVO = 1 << PlatformId::PROVO, Platform_PROVO = 1 << PlatformId::PROVO,
Platform_SALEM = 1 << PlatformId::SALEM, Platform_SALEM = 1 << PlatformId::SALEM,
Platform_JASPER = 1 << PlatformId::JASPER, Platform_JASPER = 1 << PlatformId::JASPER,
@ -87,7 +87,7 @@ namespace AZ
// A special platform that will always correspond to all non-server platforms, even if new ones are added // A special platform that will always correspond to all non-server platforms, even if new ones are added
Platform_ALL_CLIENT = 1ULL << 31, Platform_ALL_CLIENT = 1ULL << 31,
AllNamedPlatforms = Platform_PC | Platform_ES3 | Platform_IOS | Platform_OSX | Platform_PROVO | Platform_SALEM | Platform_JASPER | Platform_SERVER, AllNamedPlatforms = Platform_PC | Platform_ANDROID | Platform_IOS | Platform_MAC | Platform_PROVO | Platform_SALEM | Platform_JASPER | Platform_SERVER,
}; };
AZ_DEFINE_ENUM_BITWISE_OPERATORS(PlatformFlags); AZ_DEFINE_ENUM_BITWISE_OPERATORS(PlatformFlags);

@ -28,8 +28,8 @@ namespace AZ
return "Android64"; return "Android64";
case PlatformID::PLATFORM_APPLE_IOS: case PlatformID::PLATFORM_APPLE_IOS:
return "iOS"; return "iOS";
case PlatformID::PLATFORM_APPLE_OSX: case PlatformID::PLATFORM_APPLE_MAC:
return "OSX"; return "Mac";
#if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS) #if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\ #define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
case PlatformID::PLATFORM_##PUBLICNAME:\ case PlatformID::PLATFORM_##PUBLICNAME:\

@ -23,7 +23,7 @@ namespace AZ
PLATFORM_WINDOWS_64, PLATFORM_WINDOWS_64,
PLATFORM_LINUX_64, PLATFORM_LINUX_64,
PLATFORM_APPLE_IOS, PLATFORM_APPLE_IOS,
PLATFORM_APPLE_OSX, PLATFORM_APPLE_MAC,
PLATFORM_ANDROID_64, // ARMv8 / 64-bit PLATFORM_ANDROID_64, // ARMv8 / 64-bit
#if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS) #if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\ #define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\

@ -937,7 +937,7 @@ void ScriptSystemComponent::Reflect(ReflectContext* reflection)
->Enum<static_cast<int>(PlatformID::PLATFORM_LINUX_64)>("Linux") ->Enum<static_cast<int>(PlatformID::PLATFORM_LINUX_64)>("Linux")
->Enum<static_cast<int>(PlatformID::PLATFORM_ANDROID_64)>("Android64") ->Enum<static_cast<int>(PlatformID::PLATFORM_ANDROID_64)>("Android64")
->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_IOS)>("iOS") ->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_IOS)>("iOS")
->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_OSX)>("OSX") ->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_MAC)>("Mac")
#if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS) #if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\ #define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
->Enum<static_cast<int>(PlatformID::PLATFORM_##PUBLICNAME)>(#CodeName) ->Enum<static_cast<int>(PlatformID::PLATFORM_##PUBLICNAME)>(#CodeName)

@ -523,13 +523,6 @@ namespace AZ::SettingsRegistryMergeUtils
return configFileParsed; return configFileParsed;
} }
void MergeSettingsToRegistry_Bootstrap(SettingsRegistryInterface& registry)
{
ConfigParserSettings parserSettings;
parserSettings.m_registryRootPointerPath = BootstrapSettingsRootKey;
MergeSettingsToRegistry_ConfigFile(registry, "bootstrap.cfg", parserSettings);
}
void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry) void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry)
{ {
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString; using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;

@ -172,9 +172,6 @@ namespace AZ::SettingsRegistryMergeUtils
bool MergeSettingsToRegistry_ConfigFile(SettingsRegistryInterface& registry, AZStd::string_view filePath, bool MergeSettingsToRegistry_ConfigFile(SettingsRegistryInterface& registry, AZStd::string_view filePath,
const ConfigParserSettings& configParserSettings); const ConfigParserSettings& configParserSettings);
//! Loads bootstrap.cfg into the Settings Registry. This file does not support specializations.
void MergeSettingsToRegistry_Bootstrap(SettingsRegistryInterface& registry);
//! Extracts file path information from the environment and bootstrap to calculate the various file paths and adds those //! Extracts file path information from the environment and bootstrap to calculate the various file paths and adds those
//! to the Settings Registry under the FilePathsRootKey. //! to the Settings Registry under the FilePathsRootKey.
void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry); void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry);

@ -24,7 +24,7 @@ namespace UnitTest
EXPECT_FLOAT_EQ(5981.0f / 15625.0f, GetHaltonNumber(4321, 5)); EXPECT_FLOAT_EQ(5981.0f / 15625.0f, GetHaltonNumber(4321, 5));
} }
TEST(MATH_Random, HaltonSequence) TEST(MATH_Random, HaltonSequenceStandard)
{ {
HaltonSequence<3> sequence({ 2, 3, 5 }); HaltonSequence<3> sequence({ 2, 3, 5 });
auto regularSequence = sequence.GetHaltonSequence<5>(); auto regularSequence = sequence.GetHaltonSequence<5>();
@ -48,7 +48,11 @@ namespace UnitTest
EXPECT_FLOAT_EQ(5.0f / 8.0f, regularSequence[4][0]); EXPECT_FLOAT_EQ(5.0f / 8.0f, regularSequence[4][0]);
EXPECT_FLOAT_EQ(7.0f / 9.0f, regularSequence[4][1]); EXPECT_FLOAT_EQ(7.0f / 9.0f, regularSequence[4][1]);
EXPECT_FLOAT_EQ(1.0f / 25.0f, regularSequence[4][2]); EXPECT_FLOAT_EQ(1.0f / 25.0f, regularSequence[4][2]);
}
TEST(MATH_Random, HaltonSequenceOffsets)
{
HaltonSequence<3> sequence({ 2, 3, 5 });
sequence.SetOffsets({ 1, 2, 3 }); sequence.SetOffsets({ 1, 2, 3 });
auto offsetSequence = sequence.GetHaltonSequence<2>(); auto offsetSequence = sequence.GetHaltonSequence<2>();
@ -59,10 +63,15 @@ namespace UnitTest
EXPECT_FLOAT_EQ(3.0f / 4.0f, offsetSequence[1][0]); EXPECT_FLOAT_EQ(3.0f / 4.0f, offsetSequence[1][0]);
EXPECT_FLOAT_EQ(4.0f / 9.0f, offsetSequence[1][1]); EXPECT_FLOAT_EQ(4.0f / 9.0f, offsetSequence[1][1]);
EXPECT_FLOAT_EQ(1.0f / 25.0f, offsetSequence[1][2]); EXPECT_FLOAT_EQ(1.0f / 25.0f, offsetSequence[1][2]);
}
TEST(MATH_Random, HaltonSequenceIncrements)
{
HaltonSequence<3> sequence({ 2, 3, 5 });
sequence.SetOffsets({ 1, 2, 3 });
sequence.SetIncrements({ 1, 2, 3 }); sequence.SetIncrements({ 1, 2, 3 });
auto incrementedSequence = sequence.GetHaltonSequence<2>(); auto incrementedSequence = sequence.GetHaltonSequence<2>();
EXPECT_FLOAT_EQ(1.0f / 4.0f, incrementedSequence[0][0]); EXPECT_FLOAT_EQ(1.0f / 4.0f, incrementedSequence[0][0]);
EXPECT_FLOAT_EQ(1.0f / 9.0f, incrementedSequence[0][1]); EXPECT_FLOAT_EQ(1.0f / 9.0f, incrementedSequence[0][1]);
EXPECT_FLOAT_EQ(4.0f / 5.0f, incrementedSequence[0][2]); EXPECT_FLOAT_EQ(4.0f / 5.0f, incrementedSequence[0][2]);
@ -71,4 +80,35 @@ namespace UnitTest
EXPECT_FLOAT_EQ(7.0f / 9.0f, incrementedSequence[1][1]); EXPECT_FLOAT_EQ(7.0f / 9.0f, incrementedSequence[1][1]);
EXPECT_FLOAT_EQ(11.0f / 25.0f, incrementedSequence[1][2]); EXPECT_FLOAT_EQ(11.0f / 25.0f, incrementedSequence[1][2]);
} }
TEST(MATH_Random, FillHaltonSequence)
{
HaltonSequence<3> sequence({ 2, 3, 5 });
auto regularSequence = sequence.GetHaltonSequence<5>();
struct Point
{
Point() = default;
Point(AZStd::array<float, 3> arr)
:x(arr[0])
,y(arr[1])
,z(arr[2])
{}
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
};
AZStd::array<Point, 5> ownedContainer;
sequence.FillHaltonSequence(ownedContainer.begin(), ownedContainer.end());
for (size_t i = 0; i < regularSequence.size(); ++i)
{
EXPECT_FLOAT_EQ(regularSequence[i][0], ownedContainer[i].x);
EXPECT_FLOAT_EQ(regularSequence[i][1], ownedContainer[i].y);
EXPECT_FLOAT_EQ(regularSequence[i][2], ownedContainer[i].z);
}
}
} }

@ -112,7 +112,7 @@ namespace JsonSerializationTests
AZ::Transform testTransform = AZ::Transform::CreateIdentity(); AZ::Transform testTransform = AZ::Transform::CreateIdentity();
AZ::Transform expectedTransform = AZ::Transform expectedTransform =
AZ::Transform::CreateFromQuaternion(AZ::Quaternion(0.25f, 0.5f, 0.75f, 1.0f)); AZ::Transform::CreateFromQuaternion(AZ::Quaternion(0.25f, 0.5f, 0.75f, 1.0f));
expectedTransform.SetScale(AZ::Vector3(5.5f)); expectedTransform.SetUniformScale(5.5f);
rapidjson::Document json; rapidjson::Document json;
json.Parse(R"({ "Rotation": [ 0.25, 0.5, 0.75, 1.0 ], "Scale": 5.5 })"); json.Parse(R"({ "Rotation": [ 0.25, 0.5, 0.75, 1.0 ], "Scale": 5.5 })");
@ -128,7 +128,7 @@ namespace JsonSerializationTests
{ {
AZ::Transform testTransform = AZ::Transform::CreateIdentity(); AZ::Transform testTransform = AZ::Transform::CreateIdentity();
AZ::Transform expectedTransform = AZ::Transform::CreateTranslation(AZ::Vector3(2.25f, 3.5f, 4.75f)); AZ::Transform expectedTransform = AZ::Transform::CreateTranslation(AZ::Vector3(2.25f, 3.5f, 4.75f));
expectedTransform.SetScale(AZ::Vector3(5.5f)); expectedTransform.SetUniformScale(5.5f);
rapidjson::Document json; rapidjson::Document json;
json.Parse(R"({ "Translation": [ 2.25, 3.5, 4.75 ], "Scale": 5.5 })"); json.Parse(R"({ "Translation": [ 2.25, 3.5, 4.75 ], "Scale": 5.5 })");

@ -372,15 +372,15 @@ mac_remote_filesystem=0
-- We need to know this before we establish VFS because different platform assets -- We need to know this before we establish VFS because different platform assets
-- are stored in different root folders in the cache. These correspond to the names -- are stored in different root folders in the cache. These correspond to the names
-- In the asset processor config file. This value also controls what config file is read -- In the asset processor config file. This value also controls what config file is read
-- when you read system_xxxx_xxxx.cfg (for example, system_windows_pc.cfg or system_android_es3.cfg) -- when you read system_xxxx_xxxx.cfg (for example, system_windows_pc.cfg or system_android_android.cfg)
-- by default, pc assets (in the 'pc' folder) are used, with RC being fed 'pc' as the platform -- by default, pc assets (in the 'pc' folder) are used, with RC being fed 'pc' as the platform
-- by default on console we use the default assets=pc for better iteration times -- by default on console we use the default assets=pc for better iteration times
-- we should turn on console specific assets only when in release and/or testing assets and/or loading performance -- we should turn on console specific assets only when in release and/or testing assets and/or loading performance
-- that way most people will not need to have 3 different caches taking up disk space -- that way most people will not need to have 3 different caches taking up disk space
assets = pc assets = pc
android_assets = es3 android_assets = android
ios_assets = ios ios_assets = ios
mac_assets = osx_gl mac_assets = mac
-- Add the IP address of your console to the white list that will connect to the asset processor here -- Add the IP address of your console to the white list that will connect to the asset processor here
-- You can list addresses or CIDR's. CIDR's are helpful if you are using DHCP. A CIDR looks like an ip address with -- You can list addresses or CIDR's. CIDR's are helpful if you are using DHCP. A CIDR looks like an ip address with
@ -438,9 +438,9 @@ mac_wait_for_connect=0
ConfigFileParams::SettingsKeyValuePair{"/ios_remote_filesystem", AZ::s64{0}}, ConfigFileParams::SettingsKeyValuePair{"/ios_remote_filesystem", AZ::s64{0}},
ConfigFileParams::SettingsKeyValuePair{"/mac_remote_filesystem", AZ::s64{0}}, ConfigFileParams::SettingsKeyValuePair{"/mac_remote_filesystem", AZ::s64{0}},
ConfigFileParams::SettingsKeyValuePair{"/assets", AZStd::string_view{"pc"}}, ConfigFileParams::SettingsKeyValuePair{"/assets", AZStd::string_view{"pc"}},
ConfigFileParams::SettingsKeyValuePair{"/android_assets", AZStd::string_view{"es3"}}, ConfigFileParams::SettingsKeyValuePair{"/android_assets", AZStd::string_view{"android"}},
ConfigFileParams::SettingsKeyValuePair{"/ios_assets", AZStd::string_view{"ios"}}, ConfigFileParams::SettingsKeyValuePair{"/ios_assets", AZStd::string_view{"ios"}},
ConfigFileParams::SettingsKeyValuePair{"/mac_assets", AZStd::string_view{"osx_gl"}}, ConfigFileParams::SettingsKeyValuePair{"/mac_assets", AZStd::string_view{"mac"}},
ConfigFileParams::SettingsKeyValuePair{"/connect_to_remote", AZ::s64{0}}, ConfigFileParams::SettingsKeyValuePair{"/connect_to_remote", AZ::s64{0}},
ConfigFileParams::SettingsKeyValuePair{"/windows_connect_to_remote", AZ::s64{1}}, ConfigFileParams::SettingsKeyValuePair{"/windows_connect_to_remote", AZ::s64{1}},
ConfigFileParams::SettingsKeyValuePair{"/android_connect_to_remote", AZ::s64{0}}, ConfigFileParams::SettingsKeyValuePair{"/android_connect_to_remote", AZ::s64{0}},
@ -478,20 +478,20 @@ test_asset_processor_tag = test_value
[Platform pc] [Platform pc]
tags=tools,renderer,dx12,vulkan tags=tools,renderer,dx12,vulkan
[Platform es3] [Platform android]
tags=android,mobile,renderer,vulkan ; With Comments at the end tags=android,mobile,renderer,vulkan ; With Comments at the end
[Platform ios] [Platform ios]
tags=mobile,renderer,metal tags=mobile,renderer,metal
[Platform osx_gl] [Platform mac]
tags=tools,renderer,metal)" tags=tools,renderer,metal)"
, AZStd::fixed_vector<ConfigFileParams::SettingsKeyValuePair, 20>{ , AZStd::fixed_vector<ConfigFileParams::SettingsKeyValuePair, 20>{
ConfigFileParams::SettingsKeyValuePair{"/test_asset_processor_tag", AZStd::string_view{"test_value"}}, ConfigFileParams::SettingsKeyValuePair{"/test_asset_processor_tag", AZStd::string_view{"test_value"}},
ConfigFileParams::SettingsKeyValuePair{"/Platform pc/tags", AZStd::string_view{"tools,renderer,dx12,vulkan"}}, ConfigFileParams::SettingsKeyValuePair{"/Platform pc/tags", AZStd::string_view{"tools,renderer,dx12,vulkan"}},
ConfigFileParams::SettingsKeyValuePair{"/Platform es3/tags", AZStd::string_view{"android,mobile,renderer,vulkan"}}, ConfigFileParams::SettingsKeyValuePair{"/Platform android/tags", AZStd::string_view{"android,mobile,renderer,vulkan"}},
ConfigFileParams::SettingsKeyValuePair{"/Platform ios/tags", AZStd::string_view{"mobile,renderer,metal"}}, ConfigFileParams::SettingsKeyValuePair{"/Platform ios/tags", AZStd::string_view{"mobile,renderer,metal"}},
ConfigFileParams::SettingsKeyValuePair{"/Platform osx_gl/tags", AZStd::string_view{"tools,renderer,metal"}}, ConfigFileParams::SettingsKeyValuePair{"/Platform mac/tags", AZStd::string_view{"tools,renderer,metal"}},
}} }}
) )
); );

@ -679,8 +679,6 @@ namespace AzFramework
{ {
auto fileIoBase = m_archiveFileIO.get(); auto fileIoBase = m_archiveFileIO.get();
// Set up the default file aliases based on the settings registry // Set up the default file aliases based on the settings registry
fileIoBase->SetAlias("@assets@", "");
fileIoBase->SetAlias("@root@", GetEngineRoot());
fileIoBase->SetAlias("@engroot@", GetEngineRoot()); fileIoBase->SetAlias("@engroot@", GetEngineRoot());
fileIoBase->SetAlias("@projectroot@", GetEngineRoot()); fileIoBase->SetAlias("@projectroot@", GetEngineRoot());
fileIoBase->SetAlias("@exefolder@", GetExecutableFolder()); fileIoBase->SetAlias("@exefolder@", GetExecutableFolder());
@ -694,8 +692,8 @@ namespace AzFramework
pathAliases.clear(); pathAliases.clear();
if (m_settingsRegistry->Get(pathAliases.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder)) if (m_settingsRegistry->Get(pathAliases.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
{ {
fileIoBase->SetAlias("@projectplatformcache@", pathAliases.c_str());
fileIoBase->SetAlias("@assets@", pathAliases.c_str()); fileIoBase->SetAlias("@assets@", pathAliases.c_str());
fileIoBase->SetAlias("@projectplatformcache@", pathAliases.c_str());
fileIoBase->SetAlias("@root@", pathAliases.c_str()); // Deprecated Use @projectplatformcache@ fileIoBase->SetAlias("@root@", pathAliases.c_str()); // Deprecated Use @projectplatformcache@
} }
pathAliases.clear(); pathAliases.clear();

@ -308,6 +308,56 @@ namespace AzFramework
} }
} }
//---------------------------------------------------------------------
GenerateRelativeSourcePathRequest::GenerateRelativeSourcePathRequest(const AZ::OSString& sourcePath)
{
AZ_Assert(!sourcePath.empty(), "GenerateRelativeSourcePathRequest: asset path is empty");
m_sourcePath = sourcePath;
}
unsigned int GenerateRelativeSourcePathRequest::GetMessageType() const
{
return MessageType;
}
void GenerateRelativeSourcePathRequest::Reflect(AZ::ReflectContext* context)
{
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
if (serialize)
{
serialize->Class<GenerateRelativeSourcePathRequest, BaseAssetProcessorMessage>()
->Version(1)
->Field("SourcePath", &GenerateRelativeSourcePathRequest::m_sourcePath);
}
}
//---------------------------------------------------------------------
GenerateRelativeSourcePathResponse::GenerateRelativeSourcePathResponse(
bool resolved, const AZ::OSString& relativeSourcePath, const AZ::OSString& rootFolder)
{
m_relativeSourcePath = relativeSourcePath;
m_resolved = resolved;
m_rootFolder = rootFolder;
}
unsigned int GenerateRelativeSourcePathResponse::GetMessageType() const
{
return GenerateRelativeSourcePathRequest::MessageType;
}
void GenerateRelativeSourcePathResponse::Reflect(AZ::ReflectContext* context)
{
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
if (serialize)
{
serialize->Class<GenerateRelativeSourcePathResponse, BaseAssetProcessorMessage>()
->Version(1)
->Field("RelativeSourcePath", &GenerateRelativeSourcePathResponse::m_relativeSourcePath)
->Field("RootFolder", &GenerateRelativeSourcePathResponse::m_rootFolder)
->Field("Resolved", &GenerateRelativeSourcePathResponse::m_resolved);
}
}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
GetFullSourcePathFromRelativeProductPathRequest::GetFullSourcePathFromRelativeProductPathRequest(const AZ::OSString& relativeProductPath) GetFullSourcePathFromRelativeProductPathRequest::GetFullSourcePathFromRelativeProductPathRequest(const AZ::OSString& relativeProductPath)
{ {

@ -288,6 +288,45 @@ namespace AzFramework
bool m_resolved; bool m_resolved;
}; };
//////////////////////////////////////////////////////////////////////////
class GenerateRelativeSourcePathRequest : public BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(GenerateRelativeSourcePathRequest, AZ::OSAllocator, 0);
AZ_RTTI(GenerateRelativeSourcePathRequest, "{B3865033-F5A3-4749-8147-7B1AB04D5F6D}",
BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
// For people that are debugging the network messages and just see MessageType as a value,
// the CRC value below is 739777771 (0x2C181CEB)
static constexpr unsigned int MessageType =
AZ_CRC_CE("AssetSystem::GenerateRelativeSourcePathRequest");
GenerateRelativeSourcePathRequest() = default;
GenerateRelativeSourcePathRequest(const AZ::OSString& sourcePath);
unsigned int GetMessageType() const override;
AZ::OSString m_sourcePath;
};
class GenerateRelativeSourcePathResponse : public BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(GenerateRelativeSourcePathResponse, AZ::OSAllocator, 0);
AZ_RTTI(GenerateRelativeSourcePathResponse, "{938D33DB-C8F6-4FA4-BC81-2F139A9BE1D7}",
BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
GenerateRelativeSourcePathResponse() = default;
GenerateRelativeSourcePathResponse(
bool resolved, const AZ::OSString& relativeSourcePath, const AZ::OSString& rootFolder);
unsigned int GetMessageType() const override;
AZ::OSString m_relativeSourcePath;
AZ::OSString m_rootFolder; ///< This is the folder it was found in (the watched/scanned folder, such as gems /assets/ folder)
bool m_resolved;
};
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
class GetFullSourcePathFromRelativeProductPathRequest class GetFullSourcePathFromRelativeProductPathRequest
: public BaseAssetProcessorMessage : public BaseAssetProcessorMessage

@ -202,6 +202,7 @@ namespace AzFramework
// Requests // Requests
GetUnresolvedDependencyCountsRequest::Reflect(context); GetUnresolvedDependencyCountsRequest::Reflect(context);
GetRelativeProductPathFromFullSourceOrProductPathRequest::Reflect(context); GetRelativeProductPathFromFullSourceOrProductPathRequest::Reflect(context);
GenerateRelativeSourcePathRequest::Reflect(context);
GetFullSourcePathFromRelativeProductPathRequest::Reflect(context); GetFullSourcePathFromRelativeProductPathRequest::Reflect(context);
SourceAssetInfoRequest::Reflect(context); SourceAssetInfoRequest::Reflect(context);
AssetInfoRequest::Reflect(context); AssetInfoRequest::Reflect(context);
@ -234,6 +235,7 @@ namespace AzFramework
// Responses // Responses
GetUnresolvedDependencyCountsResponse::Reflect(context); GetUnresolvedDependencyCountsResponse::Reflect(context);
GetRelativeProductPathFromFullSourceOrProductPathResponse::Reflect(context); GetRelativeProductPathFromFullSourceOrProductPathResponse::Reflect(context);
GenerateRelativeSourcePathResponse::Reflect(context);
GetFullSourcePathFromRelativeProductPathResponse::Reflect(context); GetFullSourcePathFromRelativeProductPathResponse::Reflect(context);
SourceAssetInfoResponse::Reflect(context); SourceAssetInfoResponse::Reflect(context);
AssetInfoResponse::Reflect(context); AssetInfoResponse::Reflect(context);

@ -46,7 +46,6 @@ namespace AzFramework::ProjectManager
// Store the Command line to the Setting Registry // Store the Command line to the Setting Registry
AZ::SettingsRegistryImpl settingsRegistry; AZ::SettingsRegistryImpl settingsRegistry;
AZ::SettingsRegistryMergeUtils::StoreCommandLineToRegistry(settingsRegistry, commandLine); AZ::SettingsRegistryMergeUtils::StoreCommandLineToRegistry(settingsRegistry, commandLine);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(settingsRegistry);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {}); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
// Retrieve Command Line from Settings Registry, it may have been updated by the call to FindEngineRoot() // Retrieve Command Line from Settings Registry, it may have been updated by the call to FindEngineRoot()
// in MergeSettingstoRegistry_ConfigFile // in MergeSettingstoRegistry_ConfigFile

@ -19,10 +19,13 @@
#include <AzCore/std/smart_ptr/unique_ptr.h> #include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzFramework/Spawnable/SpawnableMetaData.h> #include <AzFramework/Spawnable/SpawnableMetaData.h>
namespace AzFramework namespace AZ
{ {
class ReflectContext; class ReflectContext;
}
namespace AzFramework
{
class Spawnable final class Spawnable final
: public AZ::Data::AssetData : public AZ::Data::AssetData
{ {

@ -14,6 +14,10 @@
namespace AzFramework namespace AzFramework
{ {
//
// SpawnableEntityContainerView
//
SpawnableEntityContainerView::SpawnableEntityContainerView(AZ::Entity** begin, size_t length) SpawnableEntityContainerView::SpawnableEntityContainerView(AZ::Entity** begin, size_t length)
: m_begin(begin) : m_begin(begin)
, m_end(begin + length) , m_end(begin + length)
@ -52,6 +56,9 @@ namespace AzFramework
} }
//
// SpawnableConstEntityContainerView
//
SpawnableConstEntityContainerView::SpawnableConstEntityContainerView(AZ::Entity** begin, size_t length) SpawnableConstEntityContainerView::SpawnableConstEntityContainerView(AZ::Entity** begin, size_t length)
: m_begin(begin) : m_begin(begin)
@ -91,6 +98,136 @@ namespace AzFramework
} }
//
// SpawnableIndexEntityPair
//
SpawnableIndexEntityPair::SpawnableIndexEntityPair(AZ::Entity** entityIterator, size_t* indexIterator)
: m_entity(entityIterator)
, m_index(indexIterator)
{
}
AZ::Entity* SpawnableIndexEntityPair::GetEntity()
{
return *m_entity;
}
const AZ::Entity* SpawnableIndexEntityPair::GetEntity() const
{
return *m_entity;
}
size_t SpawnableIndexEntityPair::GetIndex() const
{
return *m_index;
}
//
// SpawnableIndexEntityIterator
//
SpawnableIndexEntityIterator::SpawnableIndexEntityIterator(AZ::Entity** entityIterator, size_t* indexIterator)
: m_value(entityIterator, indexIterator)
{
}
SpawnableIndexEntityIterator& SpawnableIndexEntityIterator::operator++()
{
++m_value.m_entity;
++m_value.m_index;
return *this;
}
SpawnableIndexEntityIterator SpawnableIndexEntityIterator::operator++(int)
{
SpawnableIndexEntityIterator result = *this;
++m_value.m_entity;
++m_value.m_index;
return result;
}
SpawnableIndexEntityIterator& SpawnableIndexEntityIterator::operator--()
{
--m_value.m_entity;
--m_value.m_index;
return *this;
}
SpawnableIndexEntityIterator SpawnableIndexEntityIterator::operator--(int)
{
SpawnableIndexEntityIterator result = *this;
--m_value.m_entity;
--m_value.m_index;
return result;
}
bool SpawnableIndexEntityIterator::operator==(const SpawnableIndexEntityIterator& rhs)
{
return m_value.m_entity == rhs.m_value.m_entity && m_value.m_index == rhs.m_value.m_index;
}
bool SpawnableIndexEntityIterator::operator!=(const SpawnableIndexEntityIterator& rhs)
{
return m_value.m_entity != rhs.m_value.m_entity || m_value.m_index != rhs.m_value.m_index;
}
SpawnableIndexEntityPair& SpawnableIndexEntityIterator::operator*()
{
return m_value;
}
const SpawnableIndexEntityPair& SpawnableIndexEntityIterator::operator*() const
{
return m_value;
}
SpawnableIndexEntityPair* SpawnableIndexEntityIterator::operator->()
{
return &m_value;
}
const SpawnableIndexEntityPair* SpawnableIndexEntityIterator::operator->() const
{
return &m_value;
}
//
// SpawnableConstIndexEntityContainerView
//
SpawnableConstIndexEntityContainerView::SpawnableConstIndexEntityContainerView(
AZ::Entity** beginEntity, size_t* beginIndices, size_t length)
: m_begin(beginEntity, beginIndices)
, m_end(beginEntity + length, beginIndices + length)
{
}
const SpawnableIndexEntityIterator& SpawnableConstIndexEntityContainerView::begin()
{
return m_begin;
}
const SpawnableIndexEntityIterator& SpawnableConstIndexEntityContainerView::end()
{
return m_end;
}
const SpawnableIndexEntityIterator& SpawnableConstIndexEntityContainerView::cbegin()
{
return m_begin;
}
const SpawnableIndexEntityIterator& SpawnableConstIndexEntityContainerView::cend()
{
return m_end;
}
//
// EntitySpawnTicket
//
EntitySpawnTicket::EntitySpawnTicket(EntitySpawnTicket&& rhs) EntitySpawnTicket::EntitySpawnTicket(EntitySpawnTicket&& rhs)
: m_payload(rhs.m_payload) : m_payload(rhs.m_payload)

@ -58,6 +58,72 @@ namespace AzFramework
AZ::Entity** m_end; AZ::Entity** m_end;
}; };
class SpawnableIndexEntityPair
{
public:
friend class SpawnableIndexEntityIterator;
AZ::Entity* GetEntity();
const AZ::Entity* GetEntity() const;
size_t GetIndex() const;
private:
SpawnableIndexEntityPair() = default;
SpawnableIndexEntityPair(const SpawnableIndexEntityPair&) = default;
SpawnableIndexEntityPair(SpawnableIndexEntityPair&&) = default;
SpawnableIndexEntityPair(AZ::Entity** entityIterator, size_t* indexIterator);
SpawnableIndexEntityPair& operator=(const SpawnableIndexEntityPair&) = default;
SpawnableIndexEntityPair& operator=(SpawnableIndexEntityPair&&) = default;
AZ::Entity** m_entity { nullptr };
size_t* m_index { nullptr };
};
class SpawnableIndexEntityIterator
{
public:
// Limited to bidirectional iterator as there's no use case for extending it further, but can be extended if a use case is found.
using iterator_category = AZStd::bidirectional_iterator_tag;
using value_type = SpawnableIndexEntityPair;
using difference_type = size_t;
using pointer = SpawnableIndexEntityPair*;
using reference = SpawnableIndexEntityPair&;
SpawnableIndexEntityIterator(AZ::Entity** entityIterator, size_t* indexIterator);
SpawnableIndexEntityIterator& operator++();
SpawnableIndexEntityIterator operator++(int);
SpawnableIndexEntityIterator& operator--();
SpawnableIndexEntityIterator operator--(int);
bool operator==(const SpawnableIndexEntityIterator& rhs);
bool operator!=(const SpawnableIndexEntityIterator& rhs);
SpawnableIndexEntityPair& operator*();
const SpawnableIndexEntityPair& operator*() const;
SpawnableIndexEntityPair* operator->();
const SpawnableIndexEntityPair* operator->() const;
private:
SpawnableIndexEntityPair m_value;
};
class SpawnableConstIndexEntityContainerView
{
public:
SpawnableConstIndexEntityContainerView(AZ::Entity** beginEntity, size_t* beginIndices, size_t length);
const SpawnableIndexEntityIterator& begin();
const SpawnableIndexEntityIterator& end();
const SpawnableIndexEntityIterator& cbegin();
const SpawnableIndexEntityIterator& cend();
private:
SpawnableIndexEntityIterator m_begin;
SpawnableIndexEntityIterator m_end;
};
//! Requests to the SpawnableEntitiesInterface require a ticket with a valid spawnable that be used as a template. A ticket can //! Requests to the SpawnableEntitiesInterface require a ticket with a valid spawnable that be used as a template. A ticket can
//! be reused for multiple calls on the same spawnable and is safe to use by multiple threads at the same time. Entities created //! be reused for multiple calls on the same spawnable and is safe to use by multiple threads at the same time. Entities created
//! from the spawnable may be tracked by the ticket and so using the same ticket is needed to despawn the exact entities created //! from the spawnable may be tracked by the ticket and so using the same ticket is needed to despawn the exact entities created
@ -88,6 +154,7 @@ namespace AzFramework
using EntityDespawnCallback = AZStd::function<void(EntitySpawnTicket&)>; using EntityDespawnCallback = AZStd::function<void(EntitySpawnTicket&)>;
using ReloadSpawnableCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableConstEntityContainerView)>; using ReloadSpawnableCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableConstEntityContainerView)>;
using ListEntitiesCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableConstEntityContainerView)>; using ListEntitiesCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableConstEntityContainerView)>;
using ListIndicesEntitiesCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableConstIndexEntityContainerView)>;
using ClaimEntitiesCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableEntityContainerView)>; using ClaimEntitiesCallback = AZStd::function<void(EntitySpawnTicket&, SpawnableEntityContainerView)>;
using BarrierCallback = AZStd::function<void(EntitySpawnTicket&)>; using BarrierCallback = AZStd::function<void(EntitySpawnTicket&)>;
@ -140,6 +207,15 @@ namespace AzFramework
//! @param ticket Only the entities associated with this ticket will be listed. //! @param ticket Only the entities associated with this ticket will be listed.
//! @param listCallback Required callback that will be called to list the entities on. //! @param listCallback Required callback that will be called to list the entities on.
virtual void ListEntities(EntitySpawnTicket& ticket, ListEntitiesCallback listCallback) = 0; virtual void ListEntities(EntitySpawnTicket& ticket, ListEntitiesCallback listCallback) = 0;
//! List all entities that are spawned using this ticket with their spawnable index.
//! Spawnables contain a flat list of entities, which are used as templates to spawn entities from. For every spawned entity
//! the index of the entity in the spawnable that was used as a template is stored. This version of ListEntities will return
//! both the entities and this index. The index can be used with SpawnEntities to create the same entities again. Note that
//! the same index may appear multiple times as there are no restriction on how many instance of a specific entity can be
//! created.
//! @param ticket Only the entities associated with this ticket will be listed.
//! @param listCallback Required callback that will be called to list the entities and indices on.
virtual void ListIndicesAndEntities(EntitySpawnTicket& ticket, ListIndicesEntitiesCallback listCallback) = 0;
//! Claim all entities that are spawned using this ticket. Ownership of the entities is transferred from the ticket to the //! Claim all entities that are spawned using this ticket. Ownership of the entities is transferred from the ticket to the
//! caller through the callback. After this call the ticket will have no entities associated with it. The caller of //! caller through the callback. After this call the ticket will have no entities associated with it. The caller of
//! this function will need to manage the entities after this call. //! this function will need to manage the entities after this call.

@ -25,6 +25,8 @@ namespace AzFramework
void SpawnableEntitiesManager::SpawnAllEntities(EntitySpawnTicket& ticket, EntityPreInsertionCallback preInsertionCallback, void SpawnableEntitiesManager::SpawnAllEntities(EntitySpawnTicket& ticket, EntityPreInsertionCallback preInsertionCallback,
EntitySpawnCallback completionCallback) EntitySpawnCallback completionCallback)
{ {
AZ_Assert(ticket.IsValid(), "Ticket provided to SpawnAllEntities hasn't been initialized.");
SpawnAllEntitiesCommand queueEntry; SpawnAllEntitiesCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
queueEntry.m_completionCallback = AZStd::move(completionCallback); queueEntry.m_completionCallback = AZStd::move(completionCallback);
@ -40,6 +42,8 @@ namespace AzFramework
EntitySpawnTicket& ticket, AZStd::vector<size_t> entityIndices, EntitySpawnTicket& ticket, AZStd::vector<size_t> entityIndices,
EntityPreInsertionCallback preInsertionCallback, EntitySpawnCallback completionCallback) EntityPreInsertionCallback preInsertionCallback, EntitySpawnCallback completionCallback)
{ {
AZ_Assert(ticket.IsValid(), "Ticket provided to SpawnEntities hasn't been initialized.");
SpawnEntitiesCommand queueEntry; SpawnEntitiesCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
queueEntry.m_entityIndices = AZStd::move(entityIndices); queueEntry.m_entityIndices = AZStd::move(entityIndices);
@ -54,6 +58,8 @@ namespace AzFramework
void SpawnableEntitiesManager::DespawnAllEntities(EntitySpawnTicket& ticket, EntityDespawnCallback completionCallback) void SpawnableEntitiesManager::DespawnAllEntities(EntitySpawnTicket& ticket, EntityDespawnCallback completionCallback)
{ {
AZ_Assert(ticket.IsValid(), "Ticket provided to DespawnAllEntities hasn't been initialized.");
DespawnAllEntitiesCommand queueEntry; DespawnAllEntitiesCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
queueEntry.m_completionCallback = AZStd::move(completionCallback); queueEntry.m_completionCallback = AZStd::move(completionCallback);
@ -67,6 +73,8 @@ namespace AzFramework
void SpawnableEntitiesManager::ReloadSpawnable(EntitySpawnTicket& ticket, AZ::Data::Asset<Spawnable> spawnable, void SpawnableEntitiesManager::ReloadSpawnable(EntitySpawnTicket& ticket, AZ::Data::Asset<Spawnable> spawnable,
ReloadSpawnableCallback completionCallback) ReloadSpawnableCallback completionCallback)
{ {
AZ_Assert(ticket.IsValid(), "Ticket provided to ReloadSpawnable hasn't been initialized.");
ReloadSpawnableCommand queueEntry; ReloadSpawnableCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
queueEntry.m_spawnable = AZStd::move(spawnable); queueEntry.m_spawnable = AZStd::move(spawnable);
@ -81,6 +89,7 @@ namespace AzFramework
void SpawnableEntitiesManager::ListEntities(EntitySpawnTicket& ticket, ListEntitiesCallback listCallback) void SpawnableEntitiesManager::ListEntities(EntitySpawnTicket& ticket, ListEntitiesCallback listCallback)
{ {
AZ_Assert(listCallback, "ListEntities called on spawnable entities without a valid callback to use."); AZ_Assert(listCallback, "ListEntities called on spawnable entities without a valid callback to use.");
AZ_Assert(ticket.IsValid(), "Ticket provided to ListEntities hasn't been initialized.");
ListEntitiesCommand queueEntry; ListEntitiesCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
@ -92,9 +101,25 @@ namespace AzFramework
} }
} }
void SpawnableEntitiesManager::ListIndicesAndEntities(EntitySpawnTicket& ticket, ListIndicesEntitiesCallback listCallback)
{
AZ_Assert(listCallback, "ListEntities called on spawnable entities without a valid callback to use.");
AZ_Assert(ticket.IsValid(), "Ticket provided to ListEntities hasn't been initialized.");
ListIndicesEntitiesCommand queueEntry;
queueEntry.m_ticket = &ticket;
queueEntry.m_listCallback = AZStd::move(listCallback);
{
AZStd::scoped_lock queueLock(m_pendingRequestQueueMutex);
queueEntry.m_ticketId = GetTicketPayload<Ticket>(ticket).m_nextTicketId++;
m_pendingRequestQueue.push(AZStd::move(queueEntry));
}
}
void SpawnableEntitiesManager::ClaimEntities(EntitySpawnTicket& ticket, ClaimEntitiesCallback listCallback) void SpawnableEntitiesManager::ClaimEntities(EntitySpawnTicket& ticket, ClaimEntitiesCallback listCallback)
{ {
AZ_Assert(listCallback, "ClaimEntities called on spawnable entities without a valid callback to use."); AZ_Assert(listCallback, "ClaimEntities called on spawnable entities without a valid callback to use.");
AZ_Assert(ticket.IsValid(), "Ticket provided to ClaimEntities hasn't been initialized.");
ClaimEntitiesCommand queueEntry; ClaimEntitiesCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
@ -109,6 +134,7 @@ namespace AzFramework
void SpawnableEntitiesManager::Barrier(EntitySpawnTicket& ticket, BarrierCallback completionCallback) void SpawnableEntitiesManager::Barrier(EntitySpawnTicket& ticket, BarrierCallback completionCallback)
{ {
AZ_Assert(completionCallback, "Barrier on spawnable entities called without a valid callback to use."); AZ_Assert(completionCallback, "Barrier on spawnable entities called without a valid callback to use.");
AZ_Assert(ticket.IsValid(), "Ticket provided to Barrier hasn't been initialized.");
BarrierCommand queueEntry; BarrierCommand queueEntry;
queueEntry.m_ticket = &ticket; queueEntry.m_ticket = &ticket;
@ -499,6 +525,27 @@ namespace AzFramework
} }
} }
bool SpawnableEntitiesManager::ProcessRequest(ListIndicesEntitiesCommand& request, [[maybe_unused]] AZ::SerializeContext& serializeContext)
{
Ticket& ticket = GetTicketPayload<Ticket>(*request.m_ticket);
if (request.m_ticketId == ticket.m_currentTicketId)
{
AZ_Assert(
ticket.m_spawnedEntities.size() == ticket.m_spawnedEntityIndices.size(),
"Entities and indices on spawnable ticket have gone out of sync.");
request.m_listCallback(
*request.m_ticket,
SpawnableConstIndexEntityContainerView(
ticket.m_spawnedEntities.begin(), ticket.m_spawnedEntityIndices.begin(), ticket.m_spawnedEntities.size()));
ticket.m_currentTicketId++;
return true;
}
else
{
return false;
}
}
bool SpawnableEntitiesManager::ProcessRequest(ClaimEntitiesCommand& request, [[maybe_unused]] AZ::SerializeContext& serializeContext) bool SpawnableEntitiesManager::ProcessRequest(ClaimEntitiesCommand& request, [[maybe_unused]] AZ::SerializeContext& serializeContext)
{ {
Ticket& ticket = GetTicketPayload<Ticket>(*request.m_ticket); Ticket& ticket = GetTicketPayload<Ticket>(*request.m_ticket);

@ -36,6 +36,7 @@ namespace AzFramework
{ {
public: public:
AZ_RTTI(AzFramework::SpawnableEntitiesManager, "{6E14333F-128C-464C-94CA-A63B05A5E51C}"); AZ_RTTI(AzFramework::SpawnableEntitiesManager, "{6E14333F-128C-464C-94CA-A63B05A5E51C}");
AZ_CLASS_ALLOCATOR(SpawnableEntitiesManager, AZ::SystemAllocator, 0);
enum class CommandQueueStatus : bool enum class CommandQueueStatus : bool
{ {
@ -58,6 +59,7 @@ namespace AzFramework
ReloadSpawnableCallback completionCallback = {}) override; ReloadSpawnableCallback completionCallback = {}) override;
void ListEntities(EntitySpawnTicket& ticket, ListEntitiesCallback listCallback) override; void ListEntities(EntitySpawnTicket& ticket, ListEntitiesCallback listCallback) override;
void ListIndicesAndEntities(EntitySpawnTicket& ticket, ListIndicesEntitiesCallback listCallback) override;
void ClaimEntities(EntitySpawnTicket& ticket, ClaimEntitiesCallback listCallback) override; void ClaimEntities(EntitySpawnTicket& ticket, ClaimEntitiesCallback listCallback) override;
void Barrier(EntitySpawnTicket& spawnInfo, BarrierCallback completionCallback) override; void Barrier(EntitySpawnTicket& spawnInfo, BarrierCallback completionCallback) override;
@ -123,6 +125,12 @@ namespace AzFramework
EntitySpawnTicket* m_ticket; EntitySpawnTicket* m_ticket;
uint32_t m_ticketId; uint32_t m_ticketId;
}; };
struct ListIndicesEntitiesCommand
{
ListIndicesEntitiesCallback m_listCallback;
EntitySpawnTicket* m_ticket;
uint32_t m_ticketId;
};
struct ClaimEntitiesCommand struct ClaimEntitiesCommand
{ {
ClaimEntitiesCallback m_listCallback; ClaimEntitiesCallback m_listCallback;
@ -141,8 +149,9 @@ namespace AzFramework
uint32_t m_ticketId; uint32_t m_ticketId;
}; };
using Requests = AZStd::variant<SpawnAllEntitiesCommand, SpawnEntitiesCommand, DespawnAllEntitiesCommand, ReloadSpawnableCommand, using Requests = AZStd::variant<
ListEntitiesCommand, ClaimEntitiesCommand, BarrierCommand, DestroyTicketCommand>; SpawnAllEntitiesCommand, SpawnEntitiesCommand, DespawnAllEntitiesCommand, ReloadSpawnableCommand, ListEntitiesCommand,
ListIndicesEntitiesCommand, ClaimEntitiesCommand, BarrierCommand, DestroyTicketCommand>;
AZ::Entity* SpawnSingleEntity(const AZ::Entity& entityTemplate, AZ::Entity* SpawnSingleEntity(const AZ::Entity& entityTemplate,
AZ::SerializeContext& serializeContext); AZ::SerializeContext& serializeContext);
@ -155,6 +164,7 @@ namespace AzFramework
bool ProcessRequest(DespawnAllEntitiesCommand& request, AZ::SerializeContext& serializeContext); bool ProcessRequest(DespawnAllEntitiesCommand& request, AZ::SerializeContext& serializeContext);
bool ProcessRequest(ReloadSpawnableCommand& request, AZ::SerializeContext& serializeContext); bool ProcessRequest(ReloadSpawnableCommand& request, AZ::SerializeContext& serializeContext);
bool ProcessRequest(ListEntitiesCommand& request, AZ::SerializeContext& serializeContext); bool ProcessRequest(ListEntitiesCommand& request, AZ::SerializeContext& serializeContext);
bool ProcessRequest(ListIndicesEntitiesCommand& request, AZ::SerializeContext& serializeContext);
bool ProcessRequest(ClaimEntitiesCommand& request, AZ::SerializeContext& serializeContext); bool ProcessRequest(ClaimEntitiesCommand& request, AZ::SerializeContext& serializeContext);
bool ProcessRequest(BarrierCommand& request, AZ::SerializeContext& serializeContext); bool ProcessRequest(BarrierCommand& request, AZ::SerializeContext& serializeContext);
bool ProcessRequest(DestroyTicketCommand& request, AZ::SerializeContext& serializeContext); bool ProcessRequest(DestroyTicketCommand& request, AZ::SerializeContext& serializeContext);

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon / Local</title>
<g id="Icon-/-Local" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" x="0" y="0" width="24" height="24"></rect>
<polygon id="L" fill="#FFFFFF" fill-rule="nonzero" points="16.9658203 19 16.9658203 16.5 11.1748047 16.5 11.1748047 4.72265625 8.14746094 4.72265625 8.14746094 19"></polygon>
</g>
</svg>

After

Width:  |  Height:  |  Size: 575 B

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon / Parent</title>
<g id="Icon-/-Parent" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" x="0" y="0" width="24" height="24"></rect>
<path d="M10.5449219,19 L10.5449219,13.921875 L11.84375,13.921875 C13.6145833,13.921875 14.9801432,13.514974 15.9404297,12.7011719 C16.9007161,11.8873698 17.3808594,10.7122396 17.3808594,9.17578125 C17.3808594,7.69791667 16.930013,6.58626302 16.0283203,5.84082031 C15.1266276,5.0953776 13.8098958,4.72265625 12.078125,4.72265625 L12.078125,4.72265625 L7.51757812,4.72265625 L7.51757812,19 L10.5449219,19 Z M11.5410156,11.4414062 L10.5449219,11.4414062 L10.5449219,7.203125 L11.921875,7.203125 C12.7486979,7.203125 13.3557943,7.37239583 13.7431641,7.7109375 C14.1305339,8.04947917 14.3242188,8.57356771 14.3242188,9.28320312 C14.3242188,9.98632812 14.093099,10.5218099 13.6308594,10.8896484 C13.1686198,11.257487 12.4720052,11.4414062 11.5410156,11.4414062 L11.5410156,11.4414062 Z" id="P" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon / World</title>
<g id="Icon-/-World" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" x="0" y="0" width="24" height="24"></rect>
<path d="M9.41210938,19 L11.3359375,11.5195312 C11.4205729,11.1875 11.5410156,10.632487 11.6972656,9.85449219 C11.8535156,9.0764974 11.9511719,8.51171875 11.9902344,8.16015625 C12.016276,8.44661458 12.1155599,9.00813802 12.2880859,9.84472656 C12.460612,10.6813151 12.5826823,11.2330729 12.6542969,11.5 L12.6542969,11.5 L14.5878906,19 L18.0351562,19 L21.6679688,4.72265625 L18.6894531,4.72265625 L16.8730469,12.515625 C16.7558594,12.984375 16.625651,13.5979818 16.4824219,14.3564453 C16.3391927,15.1149089 16.235026,15.7480469 16.1699219,16.2558594 C16.0983073,15.7285156 15.9941406,15.0970052 15.8574219,14.3613281 C15.7207031,13.625651 15.6067708,13.078776 15.515625,12.7207031 L15.515625,12.7207031 L13.4355469,4.72265625 L10.5742188,4.72265625 L8.49414062,12.7207031 C8.37044271,13.1503906 8.23860677,13.7542318 8.09863281,14.5322266 C7.95865885,15.3102214 7.86914062,15.8847656 7.83007812,16.2558594 C7.68684896,15.2011719 7.45572917,13.9544271 7.13671875,12.515625 L7.13671875,12.515625 L5.31054688,4.72265625 L2.33203125,4.72265625 L5.97460938,19 L9.41210938,19 Z" id="W" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -354,6 +354,7 @@
<file>img/UI20/toolbar/Grid.svg</file> <file>img/UI20/toolbar/Grid.svg</file>
<file>img/UI20/toolbar/Lighting.svg</file> <file>img/UI20/toolbar/Lighting.svg</file>
<file>img/UI20/toolbar/Load.svg</file> <file>img/UI20/toolbar/Load.svg</file>
<file>img/UI20/toolbar/Local.svg</file>
<file>img/UI20/toolbar/Locked.svg</file> <file>img/UI20/toolbar/Locked.svg</file>
<file>img/UI20/toolbar/LUA.svg</file> <file>img/UI20/toolbar/LUA.svg</file>
<file>img/UI20/toolbar/Material.svg</file> <file>img/UI20/toolbar/Material.svg</file>
@ -362,6 +363,7 @@
<file>img/UI20/toolbar/Object_follow_terrain.svg</file> <file>img/UI20/toolbar/Object_follow_terrain.svg</file>
<file>img/UI20/toolbar/Object_height.svg</file> <file>img/UI20/toolbar/Object_height.svg</file>
<file>img/UI20/toolbar/Object_list.svg</file> <file>img/UI20/toolbar/Object_list.svg</file>
<file>img/UI20/toolbar/Parent.svg</file>
<file>img/UI20/toolbar/particle.svg</file> <file>img/UI20/toolbar/particle.svg</file>
<file>img/UI20/toolbar/Play.svg</file> <file>img/UI20/toolbar/Play.svg</file>
<file>img/UI20/toolbar/Redo.svg</file> <file>img/UI20/toolbar/Redo.svg</file>
@ -380,6 +382,7 @@
<file>img/UI20/toolbar/undo.svg</file> <file>img/UI20/toolbar/undo.svg</file>
<file>img/UI20/toolbar/Unlocked.svg</file> <file>img/UI20/toolbar/Unlocked.svg</file>
<file>img/UI20/toolbar/Vertex_snapping.svg</file> <file>img/UI20/toolbar/Vertex_snapping.svg</file>
<file>img/UI20/toolbar/World.svg</file>
<file>img/UI20/toolbar/X_axis.svg</file> <file>img/UI20/toolbar/X_axis.svg</file>
<file>img/UI20/toolbar/Y_axis.svg</file> <file>img/UI20/toolbar/Y_axis.svg</file>
<file>img/UI20/toolbar/Z_axis.svg</file> <file>img/UI20/toolbar/Z_axis.svg</file>

@ -60,10 +60,20 @@ namespace AzToolsFramework
//! and is generally checked into source control. //! and is generally checked into source control.
virtual const char* GetAbsoluteDevRootFolderPath() = 0; virtual const char* GetAbsoluteDevRootFolderPath() = 0;
/// Convert a full source path like "c:\\dev\gamename\\blah\\test.tga" into a relative product path. /// Convert a full source path like "c:\\dev\\gamename\\blah\\test.tga" into a relative product path.
/// asset paths never mention their alias and are relative to the asset cache root /// asset paths never mention their alias and are relative to the asset cache root
virtual bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& relativeProductPath) = 0; virtual bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& relativeProductPath) = 0;
/** Convert a source path like "c:\\dev\\gamename\\blah\\test.tga" into a relative source path, like "blah/test.tga".
* If no valid relative path could be created, the input source path will be returned in relativePath.
* @param sourcePath partial or full path to a source file. (The file doesn't need to exist)
* @param relativePath the output relative path for the source file, if a valid one could be created
* @param rootFilePath the root path that relativePath is relative to
* @return true if a valid relative path was created, false if it wasn't
*/
virtual bool GenerateRelativeSourcePath(
const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& rootFilePath) = 0;
/// Convert a relative asset path like "blah/test.tga" to a full source path path. /// Convert a relative asset path like "blah/test.tga" to a full source path path.
/// Once the asset processor has finished building, this function is capable of handling even when the extension changes /// Once the asset processor has finished building, this function is capable of handling even when the extension changes
/// or when the source is in a different folder or in a different location (such as inside gems) /// or when the source is in a different folder or in a different location (such as inside gems)
@ -110,14 +120,14 @@ namespace AzToolsFramework
/** /**
* Query to see if a specific asset platform is enabled * Query to see if a specific asset platform is enabled
* @param platform the asset platform to check e.g. es3, ios, etc. * @param platform the asset platform to check e.g. android, ios, etc.
* @return true if enabled, false otherwise * @return true if enabled, false otherwise
*/ */
virtual bool IsAssetPlatformEnabled(const char* platform) = 0; virtual bool IsAssetPlatformEnabled(const char* platform) = 0;
/** /**
* Get the total number of pending assets left to process for a specific asset platform * Get the total number of pending assets left to process for a specific asset platform
* @param platform the asset platform to check e.g. es3, ios, etc. * @param platform the asset platform to check e.g. android, ios, etc.
* @return -1 if the process fails, a positive number otherwise * @return -1 if the process fails, a positive number otherwise
*/ */
virtual int GetPendingAssetsForPlatform(const char* platform) = 0; virtual int GetPendingAssetsForPlatform(const char* platform) = 0;
@ -302,7 +312,7 @@ namespace AzToolsFramework
inline const char* GetHostAssetPlatform() inline const char* GetHostAssetPlatform()
{ {
#if defined(AZ_PLATFORM_MAC) #if defined(AZ_PLATFORM_MAC)
return "osx_gl"; return "mac";
#elif defined(AZ_PLATFORM_WINDOWS) #elif defined(AZ_PLATFORM_WINDOWS)
return "pc"; return "pc";
#elif defined(AZ_PLATFORM_LINUX) #elif defined(AZ_PLATFORM_LINUX)

@ -0,0 +1,80 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Math/Color.h>
#include <AzFramework/Viewport/ViewportId.h>
namespace AzToolsFramework
{
//! An interface for loading simple icon assets and rendering them to screen on a per-viewport basis.
class EditorViewportIconDisplayInterface
{
public:
AZ_RTTI(EditorViewportIconDisplayInterface, "{D5190B58-2561-4F3F-B793-F1E7D454CDF2}");
using IconId = AZ::s32;
static constexpr IconId InvalidIconId = -1;
enum class CoordinateSpace : AZ::u8
{
ScreenSpace,
WorldSpace
};
//! These draw parameters control rendering for a single icon to a single viewport.
struct DrawParameters
{
//! The ViewportId to render to.
AzFramework::ViewportId m_viewport = AzFramework::InvalidViewportId;
//! The icon ID, retrieved from GetOrLoadIconForPath, to render to screen.
IconId m_icon = InvalidIconId;
//! The color, including opacity, to render the icon with. White will render the icon as opaque in its original color.
AZ::Color m_color = AZ::Colors::White;
//! The position to render the icon to, in world or screen space depending on m_positionSpace.
AZ::Vector3 m_position;
//! The coordinate system to use for m_position.
//! ScreenSpace will accept m_position in the form of [X, Y, Depth], where X & Y are screen coordinates in
//! pixels and Depth is a z-ordering depth value from 0.0f to 1.0f.
//! WorldSpace will accept a 3D vector in world space coordinates that will be translated back into screen
//! space when the icon is rendered.
CoordinateSpace m_positionSpace = CoordinateSpace::ScreenSpace;
//! The size to render the icon as, in pixels.
AZ::Vector2 m_size;
};
//! The current load status of an icon retrieved by GetOrLoadIconForPath.
enum class IconLoadStatus : AZ::u8
{
Unloaded,
Loading,
Loaded,
Error
};
//! Draws an icon to a viewport given a set of draw parameters.
//! Requires an IconId retrieved from GetOrLoadIconForPath.
virtual void DrawIcon(const DrawParameters& drawParameters) = 0;
//! Retrieves a reusable IconId for an icon at a given path.
//! This will load the icon, if it has not already been loaded.
//! @param path should be a relative asset path to an icon image asset.
//! png and svg icons are currently supported.
virtual IconId GetOrLoadIconForPath(AZStd::string_view path) = 0;
//! Gets the current load status of an icon retrieved via GetOrLoadIconForPath.
virtual IconLoadStatus GetIconLoadStatus(IconId icon) = 0;
};
using EditorViewportIconDisplay = AZ::Interface<EditorViewportIconDisplayInterface>;
} //namespace AzToolsFramework

@ -239,6 +239,11 @@ namespace AzToolsFramework
*/ */
virtual int RemoveDirtyEntity(AZ::EntityId target) = 0; virtual int RemoveDirtyEntity(AZ::EntityId target) = 0;
/*!
* Clears the dirty entity set.
*/
virtual void ClearDirtyEntities() = 0;
/*! /*!
* \return true if an undo/redo operation is in progress. * \return true if an undo/redo operation is in progress.
*/ */

@ -1354,6 +1354,11 @@ namespace AzToolsFramework
return static_cast<int>(m_dirtyEntities.erase(entityId)); return static_cast<int>(m_dirtyEntities.erase(entityId));
} }
void ToolsApplication::ClearDirtyEntities()
{
m_dirtyEntities.clear();
}
void ToolsApplication::UndoPressed() void ToolsApplication::UndoPressed()
{ {
if (m_undoStack) if (m_undoStack)

@ -85,6 +85,7 @@ namespace AzToolsFramework
void AddDirtyEntity(AZ::EntityId entityId) override; void AddDirtyEntity(AZ::EntityId entityId) override;
int RemoveDirtyEntity(AZ::EntityId entityId) override; int RemoveDirtyEntity(AZ::EntityId entityId) override;
void ClearDirtyEntities() override;
bool IsDuringUndoRedo() override { return m_isDuringUndoRedo; } bool IsDuringUndoRedo() override { return m_isDuringUndoRedo; }
void UndoPressed() override; void UndoPressed() override;
void RedoPressed() override; void RedoPressed() override;

@ -265,6 +265,30 @@ namespace AzToolsFramework
return response.m_resolved; return response.m_resolved;
} }
bool AssetSystemComponent::GenerateRelativeSourcePath(
const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& rootFilePath)
{
AzFramework::SocketConnection* engineConnection = AzFramework::SocketConnection::GetInstance();
if (!engineConnection || !engineConnection->IsConnected())
{
relativePath = sourcePath;
return false;
}
AzFramework::AssetSystem::GenerateRelativeSourcePathRequest request(sourcePath);
AzFramework::AssetSystem::GenerateRelativeSourcePathResponse response;
if (!SendRequest(request, response))
{
AZ_Error("Editor", false, "Failed to send GenerateRelativeSourcePath request for %s", sourcePath.c_str());
relativePath = sourcePath;
return false;
}
relativePath = response.m_relativeSourcePath;
rootFilePath = response.m_rootFolder;
return response.m_resolved;
}
bool AssetSystemComponent::GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullPath) bool AssetSystemComponent::GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullPath)
{ {
auto foundIt = m_assetSourceRelativePathToFullPathCache.find(relPath); auto foundIt = m_assetSourceRelativePathToFullPathCache.find(relPath);

@ -63,6 +63,8 @@ namespace AzToolsFramework
const char* GetAbsoluteDevGameFolderPath() override; const char* GetAbsoluteDevGameFolderPath() override;
const char* GetAbsoluteDevRootFolderPath() override; const char* GetAbsoluteDevRootFolderPath() override;
bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& outputPath) override; bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& outputPath) override;
bool GenerateRelativeSourcePath(
const AZStd::string& sourcePath, AZStd::string& outputPath, AZStd::string& watchFolder) override;
bool GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullPath) override; bool GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullPath) override;
bool GetAssetInfoById(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath) override; bool GetAssetInfoById(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath) override;
bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override; bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override;

@ -56,5 +56,7 @@ namespace AzToolsFramework
virtual void StartPlayInEditor() = 0; virtual void StartPlayInEditor() = 0;
virtual void StopPlayInEditor() = 0; virtual void StopPlayInEditor() = 0;
virtual void CreateNewLevelPrefab(AZStd::string_view filename) = 0;
}; };
} }

@ -225,50 +225,19 @@ namespace AzToolsFramework
m_rootInstance->SetTemplateSourcePath(relativePath); m_rootInstance->SetTemplateSourcePath(relativePath);
bool newLevelFromTemplate = false;
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId) if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
{ {
AZStd::string watchFolder; m_rootInstance->m_containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent());
AZ::Data::AssetInfo assetInfo; HandleEntitiesAdded({ m_rootInstance->m_containerEntity.get() });
bool sourceInfoFound = false;
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, DefaultLevelTemplateName,
assetInfo, watchFolder);
if (sourceInfoFound)
{
AZStd::string fullPath;
AZ::StringFunc::Path::Join(watchFolder.c_str(), assetInfo.m_relativePath.c_str(), fullPath);
// Get the default prefab and copy the Dom over to the new template being saved
Prefab::TemplateId defaultId = m_loaderInterface->LoadTemplateFromFile(fullPath.c_str());
Prefab::PrefabDom& dom = m_prefabSystemComponent->FindTemplateDom(defaultId);
Prefab::PrefabDom levelDefaultDom; AzToolsFramework::Prefab::PrefabDom dom;
levelDefaultDom.CopyFrom(dom, levelDefaultDom.GetAllocator()); bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
if (!success)
Prefab::PrefabDomPath sourcePath("/Source");
sourcePath.Set(levelDefaultDom, relativePath.c_str());
templateId = m_prefabSystemComponent->AddTemplate(relativePath, std::move(levelDefaultDom));
newLevelFromTemplate = true;
}
else
{ {
// Create an empty level since we couldn't find the default template AZ_Error("Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
m_rootInstance->m_containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent()); return false;
HandleEntitiesAdded({ m_rootInstance->m_containerEntity.get() });
AzToolsFramework::Prefab::PrefabDom dom;
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
if (!success)
{
AZ_Error("Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
return false;
}
templateId = m_prefabSystemComponent->AddTemplate(relativePath, std::move(dom));
} }
templateId = m_prefabSystemComponent->AddTemplate(relativePath, AZStd::move(dom));
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId) if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
{ {
@ -286,13 +255,6 @@ namespace AzToolsFramework
m_prefabSystemComponent->RemoveTemplate(prevTemplateId); m_prefabSystemComponent->RemoveTemplate(prevTemplateId);
} }
// If we have a new level from a template, we need to make sure to propagate the changes here otherwise
// the entities from the new template won't show up
if (newLevelFromTemplate)
{
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
}
AZStd::string out; AZStd::string out;
if (m_loaderInterface->SaveTemplateToString(m_rootInstance->GetTemplateId(), out)) if (m_loaderInterface->SaveTemplateToString(m_rootInstance->GetTemplateId(), out))
{ {
@ -303,6 +265,71 @@ namespace AzToolsFramework
return false; return false;
} }
void PrefabEditorEntityOwnershipService::CreateNewLevelPrefab(AZStd::string_view filename)
{
AZ::IO::Path relativePath = m_loaderInterface->GetRelativePathToProject(filename);
AzToolsFramework::Prefab::TemplateId templateId = m_prefabSystemComponent->GetTemplateIdFromFilePath(relativePath);
m_rootInstance->SetTemplateSourcePath(relativePath);
AZStd::string watchFolder;
AZ::Data::AssetInfo assetInfo;
bool sourceInfoFound = false;
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, DefaultLevelTemplateName,
assetInfo, watchFolder);
if (sourceInfoFound)
{
AZStd::string fullPath;
AZ::StringFunc::Path::Join(watchFolder.c_str(), assetInfo.m_relativePath.c_str(), fullPath);
// Get the default prefab and copy the Dom over to the new template being saved
Prefab::TemplateId defaultId = m_loaderInterface->LoadTemplateFromFile(fullPath.c_str());
Prefab::PrefabDom& dom = m_prefabSystemComponent->FindTemplateDom(defaultId);
Prefab::PrefabDom levelDefaultDom;
levelDefaultDom.CopyFrom(dom, levelDefaultDom.GetAllocator());
Prefab::PrefabDomPath sourcePath("/Source");
sourcePath.Set(levelDefaultDom, assetInfo.m_relativePath.c_str());
templateId = m_prefabSystemComponent->AddTemplate(relativePath, AZStd::move(levelDefaultDom));
}
else
{
m_rootInstance->m_containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent());
HandleEntitiesAdded({ m_rootInstance->m_containerEntity.get() });
AzToolsFramework::Prefab::PrefabDom dom;
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
if (!success)
{
AZ_Error(
"Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
return;
}
templateId = m_prefabSystemComponent->AddTemplate(relativePath, std::move(dom));
}
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
{
AZ_Error("Prefab", false, "Couldn't create new template id '%i' when creating new level '%.*s'", templateId, AZ_STRING_ARG(filename));
return;
}
Prefab::TemplateId prevTemplateId = m_rootInstance->GetTemplateId();
m_rootInstance->SetTemplateId(templateId);
if (prevTemplateId != Prefab::InvalidTemplateId && templateId != prevTemplateId)
{
// Make sure we only have one level template loaded at a time
m_prefabSystemComponent->RemoveTemplate(prevTemplateId);
}
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
}
Prefab::InstanceOptionalReference PrefabEditorEntityOwnershipService::CreatePrefab( Prefab::InstanceOptionalReference PrefabEditorEntityOwnershipService::CreatePrefab(
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Prefab::Instance>>&& nestedPrefabInstances, const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Prefab::Instance>>&& nestedPrefabInstances,
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder) AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder)

@ -170,6 +170,8 @@ namespace AzToolsFramework
void StartPlayInEditor() override; void StartPlayInEditor() override;
void StopPlayInEditor() override; void StopPlayInEditor() override;
void CreateNewLevelPrefab(AZStd::string_view filename) override;
protected: protected:
AZ::SliceComponent::SliceInstanceAddress GetOwningSlice() override; AZ::SliceComponent::SliceInstanceAddress GetOwningSlice() override;

@ -23,7 +23,7 @@ namespace AzToolsFramework
inline AZ::Transform TransformNormalizedScale(const AZ::Transform& transform) inline AZ::Transform TransformNormalizedScale(const AZ::Transform& transform)
{ {
AZ::Transform transformNormalizedScale = transform; AZ::Transform transformNormalizedScale = transform;
transformNormalizedScale.SetScale(AZ::Vector3::CreateOne()); transformNormalizedScale.SetUniformScale(1.0f);
return transformNormalizedScale; return transformNormalizedScale;
} }

@ -276,18 +276,14 @@ namespace AzToolsFramework
PrefabDomValueReference linkPatchesReference = PrefabDomValueReference linkPatchesReference =
PrefabDomUtils::FindPrefabDomValue(linkDom, PrefabDomUtils::PatchesName); PrefabDomUtils::FindPrefabDomValue(linkDom, PrefabDomUtils::PatchesName);
// This logic only covers addition of patches. If patches already exists, the given list of patches must be appended to them. /*
if (!linkPatchesReference.has_value()) If the original allocator the patches were created with gets destroyed, then the patches would become garbage in the
{ linkDom. Since we cannot guarantee the lifecycle of the patch allocators, we are doing a copy of the patches here to
/* associate them with the linkDom's allocator.
If the original allocator the patches were created with gets destroyed, then the patches would become garbage in the */
linkDom. Since we cannot guarantee the lifecycle of the patch allocators, we are doing a copy of the patches here to PrefabDom patchesCopy;
associate them with the linkDom's allocator. patchesCopy.CopyFrom(patches, linkDom.GetAllocator());
*/ linkDom.AddMember(rapidjson::StringRef(PrefabDomUtils::PatchesName), patchesCopy, linkDom.GetAllocator());
PrefabDom patchesCopy;
patchesCopy.CopyFrom(patches, linkDom.GetAllocator());
linkDom.AddMember(rapidjson::StringRef(PrefabDomUtils::PatchesName), patchesCopy, linkDom.GetAllocator());
}
} }
} }
} }

@ -234,5 +234,10 @@ namespace AzToolsFramework
} }
} }
PrefabDomValueReference Link::GetLinkPatches()
{
return PrefabDomUtils::FindPrefabDomValue(m_linkDom, PrefabDomUtils::PatchesName);
}
} // namespace Prefab } // namespace Prefab
} // namespace AzToolsFramework } // namespace AzToolsFramework

@ -79,6 +79,8 @@ namespace AzToolsFramework
*/ */
void AddLinkIdToInstanceDom(PrefabDomValue& instanceDomValue); void AddLinkIdToInstanceDom(PrefabDomValue& instanceDomValue);
PrefabDomValueReference GetLinkPatches();
private: private:
/** /**

@ -41,7 +41,7 @@ namespace AzToolsFramework
[[maybe_unused]] bool result = [[maybe_unused]] bool result =
settingsRegistry->Get(m_projectPathWithOsSeparator.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectPath); settingsRegistry->Get(m_projectPathWithOsSeparator.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectPath);
AZ_Assert(result, "Couldn't retrieve project root path"); AZ_Warning("Prefab", result, "Couldn't retrieve project root path");
m_projectPathWithSlashSeparator = AZ::IO::Path(m_projectPathWithOsSeparator.Native(), '/').MakePreferred(); m_projectPathWithSlashSeparator = AZ::IO::Path(m_projectPathWithOsSeparator.Native(), '/').MakePreferred();
AZ::Interface<PrefabLoaderInterface>::Register(this); AZ::Interface<PrefabLoaderInterface>::Register(this);

@ -10,8 +10,6 @@
* *
*/ */
#include <AzToolsFramework/Prefab/PrefabPublicHandler.h>
#include <AzCore/Component/TransformBus.h> #include <AzCore/Component/TransformBus.h>
#include <AzCore/JSON/stringbuffer.h> #include <AzCore/JSON/stringbuffer.h>
#include <AzCore/JSON/writer.h> #include <AzCore/JSON/writer.h>
@ -28,6 +26,7 @@
#include <AzToolsFramework/Prefab/Instance/InstanceToTemplateInterface.h> #include <AzToolsFramework/Prefab/Instance/InstanceToTemplateInterface.h>
#include <AzToolsFramework/Prefab/PrefabDomUtils.h> #include <AzToolsFramework/Prefab/PrefabDomUtils.h>
#include <AzToolsFramework/Prefab/PrefabLoaderInterface.h> #include <AzToolsFramework/Prefab/PrefabLoaderInterface.h>
#include <AzToolsFramework/Prefab/PrefabPublicHandler.h>
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h> #include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
#include <AzToolsFramework/Prefab/PrefabUndo.h> #include <AzToolsFramework/Prefab/PrefabUndo.h>
#include <AzToolsFramework/Prefab/PrefabUndoHelpers.h> #include <AzToolsFramework/Prefab/PrefabUndoHelpers.h>
@ -98,9 +97,13 @@ namespace AzToolsFramework
AZStd::string("Could not create a new prefab out of the entities provided - invalid selection.")); AZStd::string("Could not create a new prefab out of the entities provided - invalid selection."));
} }
AZStd::unordered_map<AZ::EntityId, AZStd::string> oldEntityAliases;
// Detach the retrieved entities // Detach the retrieved entities
for (AZ::Entity* entity : entities) for (AZ::Entity* entity : entities)
{ {
AZ::EntityId entityId = entity->GetId();
oldEntityAliases.emplace(entityId, commonRootEntityOwningInstance->get().GetEntityAlias(entityId)->get());
commonRootEntityOwningInstance->get().DetachEntity(entity->GetId()).release(); commonRootEntityOwningInstance->get().DetachEntity(entity->GetId()).release();
} }
@ -110,15 +113,18 @@ namespace AzToolsFramework
{ {
AZStd::unique_ptr<Instance> outInstance = commonRootEntityOwningInstance->get().DetachNestedInstance(nestedInstance->GetInstanceAlias()); AZStd::unique_ptr<Instance> outInstance = commonRootEntityOwningInstance->get().DetachNestedInstance(nestedInstance->GetInstanceAlias());
auto linkRef = m_prefabSystemComponentInterface->FindLink(nestedInstance->GetLinkId()); LinkId detachingInstanceLinkId = nestedInstance->GetLinkId();
auto linkRef = m_prefabSystemComponentInterface->FindLink(detachingInstanceLinkId);
AZ_Assert(linkRef.has_value(), "Unable to find link with id '%llu' during prefab creation.", detachingInstanceLinkId);
if (linkRef.has_value()) PrefabDomValueReference linkPatches = linkRef->get().GetLinkPatches();
{ AZ_Assert(
PrefabDom oldLinkPatches; linkPatches.has_value(), "Unable to get patches on link with id '%llu' during prefab creation.",
oldLinkPatches.CopyFrom(linkRef->get().GetLinkDom(), oldLinkPatches.GetAllocator()); detachingInstanceLinkId);
nestedInstanceLinkPatchesMap.emplace(nestedInstance, AZStd::move(oldLinkPatches)); PrefabDom linkPatchesCopy;
} linkPatchesCopy.CopyFrom(linkPatches->get(), linkPatchesCopy.GetAllocator());
nestedInstanceLinkPatchesMap.emplace(nestedInstance, AZStd::move(linkPatchesCopy));
RemoveLink(outInstance, commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch()); RemoveLink(outInstance, commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch());
@ -182,6 +188,24 @@ namespace AzToolsFramework
if (nestedInstanceLinkPatchesMap.contains(nestedInstance.get())) if (nestedInstanceLinkPatchesMap.contains(nestedInstance.get()))
{ {
previousPatch = AZStd::move(nestedInstanceLinkPatchesMap[nestedInstance.get()]); previousPatch = AZStd::move(nestedInstanceLinkPatchesMap[nestedInstance.get()]);
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
previousPatch.Accept(writer);
QString previousPatchString(buffer.GetString());
for (AZ::Entity* entity : entities)
{
AZ::EntityId entityId = entity->GetId();
AZStd::string oldEntityAlias = oldEntityAliases[entityId];
EntityAliasOptionalReference newEntityAlias = instanceToCreate->get().GetEntityAlias(entityId);
AZ_Assert(
newEntityAlias.has_value(),
"Could not fetch entity alias for entity with id '%llu' during prefab creation.",
static_cast<AZ::u64>(entityId));
ReplaceOldAliases(previousPatchString, oldEntityAlias, newEntityAlias->get());
}
previousPatch.Parse(previousPatchString.toUtf8().constData());
} }
// These link creations shouldn't be undone because that would put the template in a non-usable state if a user // These link creations shouldn't be undone because that would put the template in a non-usable state if a user
@ -203,36 +227,23 @@ namespace AzToolsFramework
m_instanceToTemplateInterface->GeneratePatch(reparentPatch, containerEntityDomBefore, containerEntityDomAfter); m_instanceToTemplateInterface->GeneratePatch(reparentPatch, containerEntityDomBefore, containerEntityDomAfter);
m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(reparentPatch, nestedInstanceContainerEntityId); m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(reparentPatch, nestedInstanceContainerEntityId);
// Update the cache - this prevents these changes from being stored in the regular undo/redo nodes as a separate step // We won't parent this undo node to the undo batch so that the newly created template and link will remain
m_prefabUndoCache.Store(nestedInstanceContainerEntityId, AZStd::move(containerEntityDomAfter)); // unaffected by undo actions. This is needed so that any future instantiations of the template will work.
PrefabUndoLinkUpdate linkUpdate = PrefabUndoLinkUpdate(AZStd::to_string(static_cast<AZ::u64>(nestedInstanceContainerEntityId)));
// Save these changes as patches to the link linkUpdate.Capture(reparentPatch, nestedInstance->GetLinkId());
PrefabUndoLinkUpdate* linkUpdate = aznew PrefabUndoLinkUpdate(AZStd::to_string(static_cast<AZ::u64>(nestedInstanceContainerEntityId))); linkUpdate.Redo();
linkUpdate->SetParent(undoBatch.GetUndoBatch());
linkUpdate->Capture(reparentPatch, nestedInstance->GetLinkId());
linkUpdate->Redo();
} }
}); });
// Create a link between the templates of the newly created instance and the instance it's being parented under. // Create a link between the templates of the newly created instance and the instance it's being parented under.
CreateLink( CreateLink(
instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(), instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(),
AZStd::move(patch)); AZStd::move(patch));
for (AZ::Entity* topLevelEntity : topLevelEntities) // This clears any entities marked as dirty due to reparenting of entities during the process of creating a prefab.
{ // We are doing this so that the changes in those enities are not queued up twice for propagation.
AZ::EntityId topLevelEntityId = topLevelEntity->GetId(); AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
if (topLevelEntityId.IsValid()) &AzToolsFramework::ToolsApplicationRequestBus::Events::ClearDirtyEntities);
{
m_prefabUndoCache.UpdateCache(topLevelEntity->GetId());
// Parenting entities would mark entities as dirty. But we want to unmark the top level entities as dirty because
// if we don't, the template created would be updated and cause issues with undo operation followed by instantiation.
ToolsApplicationRequests::Bus::Broadcast(
&ToolsApplicationRequests::Bus::Events::RemoveDirtyEntity, topLevelEntity->GetId());
}
}
// Select Container Entity // Select Container Entity
{ {
@ -824,15 +835,7 @@ namespace AzToolsFramework
// This will cover both cases where an alias could be used in a normal entity vs. an instance // This will cover both cases where an alias could be used in a normal entity vs. an instance
for (auto aliasMapIter : oldAliasToNewAliasMap) for (auto aliasMapIter : oldAliasToNewAliasMap)
{ {
QString oldAliasQuotes = QString("\"%1\"").arg(aliasMapIter.first.c_str()); ReplaceOldAliases(newEntityDomString, aliasMapIter.first, aliasMapIter.second);
QString newAliasQuotes = QString("\"%1\"").arg(aliasMapIter.second.c_str());
newEntityDomString.replace(oldAliasQuotes, newAliasQuotes);
QString oldAliasPathRef = QString("/%1").arg(aliasMapIter.first.c_str());
QString newAliasPathRef = QString("/%1").arg(aliasMapIter.second.c_str());
newEntityDomString.replace(oldAliasPathRef, newAliasPathRef);
} }
// Create the new Entity DOM from parsing the JSON string // Create the new Entity DOM from parsing the JSON string
@ -1233,5 +1236,18 @@ namespace AzToolsFramework
return true; return true;
} }
void PrefabPublicHandler::ReplaceOldAliases(QString& stringToReplace, AZStd::string_view oldAlias, AZStd::string_view newAlias)
{
QString oldAliasQuotes = QString("\"%1\"").arg(oldAlias.data());
QString newAliasQuotes = QString("\"%1\"").arg(newAlias.data());
stringToReplace.replace(oldAliasQuotes, newAliasQuotes);
QString oldAliasPathRef = QString("/%1").arg(oldAlias.data());
QString newAliasPathRef = QString("/%1").arg(newAlias.data());
stringToReplace.replace(oldAliasPathRef, newAliasPathRef);
}
} // namespace Prefab } // namespace Prefab
} // namespace AzToolsFramework } // namespace AzToolsFramework

@ -14,12 +14,15 @@
#include <AzCore/Math/Vector3.h> #include <AzCore/Math/Vector3.h>
#include <AzCore/Memory/SystemAllocator.h> #include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/string/string_view.h>
#include <AzToolsFramework/Prefab/Instance/Instance.h> #include <AzToolsFramework/Prefab/Instance/Instance.h>
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h> #include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h> #include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
#include <AzToolsFramework/Prefab/PrefabUndoCache.h> #include <AzToolsFramework/Prefab/PrefabUndoCache.h>
class QString;
namespace AzToolsFramework namespace AzToolsFramework
{ {
using EntityList = AZStd::vector<AZ::Entity*>; using EntityList = AZStd::vector<AZ::Entity*>;
@ -27,7 +30,6 @@ namespace AzToolsFramework
namespace Prefab namespace Prefab
{ {
class Instance; class Instance;
class InstanceEntityMapperInterface; class InstanceEntityMapperInterface;
class InstanceToTemplateInterface; class InstanceToTemplateInterface;
class PrefabLoaderInterface; class PrefabLoaderInterface;
@ -130,6 +132,8 @@ namespace AzToolsFramework
bool IsCyclicalDependencyFound( bool IsCyclicalDependencyFound(
InstanceOptionalConstReference instance, const AZStd::unordered_set<AZ::IO::Path>& templateSourcePaths); InstanceOptionalConstReference instance, const AZStd::unordered_set<AZ::IO::Path>& templateSourcePaths);
void ReplaceOldAliases(QString& stringToReplace, AZStd::string_view oldAlias, AZStd::string_view newAlias);
static Instance* GetParentInstance(Instance* instance); static Instance* GetParentInstance(Instance* instance);
static Instance* GetAncestorOfInstanceThatIsChildOfRoot(const Instance* ancestor, Instance* descendant); static Instance* GetAncestorOfInstanceThatIsChildOfRoot(const Instance* ancestor, Instance* descendant);
static void GenerateContainerEntityTransform(const EntityList& topLevelEntities, AZ::Vector3& translation, AZ::Quaternion& rotation); static void GenerateContainerEntityTransform(const EntityList& topLevelEntities, AZ::Vector3& translation, AZ::Quaternion& rotation);

@ -17,6 +17,7 @@
#include <AzCore/Asset/AssetManagerBus.h> #include <AzCore/Asset/AssetManagerBus.h>
#include <AzToolsFramework/API/EditorAssetSystemAPI.h> #include <AzToolsFramework/API/EditorAssetSystemAPI.h>
#include <AzToolsFramework/API/EditorViewportIconDisplayInterface.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h> #include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h> #include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
#include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h> #include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
@ -313,8 +314,7 @@ namespace AzToolsFramework
// if we do not yet have a valid texture id, request it using the entity icon path // if we do not yet have a valid texture id, request it using the entity icon path
if (m_entityIconTextureId == 0) if (m_entityIconTextureId == 0)
{ {
EditorRequestBus::BroadcastResult( m_entityIconTextureId = EditorViewportIconDisplay::Get()->GetOrLoadIconForPath(m_entityIconPath);
m_entityIconTextureId, &EditorRequests::GetIconTextureIdFromEntityIconPath, m_entityIconPath);
} }
return m_entityIconTextureId; return m_entityIconTextureId;

@ -21,6 +21,7 @@
#include <AzToolsFramework/Viewport/ViewportTypes.h> #include <AzToolsFramework/Viewport/ViewportTypes.h>
#include <AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.h> #include <AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.h>
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h> #include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
#include <AzToolsFramework/API/EditorViewportIconDisplayInterface.h>
AZ_CVAR( AZ_CVAR(
bool, ed_visibility_showAggregateEntitySelectionBounds, false, nullptr, AZ::ConsoleFunctorFlags::Null, bool, ed_visibility_showAggregateEntitySelectionBounds, false, nullptr, AZ::ConsoleFunctorFlags::Null,
@ -232,10 +233,14 @@ namespace AzToolsFramework
return AZ::Color(1.0f, 1.0f, 1.0f, 1.0f); return AZ::Color(1.0f, 1.0f, 1.0f, 1.0f);
}(); }();
debugDisplay.SetColor(iconHighlight); EditorViewportIconDisplay::Get()->DrawIcon({
// debugDisplay.DrawTextureLabel( viewportInfo.m_viewportId,
// iconTextureId, entityPosition, iconSize, iconSize, iconTextureId,
// /*DisplayContext::ETextureIconFlags::TEXICON_ON_TOP=*/ 0x0008); iconHighlight,
entityPosition,
EditorViewportIconDisplayInterface::CoordinateSpace::WorldSpace,
AZ::Vector2{iconSize, iconSize}
});
} }
} }
} }

@ -435,7 +435,7 @@ namespace AzToolsFramework
} }
} }
static void DestroyTransformModeSelectionCluster(const ViewportUi::ClusterId clusterId) static void DestroyCluster(const ViewportUi::ClusterId clusterId)
{ {
ViewportUi::ViewportUiRequestBus::Event( ViewportUi::ViewportUiRequestBus::Event(
ViewportUi::DefaultViewportId, ViewportUi::DefaultViewportId,
@ -483,6 +483,26 @@ namespace AzToolsFramework
return worldFromLocal.TransformPoint(CalculateCenterOffset(entityId, pivot)); return worldFromLocal.TransformPoint(CalculateCenterOffset(entityId, pivot));
} }
void EditorTransformComponentSelection::UpdateSpaceCluster(const ReferenceFrame referenceFrame)
{
auto buttonIdFromFrameFn = [this](const ReferenceFrame referenceFrame) {
switch (referenceFrame)
{
case ReferenceFrame::Local:
return m_spaceCluster.m_localButtonId;
case ReferenceFrame::Parent:
return m_spaceCluster.m_parentButtonId;
case ReferenceFrame::World:
return m_spaceCluster.m_worldButtonId;
}
return m_spaceCluster.m_parentButtonId;
};
ViewportUi::ViewportUiRequestBus::Event(
ViewportUi::DefaultViewportId, &ViewportUi::ViewportUiRequestBus::Events::SetClusterActiveButton, m_spaceCluster.m_spaceClusterId,
buttonIdFromFrameFn(referenceFrame));
}
namespace ETCS namespace ETCS
{ {
PivotOrientationResult CalculatePivotOrientation( PivotOrientationResult CalculatePivotOrientation(
@ -789,13 +809,13 @@ namespace AzToolsFramework
EntityIdManipulators& entityIdManipulators, EntityIdManipulators& entityIdManipulators,
OptionalFrame& pivotOverrideFrame, OptionalFrame& pivotOverrideFrame,
ViewportInteraction::KeyboardModifiers& prevModifiers, ViewportInteraction::KeyboardModifiers& prevModifiers,
bool& transformChangedInternally) bool& transformChangedInternally, SpaceCluster spaceCluster)
{ {
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
entityIdManipulators.m_manipulators->SetLocalPosition(action.LocalPosition()); entityIdManipulators.m_manipulators->SetLocalPosition(action.LocalPosition());
const ReferenceFrame referenceFrame = ReferenceFrameFromModifiers(action.m_modifiers); const ReferenceFrame referenceFrame = spaceCluster.m_spaceLock ? spaceCluster.m_currentSpace : ReferenceFrameFromModifiers(action.m_modifiers);
if (action.m_modifiers.Ctrl()) if (action.m_modifiers.Ctrl())
{ {
@ -1027,6 +1047,7 @@ namespace AzToolsFramework
EditorManipulatorCommandUndoRedoRequestBus::Handler::BusConnect(entityContextId); EditorManipulatorCommandUndoRedoRequestBus::Handler::BusConnect(entityContextId);
CreateTransformModeSelectionCluster(); CreateTransformModeSelectionCluster();
CreateSpaceSelectionCluster();
RegisterActions(); RegisterActions();
SetupBoxSelect(); SetupBoxSelect();
RefreshSelectedEntityIdsAndRegenerateManipulators(); RefreshSelectedEntityIdsAndRegenerateManipulators();
@ -1037,7 +1058,9 @@ namespace AzToolsFramework
m_selectedEntityIds.clear(); m_selectedEntityIds.clear();
DestroyManipulators(m_entityIdManipulators); DestroyManipulators(m_entityIdManipulators);
DestroyTransformModeSelectionCluster(m_transformModeClusterId); DestroyCluster(m_transformModeClusterId);
DestroyCluster(m_spaceCluster.m_spaceClusterId);
UnregisterActions(); UnregisterActions();
m_pivotOverrideFrame.Reset(); m_pivotOverrideFrame.Reset();
@ -1274,8 +1297,8 @@ namespace AzToolsFramework
[this, prevModifiers, manipulatorEntityIds](const LinearManipulator::Action& action) mutable -> void [this, prevModifiers, manipulatorEntityIds](const LinearManipulator::Action& action) mutable -> void
{ {
UpdateTranslationManipulator( UpdateTranslationManipulator(
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
m_pivotOverrideFrame, prevModifiers, m_transformChangedInternally); m_transformChangedInternally, m_spaceCluster);
}); });
translationManipulators->InstallLinearManipulatorMouseUpCallback( translationManipulators->InstallLinearManipulatorMouseUpCallback(
@ -1305,8 +1328,8 @@ namespace AzToolsFramework
[this, prevModifiers, manipulatorEntityIds](const PlanarManipulator::Action& action) mutable -> void [this, prevModifiers, manipulatorEntityIds](const PlanarManipulator::Action& action) mutable -> void
{ {
UpdateTranslationManipulator( UpdateTranslationManipulator(
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
m_pivotOverrideFrame, prevModifiers, m_transformChangedInternally); m_transformChangedInternally, m_spaceCluster);
}); });
translationManipulators->InstallPlanarManipulatorMouseUpCallback( translationManipulators->InstallPlanarManipulatorMouseUpCallback(
@ -1335,8 +1358,8 @@ namespace AzToolsFramework
[this, prevModifiers, manipulatorEntityIds](const SurfaceManipulator::Action& action) mutable -> void [this, prevModifiers, manipulatorEntityIds](const SurfaceManipulator::Action& action) mutable -> void
{ {
UpdateTranslationManipulator( UpdateTranslationManipulator(
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
m_pivotOverrideFrame, prevModifiers, m_transformChangedInternally); m_transformChangedInternally, m_spaceCluster);
}); });
translationManipulators->InstallSurfaceManipulatorMouseUpCallback( translationManipulators->InstallSurfaceManipulatorMouseUpCallback(
@ -1414,7 +1437,7 @@ namespace AzToolsFramework
[this, prevModifiers, sharedRotationState] [this, prevModifiers, sharedRotationState]
(const AngularManipulator::Action& action) mutable -> void (const AngularManipulator::Action& action) mutable -> void
{ {
const ReferenceFrame referenceFrame = ReferenceFrameFromModifiers(action.m_modifiers); const ReferenceFrame referenceFrame = m_spaceCluster.m_spaceLock ? m_spaceCluster.m_currentSpace : ReferenceFrameFromModifiers(action.m_modifiers);
const AZ::Quaternion manipulatorOrientation = action.m_start.m_rotation * action.m_current.m_delta; const AZ::Quaternion manipulatorOrientation = action.m_start.m_rotation * action.m_current.m_delta;
// store the pivot override frame when positioning the manipulator manually (ctrl) // store the pivot override frame when positioning the manipulator manually (ctrl)
@ -2566,6 +2589,67 @@ namespace AzToolsFramework
m_transformModeSelectionHandler); m_transformModeSelectionHandler);
} }
void EditorTransformComponentSelection::CreateSpaceSelectionCluster()
{
// create the cluster for switching spaces/reference frames
ViewportUi::ViewportUiRequestBus::EventResult(
m_spaceCluster.m_spaceClusterId, ViewportUi::DefaultViewportId, &ViewportUi::ViewportUiRequestBus::Events::CreateCluster,
ViewportUi::Alignment::TopRight);
// create and register the buttons (strings correspond to icons even if the values appear different)
m_spaceCluster.m_worldButtonId = RegisterClusterButton(m_spaceCluster.m_spaceClusterId, "World");
m_spaceCluster.m_parentButtonId = RegisterClusterButton(m_spaceCluster.m_spaceClusterId, "Parent");
m_spaceCluster.m_localButtonId = RegisterClusterButton(m_spaceCluster.m_spaceClusterId, "Local");
auto onButtonClicked = [this](ViewportUi::ButtonId buttonId) {
if (buttonId == m_spaceCluster.m_localButtonId)
{
// Unlock
if (m_spaceCluster.m_spaceLock && m_spaceCluster.m_currentSpace == ReferenceFrame::Local)
{
m_spaceCluster.m_spaceLock = false;
}
else
{
m_spaceCluster.m_spaceLock = true;
m_spaceCluster.m_currentSpace = ReferenceFrame::Local;
}
}
else if (buttonId == m_spaceCluster.m_parentButtonId)
{
// Unlock
if (m_spaceCluster.m_spaceLock && m_spaceCluster.m_currentSpace == ReferenceFrame::Parent)
{
m_spaceCluster.m_spaceLock = false;
}
else
{
m_spaceCluster.m_spaceLock = true;
m_spaceCluster.m_currentSpace = ReferenceFrame::Parent;
}
}
else if (buttonId == m_spaceCluster.m_worldButtonId)
{
// Unlock
if (m_spaceCluster.m_spaceLock && m_spaceCluster.m_currentSpace == ReferenceFrame::World)
{
m_spaceCluster.m_spaceLock = false;
}
else
{
m_spaceCluster.m_spaceLock = true;
m_spaceCluster.m_currentSpace = ReferenceFrame::World;
}
}
};
m_spaceCluster.m_spaceSelectionHandler = AZ::Event<ViewportUi::ButtonId>::Handler(onButtonClicked);
ViewportUi::ViewportUiRequestBus::Event(
ViewportUi::DefaultViewportId, &ViewportUi::ViewportUiRequestBus::Events::RegisterClusterEventHandler,
m_spaceCluster.m_spaceClusterId, m_spaceCluster.m_spaceSelectionHandler);
}
EditorTransformComponentSelectionRequests::Mode EditorTransformComponentSelection::GetTransformMode() EditorTransformComponentSelectionRequests::Mode EditorTransformComponentSelection::GetTransformMode()
{ {
return m_mode; return m_mode;
@ -2963,7 +3047,7 @@ namespace AzToolsFramework
if (transformIt != transformsBefore.end()) if (transformIt != transformsBefore.end())
{ {
AZ::Transform transformBefore = transformIt->second; AZ::Transform transformBefore = transformIt->second;
transformBefore.ExtractScale(); transformBefore.ExtractUniformScale();
AZ::Transform newWorldFromLocal = transformBefore * scaleTransform; AZ::Transform newWorldFromLocal = transformBefore * scaleTransform;
SetEntityWorldTransform(entityId, newWorldFromLocal); SetEntityWorldTransform(entityId, newWorldFromLocal);
@ -3277,7 +3361,10 @@ namespace AzToolsFramework
ViewportInteraction::BuildMouseButtons( ViewportInteraction::BuildMouseButtons(
QGuiApplication::mouseButtons()), m_boxSelect.Active()); QGuiApplication::mouseButtons()), m_boxSelect.Active());
const ReferenceFrame referenceFrame = ReferenceFrameFromModifiers(modifiers); const ReferenceFrame referenceFrame =
m_spaceCluster.m_spaceLock ? m_spaceCluster.m_currentSpace : ReferenceFrameFromModifiers(modifiers);
UpdateSpaceCluster(referenceFrame);
bool refresh = false; bool refresh = false;
if (referenceFrame != m_referenceFrame) if (referenceFrame != m_referenceFrame)

@ -106,6 +106,17 @@ namespace AzToolsFramework
World, //!< World space (space aligned to world axes - identity). World, //!< World space (space aligned to world axes - identity).
}; };
struct SpaceCluster
{
ViewportUi::ClusterId m_spaceClusterId;
ViewportUi::ButtonId m_localButtonId;
ViewportUi::ButtonId m_parentButtonId;
ViewportUi::ButtonId m_worldButtonId;
AZ::Event<ViewportUi::ButtonId>::Handler m_spaceSelectionHandler;
ReferenceFrame m_currentSpace = ReferenceFrame::Parent;
bool m_spaceLock = false;
};
//! Entity selection/interaction handling. //! Entity selection/interaction handling.
//! Provide a suite of functionality for manipulating entities, primarily through their TransformComponent. //! Provide a suite of functionality for manipulating entities, primarily through their TransformComponent.
class EditorTransformComponentSelection class EditorTransformComponentSelection
@ -160,6 +171,7 @@ namespace AzToolsFramework
void RegenerateManipulators(); void RegenerateManipulators();
void CreateTransformModeSelectionCluster(); void CreateTransformModeSelectionCluster();
void CreateSpaceSelectionCluster();
void ClearManipulatorTranslationOverride(); void ClearManipulatorTranslationOverride();
void ClearManipulatorOrientationOverride(); void ClearManipulatorOrientationOverride();
@ -285,6 +297,9 @@ namespace AzToolsFramework
AZ::Event<ViewportUi::ButtonId>::Handler m_transformModeSelectionHandler; //!< Event handler for the Viewport UI cluster. AZ::Event<ViewportUi::ButtonId>::Handler m_transformModeSelectionHandler; //!< Event handler for the Viewport UI cluster.
AzFramework::ClickDetector m_clickDetector; //!< Detect different types of mouse click. AzFramework::ClickDetector m_clickDetector; //!< Detect different types of mouse click.
AzFramework::CursorState m_cursorState; //!< Track the mouse position and delta movement each frame. AzFramework::CursorState m_cursorState; //!< Track the mouse position and delta movement each frame.
SpaceCluster m_spaceCluster;
void UpdateSpaceCluster(ReferenceFrame referenceFrame);
}; };
//! The ETCS (EntityTransformComponentSelection) namespace contains functions and data used exclusively by //! The ETCS (EntityTransformComponentSelection) namespace contains functions and data used exclusively by

@ -46,6 +46,7 @@ set(FILES
API/EditorWindowRequestBus.h API/EditorWindowRequestBus.h
API/EntityCompositionRequestBus.h API/EntityCompositionRequestBus.h
API/EntityCompositionNotificationBus.h API/EntityCompositionNotificationBus.h
API/EditorViewportIconDisplayInterface.h
API/ViewPaneOptions.h API/ViewPaneOptions.h
Application/Ticker.h Application/Ticker.h
Application/Ticker.cpp Application/Ticker.cpp

@ -15,6 +15,7 @@
#include <AzToolsFramework/Asset/AssetSeedManager.h> #include <AzToolsFramework/Asset/AssetSeedManager.h>
#include <AzFramework/Asset/AssetRegistry.h> #include <AzFramework/Asset/AssetRegistry.h>
#include <AzCore/IO/FileIO.h> #include <AzCore/IO/FileIO.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzFramework/IO/LocalFileIO.h> #include <AzFramework/IO/LocalFileIO.h>
#include <AzFramework/Asset/AssetCatalog.h> #include <AzFramework/Asset/AssetCatalog.h>
#include <AzFramework/StringFunc/StringFunc.h> #include <AzFramework/StringFunc/StringFunc.h>
@ -62,6 +63,12 @@ namespace UnitTest
m_assetSeedManager = new AzToolsFramework::AssetSeedManager(); m_assetSeedManager = new AzToolsFramework::AssetSeedManager();
m_assetRegistry = new AzFramework::AssetRegistry(); m_assetRegistry = new AzFramework::AssetRegistry();
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_application->Start(AzFramework::Application::Descriptor()); m_application->Start(AzFramework::Application::Descriptor());
for (int idx = 0; idx < s_totalAssets; idx++) for (int idx = 0; idx < s_totalAssets; idx++)
@ -75,7 +82,7 @@ namespace UnitTest
} }
m_testPlatforms[0] = AzFramework::PlatformId::PC; m_testPlatforms[0] = AzFramework::PlatformId::PC;
m_testPlatforms[1] = AzFramework::PlatformId::ES3; m_testPlatforms[1] = AzFramework::PlatformId::ANDROID_ID;
int platformCount = 0; int platformCount = 0;
for(auto thisPlatform : m_testPlatforms) for(auto thisPlatform : m_testPlatforms)
@ -163,20 +170,20 @@ namespace UnitTest
AzFramework::AssetCatalog assetCatalog(useRequestBus); AzFramework::AssetCatalog assetCatalog(useRequestBus);
AZStd::string pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC); AZStd::string pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
AZStd::string es3CatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ES3); AZStd::string androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
if (!assetCatalog.SaveCatalog(pcCatalogFile.c_str(), m_assetRegistry)) if (!assetCatalog.SaveCatalog(pcCatalogFile.c_str(), m_assetRegistry))
{ {
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (PC) file.\n").c_str()); GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (PC) file.\n").c_str());
} }
if (!assetCatalog.SaveCatalog(es3CatalogFile.c_str(), m_assetRegistry)) if (!assetCatalog.SaveCatalog(androidCatalogFile.c_str(), m_assetRegistry))
{ {
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (ES3) file.\n").c_str()); GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (ANDROID) file.\n").c_str());
} }
m_pcCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::PC); m_pcCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::PC);
m_es3Catalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::ES3); m_androidCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::ANDROID_ID);
const AZStd::string engroot = AZ::Test::GetEngineRootPath(); const AZStd::string engroot = AZ::Test::GetEngineRootPath();
AZ::IO::FileIOBase::GetInstance()->SetAlias("@engroot@", engroot.c_str()); AZ::IO::FileIOBase::GetInstance()->SetAlias("@engroot@", engroot.c_str());
@ -220,21 +227,21 @@ namespace UnitTest
} }
auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC); auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
auto es3CatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ES3); auto androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
if (fileIO->Exists(pcCatalogFile.c_str())) if (fileIO->Exists(pcCatalogFile.c_str()))
{ {
fileIO->Remove(pcCatalogFile.c_str()); fileIO->Remove(pcCatalogFile.c_str());
} }
if (fileIO->Exists(es3CatalogFile.c_str())) if (fileIO->Exists(androidCatalogFile.c_str()))
{ {
fileIO->Remove(es3CatalogFile.c_str()); fileIO->Remove(androidCatalogFile.c_str());
} }
delete m_assetSeedManager; delete m_assetSeedManager;
delete m_assetRegistry; delete m_assetRegistry;
delete m_pcCatalog; delete m_pcCatalog;
delete m_es3Catalog; delete m_androidCatalog;
m_application->Stop(); m_application->Stop();
delete m_application; delete m_application;
} }
@ -335,10 +342,10 @@ namespace UnitTest
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
// Step we are testing // Step we are testing
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ES3); m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ANDROID_ID);
// Verification // Verification
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3; AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList()) for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList())
{ {
EXPECT_EQ(seedInfo.m_platformFlags, expectedPlatformFlags); EXPECT_EQ(seedInfo.m_platformFlags, expectedPlatformFlags);
@ -351,14 +358,14 @@ namespace UnitTest
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC);
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_PC);
m_es3Catalog->UnregisterAsset(assets[2]); m_androidCatalog->UnregisterAsset(assets[2]);
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
// Step we are testing // Step we are testing
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ES3); m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ANDROID_ID);
// Verification // Verification
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3; AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList()) for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList())
{ {
if (seedInfo.m_assetId == assets[2]) if (seedInfo.m_assetId == assets[2])
@ -376,14 +383,14 @@ namespace UnitTest
{ {
// Setup // Setup
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC);
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_ANDROID);
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_PC);
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_ANDROID);
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_ANDROID);
// Step we are testing // Step we are testing
m_assetSeedManager->RemovePlatformFromAllSeeds(AzFramework::PlatformId::ES3); m_assetSeedManager->RemovePlatformFromAllSeeds(AzFramework::PlatformId::ANDROID_ID);
// Verification // Verification
for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList()) for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList())
@ -507,8 +514,8 @@ namespace UnitTest
void DependencyValidation_MultipleAssetSeeds_MultiplePlatformFlags_ListValid() void DependencyValidation_MultipleAssetSeeds_MultiplePlatformFlags_ListValid()
{ {
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
m_assetSeedManager->AddSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
AzToolsFramework::AssetFileInfoList assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC); AzToolsFramework::AssetFileInfoList assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
@ -524,7 +531,7 @@ namespace UnitTest
assetList.m_fileInfoList.clear(); assetList.m_fileInfoList.clear();
m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC); assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
@ -540,7 +547,7 @@ namespace UnitTest
EXPECT_TRUE(Search(assetList, assets[8])); EXPECT_TRUE(Search(assetList, assets[8]));
assetList.m_fileInfoList.clear(); assetList.m_fileInfoList.clear();
m_assetSeedManager->RemoveSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->RemoveSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC); assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
@ -555,7 +562,7 @@ namespace UnitTest
EXPECT_TRUE(Search(assetList, assets[8])); EXPECT_TRUE(Search(assetList, assets[8]));
// Removing the android flag from the asset should still produce the same result // Removing the android flag from the asset should still produce the same result
m_assetSeedManager->RemoveSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->RemoveSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ANDROID);
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC); assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
@ -569,7 +576,7 @@ namespace UnitTest
EXPECT_TRUE(Search(assetList, assets[7])); EXPECT_TRUE(Search(assetList, assets[7]));
EXPECT_TRUE(Search(assetList, assets[8])); EXPECT_TRUE(Search(assetList, assets[8]));
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ES3); assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ANDROID_ID);
EXPECT_EQ(assetList.m_fileInfoList.size(), 5); EXPECT_EQ(assetList.m_fileInfoList.size(), 5);
EXPECT_TRUE(Search(assetList, assets[0])); EXPECT_TRUE(Search(assetList, assets[0]));
@ -579,8 +586,8 @@ namespace UnitTest
EXPECT_TRUE(Search(assetList, assets[4])); EXPECT_TRUE(Search(assetList, assets[4]));
// Adding the android flag again to the asset // Adding the android flag again to the asset
m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ES3); m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ANDROID);
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ES3); assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ANDROID_ID);
EXPECT_EQ(assetList.m_fileInfoList.size(), 8); EXPECT_EQ(assetList.m_fileInfoList.size(), 8);
EXPECT_TRUE(Search(assetList, assets[0])); EXPECT_TRUE(Search(assetList, assets[0]));
@ -766,7 +773,7 @@ namespace UnitTest
AzFramework::AssetRegistry* m_assetRegistry; AzFramework::AssetRegistry* m_assetRegistry;
ToolsTestApplication* m_application; ToolsTestApplication* m_application;
AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog; AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog;
AzToolsFramework::PlatformAddressedAssetCatalog* m_es3Catalog; AzToolsFramework::PlatformAddressedAssetCatalog* m_androidCatalog;
AZ::IO::FileIOStream m_fileStreams[s_totalTestPlatforms][s_totalAssets]; AZ::IO::FileIOStream m_fileStreams[s_totalTestPlatforms][s_totalAssets];
AzFramework::PlatformId m_testPlatforms[s_totalTestPlatforms]; AzFramework::PlatformId m_testPlatforms[s_totalTestPlatforms];
AZStd::string m_assetsPath[s_totalAssets]; AZStd::string m_assetsPath[s_totalAssets];
@ -929,7 +936,7 @@ namespace UnitTest
TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_AllPlatformsValid_SeedAddedForEveryInputPlatform) TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_AllPlatformsValid_SeedAddedForEveryInputPlatform)
{ {
using namespace AzFramework; using namespace AzFramework;
PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ES3; PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ANDROID;
AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, validPlatforms); AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, validPlatforms);
// Verify the function outputs // Verify the function outputs
@ -946,8 +953,8 @@ namespace UnitTest
TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_SomePlatformsValid_SeedAddedForEveryValidPlatform) TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_SomePlatformsValid_SeedAddedForEveryValidPlatform)
{ {
using namespace AzFramework; using namespace AzFramework;
PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ES3; PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ANDROID;
PlatformFlags inputPlatforms = validPlatforms | PlatformFlags::Platform_OSX; PlatformFlags inputPlatforms = validPlatforms | PlatformFlags::Platform_MAC;
AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, inputPlatforms); AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, inputPlatforms);
// Verify the function outputs // Verify the function outputs
@ -964,7 +971,7 @@ namespace UnitTest
TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_NoPlatformsValid_NoSeedAdded) TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_NoPlatformsValid_NoSeedAdded)
{ {
using namespace AzFramework; using namespace AzFramework;
PlatformFlags inputPlatforms = PlatformFlags::Platform_OSX; PlatformFlags inputPlatforms = PlatformFlags::Platform_MAC;
AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, inputPlatforms); AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, inputPlatforms);
// Verify the function outputs // Verify the function outputs
@ -978,30 +985,30 @@ namespace UnitTest
TEST_F(AssetSeedManagerTest, Valid_Seed_Remove_ForAllPlatform_OK) TEST_F(AssetSeedManagerTest, Valid_Seed_Remove_ForAllPlatform_OK)
{ {
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList(); const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList();
EXPECT_EQ(seedList.size(), 0); EXPECT_EQ(seedList.size(), 0);
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList(); const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList();
EXPECT_EQ(secondSeedList.size(), 0); EXPECT_EQ(secondSeedList.size(), 0);
} }
TEST_F(AssetSeedManagerTest, Valid_Seed_Remove_ForSpecificPlatform_OK) TEST_F(AssetSeedManagerTest, Valid_Seed_Remove_ForSpecificPlatform_OK)
{ {
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_MAC);
const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList(); const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList();
EXPECT_EQ(seedList.size(), 1); EXPECT_EQ(seedList.size(), 1);
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC); m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC);
const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList(); const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList();
@ -1010,14 +1017,14 @@ namespace UnitTest
TEST_F(AssetSeedManagerTest, Invalid_NotRemove_SeedForAllPlatform_Ok) TEST_F(AssetSeedManagerTest, Invalid_NotRemove_SeedForAllPlatform_Ok)
{ {
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
m_assetSeedManager->RemoveSeedAsset(assets[1].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->RemoveSeedAsset(assets[1].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList(); const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList();
EXPECT_EQ(seedList.size(), 1); EXPECT_EQ(seedList.size(), 1);
m_assetSeedManager->RemoveSeedAsset("asset1.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX); m_assetSeedManager->RemoveSeedAsset("asset1.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList(); const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList();
EXPECT_EQ(secondSeedList.size(), 1); EXPECT_EQ(secondSeedList.size(), 1);
} }

@ -25,6 +25,8 @@ namespace UnitTests
MOCK_METHOD0(GetAbsoluteDevGameFolderPath, const char* ()); MOCK_METHOD0(GetAbsoluteDevGameFolderPath, const char* ());
MOCK_METHOD0(GetAbsoluteDevRootFolderPath, const char* ()); MOCK_METHOD0(GetAbsoluteDevRootFolderPath, const char* ());
MOCK_METHOD2(GetRelativeProductPathFromFullSourceOrProductPath, bool(const AZStd::string& fullPath, AZStd::string& relativeProductPath)); MOCK_METHOD2(GetRelativeProductPathFromFullSourceOrProductPath, bool(const AZStd::string& fullPath, AZStd::string& relativeProductPath));
MOCK_METHOD3(GenerateRelativeSourcePath,
bool(const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& watchFolder));
MOCK_METHOD2(GetFullSourcePathFromRelativeProductPath, bool(const AZStd::string& relPath, AZStd::string& fullSourcePath)); MOCK_METHOD2(GetFullSourcePathFromRelativeProductPath, bool(const AZStd::string& relPath, AZStd::string& fullSourcePath));
MOCK_METHOD5(GetAssetInfoById, bool(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath)); MOCK_METHOD5(GetAssetInfoById, bool(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath));
MOCK_METHOD3(GetSourceInfoBySourcePath, bool(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder)); MOCK_METHOD3(GetSourceInfoBySourcePath, bool(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder));

@ -10,6 +10,8 @@
* *
*/ */
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
#include <AzToolsFramework/AssetCatalog/PlatformAddressedAssetCatalogManager.h> #include <AzToolsFramework/AssetCatalog/PlatformAddressedAssetCatalogManager.h>
#include <AzFramework/Asset/AssetRegistry.h> #include <AzFramework/Asset/AssetRegistry.h>
@ -49,6 +51,14 @@ namespace UnitTest
using namespace AZ::Data; using namespace AZ::Data;
m_application = new ToolsTestApplication("AddressedAssetCatalogManager"); // Shorter name because Setting Registry m_application = new ToolsTestApplication("AddressedAssetCatalogManager"); // Shorter name because Setting Registry
// specialization are 32 characters max. // specialization are 32 characters max.
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_application->Start(AzFramework::Application::Descriptor()); m_application->Start(AzFramework::Application::Descriptor());
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash // shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
@ -174,13 +184,13 @@ namespace UnitTest
TEST_F(PlatformAddressedAssetCatalogManagerTest, PlatformAddressedAssetCatalogManager_CatalogExistsChecks_Success) TEST_F(PlatformAddressedAssetCatalogManagerTest, PlatformAddressedAssetCatalogManager_CatalogExistsChecks_Success)
{ {
EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ES3), true); EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ANDROID_ID), true);
AZStd::string es3CatalogPath = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ES3); AZStd::string androidCatalogPath = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
if (AZ::IO::FileIOBase::GetInstance()->Exists(es3CatalogPath.c_str())) if (AZ::IO::FileIOBase::GetInstance()->Exists(androidCatalogPath.c_str()))
{ {
AZ::IO::FileIOBase::GetInstance()->Remove(es3CatalogPath.c_str()); AZ::IO::FileIOBase::GetInstance()->Remove(androidCatalogPath.c_str());
} }
EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ES3), false); EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ANDROID_ID), false);
} }
class PlatformAddressedAssetCatalogMessageTest : public AzToolsFramework::PlatformAddressedAssetCatalog class PlatformAddressedAssetCatalogMessageTest : public AzToolsFramework::PlatformAddressedAssetCatalog
@ -241,7 +251,7 @@ namespace UnitTest
AzFramework::AssetSystem::NetworkAssetUpdateInterface* notificationInterface = AZ::Interface<AzFramework::AssetSystem::NetworkAssetUpdateInterface>::Get(); AzFramework::AssetSystem::NetworkAssetUpdateInterface* notificationInterface = AZ::Interface<AzFramework::AssetSystem::NetworkAssetUpdateInterface>::Get();
EXPECT_NE(notificationInterface, nullptr); EXPECT_NE(notificationInterface, nullptr);
auto* mockCatalog = new ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>(AzFramework::PlatformId::ES3); auto* mockCatalog = new ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>(AzFramework::PlatformId::ANDROID_ID);
AZStd::unique_ptr< ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>> catalogHolder; AZStd::unique_ptr< ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>> catalogHolder;
catalogHolder.reset(mockCatalog); catalogHolder.reset(mockCatalog);
@ -249,7 +259,7 @@ namespace UnitTest
EXPECT_CALL(*mockCatalog, AssetChanged(testing::_)).Times(0); EXPECT_CALL(*mockCatalog, AssetChanged(testing::_)).Times(0);
notificationInterface->AssetChanged(testMessage); notificationInterface->AssetChanged(testMessage);
testMessage.m_platform = "es3"; testMessage.m_platform = "android";
EXPECT_CALL(*mockCatalog, AssetChanged(testing::_)).Times(1); EXPECT_CALL(*mockCatalog, AssetChanged(testing::_)).Times(1);
notificationInterface->AssetChanged(testMessage); notificationInterface->AssetChanged(testMessage);
@ -260,7 +270,7 @@ namespace UnitTest
EXPECT_CALL(*mockCatalog, AssetRemoved(testing::_)).Times(0); EXPECT_CALL(*mockCatalog, AssetRemoved(testing::_)).Times(0);
notificationInterface->AssetRemoved(testMessage); notificationInterface->AssetRemoved(testMessage);
testMessage.m_platform = "es3"; testMessage.m_platform = "android";
EXPECT_CALL(*mockCatalog, AssetRemoved(testing::_)).Times(1); EXPECT_CALL(*mockCatalog, AssetRemoved(testing::_)).Times(1);
notificationInterface->AssetRemoved(testMessage); notificationInterface->AssetRemoved(testMessage);
} }

@ -149,6 +149,9 @@ namespace UnitTest
const char* GetAbsoluteDevGameFolderPath() override { return ""; } const char* GetAbsoluteDevGameFolderPath() override { return ""; }
const char* GetAbsoluteDevRootFolderPath() override { return ""; } const char* GetAbsoluteDevRootFolderPath() override { return ""; }
bool GetRelativeProductPathFromFullSourceOrProductPath([[maybe_unused]] const AZStd::string& fullPath, [[maybe_unused]] AZStd::string& relativeProductPath) override { return false; } bool GetRelativeProductPathFromFullSourceOrProductPath([[maybe_unused]] const AZStd::string& fullPath, [[maybe_unused]] AZStd::string& relativeProductPath) override { return false; }
bool GenerateRelativeSourcePath(
[[maybe_unused]] const AZStd::string& sourcePath, [[maybe_unused]] AZStd::string& relativePath,
[[maybe_unused]] AZStd::string& watchFolder) override { return false; }
bool GetFullSourcePathFromRelativeProductPath([[maybe_unused]] const AZStd::string& relPath, [[maybe_unused]] AZStd::string& fullSourcePath) override { return false; } bool GetFullSourcePathFromRelativeProductPath([[maybe_unused]] const AZStd::string& relPath, [[maybe_unused]] AZStd::string& fullSourcePath) override { return false; }
bool GetAssetInfoById([[maybe_unused]] const AZ::Data::AssetId& assetId, [[maybe_unused]] const AZ::Data::AssetType& assetType, [[maybe_unused]] const AZStd::string& platformName, [[maybe_unused]] AZ::Data::AssetInfo& assetInfo, [[maybe_unused]] AZStd::string& rootFilePath) override { return false; } bool GetAssetInfoById([[maybe_unused]] const AZ::Data::AssetId& assetId, [[maybe_unused]] const AZ::Data::AssetType& assetType, [[maybe_unused]] const AZStd::string& platformName, [[maybe_unused]] AZ::Data::AssetInfo& assetInfo, [[maybe_unused]] AZStd::string& rootFilePath) override { return false; }
bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override; bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override;

@ -488,18 +488,17 @@ void TransformCompressor::Marshal(WriteBuffer& wb, const AZ::Transform& value) c
{ {
AZ::u8 flags = 0; AZ::u8 flags = 0;
auto flagsMarker = wb.InsertMarker(flags); auto flagsMarker = wb.InsertMarker(flags);
AZ::Matrix3x3 m33 = AZ::Matrix3x3::CreateFromTransform(value); float scale = value.GetUniformScale();
AZ::Vector3 scale = m33.ExtractScale(); AZ::Quaternion rot = value.GetRotation();
AZ::Quaternion rot = AZ::Quaternion::CreateFromMatrix3x3(m33.GetOrthogonalized());
if (!rot.IsIdentity()) if (!rot.IsIdentity())
{ {
flags |= HAS_ROT; flags |= HAS_ROT;
wb.Write(rot, QuatCompMarshaler()); wb.Write(rot, QuatCompMarshaler());
} }
if (!scale.IsClose(AZ::Vector3::CreateOne())) if (!AZ::IsClose(scale, 1.0f, AZ::Constants::Tolerance))
{ {
flags |= HAS_SCALE; flags |= HAS_SCALE;
wb.Write(scale, Vec3CompMarshaler()); wb.Write(scale, HalfMarshaler());
} }
AZ::Vector3 pos = value.GetTranslation(); AZ::Vector3 pos = value.GetTranslation();
if (!pos.IsZero()) if (!pos.IsZero())
@ -527,9 +526,9 @@ void TransformCompressor::Unmarshal(AZ::Transform& value, ReadBuffer& rb) const
} }
if (flags & HAS_SCALE) if (flags & HAS_SCALE)
{ {
AZ::Vector3 scale; float scale;
rb.Read(scale, Vec3CompMarshaler()); rb.Read(scale, HalfMarshaler());
xform.MultiplyByScale(scale); xform.MultiplyByUniformScale(scale);
} }
if (flags & HAS_POS) if (flags & HAS_POS)
{ {

@ -11,6 +11,7 @@
*/ */
#include <AzTest/AzTest.h> #include <AzTest/AzTest.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/UnitTest/UnitTest.h> #include <AzCore/UnitTest/UnitTest.h>
#include <AzCore/UserSettings/UserSettingsComponent.h> #include <AzCore/UserSettings/UserSettingsComponent.h>
@ -40,6 +41,13 @@ namespace UnitTest
void SetUp() override void SetUp() override
{ {
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_application->Start({}); m_application->Start({});
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash // shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash

@ -16,6 +16,7 @@
#include <AzCore/UnitTest/UnitTest.h> #include <AzCore/UnitTest/UnitTest.h>
#include <AzCore/IO/SystemFile.h> // for max path decl #include <AzCore/IO/SystemFile.h> // for max path decl
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/std/parallel/thread.h> #include <AzCore/std/parallel/thread.h>
#include <AzCore/std/parallel/semaphore.h> #include <AzCore/std/parallel/semaphore.h>
#include <AzCore/std/functional.h> // for function<> in the find files callback. #include <AzCore/std/functional.h> // for function<> in the find files callback.
@ -42,6 +43,14 @@ namespace UnitTest
{ {
AZ::ComponentApplication::Descriptor descriptor; AZ::ComponentApplication::Descriptor descriptor;
descriptor.m_stackRecordLevels = 30; descriptor.m_stackRecordLevels = 30;
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_application->Start(descriptor); m_application->Start(descriptor);
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash // shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash

@ -23,6 +23,7 @@
#include <AzCore/Math/Uuid.h> #include <AzCore/Math/Uuid.h>
#include <AzCore/Memory/Memory.h> #include <AzCore/Memory/Memory.h>
#include <AzCore/Memory/PoolAllocator.h> #include <AzCore/Memory/PoolAllocator.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/std/containers/vector.h> #include <AzCore/std/containers/vector.h>
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/UserSettings/UserSettingsComponent.h> #include <AzCore/UserSettings/UserSettingsComponent.h>
@ -304,6 +305,13 @@ namespace UnitTest
m_app.reset(aznew AzFramework::Application()); m_app.reset(aznew AzFramework::Application());
AZ::ComponentApplication::Descriptor desc; AZ::ComponentApplication::Descriptor desc;
desc.m_useExistingAllocator = true; desc.m_useExistingAllocator = true;
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_app->Start(desc); m_app->Start(desc);
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is

@ -12,6 +12,7 @@
#include <AzCore/Component/ComponentApplicationBus.h> #include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Outcome/Outcome.h> #include <AzCore/Outcome/Outcome.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/UserSettings/UserSettingsComponent.h> #include <AzCore/UserSettings/UserSettingsComponent.h>
@ -572,6 +573,12 @@ namespace UnitTest
{ {
AllocatorsTestFixture::SetUp(); AllocatorsTestFixture::SetUp();
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
AzFramework::Application::Descriptor descriptor; AzFramework::Application::Descriptor descriptor;
descriptor.m_enableDrilling = false; descriptor.m_enableDrilling = false;
m_app.Start(descriptor); m_app.Start(descriptor);

@ -17,6 +17,7 @@
#include <AzCore/Serialization/Json/JsonSerialization.h> #include <AzCore/Serialization/Json/JsonSerialization.h>
#include <AzCore/Serialization/Json/JsonSystemComponent.h> #include <AzCore/Serialization/Json/JsonSystemComponent.h>
#include <AzCore/Serialization/Json/RegistrationContext.h> #include <AzCore/Serialization/Json/RegistrationContext.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/Utils/Utils.h> #include <AzCore/Utils/Utils.h>
#include <AzFramework/FileFunc/FileFunc.h> #include <AzFramework/FileFunc/FileFunc.h>
@ -278,6 +279,12 @@ namespace UnitTest
{ {
FrameworkApplicationFixture::SetUp(); FrameworkApplicationFixture::SetUp();
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_serializeContext = AZStd::make_unique<AZ::SerializeContext>(); m_serializeContext = AZStd::make_unique<AZ::SerializeContext>();
m_jsonRegistrationContext = AZStd::make_unique<AZ::JsonRegistrationContext>(); m_jsonRegistrationContext = AZStd::make_unique<AZ::JsonRegistrationContext>();
m_jsonSystemComponent = AZStd::make_unique<AZ::JsonSystemComponent>(); m_jsonSystemComponent = AZStd::make_unique<AZ::JsonSystemComponent>();

@ -83,6 +83,7 @@ namespace UnitTest
void SetUp() override void SetUp() override
{ {
AllocatorsFixture::SetUp(); AllocatorsFixture::SetUp();
m_data = AZStd::make_unique<StaticData>(); m_data = AZStd::make_unique<StaticData>();
using namespace AzFramework::FileTag; using namespace AzFramework::FileTag;
AZ::ComponentApplication::Descriptor desc; AZ::ComponentApplication::Descriptor desc;

@ -54,7 +54,7 @@ namespace UnitTest
}; };
void SetUp() override void SetUp() override
{ {
m_appDescriptor.m_allocationRecords = true; m_appDescriptor.m_allocationRecords = true;
m_appDescriptor.m_allocationRecordsSaveNames = true; m_appDescriptor.m_allocationRecordsSaveNames = true;
m_appDescriptor.m_recordingMode = AZ::Debug::AllocationRecords::Mode::RECORD_FULL; m_appDescriptor.m_recordingMode = AZ::Debug::AllocationRecords::Mode::RECORD_FULL;

@ -12,6 +12,7 @@
#include <AzTest/AzTest.h> #include <AzTest/AzTest.h>
#include <AzCore/Slice/SliceComponent.h> #include <AzCore/Slice/SliceComponent.h>
#include <AzCore/Serialization/Utils.h> #include <AzCore/Serialization/Utils.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h> #include <AzCore/UserSettings/UserSettingsComponent.h>
#include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h> #include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
#include <AzToolsFramework/Application/ToolsApplication.h> #include <AzToolsFramework/Application/ToolsApplication.h>
@ -59,6 +60,12 @@ class WrappedEditorComponentTest
protected: protected:
void SetUp() override void SetUp() override
{ {
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_app.Start(AZ::ComponentApplication::Descriptor()); m_app.Start(AZ::ComponentApplication::Descriptor());
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
@ -178,6 +185,12 @@ class FindWrappedComponentsTest
public: public:
void SetUp() override void SetUp() override
{ {
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_app.Start(AzFramework::Application::Descriptor()); m_app.Start(AzFramework::Application::Descriptor());
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is

@ -30,11 +30,11 @@ TEST_F(PlatformHelperTest, SinglePlatformFlags_PlatformId_Valid)
TEST_F(PlatformHelperTest, MultiplePlatformFlags_PlatformId_Valid) TEST_F(PlatformHelperTest, MultiplePlatformFlags_PlatformId_Valid)
{ {
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3; AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
auto platforms = AzFramework::PlatformHelper::GetPlatforms(platformFlags); auto platforms = AzFramework::PlatformHelper::GetPlatforms(platformFlags);
EXPECT_EQ(platforms.size(), 2); EXPECT_EQ(platforms.size(), 2);
EXPECT_EQ(platforms[0], "pc"); EXPECT_EQ(platforms[0], "pc");
EXPECT_EQ(platforms[1], "es3"); EXPECT_EQ(platforms[1], "android");
} }
TEST_F(PlatformHelperTest, SpecialAllFlag_PlatformId_Valid) TEST_F(PlatformHelperTest, SpecialAllFlag_PlatformId_Valid)
@ -42,7 +42,7 @@ TEST_F(PlatformHelperTest, SpecialAllFlag_PlatformId_Valid)
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL; AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL;
auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags); auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags);
EXPECT_EQ(platforms.size(), AzFramework::NumPlatforms); EXPECT_EQ(platforms.size(), AzFramework::NumPlatforms);
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "provo", "salem", "jasper", "server")); EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "android", "ios", "mac", "provo", "salem", "jasper", "server"));
} }
TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid) TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid)
@ -50,7 +50,7 @@ TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid)
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL_CLIENT; AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL_CLIENT;
auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags); auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags);
EXPECT_EQ(platforms.size(), AzFramework::NumClientPlatforms); EXPECT_EQ(platforms.size(), AzFramework::NumClientPlatforms);
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "provo", "salem", "jasper")); EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "android", "ios", "mac", "provo", "salem", "jasper"));
} }
TEST_F(PlatformHelperTest, InvalidPlatformFlags_PlatformId_Empty) TEST_F(PlatformHelperTest, InvalidPlatformFlags_PlatformId_Empty)

@ -22,6 +22,7 @@
#include <AzCore/Slice/SliceAssetHandler.h> #include <AzCore/Slice/SliceAssetHandler.h>
#include <AzCore/Script/ScriptSystemComponent.h> #include <AzCore/Script/ScriptSystemComponent.h>
#include <AzCore/Script/ScriptAsset.h> #include <AzCore/Script/ScriptAsset.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/std/chrono/chrono.h> #include <AzCore/std/chrono/chrono.h>
#include <AzCore/RTTI/TypeInfo.h> #include <AzCore/RTTI/TypeInfo.h>
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
@ -1059,6 +1060,12 @@ namespace UnitTest
void SetUp() override void SetUp() override
{ {
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_app.Start(AzFramework::Application::Descriptor()); m_app.Start(AzFramework::Application::Descriptor());
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is

@ -0,0 +1,158 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/UnitTest/TestTypes.h>
#include <AzFramework/Application/Application.h>
#include <AzFramework/Spawnable/SpawnableAssetHandler.h>
#include <AzFramework/Spawnable/SpawnableEntitiesManager.h>
#include <AzTest/AzTest.h>
namespace UnitTest
{
class TestApplication : public AzFramework::Application
{
public:
// ComponentApplication
void SetSettingsRegistrySpecializations(AZ::SettingsRegistryInterface::Specializations& specializations) override
{
Application::SetSettingsRegistrySpecializations(specializations);
specializations.Append("test");
specializations.Append("spawnable");
}
};
class SpawnableEntitiesManagerTest : public AllocatorsFixture
{
public:
void SetUp() override
{
AllocatorsFixture::SetUp();
m_application = new TestApplication();
AZ::ComponentApplication::Descriptor descriptor;
m_application->Start(descriptor);
m_spawnable = aznew AzFramework::Spawnable(
AZ::Data::AssetId::CreateString("{EB2E8A2B-F253-4A90-BBF4-55F2EED786B8}:0"), AZ::Data::AssetData::AssetStatus::Ready);
m_spawnableAsset = new AZ::Data::Asset<AzFramework::Spawnable>(m_spawnable, AZ::Data::AssetLoadBehavior::Default);
m_ticket = new AzFramework::EntitySpawnTicket(*m_spawnableAsset);
auto managerInterface = AzFramework::SpawnableEntitiesInterface::Get();
m_manager = azrtti_cast<AzFramework::SpawnableEntitiesManager*>(managerInterface);
}
void TearDown() override
{
delete m_ticket;
m_ticket = nullptr;
// One more tick on the spawnable entities manager in order to delete the ticket fully.
m_manager->ProcessQueue();
delete m_spawnableAsset;
m_spawnableAsset = nullptr;
// This will also delete m_spawnable.
delete m_application;
m_application = nullptr;
AllocatorsFixture::TearDown();
}
void FillSpawnable(size_t numElements)
{
AzFramework::Spawnable::EntityList& entities = m_spawnable->GetEntities();
entities.reserve(numElements);
for (size_t i=0; i<numElements; ++i)
{
entities.push_back(AZStd::make_unique<AZ::Entity>());
}
}
protected:
AZ::Data::Asset<AzFramework::Spawnable>* m_spawnableAsset { nullptr };
AzFramework::SpawnableEntitiesManager* m_manager { nullptr };
AzFramework::EntitySpawnTicket* m_ticket { nullptr };
AzFramework::Spawnable* m_spawnable { nullptr };
TestApplication* m_application { nullptr };
};
TEST_F(SpawnableEntitiesManagerTest, SpawnAllEntities_Call_AllEntitiesSpawned)
{
static constexpr size_t NumEntities = 4;
FillSpawnable(NumEntities);
size_t spawnedEntitiesCount = 0;
auto callback =
[&spawnedEntitiesCount](AzFramework::EntitySpawnTicket&, AzFramework::SpawnableConstEntityContainerView entities)
{
spawnedEntitiesCount += entities.size();
};
m_manager->SpawnAllEntities(*m_ticket, {}, AZStd::move(callback));
m_manager->ProcessQueue();
EXPECT_EQ(NumEntities, spawnedEntitiesCount);
}
TEST_F(SpawnableEntitiesManagerTest, ListEntities_Call_AllEntitiesAreReported)
{
static constexpr size_t NumEntities = 4;
FillSpawnable(NumEntities);
bool allValidEntityIds = true;
size_t spawnedEntitiesCount = 0;
auto callback = [&allValidEntityIds, &spawnedEntitiesCount]
(AzFramework::EntitySpawnTicket&, AzFramework::SpawnableConstEntityContainerView entities)
{
for (auto&& entity : entities)
{
allValidEntityIds = entity->GetId().IsValid() && allValidEntityIds;
}
spawnedEntitiesCount += entities.size();
};
m_manager->SpawnAllEntities(*m_ticket);
m_manager->ListEntities(*m_ticket, AZStd::move(callback));
m_manager->ProcessQueue();
EXPECT_TRUE(allValidEntityIds);
EXPECT_EQ(NumEntities, spawnedEntitiesCount);
}
TEST_F(SpawnableEntitiesManagerTest, ListIndicesAndEntities_Call_AllEntitiesAreReportedAndIncrementByOne)
{
static constexpr size_t NumEntities = 4;
FillSpawnable(NumEntities);
bool allValidEntityIds = true;
size_t spawnedEntitiesCount = 0;
auto callback = [&allValidEntityIds, &spawnedEntitiesCount]
(AzFramework::EntitySpawnTicket&, AzFramework::SpawnableConstIndexEntityContainerView entities)
{
for (auto&& indexEntityPair : entities)
{
// Since all entities are spawned a single time, the indices should be 0..NumEntities.
if (indexEntityPair.GetIndex() == spawnedEntitiesCount)
{
spawnedEntitiesCount++;
}
allValidEntityIds = indexEntityPair.GetEntity()->GetId().IsValid() && allValidEntityIds;
}
};
m_manager->SpawnAllEntities(*m_ticket);
m_manager->ListIndicesAndEntities(*m_ticket, AZStd::move(callback));
m_manager->ProcessQueue();
EXPECT_TRUE(allValidEntityIds);
EXPECT_EQ(NumEntities, spawnedEntitiesCount);
}
} // namespace UnitTest

@ -11,6 +11,7 @@
set(FILES set(FILES
../AzCore/Tests/Main.cpp ../AzCore/Tests/Main.cpp
Spawnable/SpawnableEntitiesManagerTests.cpp
ArchiveCompressionTests.cpp ArchiveCompressionTests.cpp
ArchiveTests.cpp ArchiveTests.cpp
BehaviorEntityTests.cpp BehaviorEntityTests.cpp

@ -9,6 +9,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
set_property(GLOBAL PROPERTY LAUNCHER_UNIFIED_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
# Launcher targets for a project need to be generated when configuring a project. # Launcher targets for a project need to be generated when configuring a project.
# When building the engine source, this file will be included by LauncherUnified's CMakeLists.txt # When building the engine source, this file will be included by LauncherUnified's CMakeLists.txt
# When using an installed engine, this file will be included by the FindLauncherGenerator.cmake script # When using an installed engine, this file will be included by the FindLauncherGenerator.cmake script
@ -40,28 +42,8 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
# In the monolithic case, we need to register the gem modules, to do so we will generate a StaticModules.inl # In the monolithic case, we need to register the gem modules, to do so we will generate a StaticModules.inl
# file from StaticModules.in # file from StaticModules.in
set_property(GLOBAL APPEND PROPERTY LY_STATIC_MODULE_PROJECTS_NAME ${project_name})
get_property(game_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project_name}.GameLauncher) get_property(game_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project_name}.GameLauncher)
unset(extern_module_declarations)
unset(module_invocations)
foreach(game_gem_dependency ${game_gem_dependencies})
# To match the convention on how gems targets vs gem modules are named, we remove the "Gem::" from prefix
# and remove the ".Static" from the suffix
string(REGEX REPLACE "^Gem::" "Gem_" game_gem_dependency ${game_gem_dependency})
string(REGEX REPLACE "^Project::" "Project_" game_gem_dependency ${game_gem_dependency})
# Replace "." with "_"
string(REPLACE "." "_" game_gem_dependency ${game_gem_dependency})
string(APPEND extern_module_declarations "extern \"C\" AZ::Module* CreateModuleClass_${game_gem_dependency}();\n")
string(APPEND module_invocations " modulesOut.push_back(CreateModuleClass_${game_gem_dependency}());\n")
endforeach()
configure_file(StaticModules.in
${CMAKE_CURRENT_BINARY_DIR}/${project_name}.GameLauncher/Includes/StaticModules.inl
)
set(game_build_dependencies set(game_build_dependencies
${game_gem_dependencies} ${game_gem_dependencies}
@ -70,29 +52,9 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
get_property(server_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project_name}.ServerLauncher) get_property(server_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project_name}.ServerLauncher)
unset(extern_module_declarations)
unset(module_invocations)
foreach(server_gem_dependency ${server_gem_dependencies})
# To match the convention on how gems targets vs gem modules are named, we remove the "Gem::" from prefix
# and remove the ".Static" from the suffix
string(REGEX REPLACE "^Gem::" "Gem_" server_gem_dependency ${server_gem_dependency})
string(REGEX REPLACE "^Project::" "Project_" server_gem_dependency ${server_gem_dependency})
# Replace "." with "_"
string(REPLACE "." "_" server_gem_dependency ${server_gem_dependency})
string(APPEND extern_module_declarations "extern \"C\" AZ::Module* CreateModuleClass_${server_gem_dependency}();\n")
string(APPEND module_invocations " modulesOut.push_back(CreateModuleClass_${server_gem_dependency}());\n")
endforeach()
configure_file(StaticModules.in
${CMAKE_CURRENT_BINARY_DIR}/${project_name}.ServerLauncher/Includes/StaticModules.inl
)
set(server_build_dependencies set(server_build_dependencies
${game_gem_dependencies} ${server_gem_dependencies}
Legacy::CrySystem Legacy::CrySystem
) )
endif() endif()
@ -186,3 +148,63 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
endif() endif()
endforeach() endforeach()
#! Defer generation of the StaticModules.inl file needed in monolithic builds until after all the CMake targets are known
# This is that the GEM_MODULE target runtime dependencies can be parsed to discover the list of dependent modules
# to load
function(ly_delayed_generate_static_modules_inl)
if(LY_MONOLITHIC_GAME)
get_property(launcher_unified_binary_dir GLOBAL PROPERTY LAUNCHER_UNIFIED_BINARY_DIR)
get_property(project_names GLOBAL PROPERTY LY_STATIC_MODULE_PROJECTS_NAME)
foreach(project_name ${project_names})
unset(extern_module_declarations)
unset(module_invocations)
unset(all_game_gem_dependencies)
ly_get_gem_load_dependencies(all_game_gem_dependencies ${project_name}.GameLauncher)
foreach(game_gem_dependency ${all_game_gem_dependencies})
# To match the convention on how gems targets vs gem modules are named,
# we remove the ".Static" from the suffix
# Replace "." with "_"
string(REPLACE "." "_" game_gem_dependency ${game_gem_dependency})
string(APPEND extern_module_declarations "extern \"C\" AZ::Module* CreateModuleClass_Gem_${game_gem_dependency}();\n")
string(APPEND module_invocations " modulesOut.push_back(CreateModuleClass_Gem_${game_gem_dependency}());\n")
endforeach()
configure_file(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/StaticModules.in
${launcher_unified_binary_dir}/${project_name}.GameLauncher/Includes/StaticModules.inl
)
if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
get_property(server_gem_dependencies GLOBAL PROPERTY LY_STATIC_MODULE_PROJECTS_DEPENDENCIES_${project_name}.ServerLauncher)
unset(extern_module_declarations)
unset(module_invocations)
unset(all_server_gem_dependencies)
ly_get_gem_load_dependencies(all_server_gem_dependencies ${project_name}.ServerLauncher)
foreach(server_gem_dependency ${server_gem_dependencies})
ly_get_gem_load_dependencies(server_gem_load_dependencies ${server_gem_dependency})
list(APPEND all_server_gem_dependencies ${server_gem_load_dependencies} ${server_gem_dependency})
endforeach()
foreach(server_gem_dependency ${all_server_gem_dependencies})
# Replace "." with "_"
string(REPLACE "." "_" server_gem_dependency ${server_gem_dependency})
string(APPEND extern_module_declarations "extern \"C\" AZ::Module* CreateModuleClass_Gem_${server_gem_dependency}();\n")
string(APPEND module_invocations " modulesOut.push_back(CreateModuleClass_Gem_${server_gem_dependency}());\n")
endforeach()
configure_file(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/StaticModules.in
${launcher_unified_binary_dir}/${project_name}.ServerLauncher/Includes/StaticModules.inl
)
endif()
endforeach()
endif()
endfunction()

@ -69,6 +69,7 @@ AZ_POP_DISABLE_WARNING
#include <AzToolsFramework/API/EditorPythonConsoleBus.h> #include <AzToolsFramework/API/EditorPythonConsoleBus.h>
#include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h> #include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h> #include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
#include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h> #include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
// AzQtComponents // AzQtComponents
@ -3105,6 +3106,15 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
GetIEditor()->GetDocument()->SetPathName(fullyQualifiedLevelName); GetIEditor()->GetDocument()->SetPathName(fullyQualifiedLevelName);
GetIEditor()->GetGameEngine()->SetLevelPath(levelPath); GetIEditor()->GetGameEngine()->SetLevelPath(levelPath);
if (usePrefabSystemForLevels)
{
auto* service = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
if (service)
{
service->CreateNewLevelPrefab((const char*)fullyQualifiedLevelName.toUtf8());
}
}
if (GetIEditor()->GetDocument()->Save()) if (GetIEditor()->GetDocument()->Save())
{ {
if (!usePrefabSystemForLevels) if (!usePrefabSystemForLevels)

@ -533,7 +533,7 @@ namespace AzToolsFramework
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation); ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_PC>("SystemConfigPlatform_Pc") behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_PC>("SystemConfigPlatform_Pc")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation); ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_OSX_GL>("SystemConfigPlatform_OsxGl") behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_MAC>("SystemConfigPlatform_Mac")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation); ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_OSX_METAL>("SystemConfigPlatform_OsxMetal") behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_OSX_METAL>("SystemConfigPlatform_OsxMetal")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation); ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);

@ -3,7 +3,7 @@
"AssetProcessor": { "AssetProcessor": {
"Settings": { "Settings": {
"Platforms": { "Platforms": {
"es3": "enabled" "android": "enabled"
} }
} }
} }

@ -17,6 +17,7 @@
#include <AzToolsFramework/Application/ToolsApplication.h> #include <AzToolsFramework/Application/ToolsApplication.h>
#include <AzToolsFramework/Asset/AssetBundler.h> #include <AzToolsFramework/Asset/AssetBundler.h>
#include <AzCore/IO/Path/Path.h> #include <AzCore/IO/Path/Path.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h> #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h> #include <AzCore/UserSettings/UserSettingsComponent.h>
@ -57,6 +58,22 @@ namespace AssetBundler
UnitTest::ScopedAllocatorSetupFixture::SetUp(); UnitTest::ScopedAllocatorSetupFixture::SetUp();
m_data = AZStd::make_unique<StaticData>(); m_data = AZStd::make_unique<StaticData>();
AZ::SettingsRegistryInterface* registry = nullptr;
if (!AZ::SettingsRegistry::Get())
{
AZ::SettingsRegistry::Register(&m_registry);
registry = &m_registry;
}
else
{
registry = AZ::SettingsRegistry::Get();
}
auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
+ "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_data->m_applicationManager.reset(aznew MockApplicationManagerTest(0, 0)); m_data->m_applicationManager.reset(aznew MockApplicationManagerTest(0, 0));
m_data->m_applicationManager->Start(AzFramework::Application::Descriptor()); m_data->m_applicationManager->Start(AzFramework::Application::Descriptor());
@ -84,6 +101,12 @@ namespace AssetBundler
delete m_data->m_localFileIO; delete m_data->m_localFileIO;
AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO); AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO);
auto settingsRegistry = AZ::SettingsRegistry::Get();
if(settingsRegistry == &m_registry)
{
AZ::SettingsRegistry::Unregister(settingsRegistry);
}
m_data->m_applicationManager->Stop(); m_data->m_applicationManager->Stop();
m_data->m_applicationManager.reset(); m_data->m_applicationManager.reset();
m_data.reset(); m_data.reset();
@ -99,6 +122,7 @@ namespace AssetBundler
}; };
AZStd::unique_ptr<StaticData> m_data; AZStd::unique_ptr<StaticData> m_data;
AZ::SettingsRegistryImpl m_registry;
}; };
TEST_F(ApplicationManagerTest, ValidatePlatformFlags_ReadConfigFiles_OK) TEST_F(ApplicationManagerTest, ValidatePlatformFlags_ReadConfigFiles_OK)
@ -126,7 +150,7 @@ namespace AssetBundler
AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(m_data->m_testEngineRoot.c_str(), m_data->m_testEngineRoot.c_str(), DummyProjectName); AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(m_data->m_testEngineRoot.c_str(), m_data->m_testEngineRoot.c_str(), DummyProjectName);
AzFramework::PlatformFlags hostPlatformFlag = AzFramework::PlatformHelper::GetPlatformFlag(AzToolsFramework::AssetSystem::GetHostAssetPlatform()); AzFramework::PlatformFlags hostPlatformFlag = AzFramework::PlatformHelper::GetPlatformFlag(AzToolsFramework::AssetSystem::GetHostAssetPlatform());
AzFramework::PlatformFlags expectedFlags = AzFramework::PlatformFlags::Platform_ES3 | AzFramework::PlatformFlags::Platform_IOS | AzFramework::PlatformFlags::Platform_PROVO | hostPlatformFlag; AzFramework::PlatformFlags expectedFlags = AzFramework::PlatformFlags::Platform_ANDROID | AzFramework::PlatformFlags::Platform_IOS | AzFramework::PlatformFlags::Platform_PROVO | hostPlatformFlag;
ASSERT_EQ(platformFlags, expectedFlags); ASSERT_EQ(platformFlags, expectedFlags);
} }

@ -40,14 +40,14 @@ namespace AssetBundler
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_MacFile_OutputBaseNameAndPlatform) TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_MacFile_OutputBaseNameAndPlatform)
{ {
AZStd::string filePath = "assetInfoFile_osx_gl.xml"; AZStd::string filePath = "assetInfoFile_mac.xml";
AZStd::string baseFilename; AZStd::string baseFilename;
AZStd::string platformIdentifier; AZStd::string platformIdentifier;
AzToolsFramework::SplitFilename(filePath, baseFilename, platformIdentifier); AzToolsFramework::SplitFilename(filePath, baseFilename, platformIdentifier);
ASSERT_EQ(baseFilename, "assetInfoFile"); ASSERT_EQ(baseFilename, "assetInfoFile");
ASSERT_EQ(platformIdentifier, "osx_gl"); ASSERT_EQ(platformIdentifier, "mac");
} }
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_PcFile_OutputBaseNameAndPlatform) TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_PcFile_OutputBaseNameAndPlatform)
@ -64,14 +64,14 @@ namespace AssetBundler
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_MacFileWithUnderScoreInFileName_OutputBaseNameAndPlatform) TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_MacFileWithUnderScoreInFileName_OutputBaseNameAndPlatform)
{ {
AZStd::string filePath = "assetInfoFile_test_osx_gl.xml"; AZStd::string filePath = "assetInfoFile_test_mac.xml";
AZStd::string baseFilename; AZStd::string baseFilename;
AZStd::string platformIdentifier; AZStd::string platformIdentifier;
AzToolsFramework::SplitFilename(filePath, baseFilename, platformIdentifier); AzToolsFramework::SplitFilename(filePath, baseFilename, platformIdentifier);
ASSERT_EQ(baseFilename, "assetInfoFile_test"); ASSERT_EQ(baseFilename, "assetInfoFile_test");
ASSERT_EQ(platformIdentifier, "osx_gl"); ASSERT_EQ(platformIdentifier, "mac");
} }
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_PcFileWithUnderScoreInFileName_OutputBaseNameAndPlatform) TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_PcFileWithUnderScoreInFileName_OutputBaseNameAndPlatform)
@ -97,21 +97,21 @@ namespace AssetBundler
{ {
public: public:
void SetUp() override void SetUp() override
{ {
m_data = AZStd::make_unique<StaticData>(); AZ::SettingsRegistryInterface* registry = nullptr;
m_data->m_application.reset(aznew AzToolsFramework::ToolsApplication());
m_data->m_application.get()->Start(AzFramework::Application::Descriptor());
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
// in the unit tests.
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
if (!AZ::SettingsRegistry::Get()) if (!AZ::SettingsRegistry::Get())
{ {
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(m_registry);
AZ::SettingsRegistry::Register(&m_registry); AZ::SettingsRegistry::Register(&m_registry);
registry = &m_registry;
} }
else
{
registry = AZ::SettingsRegistry::Get();
}
auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
+ "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath(); AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
if (engineRoot.empty()) if (engineRoot.empty())
@ -119,6 +119,14 @@ namespace AssetBundler
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to locate engine root.\n").c_str()); GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to locate engine root.\n").c_str());
} }
m_data = AZStd::make_unique<StaticData>();
m_data->m_application.reset(aznew AzToolsFramework::ToolsApplication());
m_data->m_application.get()->Start(AzFramework::Application::Descriptor());
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
// in the unit tests.
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
m_data->m_testEngineRoot = (engineRoot / RelativeTestFolder).LexicallyNormal().String(); m_data->m_testEngineRoot = (engineRoot / RelativeTestFolder).LexicallyNormal().String();
@ -144,14 +152,24 @@ namespace AssetBundler
} }
void TearDown() override void TearDown() override
{ {
AZ::IO::FileIOBase::SetInstance(nullptr); if (m_data)
delete m_data->m_localFileIO; {
AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO); AZ::IO::FileIOBase::SetInstance(nullptr);
delete m_data->m_localFileIO;
AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO);
m_data->m_gemInfoList.set_capacity(0);
m_data->m_gemSeedFilePairList.set_capacity(0);
m_data->m_application.get()->Stop();
m_data->m_application.reset();
}
if(auto settingsRegistry = AZ::SettingsRegistry::Get();
settingsRegistry == &m_registry)
{
AZ::SettingsRegistry::Unregister(settingsRegistry);
}
m_data->m_gemInfoList.set_capacity(0);
m_data->m_gemSeedFilePairList.set_capacity(0);
m_data->m_application.get()->Stop();
m_data->m_application.reset();
} }
void AddGemData(const char* engineRoot, const char* gemName, bool seedFileExists = true) void AddGemData(const char* engineRoot, const char* gemName, bool seedFileExists = true)

@ -78,17 +78,17 @@ namespace AssetBuilderSDK
{ {
return AssetBuilderSDK::Platform_PC; return AssetBuilderSDK::Platform_PC;
} }
if (azstricmp(newPlatformName, "es3") == 0) if (azstricmp(newPlatformName, "android") == 0)
{ {
return AssetBuilderSDK::Platform_ES3; return AssetBuilderSDK::Platform_ANDROID;
} }
if (azstricmp(newPlatformName, "ios") == 0) if (azstricmp(newPlatformName, "ios") == 0)
{ {
return AssetBuilderSDK::Platform_IOS; return AssetBuilderSDK::Platform_IOS;
} }
if (azstricmp(newPlatformName, "osx_gl") == 0) if (azstricmp(newPlatformName, "mac") == 0)
{ {
return AssetBuilderSDK::Platform_OSX; return AssetBuilderSDK::Platform_MAC;
} }
if (azstricmp(newPlatformName, "provo") == 0) if (azstricmp(newPlatformName, "provo") == 0)
{ {
@ -115,12 +115,12 @@ namespace AssetBuilderSDK
{ {
case AssetBuilderSDK::Platform_PC: case AssetBuilderSDK::Platform_PC:
return "pc"; return "pc";
case AssetBuilderSDK::Platform_ES3: case AssetBuilderSDK::Platform_ANDROID:
return "es3"; return "android";
case AssetBuilderSDK::Platform_IOS: case AssetBuilderSDK::Platform_IOS:
return "ios"; return "ios";
case AssetBuilderSDK::Platform_OSX: case AssetBuilderSDK::Platform_MAC:
return "osx_gl"; return "mac";
case AssetBuilderSDK::Platform_PROVO: case AssetBuilderSDK::Platform_PROVO:
return "provo"; return "provo";
case AssetBuilderSDK::Platform_SALEM: case AssetBuilderSDK::Platform_SALEM:

@ -148,15 +148,15 @@ namespace AssetBuilderSDK
{ {
Platform_NONE = 0x00, Platform_NONE = 0x00,
Platform_PC = 0x01, Platform_PC = 0x01,
Platform_ES3 = 0x02, Platform_ANDROID = 0x02,
Platform_IOS = 0x04, Platform_IOS = 0x04,
Platform_OSX = 0x08, Platform_MAC = 0x08,
Platform_PROVO = 0x20, Platform_PROVO = 0x20,
Platform_SALEM = 0x40, Platform_SALEM = 0x40,
Platform_JASPER = 0x80, Platform_JASPER = 0x80,
//! if you add a new platform entry to this enum, you must add it to allplatforms as well otherwise that platform would not be considered valid. //! if you add a new platform entry to this enum, you must add it to allplatforms as well otherwise that platform would not be considered valid.
AllPlatforms = Platform_PC | Platform_ES3 | Platform_IOS | Platform_OSX | Platform_PROVO | Platform_SALEM | Platform_JASPER AllPlatforms = Platform_PC | Platform_ANDROID | Platform_IOS | Platform_MAC | Platform_PROVO | Platform_SALEM | Platform_JASPER
}; };
#endif // defined(ENABLE_LEGACY_PLATFORMFLAGS_SUPPORT) #endif // defined(ENABLE_LEGACY_PLATFORMFLAGS_SUPPORT)
//! Map data structure to holder parameters that are passed into a job for ProcessJob requests. //! Map data structure to holder parameters that are passed into a job for ProcessJob requests.
@ -503,7 +503,7 @@ namespace AssetBuilderSDK
AZ_CLASS_ALLOCATOR(PlatformInfo, AZ::SystemAllocator, 0); AZ_CLASS_ALLOCATOR(PlatformInfo, AZ::SystemAllocator, 0);
AZ_TYPE_INFO(PlatformInfo, "{F7DA39A5-C319-4552-954B-3479E2454D3F}"); AZ_TYPE_INFO(PlatformInfo, "{F7DA39A5-C319-4552-954B-3479E2454D3F}");
AZStd::string m_identifier; ///< like "pc" or "es3" or "ios"... AZStd::string m_identifier; ///< like "pc" or "android" or "ios"...
AZStd::unordered_set<AZStd::string> m_tags; ///< The tags like "console" or "tools" on that platform AZStd::unordered_set<AZStd::string> m_tags; ///< The tags like "console" or "tools" on that platform
PlatformInfo() = default; PlatformInfo() = default;

@ -655,6 +655,80 @@ namespace AssetProcessor
return true; return true;
} }
bool AssetCatalog::GenerateRelativeSourcePath(
const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& rootFolder)
{
QString normalizedSourcePath = AssetUtilities::NormalizeFilePath(sourcePath.c_str());
QDir inputPath(normalizedSourcePath);
QString scanFolder;
QString relativeName;
bool validResult = false;
AZ_TracePrintf(AssetProcessor::DebugChannel, "ProcessGenerateRelativeSourcePathRequest: %s...\n", sourcePath.c_str());
if (sourcePath.empty())
{
// For an empty input path, do nothing, we'll return an empty, invalid result.
// (We check fullPath instead of inputPath, because an empty fullPath actually produces "." for inputPath)
}
else if (inputPath.isAbsolute())
{
// For an absolute path, try to convert it to a relative path, based on the existing scan folders.
// To get the inputPath, we use absolutePath() instead of path() so that any . or .. entries get collapsed.
validResult = m_platformConfig->ConvertToRelativePath(inputPath.absolutePath(), relativeName, scanFolder);
}
else if (inputPath.isRelative())
{
// For a relative path, concatenate it with each scan folder, and see if a valid relative path emerges.
int scanFolders = m_platformConfig->GetScanFolderCount();
for (int scanIdx = 0; scanIdx < scanFolders; scanIdx++)
{
auto& scanInfo = m_platformConfig->GetScanFolderAt(scanIdx);
QDir possibleRoot(scanInfo.ScanPath());
QDir possibleAbsolutePath = possibleRoot.filePath(normalizedSourcePath);
// To get the inputPath, we use absolutePath() instead of path() so that any . or .. entries get collapsed.
if (m_platformConfig->ConvertToRelativePath(possibleAbsolutePath.absolutePath(), relativeName, scanFolder))
{
validResult = true;
break;
}
}
}
// The input has produced a valid relative path. However, the path might match multiple nested scan folders,
// so look to see if a higher-priority folder has a better match.
if (validResult)
{
QString overridingFile = m_platformConfig->GetOverridingFile(relativeName, scanFolder);
if (!overridingFile.isEmpty())
{
overridingFile = AssetUtilities::NormalizeFilePath(overridingFile);
validResult = m_platformConfig->ConvertToRelativePath(overridingFile, relativeName, scanFolder);
}
}
if (!validResult)
{
// if we are here it means we have failed to determine the relativePath, so we will send back the original path
AZ_TracePrintf(AssetProcessor::DebugChannel,
"GenerateRelativeSourcePath found no valid result, returning original path: %s...\n", sourcePath.c_str());
rootFolder.clear();
relativePath.clear();
relativePath = sourcePath;
return false;
}
relativePath = relativeName.toUtf8().data();
rootFolder = scanFolder.toUtf8().data();
AZ_Assert(!relativePath.empty(), "ConvertToRelativePath returned true, but relativePath is empty");
return true;
}
bool AssetCatalog::GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullSourcePath) bool AssetCatalog::GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullSourcePath)
{ {
ProcessGetFullSourcePathFromRelativeProductPathRequest(relPath, fullSourcePath); ProcessGetFullSourcePathFromRelativeProductPathRequest(relPath, fullSourcePath);

@ -95,6 +95,12 @@ namespace AssetProcessor
const char* GetAbsoluteDevGameFolderPath() override; const char* GetAbsoluteDevGameFolderPath() override;
const char* GetAbsoluteDevRootFolderPath() override; const char* GetAbsoluteDevRootFolderPath() override;
bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& relativeProductPath) override; bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& relativeProductPath) override;
//! Given a partial or full source file path, respond with its relative path and the watch folder it is relative to.
//! The input source path does not need to exist, so this can be used for new files that haven't been saved yet.
bool GenerateRelativeSourcePath(
const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& watchFolder) override;
bool GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullSourcePath) override; bool GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullSourcePath) override;
bool GetAssetInfoById(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath) override; bool GetAssetInfoById(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath) override;
bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override; bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override;

@ -104,6 +104,27 @@ namespace
return GetRelativeProductPathFromFullSourceOrProductPathResponse(relPathFound, relProductPath); return GetRelativeProductPathFromFullSourceOrProductPathResponse(relPathFound, relProductPath);
} }
GenerateRelativeSourcePathResponse HandleGenerateRelativeSourcePathRequest(
MessageData<GenerateRelativeSourcePathRequest> messageData)
{
bool relPathFound = false;
AZStd::string relPath;
AZStd::string watchFolder;
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
relPathFound, &AzToolsFramework::AssetSystemRequestBus::Events::GenerateRelativeSourcePath,
messageData.m_message->m_sourcePath, relPath, watchFolder);
if (!relPathFound)
{
AZ_TracePrintf(
AssetProcessor::ConsoleChannel, "Could not find relative source path for the source file (%s).",
messageData.m_message->m_sourcePath.c_str());
}
return GenerateRelativeSourcePathResponse(relPathFound, relPath, watchFolder);
}
SourceAssetInfoResponse HandleSourceAssetInfoRequest(MessageData<SourceAssetInfoRequest> messageData) SourceAssetInfoResponse HandleSourceAssetInfoRequest(MessageData<SourceAssetInfoRequest> messageData)
{ {
SourceAssetInfoResponse response; SourceAssetInfoResponse response;
@ -407,6 +428,7 @@ AssetRequestHandler::AssetRequestHandler()
m_requestRouter.RegisterMessageHandler(&HandleGetFullSourcePathFromRelativeProductPathRequest); m_requestRouter.RegisterMessageHandler(&HandleGetFullSourcePathFromRelativeProductPathRequest);
m_requestRouter.RegisterMessageHandler(&HandleGetRelativeProductPathFromFullSourceOrProductPathRequest); m_requestRouter.RegisterMessageHandler(&HandleGetRelativeProductPathFromFullSourceOrProductPathRequest);
m_requestRouter.RegisterMessageHandler(&HandleGenerateRelativeSourcePathRequest);
m_requestRouter.RegisterMessageHandler(&HandleSourceAssetInfoRequest); m_requestRouter.RegisterMessageHandler(&HandleSourceAssetInfoRequest);
m_requestRouter.RegisterMessageHandler(&HandleSourceAssetProductsInfoRequest); m_requestRouter.RegisterMessageHandler(&HandleSourceAssetProductsInfoRequest);
m_requestRouter.RegisterMessageHandler(&HandleGetScanFoldersRequest); m_requestRouter.RegisterMessageHandler(&HandleGetScanFoldersRequest);

@ -57,6 +57,9 @@ namespace AzFramework
class GetRelativeProductPathFromFullSourceOrProductPathRequest; class GetRelativeProductPathFromFullSourceOrProductPathRequest;
class GetRelativeProductPathFromFullSourceOrProductPathResponse; class GetRelativeProductPathFromFullSourceOrProductPathResponse;
class GenerateRelativeSourcePathRequest;
class GenerateRelativeSourcePathResponse;
class GetFullSourcePathFromRelativeProductPathRequest; class GetFullSourcePathFromRelativeProductPathRequest;
class GetFullSourcePathFromRelativeProductPathResponse; class GetFullSourcePathFromRelativeProductPathResponse;
class AssetNotificationMessage; class AssetNotificationMessage;
@ -104,6 +107,8 @@ namespace AssetProcessor
using GetAbsoluteAssetDatabaseLocationResponse = AzToolsFramework::AssetSystem::GetAbsoluteAssetDatabaseLocationResponse; using GetAbsoluteAssetDatabaseLocationResponse = AzToolsFramework::AssetSystem::GetAbsoluteAssetDatabaseLocationResponse;
using GetRelativeProductPathFromFullSourceOrProductPathRequest = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathRequest; using GetRelativeProductPathFromFullSourceOrProductPathRequest = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathRequest;
using GetRelativeProductPathFromFullSourceOrProductPathResponse = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathResponse; using GetRelativeProductPathFromFullSourceOrProductPathResponse = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathResponse;
using GenerateRelativeSourcePathRequest = AzFramework::AssetSystem::GenerateRelativeSourcePathRequest;
using GenerateRelativeSourcePathResponse = AzFramework::AssetSystem::GenerateRelativeSourcePathResponse;
using GetFullSourcePathFromRelativeProductPathRequest = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathRequest; using GetFullSourcePathFromRelativeProductPathRequest = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathRequest;
using GetFullSourcePathFromRelativeProductPathResponse = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathResponse; using GetFullSourcePathFromRelativeProductPathResponse = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathResponse;

@ -291,7 +291,6 @@ namespace AssetProcessor
} }
} }
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(registry);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_EngineRegistry(registry, platform, specialization, &scratchBuffer); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_EngineRegistry(registry, platform, specialization, &scratchBuffer);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_GemRegistries(registry, platform, specialization, &scratchBuffer); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_GemRegistries(registry, platform, specialization, &scratchBuffer);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectRegistry(registry, platform, specialization, &scratchBuffer); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectRegistry(registry, platform, specialization, &scratchBuffer);

@ -130,6 +130,9 @@ namespace AssetProcessor
auto cacheRootKey = auto cacheRootKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_cache_path"; AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_cache_path";
settingsRegistry->Set(cacheRootKey, m_data->m_temporarySourceDir.absoluteFilePath("Cache").toUtf8().constData()); settingsRegistry->Set(cacheRootKey, m_data->m_temporarySourceDir.absoluteFilePath("Cache").toUtf8().constData());
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
settingsRegistry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*settingsRegistry); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*settingsRegistry);
AssetUtilities::ComputeProjectCacheRoot(m_data->m_cacheRootDir); AssetUtilities::ComputeProjectCacheRoot(m_data->m_cacheRootDir);
QString normalizedCacheRoot = AssetUtilities::NormalizeDirectoryPath(m_data->m_cacheRootDir.absolutePath()); QString normalizedCacheRoot = AssetUtilities::NormalizeDirectoryPath(m_data->m_cacheRootDir.absolutePath());
@ -221,20 +224,28 @@ namespace AssetProcessor
dbConn->SetScanFolder(newScanFolder); dbConn->SetScanFolder(newScanFolder);
} }
// build some default configs. virtual void AddScanFolders(
void BuildConfig(const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config) const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config,
const AZStd::vector<AssetBuilderSDK::PlatformInfo>& platforms)
{ {
config.EnablePlatform({ "pc" ,{ "desktop", "renderer" } }, true);
config.EnablePlatform({ "es3" ,{ "mobile", "renderer" } }, true);
config.EnablePlatform({ "fandango" ,{ "console", "renderer" } }, false);
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
// PATH DisplayName PortKey root recurse platforms order // PATH DisplayName PortKey root recurse platforms order
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3 AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2 AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1 AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0), config, dbConn); // add the root AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0), config, dbConn); // add the root
}
// build some default configs.
void BuildConfig(const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config)
{
config.EnablePlatform({ "pc" ,{ "desktop", "renderer" } }, true);
config.EnablePlatform({ "android" ,{ "mobile", "renderer" } }, true);
config.EnablePlatform({ "fandango" ,{ "console", "renderer" } }, false);
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
config.PopulatePlatformsForScanFolder(platforms);
AddScanFolders(tempPath, dbConn, config, platforms);
config.AddMetaDataType("exportsettings", QString()); config.AddMetaDataType("exportsettings", QString());
@ -243,22 +254,22 @@ namespace AssetProcessor
AssetRecognizer rec; AssetRecognizer rec;
AssetPlatformSpec specpc; AssetPlatformSpec specpc;
AssetPlatformSpec speces3; AssetPlatformSpec specandroid;
speces3.m_extraRCParams = "somerandomparam"; specandroid.m_extraRCParams = "somerandomparam";
rec.m_name = "random files"; rec.m_name = "random files";
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.random", AssetBuilderSDK::AssetBuilderPattern::Wildcard); rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.random", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
rec.m_platformSpecs.insert("pc", specpc); rec.m_platformSpecs.insert("pc", specpc);
config.AddRecognizer(rec); config.AddRecognizer(rec);
specpc.m_extraRCParams = ""; // blank must work specpc.m_extraRCParams = ""; // blank must work
speces3.m_extraRCParams = "testextraparams"; specandroid.m_extraRCParams = "testextraparams";
const char* builderTxt1Name = "txt files"; const char* builderTxt1Name = "txt files";
rec.m_name = builderTxt1Name; rec.m_name = builderTxt1Name;
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.txt", AssetBuilderSDK::AssetBuilderPattern::Wildcard); rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.txt", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
rec.m_platformSpecs.insert("pc", specpc); rec.m_platformSpecs.insert("pc", specpc);
rec.m_platformSpecs.insert("es3", speces3); rec.m_platformSpecs.insert("android", specandroid);
config.AddRecognizer(rec); config.AddRecognizer(rec);
@ -269,7 +280,7 @@ namespace AssetProcessor
ignore_rec.m_name = "ignore files"; ignore_rec.m_name = "ignore files";
ignore_rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.ignore", AssetBuilderSDK::AssetBuilderPattern::Wildcard); ignore_rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.ignore", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
ignore_rec.m_platformSpecs.insert("pc", specpc); ignore_rec.m_platformSpecs.insert("pc", specpc);
ignore_rec.m_platformSpecs.insert("es3", ignore_spec); ignore_rec.m_platformSpecs.insert("android", ignore_spec);
config.AddRecognizer(ignore_rec); config.AddRecognizer(ignore_rec);
ExcludeAssetRecognizer excludeRecogniser; ExcludeAssetRecognizer excludeRecogniser;
@ -356,7 +367,8 @@ namespace AssetProcessor
return false; return false;
} }
// Calls the GetFullSourcePathFromRelativeProductPath function and checks the return results, returning true if it matches both of the expected results // Calls the GetFullSourcePathFromRelativeProductPath function and checks the return results, returning true if it matches both of
// the expected results
bool TestGetFullSourcePath(const QString& fileToCheck, const QDir& tempPath, bool expectToFind, const char* expectedPath) bool TestGetFullSourcePath(const QString& fileToCheck, const QDir& tempPath, bool expectToFind, const char* expectedPath)
{ {
bool fullPathfound = false; bool fullPathfound = false;
@ -528,6 +540,177 @@ namespace AssetProcessor
ASSERT_TRUE(TestGetRelativeProductPath(fileToCheck, true, { "aaa/basefile.txt" })); ASSERT_TRUE(TestGetRelativeProductPath(fileToCheck, true, { "aaa/basefile.txt" }));
} }
class AssetCatalogTestRelativeSourcePath : public AssetCatalogTest
{
public:
QDir GetRoot()
{
// Return an OS-friendly absolute root directory for our tests ("C:/sourceRoot" or "/sourceRoot"). It doesn't
// need to exist, it just needs to be an absolute path.
return QDir::root().filePath("sourceRoot");
}
// Set up custom scan folders for the "relative source path" tests, so that we can try out specific combinations of watch folders
void AddScanFolders(
[[maybe_unused]] const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config,
const AZStd::vector<AssetBuilderSDK::PlatformInfo>& platforms) override
{
QDir root = GetRoot();
// This will set up the following watch folders, in highest to lowest priority:
// /sourceRoot/recurseNested/nested (recurse)
// /sourceRoot/noRecurse (no recurse)
// /sourceRoot/recurseNotNested (recurse)
// /sourceRoot/recurseNested (recurse)
AddScanFolder(
ScanFolderInfo(root.filePath("recurseNested/nested"), "nested", "nested", false, true, platforms, -4), config, dbConn);
AddScanFolder(
ScanFolderInfo(root.filePath("noRecurse"), "noRecurse", "noRecurse", false, false, platforms, -3), config, dbConn);
AddScanFolder(
ScanFolderInfo(root.filePath("recurseNotNested"), "recurseNotNested", "recurseNotNested", false, true, platforms, -2),
config, dbConn);
AddScanFolder(
ScanFolderInfo(root.filePath("recurseNested"), "recurseNested", "recurseNested", false, true, platforms, -1),
config, dbConn);
}
// Calls the GenerateRelativeSourcePath function and validates that the results match the expected inputs.
void TestGetRelativeSourcePath(
const AZStd::string& sourcePath, bool expectedToFind, const AZStd::string& expectedPath, const AZStd::string& expectedRoot)
{
bool relPathFound = false;
AZStd::string relPath;
AZStd::string rootFolder;
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
relPathFound, &AzToolsFramework::AssetSystem::AssetSystemRequest::GenerateRelativeSourcePath, sourcePath,
relPath, rootFolder);
EXPECT_EQ(relPathFound, expectedToFind);
EXPECT_EQ(relPath, expectedPath);
EXPECT_EQ(rootFolder, expectedRoot);
}
};
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_EmptySourcePath_ReturnsNoMatch)
{
// Test passes in an empty source path, which shouldn't produce a valid result.
// Input: empty source path
// Output: empty, not found result
TestGetRelativeSourcePath("", false, "", "");
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_AbsolutePathOutsideWatchFolders_ReturnsNoMatch)
{
// Test passes in an invalid absolute source path, which shouldn't produce a valid result.
// Input: "/sourceRoot/noWatchFolder/test.txt"
// Output: not found result, which also returns the input as the relative file name
QDir watchFolder = GetRoot().filePath("noWatchFolder/");
QString fileToCheck = watchFolder.filePath("test.txt");
TestGetRelativeSourcePath(fileToCheck.toUtf8().constData(), false, fileToCheck.toUtf8().constData(), "");
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_AbsolutePathUnderWatchFolder_ReturnsRelativePath)
{
// Test passes in a valid absolute source path, which should produce a valid relative path
// Input: "/sourceRoot/noRecurse/test.txt"
// Output: "test.txt" in folder "/sourceRoot/noRecurse/"
QDir watchFolder = GetRoot().filePath("noRecurse/");
QString fileToCheck = watchFolder.filePath("test.txt");
TestGetRelativeSourcePath(fileToCheck.toUtf8().constData(), true, "test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_AbsolutePathUnderNestedWatchFolders_ReturnsRelativePath)
{
// Test passes in a valid absolute source path that matches a watch folder and a nested watch folder.
// The output relative path should match the nested folder, because the nested folder has a higher priority registered with the AP.
// Input: "/sourceRoot/recurseNested/nested/test.txt"
// Output: "test.txt" in folder "/sourceRoot/recurseNested/nested/"
QDir watchFolder = GetRoot().filePath("recurseNested/nested/");
QString fileToCheck = watchFolder.filePath("test.txt");
TestGetRelativeSourcePath(fileToCheck.toUtf8().constData(), true, "test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_BareFileNameValidInWatchFolder_ReturnsHighestPriorityWatchFolder)
{
// Test passes in a simple file name. The output should be relative to the highest-priority watch folder.
// Input: "test.txt"
// Output: "test.txt" in folder "/sourceRoot/recurseNested/nested/"
QDir watchFolder = GetRoot().filePath("recurseNested/nested/");
TestGetRelativeSourcePath("test.txt", true, "test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathValidInWatchFolder_ReturnsHighestPriorityWatchFolder)
{
// Test passes in a relative path. The output should preserve the relative path, but list it as relative to the highest-priority
// watch folder.
// Input: "a/b/c/test.txt"
// Output: "a/b/c/test.txt" in folder "/sourceRoot/recurseNested/nested/"
QDir watchFolder = GetRoot().filePath("recurseNested/nested/");
TestGetRelativeSourcePath("a/b/c/test.txt", true, "a/b/c/test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathNotInWatchFolder_ReturnsNoMatch)
{
// Test passes in a relative path that "backs up" two directories. This will be invalid, because no matter which watch directory
// we start at, the result will be outside of any watch directory.
// Input: "../../test.txt"
// Output: not found result, which also returns the input as the relative file name
TestGetRelativeSourcePath("../../test.txt", false, "../../test.txt", "");
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathValidFromNestedWatchFolder_ReturnsOuterFolder)
{
// Test passes in a relative path that "backs up" one directory. This will produce a valid result, because we can back up from
// the "recurseNested/nested/" watch folder to "recurseNested", which is also a valid watch folder.
// Input: "../test.txt"
// Output: "test.txt" in folder "/sourceRoot/recurseNested"
QDir watchFolder = GetRoot().filePath("recurseNested/");
TestGetRelativeSourcePath("../test.txt", true, "test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathMovesToParentWatchFolder_ReturnsOuterFolder)
{
// Test passes in a relative path that backs up one directory and then forward into a directory. This will produce a valid
// result, because it can validly start in the highest-priority watch folder (recurseNested/nested), move back one into the
// outer watch folder (recurseNested), and then have a subdirectory within it.
// Note that it would also be valid to move from recurseNested to recurseNotNested, but that won't be the result of this test
// because that's a lower-priority match.
// Input: "../recurseNotNested/test.txt"
// Output: "recurseNotNested/test.txt" in folder "/sourceRoot/recurseNested/"
QDir watchFolder = GetRoot().filePath("recurseNested/");
TestGetRelativeSourcePath("../recurseNotNested/test.txt", true, "recurseNotNested/test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathMovesToSiblingWatchFolder_ReturnsSiblingFolder)
{
// Test passes in a relative path that backs up two directories and then forward into a directory. This will produce a valid
// result, because it can validly start in the recurseNested/nested folder, move back two folders, then forward into the sibling
// recurseNotNested folder. The result will be a relative path to the sibling folder.
// Input: "../../recurseNotNested/test.txt"
// Output: "test.txt" in folder "/sourceRoot/recurseNotNested/"
QDir watchFolder = GetRoot().filePath("recurseNotNested/");
TestGetRelativeSourcePath("../../recurseNotNested/test.txt", true, "test.txt", watchFolder.path().toUtf8().constData());
}
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathBacksOutOfWatchFolder_ReturnsNoMatch)
{
// Test passes in a relative path that adds a directory, then "backs up" three directories. This will be invalid, because no
// matter which watch directory we start at, the result will be outside of any watch directory.
// Input: "../test.txt"
// Output: "test.txt" in folder "/sourceRoot/recurseNested"
TestGetRelativeSourcePath("a/../../../test.txt", false, "a/../../../test.txt", "");
}
class AssetCatalogTest_GetFullSourcePath class AssetCatalogTest_GetFullSourcePath
: public AssetCatalogTest : public AssetCatalogTest
{ {
@ -909,7 +1092,7 @@ namespace AssetProcessor
{ {
AssetCatalogTest::SetUp(); AssetCatalogTest::SetUp();
m_platforms.push_back("pc"); m_platforms.push_back("pc");
m_platforms.push_back("es3"); m_platforms.push_back("android");
// 4 products for one platform, 1 product for the other. // 4 products for one platform, 1 product for the other.
m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefilez.arc2"); m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefilez.arc2");
@ -917,7 +1100,7 @@ namespace AssetProcessor
m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefile.arc2"); m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefile.arc2");
m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefile.azm2"); m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefile.azm2");
m_platformToProductsForSourceWithDifferentProducts["es3"].push_back("subfolder3/es3exclusivefile.azm2"); m_platformToProductsForSourceWithDifferentProducts["android"].push_back("subfolder3/androidexclusivefile.azm2");
m_sourceFileWithDifferentProductsPerPlatform = AZ::Uuid::CreateString("{38032FC9-2838-4D6A-9DA0-79E5E4F20C1B}"); m_sourceFileWithDifferentProductsPerPlatform = AZ::Uuid::CreateString("{38032FC9-2838-4D6A-9DA0-79E5E4F20C1B}");
m_sourceFileWithDependency = AZ::Uuid::CreateString("{807C4174-1D19-42AD-B8BC-A59291D9388C}"); m_sourceFileWithDependency = AZ::Uuid::CreateString("{807C4174-1D19-42AD-B8BC-A59291D9388C}");
@ -930,7 +1113,7 @@ namespace AssetProcessor
// resulting in image processing jobs having different products per platform. Because of this, the material jobs will then have different // resulting in image processing jobs having different products per platform. Because of this, the material jobs will then have different
// dependencies per platform, because each material will depend on a referenced texture and all of that texture's mipmaps. // dependencies per platform, because each material will depend on a referenced texture and all of that texture's mipmaps.
// Add a source file with 4 products on pc, but 1 on es3 // Add a source file with 4 products on pc, but 1 on android
bool result = AddSourceAndJobForMultiplePlatforms( bool result = AddSourceAndJobForMultiplePlatforms(
"subfolder3", "subfolder3",
"MultiplatformFile.txt", "MultiplatformFile.txt",
@ -945,7 +1128,7 @@ namespace AssetProcessor
result = AddSourceAndJobForMultiplePlatforms("subfolder3", "FileWithDependency.txt", &(m_data->m_dbConn), sourceFileWithSameProductsJobsPerPlatform, m_platforms, m_sourceFileWithDependency); result = AddSourceAndJobForMultiplePlatforms("subfolder3", "FileWithDependency.txt", &(m_data->m_dbConn), sourceFileWithSameProductsJobsPerPlatform, m_platforms, m_sourceFileWithDependency);
EXPECT_TRUE(result); EXPECT_TRUE(result);
const AZStd::string fileWithDependencyProductPath = "subfolder3/es3exclusivefile.azm2"; const AZStd::string fileWithDependencyProductPath = "subfolder3/androidexclusivefile.azm2";
for (const AZStd::string& platform : m_platforms) for (const AZStd::string& platform : m_platforms)
{ {

@ -265,6 +265,9 @@ namespace AssetProcessorMessagesTests
addPairFunc(new GetFullSourcePathFromRelativeProductPathRequest(), new GetFullSourcePathFromRelativeProductPathResponse()); addPairFunc(new GetFullSourcePathFromRelativeProductPathRequest(), new GetFullSourcePathFromRelativeProductPathResponse());
addPairFunc(new GetRelativeProductPathFromFullSourceOrProductPathRequest(), new GetRelativeProductPathFromFullSourceOrProductPathResponse()); addPairFunc(new GetRelativeProductPathFromFullSourceOrProductPathRequest(), new GetRelativeProductPathFromFullSourceOrProductPathResponse());
addPairFunc(
new GenerateRelativeSourcePathRequest(),
new GenerateRelativeSourcePathResponse());
addPairFunc(new SourceAssetInfoRequest(), new SourceAssetInfoResponse()); addPairFunc(new SourceAssetInfoRequest(), new SourceAssetInfoResponse());
addPairFunc(new SourceAssetProductsInfoRequest(), new SourceAssetProductsInfoResponse()); addPairFunc(new SourceAssetProductsInfoRequest(), new SourceAssetProductsInfoResponse());
addPairFunc(new GetScanFoldersRequest(), new GetScanFoldersResponse()); addPairFunc(new GetScanFoldersRequest(), new GetScanFoldersResponse());

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

Loading…
Cancel
Save