diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py
index 2583109573..382a6f27f7 100644
--- a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py
+++ b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py
@@ -6,13 +6,13 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
import logging
import os
-import tempfile
+import psutil
import ly_test_tools.log.log_monitor
import ly_test_tools.environment.process_utils as process_utils
import ly_test_tools.environment.waiter as waiter
-from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
from ly_remote_console.remote_console_commands import send_command_and_expect_response as send_command_and_expect_response
+
logger = logging.getLogger(__name__)
@@ -95,7 +95,7 @@ def launch_and_validate_results_launcher(launcher, level, remote_console_instanc
return port_listening
if null_renderer:
- launcher.args.extend(["-NullRenderer"])
+ launcher.args.extend(["-rhi=Null"])
# Start the Launcher
with launcher.start():
@@ -110,8 +110,8 @@ def launch_and_validate_results_launcher(launcher, level, remote_console_instanc
# Load the specified level in the launcher
send_command_and_expect_response(remote_console_instance,
- f"map {level}",
- "LEVEL_LOAD_COMPLETE", timeout=30)
+ f"LoadLevel {level}",
+ "LEVEL_LOAD_END", timeout=30)
# Monitor the console for expected lines
for line in expected_lines:
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py
index bbdb925585..2fac361ced 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py
@@ -36,8 +36,8 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
:return: None
"""
- PREPROCESS_INSTANCE_COUNT = 24
- POSTPROCESS_INSTANCE_COUNT = 18
+ PREPROCESS_INSTANCE_COUNT = 44
+ POSTPROCESS_INSTANCE_COUNT = 34
# Create empty level
self.test_success = self.create_level(
@@ -62,25 +62,7 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
dynveg.create_surface_entity("Surface_Entity_Parent", position, 16.0, 16.0, 1.0)
# Add entity with Mesh to replicate creation of hills
- hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 40.0, 40.0, 40.0)
-
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
-
- # Increase Box Shape size to encompass the hills
- vegetation.get_set_test(1, "Box Shape|Box Configuration|Dimensions", math.Vector3(100.0, 100.0, 100.0))
+ hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 10.0)
# Set a Min Altitude of 38 and Max of 40 in Vegetation Altitude Filter
vegetation.get_set_test(3, "Configuration|Altitude Min", 38.0)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py
index 4b0951acaf..6a99979a1f 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py
@@ -9,9 +9,10 @@ import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import azlmbr.asset as asset
+import azlmbr.components as components
import azlmbr.legacy.general as general
import azlmbr.bus as bus
-import azlmbr.entity as EntityId
+import azlmbr.entity as entity
import azlmbr.editor as editor
import azlmbr.math as math
import azlmbr.paths
@@ -83,18 +84,12 @@ class TestDynamicSliceInstanceSpawnerEmbeddedEditor(EditorTestHelper):
self.log(f"Expected {num_expected_instances} instances - Found {num_found} instances")
self.test_success = self.test_success and num_found == num_expected_instances
- # 5) Create a new entity with a Camera component for testing in the launcher
+ # 5) Move the default Camera entity for testing in the launcher
cam_position = math.Vector3(512.0, 500.0, 35.0)
- camera_component = ["Camera"]
- new_entity_id2 = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", cam_position, EntityId.EntityId()
- )
- if new_entity_id2.IsValid():
- self.log("Camera entity created")
- camera_entity = hydra.Entity("Camera Entity", new_entity_id2)
- camera_entity.components = []
- for component in camera_component:
- camera_entity.components.append(hydra.add_component(component, new_entity_id2))
+ search_filter = entity.SearchFilter()
+ search_filter.names = ["Camera"]
+ search_entity_ids = entity.SearchBus(bus.Broadcast, 'SearchEntities', search_filter)
+ components.TransformBus(bus.Event, "MoveEntity", search_entity_ids[0], cam_position)
# 6) Save and export to engine
general.save_level()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py
index 892549d414..70030ff359 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py
@@ -11,7 +11,8 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import azlmbr.legacy.general as general
import azlmbr.asset as asset
import azlmbr.bus as bus
-import azlmbr.entity as EntityId
+import azlmbr.components as components
+import azlmbr.entity as entity
import azlmbr.editor as editor
import azlmbr.math as math
import azlmbr.paths
@@ -68,7 +69,7 @@ class TestDynamicSliceInstanceSpawnerExternalEditor(EditorTestHelper):
veg_area_required_components = ["Vegetation Layer Spawner", "Box Shape", "Vegetation Asset List",
"Script Canvas"]
new_entity_id = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
+ bus.Broadcast, "CreateNewEntityAtPosition", entity_position, entity.EntityId()
)
if new_entity_id.IsValid():
self.log("Spawner entity created")
@@ -106,18 +107,12 @@ class TestDynamicSliceInstanceSpawnerExternalEditor(EditorTestHelper):
self.log(f"Expected {num_expected_instances} instances - Found {num_found} instances")
self.test_success = self.test_success and num_found == num_expected_instances
- # 5) Create a new entity with a Camera component for testing in the launcher
- entity_position = math.Vector3(512.0, 500.0, 35.0)
- camera_component = ["Camera"]
- new_entity_id2 = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
- )
- if new_entity_id2.IsValid():
- self.log("Camera entity created")
- camera_entity = hydra.Entity("Camera Entity", new_entity_id2)
- camera_entity.components = []
- for component in camera_component:
- camera_entity.components.append(hydra.add_component(component, new_entity_id2))
+ # 5) Move the default Camera entity for testing in the launcher
+ cam_position = math.Vector3(512.0, 500.0, 35.0)
+ search_filter = entity.SearchFilter()
+ search_filter.names = ["Camera"]
+ search_entity_ids = entity.SearchBus(bus.Broadcast, 'SearchEntities', search_filter)
+ components.TransformBus(bus.Event, "MoveEntity", search_entity_ids[0], cam_position)
# 6) Save and export to engine
general.save_level()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py
index c4dfbbf4fe..3543b4c23c 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py
@@ -18,9 +18,9 @@ import azlmbr.areasystem as areasystem
import azlmbr.legacy.general as general
import azlmbr
import azlmbr.bus as bus
-import azlmbr.editor as editor
+import azlmbr.components as components
import azlmbr.math as math
-import azlmbr.entity as EntityId
+import azlmbr.entity as entity
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
@@ -134,20 +134,14 @@ class TestVegLayerBlenderCreated(EditorTestHelper):
purple_count += 1
self.test_success = pink_count == purple_count and (pink_count + purple_count == num_expected) and self.test_success
- # 5) Create a new entity with a Camera component for testing in the launcher
- entity_position = math.Vector3(500.0, 500.0, 47.0)
- rot_degrees_vector = math.Vector3(radians(-55.0), radians(28.5), radians(-17.0))
- camera_component = ["Camera"]
- camera_id = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
- )
- if camera_id.IsValid():
- self.log("Camera entity created")
- camera_entity = hydra.Entity("Camera Entity", camera_id)
- camera_entity.components = []
- for component in camera_component:
- camera_entity.components.append(hydra.add_component(component, camera_id))
- azlmbr.components.TransformBus(bus.Event, "SetLocalRotation", camera_id, rot_degrees_vector)
+ # 5) Move the default Camera entity for testing in the launcher
+ cam_position = math.Vector3(500.0, 500.0, 47.0)
+ cam_rot_degrees_vector = math.Vector3(radians(-55.0), radians(28.5), radians(-17.0))
+ search_filter = entity.SearchFilter()
+ search_filter.names = ["Camera"]
+ search_entity_ids = entity.SearchBus(bus.Broadcast, 'SearchEntities', search_filter)
+ components.TransformBus(bus.Event, "MoveEntity", search_entity_ids[0], cam_position)
+ azlmbr.components.TransformBus(bus.Event, "SetLocalRotation", search_entity_ids[0], cam_rot_degrees_vector)
# 6) Save and export level
general.save_level()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py
index 0224f6bc0a..fb1ac5a5ce 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py
@@ -34,8 +34,8 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
:return: None
"""
- PREPROCESS_INSTANCE_COUNT = 425
- POSTPROCESS_INSTANCE_COUNT = 430
+ PREPROCESS_INSTANCE_COUNT = 21
+ POSTPROCESS_INSTANCE_COUNT = 19
# Create empty level
self.test_success = self.create_level(
@@ -56,7 +56,6 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
vegetation_entity.add_component("Vegetation Altitude Filter")
vegetation_entity.add_component("Vegetation Position Modifier")
-
# Create a child entity under vegetation area
child_entity = hydra.Entity("child_entity")
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
@@ -66,29 +65,13 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
vegetation_entity.get_set_test(4, "Configuration|Position X|Gradient|Gradient Entity Id", child_entity.id)
vegetation_entity.get_set_test(4, "Configuration|Position Y|Gradient|Gradient Entity Id", child_entity.id)
-
# Set the min and max values for Altitude Filter
- vegetation_entity.get_set_test(3, "Configuration|Altitude Min", 32.0)
- vegetation_entity.get_set_test(3, "Configuration|Altitude Max", 35.0)
+ vegetation_entity.get_set_test(3, "Configuration|Altitude Min", 34.0)
+ vegetation_entity.get_set_test(3, "Configuration|Altitude Max", 38.0)
# Add entity with Mesh to replicate creation of hills and a flat surface to plant on
dynveg.create_surface_entity("Flat Surface", position, 32.0, 32.0, 1.0)
- hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 4.0, 4.0, 4.0)
-
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
+ hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 4.0)
# Set the filter stage to preprocess and postprocess respectively and verify instance count
vegetation_entity.get_set_test(0, "Configuration|Filter Stage", 1)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py
index c99d180253..4752aeddbc 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py
@@ -13,7 +13,7 @@ import azlmbr.legacy.general as general
import azlmbr.math as math
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
-from automatedtesting_shared.editor_test_helper import EditorTestHelper
+from editor_python_test_tools.editor_test_helper import EditorTestHelper
from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py
index d23f811f58..89367ca475 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py
@@ -82,22 +82,7 @@ class test_MeshBlocker_InstancesBlockedByMesh(EditorTestHelper):
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "_primitives", "_box_1x1.azmodel"), math.Uuid(),
False)
blocker_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", cubeId)
- components.TransformBus(bus.Event, "SetLocalScale", blocker_entity.id, math.Vector3(2.0, 2.0, 2.0))
-
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
+ components.TransformBus(bus.Event, "SetLocalUniformScale", blocker_entity.id, 2.0)
# Verify spawned instance counts are accurate after addition of Blocker Entity
num_expected = 160 # Number of "PurpleFlower"s that plant on a 10 x 10 surface minus 2m blocker cube
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py
index ad57f80776..4a3edcd0e9 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py
@@ -88,24 +88,9 @@ class test_MeshBlocker_InstancesBlockedByMeshHeightTuning(EditorTestHelper):
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "_primitives", "_box_1x1.azmodel"), math.Uuid(),
False)
blocker_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", sphere_id)
- components.TransformBus(bus.Event, "SetLocalScale", blocker_entity.id, math.Vector3(5.0, 5.0, 5.0))
+ components.TransformBus(bus.Event, "SetLocalUniformScale", blocker_entity.id, 5.0)
components.TransformBus(bus.Event, "SetLocalRotation", blocker_entity.id, math.Vector3(0.0, y_rotation, 0.0))
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
-
# 5) Adjust the height Max percentage values of blocker
blocker_entity.get_set_test(0, "Configuration|Mesh Height Percent Max", 0.8)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py
index 053c4ccbfd..eb74a5a144 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py
@@ -90,7 +90,6 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows'])
- @pytest.mark.skip # ATOM-14703
def test_DynamicSliceInstanceSpawner_Embedded_E2E_Launcher(self, workspace, launcher, level,
remote_console_instance, project, launcher_platform):
@@ -126,7 +125,6 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows'])
- @pytest.mark.skip # ATOM-14703
def test_DynamicSliceInstanceSpawner_External_E2E_Launcher(self, workspace, launcher, level,
remote_console_instance, project, launcher_platform):
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py
index 3c16420a30..2620a7d50a 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py
@@ -68,7 +68,6 @@ class TestLayerBlender(object):
"Entity has a Box Shape component",
"Blender Configuration|Vegetation Areas: SUCCESS",
"Blender Box Shape|Box Configuration|Dimensions: SUCCESS",
- "Camera entity created",
"LayerBlender_E2E_Editor: result=SUCCESS"
]
@@ -85,12 +84,11 @@ class TestLayerBlender(object):
@pytest.mark.BAT
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
- @pytest.mark.xfail
@pytest.mark.parametrize("launcher_platform", ['windows'])
def test_LayerBlender_E2E_Launcher(self, workspace, project, launcher, level, remote_console_instance,
launcher_platform):
- launcher.args.extend(["-NullRenderer"])
+ launcher.args.extend(["-rhi=Null"])
launcher.start()
assert launcher.is_alive(), "Launcher failed to start"
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py
index 410bdbafed..2af848ffb1 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py
@@ -121,7 +121,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C30000751")
@pytest.mark.SUITE_sandbox
@pytest.mark.dynveg_misc
- @pytest.mark.skip # ATOM-14828
+ @pytest.mark.skip # https://github.com/o3de/o3de/issues/2038
def test_LayerSpawner_InstancesRefreshUsingCorrectViewportCamera(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -136,5 +136,6 @@ class TestLayerSpawner(object):
editor,
"LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py",
expected_lines,
- cfg_args=[level]
+ cfg_args=[level],
+ null_renderer=False
)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py
index 515009cb3a..09d4746fa6 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py
@@ -34,7 +34,7 @@ def create_surface_entity(name, center_point, box_size_x, box_size_y, box_size_z
return surface_entity
-def create_mesh_surface_entity_with_slopes(name, center_point, scale_x, scale_y, scale_z):
+def create_mesh_surface_entity_with_slopes(name, center_point, uniform_scale):
# Creates an entity with the assigned mesh_asset as the specified scale and sets up as a planting surface
mesh_asset_path = os.path.join("models", "sphere.azmodel")
mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(),
@@ -47,7 +47,7 @@ def create_mesh_surface_entity_with_slopes(name, center_point, scale_x, scale_y,
if surface_entity.id.IsValid():
print(f"'{surface_entity.name}' created")
hydra.get_set_test(surface_entity, 0, "Controller|Configuration|Mesh Asset", mesh_asset)
- components.TransformBus(bus.Event, "SetLocalScale", surface_entity.id, math.Vector3(scale_x, scale_y, scale_z))
+ components.TransformBus(bus.Event, "SetLocalUniformScale", surface_entity.id, uniform_scale)
return surface_entity
diff --git a/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas b/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas
index f4ca23b882..10c40fbb9f 100644
--- a/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas
+++ b/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas
@@ -742,14 +742,14 @@
-
+
-
+
diff --git a/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas b/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas
index b9f438a4f3..ffdac5dd8c 100644
--- a/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas
+++ b/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas
@@ -1045,14 +1045,14 @@
-
+
-
+
diff --git a/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas b/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas
index 7db4f3a35c..4954eb4684 100644
--- a/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas
+++ b/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas
@@ -1085,14 +1085,14 @@
-
+
-
+
diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp
index 3f86260f8d..c2f16a84b1 100644
--- a/Code/Editor/EditorViewportWidget.cpp
+++ b/Code/Editor/EditorViewportWidget.cpp
@@ -1896,7 +1896,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
{
- CUndo undo("Move Camera");
+ AzToolsFramework::ScopedUndoBatch undo("Move Camera");
if (bMoveOnly)
{
// specify eObjectUpdateFlags_UserInput so that an undo command gets logged
@@ -1932,7 +1932,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
{
- CUndo undo("Move Camera");
+ AzToolsFramework::ScopedUndoBatch undo("Move Camera");
if (bMoveOnly)
{
AZ::TransformBus::Event(
@@ -1945,6 +1945,8 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
LYTransformToAZTransform(camMatrix));
}
+
+ AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequests::AddDirtyEntity, m_viewEntityId);
}
else
{
diff --git a/Code/Editor/Platform/Mac/gui_info.plist b/Code/Editor/Platform/Mac/gui_info.plist
index 0ec7b59e98..5b5f94e977 100644
--- a/Code/Editor/Platform/Mac/gui_info.plist
+++ b/Code/Editor/Platform/Mac/gui_info.plist
@@ -5,7 +5,7 @@
CFBundleExecutable
Editor
CFBundleIdentifier
- com.Amazon.Lumberyard.Editor
+ org.O3DE.Editor
CFBundlePackageType
APPL
CFBundleSignature
diff --git a/Code/Editor/Plugins/EditorCommon/CMakeLists.txt b/Code/Editor/Plugins/EditorCommon/CMakeLists.txt
index 96d9cce5b7..048f77cd0c 100644
--- a/Code/Editor/Plugins/EditorCommon/CMakeLists.txt
+++ b/Code/Editor/Plugins/EditorCommon/CMakeLists.txt
@@ -46,4 +46,8 @@ ly_add_target(
AZ::AzCore
AZ::AzToolsFramework
AZ::AzQtComponents
+ RUNTIME_DEPENDENCIES
+ AZ::AzCore
+ AZ::AzToolsFramework
+ AZ::AzQtComponents
)
diff --git a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp
index f4e4fed973..63ce446e97 100644
--- a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp
+++ b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp
@@ -20,12 +20,12 @@
#include "ValidationHandler.h"
#include
+#include
-#include "AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.h"
+#include
#include
#include
#include
-#include
#include
#include
@@ -52,7 +52,7 @@ namespace ProjectSettingsTool
PlatformEnabled(PlatformId::Ios) ?
ProjectSettingsContainer::PlistInitVector({
ProjectSettingsContainer::PlatformAndPath
- { PlatformId::Ios, m_projectRoot + PlatformResourcesFolder(PlatformId::Ios) }
+ { PlatformId::Ios, GetPlatformResource(PlatformId::Ios) }
})
:
ProjectSettingsContainer::PlistInitVector())
@@ -647,33 +647,38 @@ namespace ProjectSettingsTool
// iOS can be disabled if the plist file is missing
if (platformId == PlatformId::Ios)
{
- const AZStd::string filename = m_projectRoot + PlatformResourcesFolder(platformId);
- return CFileUtil::FileExists(filename.c_str());
+ AZStd::string plistPath = GetPlatformResource(platformId);
+ return !plistPath.empty();
}
return true;
}
- const char* ProjectSettingsToolWindow::PlatformResourcesFolder(PlatformId platformId)
+ AZStd::string ProjectSettingsToolWindow::GetPlatformResource(PlatformId platformId)
{
if (platformId == PlatformId::Ios)
{
- const AZStd::string firstfilename = m_projectRoot + "/Gem/Resources/Platform/iOS/Info.plist";
- if (CFileUtil::FileExists(firstfilename.c_str()))
- {
- return "/Gem/Resources/Platform/iOS/Info.plist";
- }
- else
+ const char* searchPaths[] = {
+ "Resources/Platform/iOS/Info.plist",
+
+ // legacy paths
+ "Gem/Resources/Platform/iOS/Info.plist",
+ "Gem/Resources/IOSLauncher/Info.plist",
+ };
+
+ for (auto relPath : searchPaths)
{
- const AZStd::string filename = m_projectRoot + "/Gem/Resources/IOSLauncher/Info.plist";
- if (CFileUtil::FileExists(filename.c_str()))
+ AZ::IO::FixedMaxPath projectPlist{ m_projectRoot };
+ projectPlist /= relPath;
+
+ if (AZ::IO::SystemFile::Exists(projectPlist.c_str()))
{
- return "/Gem/Resources/IOSLauncher/Info.plist";
+ return projectPlist.LexicallyNormal().String();
}
}
}
- return nullptr;
+ return AZStd::string();
}
#include
diff --git a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h
index 8979672f99..64a6646e7f 100644
--- a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h
+++ b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h
@@ -137,8 +137,8 @@ namespace ProjectSettingsTool
// returns true if the platform is enabled
bool PlatformEnabled(PlatformId platformId);
- // returns the resource folder
- const char* PlatformResourcesFolder(PlatformId platformId);
+ // returns the main platform specific resource file e.g. for iOS it would be the Info.plist
+ AZStd::string GetPlatformResource(PlatformId platformId);
// The ui for the window
QScopedPointer m_ui;
diff --git a/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp b/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp
index 46717440d5..82e230d54a 100644
--- a/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp
+++ b/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp
@@ -116,7 +116,7 @@ namespace AZ
{
const char* uuidString = nullptr;
unsigned int uuidStringLength = 0;
- if (dc.ReadArg(0, uuidString) && dc.ReadValue(1, uuidStringLength))
+ if (dc.ReadArg(0, uuidString) && dc.ReadArg(1, uuidStringLength))
{
dc.PushResult(Uuid(uuidString, uuidStringLength));
}
diff --git a/Code/Framework/AzFramework/AzFramework/Input/Buses/Requests/InputDeviceRequestBus.h b/Code/Framework/AzFramework/AzFramework/Input/Buses/Requests/InputDeviceRequestBus.h
index a1ec4a05f0..a122fe3133 100644
--- a/Code/Framework/AzFramework/AzFramework/Input/Buses/Requests/InputDeviceRequestBus.h
+++ b/Code/Framework/AzFramework/AzFramework/Input/Buses/Requests/InputDeviceRequestBus.h
@@ -205,6 +205,25 @@ namespace AzFramework
class InputDeviceImplementationRequest : public AZ::EBusTraits
{
public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ //! EBus Trait: requests can be addressed to a specific InputDeviceId so that they are only
+ //! handled by one input device that has connected to the bus using that unique id, or they
+ //! can be broadcast to all input devices that have connected to the bus, regardless of id.
+ //! Connected input devices are ordered by their local player index from lowest to highest.
+ static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ByIdAndOrdered;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ //! EBus Trait: requests should be handled by only one input device connected to each id
+ static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ //! EBus Trait: requests can be addressed to a specific InputDeviceId
+ using BusIdType = InputDeviceId;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ //! EBus Trait: requests are handled by connected devices in the order of local player index
+ using BusIdOrderCompare = AZStd::less;
+
////////////////////////////////////////////////////////////////////////////////////////////
//! Alias for the EBus implementation of this interface
using Bus = AZ::EBus>;
@@ -214,11 +233,12 @@ namespace AzFramework
using CreateFunctionType = typename InputDeviceType::Implementation*(*)(InputDeviceType&);
////////////////////////////////////////////////////////////////////////////////////////////
- //! Create a custom implementation for all the existing instances of this input device type.
+ //! Set a custom implementation for this input device type, either for a specific instance
+ //! by addressing the call to an InputDeviceId, or for all existing instances by broadcast.
//! Passing InputDeviceType::Implementation::Create as the argument will create the default
//! device implementation, while passing nullptr will delete any existing implementation.
//! \param[in] createFunction Pointer to the function that will create the implementation.
- virtual void CreateCustomImplementation(CreateFunctionType createFunction) = 0;
+ virtual void SetCustomImplementation(CreateFunctionType createFunction) = 0;
};
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -238,7 +258,7 @@ namespace AzFramework
AZ_INLINE InputDeviceImplementationRequestHandler(InputDeviceType& inputDevice)
: m_inputDevice(inputDevice)
{
- InputDeviceImplementationRequest::Bus::Handler::BusConnect();
+ InputDeviceImplementationRequest::Bus::Handler::BusConnect(m_inputDevice.GetInputDeviceId());
}
////////////////////////////////////////////////////////////////////////////////////////////
@@ -251,8 +271,8 @@ namespace AzFramework
using CreateFunctionType = typename InputDeviceType::Implementation*(*)(InputDeviceType&);
////////////////////////////////////////////////////////////////////////////////////////////
- //! \ref InputDeviceImplementationRequest::CreateCustomImplementation
- AZ_INLINE void CreateCustomImplementation(CreateFunctionType createFunction) override
+ //! \ref InputDeviceImplementationRequest::SetCustomImplementation
+ AZ_INLINE void SetCustomImplementation(CreateFunctionType createFunction) override
{
AZStd::unique_ptr newImplementation;
if (createFunction)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h
index 51aecbd8e7..6dd6b0b448 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h
@@ -63,6 +63,9 @@ namespace AzToolsFramework
//! Signal the Python handler to stop
virtual bool StopPython(bool silenceWarnings = false) = 0;
+ //! Query to determine if the Python VM has been initialized indicating an active state
+ virtual bool IsPythonActive() = 0;
+
//! Determines if the caller needs to wait for the Python VM to initialize (non-main thread only)
virtual void WaitForInitialization() {}
diff --git a/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp b/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp
index 62daba1197..911f469b2f 100644
--- a/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp
@@ -7,6 +7,8 @@
#include
#include
+#include
+#include
namespace AZ
{
@@ -31,6 +33,12 @@ namespace AZ
{
serializeContext->Class()->Version(2);
}
+
+ AZ::BehaviorContext* behaviorContext = azrtti_cast(context);
+ if (behaviorContext)
+ {
+ Events::ExportProductList::Reflect(behaviorContext);
+ }
}
} // namespace SceneCore
} // namespace SceneAPI
diff --git a/Code/Tools/SceneAPI/SceneCore/DllMain.cpp b/Code/Tools/SceneAPI/SceneCore/DllMain.cpp
index 7874ada7be..ac3c307b6c 100644
--- a/Code/Tools/SceneAPI/SceneCore/DllMain.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/DllMain.cpp
@@ -211,6 +211,7 @@ namespace AZ
AZ::SceneAPI::Containers::SceneGraph::Reflect(context);
AZ::SceneAPI::Containers::SceneManifest::Reflect(context);
AZ::SceneAPI::Containers::RuleContainer::Reflect(context);
+ AZ::SceneAPI::SceneCore::ExportingComponent::Reflect(context);
}
void Activate()
diff --git a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp
index c3a9abcbd2..798978024e 100644
--- a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp
@@ -6,6 +6,8 @@
*/
#include
+#include
+#include
namespace AZ
{
@@ -49,6 +51,45 @@ namespace AZ
return *this;
}
+ void ExportProductList::Reflect(ReflectContext* context)
+ {
+ if (auto* serializeContext = azrtti_cast(context))
+ {
+ serializeContext->Class()->Version(1);
+ serializeContext->Class()->Version(1);
+ }
+
+ if (auto* behaviorContext = azrtti_cast(context))
+ {
+ behaviorContext->Class("ExportProduct")
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Module, "scene")
+ ->Property("filename", BehaviorValueProperty(&ExportProduct::m_filename))
+ ->Property("sourceId", BehaviorValueProperty(&ExportProduct::m_id))
+ ->Property("assetType", BehaviorValueProperty(&ExportProduct::m_assetType))
+ ->Property("productDependencies", BehaviorValueProperty(&ExportProduct::m_productDependencies))
+ ->Property("subId",
+ [](ExportProduct* self) { return self->m_subId.has_value() ? self->m_subId.value() : 0; },
+ [](ExportProduct* self, u32 subId) { self->m_subId = AZStd::optional(subId); });
+
+ behaviorContext->Class("ExportProductList")
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Module, "scene")
+ ->Method("AddProduct", [](ExportProductList& self, ExportProduct& product)
+ {
+ self.AddProduct(
+ product.m_filename,
+ product.m_id,
+ product.m_assetType,
+ product.m_lod,
+ product.m_subId,
+ product.m_dependencyFlags);
+ })
+ ->Method("GetProducts", &ExportProductList::GetProducts)
+ ->Method("AddDependencyToProduct", &ExportProductList::AddDependencyToProduct);
+ }
+ }
+
ExportProduct& ExportProductList::AddProduct(const AZStd::string& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags)
{
diff --git a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h
index 38deea3f9f..a99303e08b 100644
--- a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h
+++ b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h
@@ -14,6 +14,8 @@
namespace AZ
{
+ class ReflectContext;
+
namespace SceneAPI
{
namespace Events
@@ -24,6 +26,7 @@ namespace AZ
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags = Data::ProductDependencyInfo::CreateFlags(Data::AssetLoadBehavior::NoLoad));
SCENE_CORE_API ExportProduct(AZStd::string&& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags = Data::ProductDependencyInfo::CreateFlags(Data::AssetLoadBehavior::NoLoad));
+ ExportProduct() = default;
ExportProduct(const ExportProduct& rhs) = default;
SCENE_CORE_API ExportProduct(ExportProduct&& rhs);
@@ -54,6 +57,8 @@ namespace AZ
class ExportProductList
{
public:
+ static void Reflect(ReflectContext* context);
+
SCENE_CORE_API ExportProduct& AddProduct(const AZStd::string& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags = Data::ProductDependencyInfo::CreateFlags(Data::AssetLoadBehavior::NoLoad));
SCENE_CORE_API ExportProduct& AddProduct(AZStd::string&& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
@@ -69,3 +74,9 @@ namespace AZ
} // namespace Events
} // namespace SceneAPI
} // namespace AZ
+
+namespace AZ
+{
+ AZ_TYPE_INFO_SPECIALIZE(SceneAPI::Events::ExportProduct, "{6054EDCB-4C04-4D96-BF26-704999FFB725}");
+ AZ_TYPE_INFO_SPECIALIZE(SceneAPI::Events::ExportProductList, "{1C76A51F-431B-4987-B653-CFCC940D0D0F}");
+}
diff --git a/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp b/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp
index a4b002db7d..073f357ee6 100644
--- a/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -75,15 +76,16 @@ namespace AZ
filename += s_extension;
filename += s_generated;
- AZStd::string altManifestPath = path;
+ AZStd::string altManifestFolder = path;
AzFramework::ApplicationRequests::Bus::Broadcast(
- &AzFramework::ApplicationRequests::Bus::Events::MakePathRootRelative,
- altManifestPath);
+ &AzFramework::ApplicationRequests::Bus::Events::MakePathRelative,
+ altManifestFolder,
+ AZ::Utils::GetProjectPath().c_str());
- AZ::StringFunc::Path::GetFolderPath(altManifestPath.c_str(), altManifestPath);
+ AZ::StringFunc::Path::GetFolderPath(altManifestFolder.c_str(), altManifestFolder);
AZStd::string generatedAssetInfoPath;
- AZ::StringFunc::Path::Join(assetCacheRoot.c_str(), altManifestPath.c_str(), generatedAssetInfoPath);
+ AZ::StringFunc::Path::Join(assetCacheRoot.c_str(), altManifestFolder.c_str(), generatedAssetInfoPath);
AZ::StringFunc::Path::ConstructFull(generatedAssetInfoPath.c_str(), filename.c_str(), generatedAssetInfoPath);
if (!AZ::IO::FileIOBase::GetInstance()->Exists(generatedAssetInfoPath.c_str()))
diff --git a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
index e1c72bc8b4..4e08181b83 100644
--- a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
@@ -28,710 +28,731 @@ extern "C" AZ_DLL_EXPORT void ReflectBehavior(AZ::BehaviorContext* context);
// the DLL entry point for SceneCore to reflect its serialize context
extern "C" AZ_DLL_EXPORT void ReflectTypes(AZ::SerializeContext* context);
-namespace AZ
+namespace AZ::SceneAPI::Containers
{
- namespace SceneAPI
+ class MockManifestRule : public DataTypes::IManifestObject
{
- namespace Containers
+ public:
+ AZ_RTTI(MockManifestRule, "{D6F96B48-4E6F-4EE8-A5A3-959B76F90DA8}", IManifestObject);
+ AZ_CLASS_ALLOCATOR(MockManifestRule, AZ::SystemAllocator, 0);
+
+ MockManifestRule() = default;
+
+ MockManifestRule(double value)
+ : m_value(value)
+ {
+ }
+
+ double GetValue() const
+ {
+ return m_value;
+ }
+
+ void SetValue(double value)
{
- class MockManifestRule : public DataTypes::IManifestObject
+ m_value = value;
+ }
+
+ static void Reflect(AZ::ReflectContext* context)
+ {
+ AZ::SerializeContext* serializeContext = azrtti_cast(context);
+ if (serializeContext)
{
- public:
- AZ_RTTI(MockManifestRule, "{D6F96B48-4E6F-4EE8-A5A3-959B76F90DA8}", IManifestObject);
- AZ_CLASS_ALLOCATOR(MockManifestRule, AZ::SystemAllocator, 0);
+ serializeContext->Class()
+ ->Version(1)
+ ->Field("value", &MockManifestRule::m_value);
+ }
+ }
- MockManifestRule() = default;
+ private:
+ double m_value = 0.0;
+ };
- MockManifestRule(double value)
- : m_value(value)
- {
- }
+ struct MockBuilder final
+ {
+ AZ_TYPE_INFO(MockBuilder, "{ECF0FB2C-E5C0-4B89-993C-8511A7EF6894}");
- double GetValue() const
- {
- return m_value;
- }
+ AZStd::unique_ptr m_scene;
- void SetValue(double value)
- {
- m_value = value;
- }
+ MockBuilder()
+ {
+ m_scene = AZStd::make_unique("unit_scene");
+ }
- static void Reflect(AZ::ReflectContext* context)
- {
- AZ::SerializeContext* serializeContext = azrtti_cast(context);
- if (serializeContext)
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("value", &MockManifestRule::m_value);
- }
- }
+ ~MockBuilder()
+ {
+ m_scene.reset();
+ }
- private:
- double m_value = 0.0;
- };
+ void BuildSceneGraph()
+ {
+ m_scene->SetManifestFilename("manifest_filename");
+ m_scene->SetSource("unit_source_filename", azrtti_typeid());
+
+ auto& graph = m_scene->GetGraph();
+
+ /*----------------------------\
+ | Root |
+ | / \ |
+ | | | |
+ | A B |
+ | | /|\ |
+ | C I J K |
+ | / | \ \ |
+ | D E F L |
+ | / \ |
+ | G H |
+ \----------------------------*/
+
+ //Build up the graph
+ const auto indexA = graph.AddChild(graph.GetRoot(), "A", AZStd::make_shared(1));
+ const auto indexC = graph.AddChild(indexA, "C", AZStd::make_shared(3));
+ const auto indexE = graph.AddChild(indexC, "E", AZStd::make_shared(4));
+ graph.AddChild(indexC, "D", AZStd::make_shared(5));
+ graph.AddChild(indexC, "F", AZStd::make_shared(6));
+ graph.AddChild(indexE, "G", AZStd::make_shared(7));
+ graph.AddChild(indexE, "H", AZStd::make_shared(8));
+ const auto indexB = graph.AddChild(graph.GetRoot(), "B", AZStd::make_shared(2));
+ const auto indexK = graph.AddChild(indexB, "K", AZStd::make_shared(2));
+ graph.AddChild(indexB, "I", AZStd::make_shared(9));
+ graph.AddChild(indexB, "J", AZStd::make_shared(10));
+ graph.AddChild(indexK, "L", AZStd::make_shared(12));
+
+ m_scene->GetManifest().AddEntry(AZStd::make_shared(0.1));
+ m_scene->GetManifest().AddEntry(AZStd::make_shared(2.3));
+ m_scene->GetManifest().AddEntry(AZStd::make_shared(4.5));
+ }
- struct MockBuilder final
+ static void Reflect(ReflectContext* context)
+ {
+ BehaviorContext* behaviorContext = azrtti_cast(context);
+ if (behaviorContext)
{
- AZ_TYPE_INFO(MockBuilder, "{ECF0FB2C-E5C0-4B89-993C-8511A7EF6894}");
+ behaviorContext->Class()
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Module, "scene")
+ ->Method("BuildSceneGraph", [](MockBuilder& self)
+ {
+ return self.BuildSceneGraph();
+ })
+ ->Method("GetScene", [](MockBuilder& self)
+ {
+ return self.m_scene.get();
+ });
+ }
+ }
+ };
- AZStd::unique_ptr m_scene;
+ class SceneGraphBehaviorTest
+ : public ::testing::Test
+ {
+ public:
+ void SetUp() override
+ {
+ m_behaviorContext = AZStd::make_unique();
+ ReflectBehavior(m_behaviorContext.get());
+ }
- MockBuilder()
- {
- m_scene = AZStd::make_unique("unit_scene");
- }
+ void TearDown() override
+ {
+ m_behaviorContext.reset();
+ }
- ~MockBuilder()
- {
- m_scene.reset();
- }
+ AZ::BehaviorClass* GetBehaviorClass(const AZ::TypeId& behaviorClassType)
+ {
+ auto entry = m_behaviorContext->m_typeToClassMap.find(behaviorClassType);
+ return (entry != m_behaviorContext->m_typeToClassMap.end()) ? entry->second : nullptr;
+ }
- void BuildSceneGraph()
- {
- m_scene->SetManifestFilename("manifest_filename");
- m_scene->SetSource("unit_source_filename", azrtti_typeid());
-
- auto& graph = m_scene->GetGraph();
-
- /*----------------------------\
- | Root |
- | / \ |
- | | | |
- | A B |
- | | /|\ |
- | C I J K |
- | / | \ \ |
- | D E F L |
- | / \ |
- | G H |
- \----------------------------*/
-
- //Build up the graph
- const auto indexA = graph.AddChild(graph.GetRoot(), "A", AZStd::make_shared(1));
- const auto indexC = graph.AddChild(indexA, "C", AZStd::make_shared(3));
- const auto indexE = graph.AddChild(indexC, "E", AZStd::make_shared(4));
- graph.AddChild(indexC, "D", AZStd::make_shared(5));
- graph.AddChild(indexC, "F", AZStd::make_shared(6));
- graph.AddChild(indexE, "G", AZStd::make_shared(7));
- graph.AddChild(indexE, "H", AZStd::make_shared(8));
- const auto indexB = graph.AddChild(graph.GetRoot(), "B", AZStd::make_shared(2));
- const auto indexK = graph.AddChild(indexB, "K", AZStd::make_shared(2));
- graph.AddChild(indexB, "I", AZStd::make_shared(9));
- graph.AddChild(indexB, "J", AZStd::make_shared(10));
- graph.AddChild(indexK, "L", AZStd::make_shared(12));
-
- m_scene->GetManifest().AddEntry(AZStd::make_shared(0.1));
- m_scene->GetManifest().AddEntry(AZStd::make_shared(2.3));
- m_scene->GetManifest().AddEntry(AZStd::make_shared(4.5));
- }
+ AZ::BehaviorProperty* GetBehaviorProperty(AZ::BehaviorClass& behaviorClass, AZStd::string_view propertyName)
+ {
+ auto entry = behaviorClass.m_properties.find(propertyName);
+ return (entry != behaviorClass.m_properties.end()) ? entry->second : nullptr;
+ }
- static void Reflect(ReflectContext* context)
- {
- BehaviorContext* behaviorContext = azrtti_cast(context);
- if (behaviorContext)
- {
- behaviorContext->Class()
- ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
- ->Attribute(AZ::Script::Attributes::Module, "scene")
- ->Method("BuildSceneGraph", [](MockBuilder& self)
- {
- return self.BuildSceneGraph();
- })
- ->Method("GetScene", [](MockBuilder& self)
- {
- return self.m_scene.get();
- });
- }
- }
- };
+ bool HasBehaviorClass(const AZ::TypeId& behaviorClassType)
+ {
+ return GetBehaviorClass(behaviorClassType) != nullptr;
+ }
- class SceneGraphBehaviorTest
- : public ::testing::Test
+ bool HasProperty(AZ::BehaviorClass& behaviorClass, AZStd::string_view propertyName, const AZ::TypeId& propertyClassType)
+ {
+ AZ::BehaviorProperty* behaviorProperty = GetBehaviorProperty(behaviorClass, propertyName);
+ if (behaviorProperty)
{
- public:
- void SetUp() override
- {
- m_behaviorContext = AZStd::make_unique();
- ReflectBehavior(m_behaviorContext.get());
- }
+ return behaviorProperty->m_getter->GetResult()->m_typeId == propertyClassType;
+ }
+ return false;
+ }
- void TearDown() override
- {
- m_behaviorContext.reset();
- }
+ using ArgList = AZStd::vector;
- AZ::BehaviorClass* GetBehaviorClass(const AZ::TypeId& behaviorClassType)
- {
- auto entry = m_behaviorContext->m_typeToClassMap.find(behaviorClassType);
- return (entry != m_behaviorContext->m_typeToClassMap.end()) ? entry->second : nullptr;
- }
+ bool HasMethodWithInput(AZ::BehaviorClass& behaviorClass, AZStd::string_view methodName, const ArgList& input)
+ {
+ auto entry = behaviorClass.m_methods.find(methodName);
+ if (entry == behaviorClass.m_methods.end())
+ {
+ return false;
+ }
+ AZ::BehaviorMethod* method = entry->second;
- AZ::BehaviorProperty* GetBehaviorProperty(AZ::BehaviorClass& behaviorClass, AZStd::string_view propertyName)
- {
- auto entry = behaviorClass.m_properties.find(propertyName);
- return (entry != behaviorClass.m_properties.end()) ? entry->second : nullptr;
- }
+ const size_t methodArgsCount = method->IsMember() ? method->GetNumArguments() - 1 : method->GetNumArguments();
+ if (input.size() != methodArgsCount)
+ {
+ return false;
+ }
- bool HasBehaviorClass(const AZ::TypeId& behaviorClassType)
+ for (size_t argIndex = 0; argIndex < input.size(); ++argIndex)
+ {
+ const size_t thisPointerOffset = method->IsMember() ? 1 : 0;
+ const auto argType = method->GetArgument(argIndex + thisPointerOffset)->m_typeId;
+ const auto inputType = input[argIndex];
+ if (inputType != argType)
{
- return GetBehaviorClass(behaviorClassType) != nullptr;
+ return false;
}
+ }
+ return true;
+ }
- bool HasProperty(AZ::BehaviorClass& behaviorClass, AZStd::string_view propertyName, const AZ::TypeId& propertyClassType)
+ bool HasMethodWithOutput(AZ::BehaviorClass& behaviorClass, AZStd::string_view methodName, const AZ::TypeId& output, const ArgList& input)
+ {
+ auto entry = behaviorClass.m_methods.find(methodName);
+ if (entry == behaviorClass.m_methods.end())
+ {
+ return false;
+ }
+ AZ::BehaviorMethod* method = entry->second;
+ if (method->HasResult())
+ {
+ if (method->GetResult()->m_typeId != output)
{
- AZ::BehaviorProperty* behaviorProperty = GetBehaviorProperty(behaviorClass, propertyName);
- if (behaviorProperty)
- {
- return behaviorProperty->m_getter->GetResult()->m_typeId == propertyClassType;
- }
return false;
}
+ }
+ else
+ {
+ return false;
+ }
+ return HasMethodWithInput(behaviorClass, methodName, input);
+ }
- using ArgList = AZStd::vector;
+ AZStd::unique_ptr m_behaviorContext;
+ };
- bool HasMethodWithInput(AZ::BehaviorClass& behaviorClass, AZStd::string_view methodName, const ArgList& input)
- {
- auto entry = behaviorClass.m_methods.find(methodName);
- if (entry == behaviorClass.m_methods.end())
- {
- return false;
- }
- AZ::BehaviorMethod* method = entry->second;
+ TEST_F(SceneGraphBehaviorTest, SceneClass_BehaviorContext_Exists)
+ {
+ EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
+ }
- const size_t methodArgsCount = method->IsMember() ? method->GetNumArguments() - 1 : method->GetNumArguments();
- if (input.size() != methodArgsCount)
- {
- return false;
- }
+ TEST_F(SceneGraphBehaviorTest, SceneClass_BehaviorContext_HasExpectedProperties)
+ {
+ AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
+ ASSERT_NE(nullptr, behaviorClass);
+ EXPECT_TRUE(HasProperty(*behaviorClass, "name", azrtti_typeid()));
+ EXPECT_TRUE(HasProperty(*behaviorClass, "manifestFilename", azrtti_typeid()));
+ EXPECT_TRUE(HasProperty(*behaviorClass, "sourceFilename", azrtti_typeid()));
+ EXPECT_TRUE(HasProperty(*behaviorClass, "sourceGuid", azrtti_typeid()));
+ EXPECT_TRUE(HasProperty(*behaviorClass, "graph", azrtti_typeid()));
+ EXPECT_TRUE(HasProperty(*behaviorClass, "manifest", azrtti_typeid()));
+ }
- for (size_t argIndex = 0; argIndex < input.size(); ++argIndex)
- {
- const size_t thisPointerOffset = method->IsMember() ? 1 : 0;
- const auto argType = method->GetArgument(argIndex + thisPointerOffset)->m_typeId;
- const auto inputType = input[argIndex];
- if (inputType != argType)
- {
- return false;
- }
- }
- return true;
- }
+ TEST_F(SceneGraphBehaviorTest, SceneGraphClass_BehaviorContext_Exists)
+ {
+ EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
+ EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
+ EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
+ }
- bool HasMethodWithOutput(AZ::BehaviorClass& behaviorClass, AZStd::string_view methodName, const AZ::TypeId& output, const ArgList& input)
- {
- auto entry = behaviorClass.m_methods.find(methodName);
- if (entry == behaviorClass.m_methods.end())
- {
- return false;
- }
- AZ::BehaviorMethod* method = entry->second;
- if (method->HasResult())
- {
- if (method->GetResult()->m_typeId != output)
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- return HasMethodWithInput(behaviorClass, methodName, input);
- }
+ TEST_F(SceneGraphBehaviorTest, SceneGraphClass_BehaviorContext_HasExpectedProperties)
+ {
+ using namespace AZ::SceneAPI::Containers;
+
+ AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
+ ASSERT_NE(nullptr, behaviorClass);
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetNodeName", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetRoot", azrtti_typeid(), {}));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeContent", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeSibling", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeChild", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeParent", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "IsNodeEndPoint", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetNodeCount", azrtti_typeid(), {}));
+ EXPECT_TRUE(HasMethodWithOutput(
+ *behaviorClass,
+ "GetNodeParent",
+ azrtti_typeid(),
+ { azrtti_typeid(), azrtti_typeid() }
+ ));
+ EXPECT_TRUE(HasMethodWithOutput(
+ *behaviorClass,
+ "GetNodeSibling",
+ azrtti_typeid(),
+ { azrtti_typeid(), azrtti_typeid() }
+ ));
+ EXPECT_TRUE(HasMethodWithOutput(
+ *behaviorClass,
+ "GetNodeChild",
+ azrtti_typeid(),
+ { azrtti_typeid(), azrtti_typeid() }
+ ));
+ EXPECT_TRUE(HasMethodWithOutput(
+ *behaviorClass,
+ "FindWithPath",
+ azrtti_typeid(),
+ { azrtti_typeid(), azrtti_typeid() }
+ ));
+ EXPECT_TRUE(HasMethodWithOutput(
+ *behaviorClass,
+ "FindWithRootAndPath",
+ azrtti_typeid(),
+ { azrtti_typeid(), azrtti_typeid(), azrtti_typeid() }
+ ));
+ }
- AZStd::unique_ptr m_behaviorContext;
- };
+ TEST_F(SceneGraphBehaviorTest, SceneGraphNodeIndexClass_BehaviorContext_HasExpectedProperties)
+ {
+ using namespace AZ::SceneAPI::Containers;
+
+ AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
+ ASSERT_NE(nullptr, behaviorClass);
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "AsNumber", azrtti_typeid(), {}));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "Distance", azrtti_typeid(), { azrtti_typeid() }));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "IsValid", azrtti_typeid(), {}));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "Equal", azrtti_typeid(), { azrtti_typeid() }));
+ }
- TEST_F(SceneGraphBehaviorTest, SceneClass_BehaviorContext_Exists)
- {
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- }
+ TEST_F(SceneGraphBehaviorTest, SceneGraphNameClass_BehaviorContext_HasExpectedProperties)
+ {
+ using namespace AZ::SceneAPI::Containers;
- TEST_F(SceneGraphBehaviorTest, SceneClass_BehaviorContext_HasExpectedProperties)
- {
- AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
- ASSERT_NE(nullptr, behaviorClass);
- EXPECT_TRUE(HasProperty(*behaviorClass, "name", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "manifestFilename", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "sourceFilename", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "sourceGuid", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "graph", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "manifest", azrtti_typeid()));
- }
+ AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
+ ASSERT_NE(nullptr, behaviorClass);
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetPath", azrtti_typeid(), {}));
+ EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetName", azrtti_typeid(), {}));
+ }
- TEST_F(SceneGraphBehaviorTest, SceneGraphClass_BehaviorContext_Exists)
- {
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- }
+ class MockSceneComponentApplication
+ : public AZ::ComponentApplicationBus::Handler
+ {
+ public:
+ MockSceneComponentApplication()
+ {
+ AZ::ComponentApplicationBus::Handler::BusConnect();
+ AZ::Interface::Register(this);
+ }
- TEST_F(SceneGraphBehaviorTest, SceneGraphClass_BehaviorContext_HasExpectedProperties)
- {
- using namespace AZ::SceneAPI::Containers;
-
- AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
- ASSERT_NE(nullptr, behaviorClass);
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetNodeName", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetRoot", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeContent", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeSibling", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeChild", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeParent", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "IsNodeEndPoint", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetNodeCount", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "GetNodeParent",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "GetNodeSibling",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "GetNodeChild",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "FindWithPath",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "FindWithRootAndPath",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid(), azrtti_typeid() }
- ));
- }
+ ~MockSceneComponentApplication()
+ {
+ AZ::Interface::Unregister(this);
+ AZ::ComponentApplicationBus::Handler::BusDisconnect();
+ }
- TEST_F(SceneGraphBehaviorTest, SceneGraphNodeIndexClass_BehaviorContext_HasExpectedProperties)
- {
- using namespace AZ::SceneAPI::Containers;
-
- AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
- ASSERT_NE(nullptr, behaviorClass);
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "AsNumber", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "Distance", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "IsValid", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "Equal", azrtti_typeid(), { azrtti_typeid() }));
- }
+ MOCK_METHOD1(FindEntity, AZ::Entity* (const AZ::EntityId&));
+ MOCK_METHOD1(AddEntity, bool(AZ::Entity*));
+ MOCK_METHOD0(Destroy, void());
+ MOCK_METHOD1(RegisterComponentDescriptor, void(const AZ::ComponentDescriptor*));
+ MOCK_METHOD1(UnregisterComponentDescriptor, void(const AZ::ComponentDescriptor*));
+ MOCK_METHOD1(RegisterEntityAddedEventHandler, void(AZ::EntityAddedEvent::Handler&));
+ MOCK_METHOD1(RegisterEntityRemovedEventHandler, void(AZ::EntityRemovedEvent::Handler&));
+ MOCK_METHOD1(RegisterEntityActivatedEventHandler, void(AZ::EntityActivatedEvent::Handler&));
+ MOCK_METHOD1(RegisterEntityDeactivatedEventHandler, void(AZ::EntityDeactivatedEvent::Handler&));
+ MOCK_METHOD1(SignalEntityActivated, void(AZ::Entity*));
+ MOCK_METHOD1(SignalEntityDeactivated, void(AZ::Entity*));
+ MOCK_METHOD1(RemoveEntity, bool(AZ::Entity*));
+ MOCK_METHOD1(DeleteEntity, bool(const AZ::EntityId&));
+ MOCK_METHOD1(GetEntityName, AZStd::string(const AZ::EntityId&));
+ MOCK_METHOD1(EnumerateEntities, void(const ComponentApplicationRequests::EntityCallback&));
+ MOCK_METHOD0(GetApplication, AZ::ComponentApplication* ());
+ MOCK_METHOD0(GetSerializeContext, AZ::SerializeContext* ());
+ MOCK_METHOD0(GetJsonRegistrationContext, AZ::JsonRegistrationContext* ());
+ MOCK_METHOD0(GetBehaviorContext, AZ::BehaviorContext* ());
+ MOCK_CONST_METHOD0(GetAppRoot, const char*());
+ MOCK_CONST_METHOD0(GetEngineRoot, const char*());
+ MOCK_CONST_METHOD0(GetExecutableFolder, const char* ());
+ MOCK_METHOD0(GetDrillerManager, AZ::Debug::DrillerManager* ());
+ MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&));
+ };
+
+ class MockEditorPythonConsoleInterface final
+ : public AzToolsFramework::EditorPythonConsoleInterface
+ {
+ public:
+ MockEditorPythonConsoleInterface()
+ {
+ AZ::Interface::Register(this);
+ }
- TEST_F(SceneGraphBehaviorTest, SceneGraphNameClass_BehaviorContext_HasExpectedProperties)
- {
- using namespace AZ::SceneAPI::Containers;
+ ~MockEditorPythonConsoleInterface()
+ {
+ AZ::Interface::Unregister(this);
+ }
- AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
- ASSERT_NE(nullptr, behaviorClass);
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetPath", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetName", azrtti_typeid(), {}));
- }
+ MOCK_CONST_METHOD1(GetModuleList, void(AZStd::vector&));
+ MOCK_CONST_METHOD1(GetGlobalFunctionList, void(GlobalFunctionCollection&));
+ MOCK_METHOD1(FetchPythonTypeName, AZStd::string(const AZ::BehaviorParameter&));
+ };
- class MockSceneComponentApplication
- : public AZ::ComponentApplicationBus::Handler
- {
- public:
- MockSceneComponentApplication()
- {
- AZ::ComponentApplicationBus::Handler::BusConnect();
- AZ::Interface::Register(this);
- }
+ //
+ // SceneGraphBehaviorScriptTest
+ //
+ class SceneGraphBehaviorScriptTest
+ : public UnitTest::AllocatorsFixture
+ {
+ public:
+ AZStd::unique_ptr m_componentApplication;
+ AZStd::unique_ptr m_editorPythonConsoleInterface;
+ AZStd::unique_ptr m_scriptContext;
+ AZStd::unique_ptr m_behaviorContext;
+ AZStd::unique_ptr m_serializeContext;
+
+ static void TestExpectTrue(bool value)
+ {
+ EXPECT_TRUE(value);
+ }
- ~MockSceneComponentApplication()
- {
- AZ::Interface::Unregister(this);
- AZ::ComponentApplicationBus::Handler::BusDisconnect();
- }
+ static void TestExpectEquals(AZ::s64 lhs, AZ::s64 rhs)
+ {
+ EXPECT_EQ(lhs, rhs);
+ }
- MOCK_METHOD1(FindEntity, AZ::Entity* (const AZ::EntityId&));
- MOCK_METHOD1(AddEntity, bool(AZ::Entity*));
- MOCK_METHOD0(Destroy, void());
- MOCK_METHOD1(RegisterComponentDescriptor, void(const AZ::ComponentDescriptor*));
- MOCK_METHOD1(UnregisterComponentDescriptor, void(const AZ::ComponentDescriptor*));
- MOCK_METHOD1(RegisterEntityAddedEventHandler, void(AZ::EntityAddedEvent::Handler&));
- MOCK_METHOD1(RegisterEntityRemovedEventHandler, void(AZ::EntityRemovedEvent::Handler&));
- MOCK_METHOD1(RegisterEntityActivatedEventHandler, void(AZ::EntityActivatedEvent::Handler&));
- MOCK_METHOD1(RegisterEntityDeactivatedEventHandler, void(AZ::EntityDeactivatedEvent::Handler&));
- MOCK_METHOD1(SignalEntityActivated, void(AZ::Entity*));
- MOCK_METHOD1(SignalEntityDeactivated, void(AZ::Entity*));
- MOCK_METHOD1(RemoveEntity, bool(AZ::Entity*));
- MOCK_METHOD1(DeleteEntity, bool(const AZ::EntityId&));
- MOCK_METHOD1(GetEntityName, AZStd::string(const AZ::EntityId&));
- MOCK_METHOD1(EnumerateEntities, void(const ComponentApplicationRequests::EntityCallback&));
- MOCK_METHOD0(GetApplication, AZ::ComponentApplication* ());
- MOCK_METHOD0(GetSerializeContext, AZ::SerializeContext* ());
- MOCK_METHOD0(GetJsonRegistrationContext, AZ::JsonRegistrationContext* ());
- MOCK_METHOD0(GetBehaviorContext, AZ::BehaviorContext* ());
- MOCK_CONST_METHOD0(GetAppRoot, const char*());
- MOCK_CONST_METHOD0(GetEngineRoot, const char*());
- MOCK_CONST_METHOD0(GetExecutableFolder, const char* ());
- MOCK_METHOD0(GetDrillerManager, AZ::Debug::DrillerManager* ());
- MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&));
- };
-
- class MockEditorPythonConsoleInterface final
- : public AzToolsFramework::EditorPythonConsoleInterface
+ static void ReflectTestTypes(AZ::ReflectContext* context)
+ {
+ AZ::BehaviorContext* behaviorContext = azrtti_cast(context);
+ if (behaviorContext)
{
- public:
- MockEditorPythonConsoleInterface()
- {
- AZ::Interface::Register(this);
- }
+ behaviorContext->Class()
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Module, "scene.graph.test")
+ ->Method("GetId", [](const DataTypes::MockIGraphObject& self)
+ {
+ return self.m_id;
+ })
+ ->Method("SetId", [](DataTypes::MockIGraphObject& self, int value)
+ {
+ self.m_id = value;
+ })
+ ->Method("AddAndSet", [](DataTypes::MockIGraphObject& self, int lhs, int rhs)
+ {
+ self.m_id = lhs + rhs;
+ });
+ }
+ }
- ~MockEditorPythonConsoleInterface()
- {
- AZ::Interface::Unregister(this);
- }
+ void SetUp() override
+ {
+ UnitTest::AllocatorsFixture::SetUp();
- MOCK_CONST_METHOD1(GetModuleList, void(AZStd::vector&));
- MOCK_CONST_METHOD1(GetGlobalFunctionList, void(GlobalFunctionCollection&));
- MOCK_METHOD1(FetchPythonTypeName, AZStd::string(const AZ::BehaviorParameter&));
- };
+ m_serializeContext = AZStd::make_unique();
- //
- // SceneGraphBehaviorScriptTest
- //
- class SceneGraphBehaviorScriptTest
- : public UnitTest::AllocatorsFixture
- {
- public:
- AZStd::unique_ptr m_componentApplication;
- AZStd::unique_ptr m_editorPythonConsoleInterface;
- AZStd::unique_ptr m_scriptContext;
- AZStd::unique_ptr m_behaviorContext;
- AZStd::unique_ptr m_serializeContext;
-
- static void TestExpectTrue(bool value)
- {
- EXPECT_TRUE(value);
- }
+ m_behaviorContext = AZStd::make_unique();
+ m_behaviorContext->Method("TestExpectTrue", &TestExpectTrue);
+ m_behaviorContext->Method("TestExpectEquals", &TestExpectEquals);
- static void TestExpectEquals(AZ::s64 lhs, AZ::s64 rhs)
- {
- EXPECT_EQ(lhs, rhs);
- }
+ AZ::MathReflect(m_behaviorContext.get());
+ ReflectBehavior(m_behaviorContext.get());
+ ReflectTestTypes(m_behaviorContext.get());
+ MockBuilder::Reflect(m_behaviorContext.get());
- static void ReflectTestTypes(AZ::ReflectContext* context)
- {
- AZ::BehaviorContext* behaviorContext = azrtti_cast(context);
- if (behaviorContext)
+ m_scriptContext = AZStd::make_unique();
+ m_scriptContext->BindTo(m_behaviorContext.get());
+
+ m_componentApplication = AZStd::make_unique<::testing::NiceMock>();
+
+ ON_CALL(*m_componentApplication, GetBehaviorContext())
+ .WillByDefault(::testing::Invoke([this]()
{
- behaviorContext->Class()
- ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
- ->Attribute(AZ::Script::Attributes::Module, "scene.graph.test")
- ->Method("GetId", [](const DataTypes::MockIGraphObject& self)
- {
- return self.m_id;
- })
- ->Method("SetId", [](DataTypes::MockIGraphObject& self, int value)
- {
- self.m_id = value;
- })
- ->Method("AddAndSet", [](DataTypes::MockIGraphObject& self, int lhs, int rhs)
- {
- self.m_id = lhs + rhs;
- });
- }
- }
+ return this->m_behaviorContext.get();
+ }));
- void SetUp() override
- {
- UnitTest::AllocatorsFixture::SetUp();
+ ON_CALL(*m_componentApplication, GetSerializeContext())
+ .WillByDefault(::testing::Invoke([this]()
+ {
+ return this->m_serializeContext.get();
+ }));
- m_serializeContext = AZStd::make_unique();
+ m_editorPythonConsoleInterface = AZStd::make_unique();
+ }
- m_behaviorContext = AZStd::make_unique();
- m_behaviorContext->Method("TestExpectTrue", &TestExpectTrue);
- m_behaviorContext->Method("TestExpectEquals", &TestExpectEquals);
+ void SetupEditorPythonConsoleInterface()
+ {
+ EXPECT_CALL(*m_editorPythonConsoleInterface, FetchPythonTypeName(::testing::_))
+ .Times(4)
+ .WillRepeatedly(::testing::Invoke([](const AZ::BehaviorParameter&) {return "int"; }));
+ }
- AZ::MathReflect(m_behaviorContext.get());
- ReflectBehavior(m_behaviorContext.get());
- ReflectTestTypes(m_behaviorContext.get());
- MockBuilder::Reflect(m_behaviorContext.get());
+ void TearDown() override
+ {
+ m_scriptContext.reset();
+ m_serializeContext.reset();
+ m_behaviorContext.reset();
- m_scriptContext = AZStd::make_unique();
- m_scriptContext->BindTo(m_behaviorContext.get());
+ UnitTest::AllocatorsFixture::TearDown();
+ }
- m_componentApplication = AZStd::make_unique<::testing::NiceMock>();
+ void ExpectExecute(AZStd::string_view script)
+ {
+ EXPECT_TRUE(m_scriptContext->Execute(script.data()));
+ }
+ };
- ON_CALL(*m_componentApplication, GetBehaviorContext())
- .WillByDefault(::testing::Invoke([this]()
- {
- return this->m_behaviorContext.get();
- }));
+ TEST_F(SceneGraphBehaviorScriptTest, Scene_ScriptContext_Access)
+ {
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+ ExpectExecute("TestExpectTrue(scene ~= nil)");
+ ExpectExecute("TestExpectTrue(scene.name == 'unit_scene')");
+ ExpectExecute("TestExpectTrue(scene.manifestFilename == 'manifest_filename')");
+ ExpectExecute("TestExpectTrue(scene.sourceFilename == 'unit_source_filename')");
+ ExpectExecute("TestExpectTrue(tostring(scene.sourceGuid) == '{1F2E6142-B0D8-42C6-A6E5-CD726DAA9EF0}')");
+ ExpectExecute("TestExpectTrue(scene:GetOriginalSceneOrientation() == Scene.SceneOrientation_YUp)");
+ }
- ON_CALL(*m_componentApplication, GetSerializeContext())
- .WillByDefault(::testing::Invoke([this]()
- {
- return this->m_serializeContext.get();
- }));
+ TEST_F(SceneGraphBehaviorScriptTest, SceneGraph_ScriptContext_AccessMockNodes)
+ {
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+
+ // instance methods
+ ExpectExecute("TestExpectTrue(scene.graph ~= nil)");
+ ExpectExecute("TestExpectTrue(scene.graph:GetRoot():IsValid())");
+ ExpectExecute("TestExpectEquals(scene.graph:GetNodeCount(), 13)");
+ ExpectExecute("nodeRoot = scene.graph:GetRoot()");
+ ExpectExecute("nodeA = scene.graph:GetNodeChild(nodeRoot); TestExpectTrue(nodeA:IsValid())");
+ ExpectExecute("TestExpectTrue(scene.graph:HasNodeContent(nodeA))");
+ ExpectExecute("nodeC = scene.graph:GetNodeChild(nodeA); TestExpectTrue(nodeC:IsValid())");
+ ExpectExecute("nodeNameC = scene.graph:GetNodeName(nodeC); TestExpectTrue(nodeNameC ~= nil)");
+ ExpectExecute("nodeE = scene.graph:GetNodeChild(nodeC); TestExpectTrue(nodeE:IsValid())");
+ ExpectExecute("TestExpectTrue(scene.graph:HasNodeSibling(nodeE))");
+ ExpectExecute("TestExpectTrue(scene.graph:HasNodeChild(nodeE))");
+ ExpectExecute("TestExpectTrue(scene.graph:HasNodeParent(nodeE))");
+ ExpectExecute("nodeG = scene.graph:GetNodeChild(nodeE); TestExpectTrue(nodeG:IsValid())");
+ ExpectExecute("TestExpectTrue(scene.graph:GetNodeParent(nodeG) == nodeE)");
+ ExpectExecute("nodeH = scene.graph:GetNodeSibling(nodeG); TestExpectTrue(nodeH:IsValid())");
+ ExpectExecute("TestExpectTrue(scene.graph:GetNodeName(nodeH):GetPath() == 'A.C.E.H')");
+ ExpectExecute("nodeB = scene.graph:GetNodeSibling(nodeA); TestExpectTrue(nodeB:IsValid())");
+ ExpectExecute("nodeK = scene.graph:GetNodeChild(nodeB); TestExpectTrue(nodeK:IsValid())");
+ ExpectExecute("TestExpectTrue(scene.graph:FindWithPath('B.K') == nodeK)");
+ ExpectExecute("nodeL = scene.graph:GetNodeChild(nodeK); TestExpectTrue(nodeL:IsValid())");
+ ExpectExecute("TestExpectTrue(scene.graph:FindWithRootAndPath(nodeK, 'L') == nodeL)");
+
+ // static methods
+ ExpectExecute("TestExpectTrue(scene.graph.IsValidName('A'))");
+ ExpectExecute("TestExpectTrue(scene.graph.GetNodeSeperationCharacter() == string.byte('.'))");
+ }
- m_editorPythonConsoleInterface = AZStd::make_unique();
- }
+ TEST_F(SceneGraphBehaviorScriptTest, SceneGraphNodeIndex_ScriptContext_AccessMockNodes)
+ {
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+ ExpectExecute("nodeA = scene.graph:GetNodeChild(scene.graph:GetRoot())");
+ ExpectExecute("TestExpectTrue(nodeA:IsValid())");
+ ExpectExecute("TestExpectEquals(nodeA:AsNumber(), 1)");
+ ExpectExecute("TestExpectEquals(scene.graph:GetRoot():Distance(nodeA), 1)");
+ ExpectExecute("TestExpectEquals(nodeA:Distance(scene.graph:GetRoot()), -1)");
+ ExpectExecute("TestExpectTrue(nodeA == scene.graph:FindWithPath('A'))");
+ }
- void SetupEditorPythonConsoleInterface()
- {
- EXPECT_CALL(*m_editorPythonConsoleInterface, FetchPythonTypeName(::testing::_))
- .Times(4)
- .WillRepeatedly(::testing::Invoke([](const AZ::BehaviorParameter&) {return "int"; }));
- }
+ TEST_F(SceneGraphBehaviorScriptTest, SceneGraphName_ScriptContext_AccessMockNodes)
+ {
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+ ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
+ ExpectExecute("nodeNameG = scene.graph:GetNodeName(nodeG)");
+ ExpectExecute("TestExpectTrue(nodeNameG:GetPath() == 'A.C.E.G')");
+ ExpectExecute("TestExpectTrue(nodeNameG:GetName() == 'G')");
+ }
- void TearDown() override
- {
- m_scriptContext.reset();
- m_serializeContext.reset();
- m_behaviorContext.reset();
+ TEST_F(SceneGraphBehaviorScriptTest, SceneGraphIGraphNode_ScriptContext_AccessMockNodes)
+ {
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+ ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
+ ExpectExecute("proxy = scene.graph:GetNodeContent(nodeG)");
+ ExpectExecute("TestExpectTrue(proxy:CastWithTypeName('MockIGraphObject'))");
+ ExpectExecute("value = proxy:Invoke('GetId', vector_any())");
+ ExpectExecute("TestExpectEquals(value, 7)");
+ ExpectExecute("setIdArgs = vector_any(); setIdArgs:push_back(8);");
+ ExpectExecute("proxy:Invoke('SetId', setIdArgs)");
+ ExpectExecute("value = proxy:Invoke('GetId', vector_any())");
+ ExpectExecute("TestExpectEquals(value, 8)");
+ ExpectExecute("addArgs = vector_any(); addArgs:push_back(8); addArgs:push_back(9)");
+ ExpectExecute("proxy:Invoke('AddAndSet', addArgs)");
+ ExpectExecute("value = proxy:Invoke('GetId', vector_any())");
+ ExpectExecute("TestExpectEquals(value, 17)");
+ }
- UnitTest::AllocatorsFixture::TearDown();
- }
+ TEST_F(SceneGraphBehaviorScriptTest, GraphObjectProxy_GetClassInfo_Loads)
+ {
+ SetupEditorPythonConsoleInterface();
+
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+ ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
+ ExpectExecute("proxy = scene.graph:GetNodeContent(nodeG)");
+ ExpectExecute("TestExpectTrue(proxy:CastWithTypeName('MockIGraphObject'))");
+ ExpectExecute("info = proxy:GetClassInfo()");
+ ExpectExecute("TestExpectTrue(info ~= nil)");
+ }
- void ExpectExecute(AZStd::string_view script)
- {
- EXPECT_TRUE(m_scriptContext->Execute(script.data()));
- }
- };
+ TEST_F(SceneGraphBehaviorScriptTest, GraphObjectProxy_GetClassInfo_CorrectFormats)
+ {
+ SetupEditorPythonConsoleInterface();
+
+ ExpectExecute("builder = MockBuilder()");
+ ExpectExecute("builder:BuildSceneGraph()");
+ ExpectExecute("scene = builder:GetScene()");
+ ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
+ ExpectExecute("proxy = scene.graph:GetNodeContent(nodeG)");
+ ExpectExecute("TestExpectTrue(proxy:CastWithTypeName('MockIGraphObject'))");
+ ExpectExecute("info = proxy:GetClassInfo()");
+ ExpectExecute("TestExpectTrue(info.className == 'MockIGraphObject')");
+ ExpectExecute("TestExpectTrue(info.classUuid == '{66A082CC-851D-4E1F-ABBD-45B58A216CFA}')");
+ ExpectExecute("TestExpectTrue(info.methodList[1] == 'def GetId(self) -> int')");
+ ExpectExecute("TestExpectTrue(info.methodList[2] == 'def SetId(self, arg1: int) -> None')");
+ ExpectExecute("TestExpectTrue(info.methodList[3] == 'def AddAndSet(self, arg1: int, arg2: int) -> None')");
+ }
- TEST_F(SceneGraphBehaviorScriptTest, Scene_ScriptContext_Access)
- {
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
- ExpectExecute("TestExpectTrue(scene ~= nil)");
- ExpectExecute("TestExpectTrue(scene.name == 'unit_scene')");
- ExpectExecute("TestExpectTrue(scene.manifestFilename == 'manifest_filename')");
- ExpectExecute("TestExpectTrue(scene.sourceFilename == 'unit_source_filename')");
- ExpectExecute("TestExpectTrue(tostring(scene.sourceGuid) == '{1F2E6142-B0D8-42C6-A6E5-CD726DAA9EF0}')");
- ExpectExecute("TestExpectTrue(scene:GetOriginalSceneOrientation() == Scene.SceneOrientation_YUp)");
- }
+ TEST_F(SceneGraphBehaviorScriptTest, ExportProduct_ExpectedClassesAndFields_Work)
+ {
+ ExpectExecute("mockAssetType = Uuid.CreateString('{B7AD6A54-963F-4F0F-A70E-1CFC0364BE6B}')");
+ ExpectExecute("exportProduct = ExportProduct()");
+ ExpectExecute("exportProduct.filename = 'some/file.name'");
+ ExpectExecute("exportProduct.sourceId = Uuid.CreateString('{A19F5FDB-C5FB-478F-A0B0-B697D2C10DB5}', 0)");
+ ExpectExecute("exportProduct.assetType = mockAssetType");
+ ExpectExecute("exportProduct.subId = 10101");
+ ExpectExecute("TestExpectEquals(exportProduct.subId, 10101)");
+ ExpectExecute("TestExpectEquals(exportProduct.productDependencies:GetSize(), 0)");
+
+ ExpectExecute("exportProductDep = ExportProduct()");
+ ExpectExecute("exportProductDep.filename = 'some/file.dep'");
+ ExpectExecute("exportProductDep.sourceId = Uuid.CreateString('{A19F5FDB-C5FB-478F-A0B0-B697D2C10DB5}', 0)");
+ ExpectExecute("exportProductDep.assetType = mockAssetType");
+ ExpectExecute("exportProductDep.subId = 2");
+
+ ExpectExecute("exportProductList = ExportProductList()");
+ ExpectExecute("exportProductList:AddProduct(exportProduct)");
+ ExpectExecute("exportProductList:AddProduct(exportProductDep)");
+ ExpectExecute("productList = exportProductList:GetProducts()");
+ ExpectExecute("TestExpectEquals(productList:GetSize(), 2)");
+ ExpectExecute("exportProductList:AddDependencyToProduct(exportProduct.filename, exportProductDep)");
+ ExpectExecute("TestExpectEquals(productList:Front().productDependencies:GetSize(), 1)");
+ }
- TEST_F(SceneGraphBehaviorScriptTest, SceneGraph_ScriptContext_AccessMockNodes)
- {
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
-
- // instance methods
- ExpectExecute("TestExpectTrue(scene.graph ~= nil)");
- ExpectExecute("TestExpectTrue(scene.graph:GetRoot():IsValid())");
- ExpectExecute("TestExpectEquals(scene.graph:GetNodeCount(), 13)");
- ExpectExecute("nodeRoot = scene.graph:GetRoot()");
- ExpectExecute("nodeA = scene.graph:GetNodeChild(nodeRoot); TestExpectTrue(nodeA:IsValid())");
- ExpectExecute("TestExpectTrue(scene.graph:HasNodeContent(nodeA))");
- ExpectExecute("nodeC = scene.graph:GetNodeChild(nodeA); TestExpectTrue(nodeC:IsValid())");
- ExpectExecute("nodeNameC = scene.graph:GetNodeName(nodeC); TestExpectTrue(nodeNameC ~= nil)");
- ExpectExecute("nodeE = scene.graph:GetNodeChild(nodeC); TestExpectTrue(nodeE:IsValid())");
- ExpectExecute("TestExpectTrue(scene.graph:HasNodeSibling(nodeE))");
- ExpectExecute("TestExpectTrue(scene.graph:HasNodeChild(nodeE))");
- ExpectExecute("TestExpectTrue(scene.graph:HasNodeParent(nodeE))");
- ExpectExecute("nodeG = scene.graph:GetNodeChild(nodeE); TestExpectTrue(nodeG:IsValid())");
- ExpectExecute("TestExpectTrue(scene.graph:GetNodeParent(nodeG) == nodeE)");
- ExpectExecute("nodeH = scene.graph:GetNodeSibling(nodeG); TestExpectTrue(nodeH:IsValid())");
- ExpectExecute("TestExpectTrue(scene.graph:GetNodeName(nodeH):GetPath() == 'A.C.E.H')");
- ExpectExecute("nodeB = scene.graph:GetNodeSibling(nodeA); TestExpectTrue(nodeB:IsValid())");
- ExpectExecute("nodeK = scene.graph:GetNodeChild(nodeB); TestExpectTrue(nodeK:IsValid())");
- ExpectExecute("TestExpectTrue(scene.graph:FindWithPath('B.K') == nodeK)");
- ExpectExecute("nodeL = scene.graph:GetNodeChild(nodeK); TestExpectTrue(nodeL:IsValid())");
- ExpectExecute("TestExpectTrue(scene.graph:FindWithRootAndPath(nodeK, 'L') == nodeL)");
-
- // static methods
- ExpectExecute("TestExpectTrue(scene.graph.IsValidName('A'))");
- ExpectExecute("TestExpectTrue(scene.graph.GetNodeSeperationCharacter() == string.byte('.'))");
- }
+ //
+ // SceneManifestBehaviorScriptTest is meant to test the script abilities of the SceneManifest
+ //
+ class SceneManifestBehaviorScriptTest
+ : public UnitTest::AllocatorsFixture
+ {
+ public:
+ AZStd::unique_ptr m_componentApplication;
+ AZStd::unique_ptr m_scriptContext;
+ AZStd::unique_ptr m_behaviorContext;
+ AZStd::unique_ptr m_serializeContext;
+ AZStd::unique_ptr m_jsonRegistrationContext;
+ AZStd::string_view m_jsonMockData = R"JSON('{"values":[{"$type":"MockManifestRule","value":0.1},{"$type":"MockManifestRule","value":2.3},{"$type":"MockManifestRule","value":4.5}]}')JSON";
+
+ static void TestAssertTrue(bool value)
+ {
+ EXPECT_TRUE(value);
+ }
- TEST_F(SceneGraphBehaviorScriptTest, SceneGraphNodeIndex_ScriptContext_AccessMockNodes)
- {
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
- ExpectExecute("nodeA = scene.graph:GetNodeChild(scene.graph:GetRoot())");
- ExpectExecute("TestExpectTrue(nodeA:IsValid())");
- ExpectExecute("TestExpectEquals(nodeA:AsNumber(), 1)");
- ExpectExecute("TestExpectEquals(scene.graph:GetRoot():Distance(nodeA), 1)");
- ExpectExecute("TestExpectEquals(nodeA:Distance(scene.graph:GetRoot()), -1)");
- ExpectExecute("TestExpectTrue(nodeA == scene.graph:FindWithPath('A'))");
- }
+ void SetUp() override
+ {
+ UnitTest::AllocatorsFixture::SetUp();
- TEST_F(SceneGraphBehaviorScriptTest, SceneGraphName_ScriptContext_AccessMockNodes)
- {
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
- ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
- ExpectExecute("nodeNameG = scene.graph:GetNodeName(nodeG)");
- ExpectExecute("TestExpectTrue(nodeNameG:GetPath() == 'A.C.E.G')");
- ExpectExecute("TestExpectTrue(nodeNameG:GetName() == 'G')");
- }
+ m_serializeContext = AZStd::make_unique();
+ MockBuilder::Reflect(m_serializeContext.get());
+ MockManifestRule::Reflect(m_serializeContext.get());
+ ReflectTypes(m_serializeContext.get());
- TEST_F(SceneGraphBehaviorScriptTest, SceneGraphIGraphNode_ScriptContext_AccessMockNodes)
- {
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
- ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
- ExpectExecute("proxy = scene.graph:GetNodeContent(nodeG)");
- ExpectExecute("TestExpectTrue(proxy:CastWithTypeName('MockIGraphObject'))");
- ExpectExecute("value = proxy:Invoke('GetId', vector_any())");
- ExpectExecute("TestExpectEquals(value, 7)");
- ExpectExecute("setIdArgs = vector_any(); setIdArgs:push_back(8);");
- ExpectExecute("proxy:Invoke('SetId', setIdArgs)");
- ExpectExecute("value = proxy:Invoke('GetId', vector_any())");
- ExpectExecute("TestExpectEquals(value, 8)");
- ExpectExecute("addArgs = vector_any(); addArgs:push_back(8); addArgs:push_back(9)");
- ExpectExecute("proxy:Invoke('AddAndSet', addArgs)");
- ExpectExecute("value = proxy:Invoke('GetId', vector_any())");
- ExpectExecute("TestExpectEquals(value, 17)");
- }
+ m_behaviorContext = AZStd::make_unique();
+ m_behaviorContext->Method("TestAssertTrue", &TestAssertTrue);
+ AZ::MathReflect(m_behaviorContext.get());
+ MockBuilder::Reflect(m_behaviorContext.get());
+ MockManifestRule::Reflect(m_behaviorContext.get());
+ ReflectBehavior(m_behaviorContext.get());
- TEST_F(SceneGraphBehaviorScriptTest, GraphObjectProxy_GetClassInfo_Loads)
- {
- SetupEditorPythonConsoleInterface();
-
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
- ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
- ExpectExecute("proxy = scene.graph:GetNodeContent(nodeG)");
- ExpectExecute("TestExpectTrue(proxy:CastWithTypeName('MockIGraphObject'))");
- ExpectExecute("info = proxy:GetClassInfo()");
- ExpectExecute("TestExpectTrue(info ~= nil)");
- }
+ m_jsonRegistrationContext = AZStd::make_unique();
+ AZ::JsonSystemComponent::Reflect(m_jsonRegistrationContext.get());
- TEST_F(SceneGraphBehaviorScriptTest, GraphObjectProxy_GetClassInfo_CorrectFormats)
- {
- SetupEditorPythonConsoleInterface();
-
- ExpectExecute("builder = MockBuilder()");
- ExpectExecute("builder:BuildSceneGraph()");
- ExpectExecute("scene = builder:GetScene()");
- ExpectExecute("nodeG = scene.graph:FindWithPath('A.C.E.G')");
- ExpectExecute("proxy = scene.graph:GetNodeContent(nodeG)");
- ExpectExecute("TestExpectTrue(proxy:CastWithTypeName('MockIGraphObject'))");
- ExpectExecute("info = proxy:GetClassInfo()");
- ExpectExecute("TestExpectTrue(info.className == 'MockIGraphObject')");
- ExpectExecute("TestExpectTrue(info.classUuid == '{66A082CC-851D-4E1F-ABBD-45B58A216CFA}')");
- ExpectExecute("TestExpectTrue(info.methodList[1] == 'def GetId(self) -> int')");
- ExpectExecute("TestExpectTrue(info.methodList[2] == 'def SetId(self, arg1: int) -> None')");
- ExpectExecute("TestExpectTrue(info.methodList[3] == 'def AddAndSet(self, arg1: int, arg2: int) -> None')");
- }
+ m_scriptContext = AZStd::make_unique();
+ m_scriptContext->BindTo(m_behaviorContext.get());
- //
- // SceneManifestBehaviorScriptTest is meant to test the script abilities of the SceneManifest
- //
- class SceneManifestBehaviorScriptTest
- : public UnitTest::AllocatorsFixture
- {
- public:
- AZStd::unique_ptr m_componentApplication;
- AZStd::unique_ptr m_scriptContext;
- AZStd::unique_ptr m_behaviorContext;
- AZStd::unique_ptr m_serializeContext;
- AZStd::unique_ptr m_jsonRegistrationContext;
- AZStd::string_view m_jsonMockData = R"JSON('{"values":[{"$type":"MockManifestRule","value":0.1},{"$type":"MockManifestRule","value":2.3},{"$type":"MockManifestRule","value":4.5}]}')JSON";
-
- static void TestAssertTrue(bool value)
- {
- EXPECT_TRUE(value);
- }
+ m_componentApplication = AZStd::make_unique<::testing::NiceMock>();
- void SetUp() override
+ ON_CALL(*m_componentApplication, GetBehaviorContext()).WillByDefault(::testing::Invoke([this]()
{
- UnitTest::AllocatorsFixture::SetUp();
-
- m_serializeContext = AZStd::make_unique();
- MockBuilder::Reflect(m_serializeContext.get());
- MockManifestRule::Reflect(m_serializeContext.get());
- ReflectTypes(m_serializeContext.get());
-
- m_behaviorContext = AZStd::make_unique();
- m_behaviorContext->Method("TestAssertTrue", &TestAssertTrue);
- AZ::MathReflect(m_behaviorContext.get());
- MockBuilder::Reflect(m_behaviorContext.get());
- MockManifestRule::Reflect(m_behaviorContext.get());
- ReflectBehavior(m_behaviorContext.get());
-
- m_jsonRegistrationContext = AZStd::make_unique