From 2539fb60650915ecb1b4c28c0d10772f73530a75 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 4 Nov 2021 11:40:01 -0700 Subject: [PATCH 01/12] saving initial round of edits for the using the Asset class Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Atom/TestSuite_Main_GPU_Optimized.py | 2 +- .../tests/hydra_AtomGPU_BasicLevelSetup.py | 119 ++++++++++++------ 2 files changed, 81 insertions(+), 40 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py index 568768e12e..39fca5c7e4 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py @@ -16,7 +16,7 @@ from .atom_utils.atom_component_helper import create_screenshots_archive, golden DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots' -@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") +# @pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.parametrize("project", ["AutomatedTesting"]) @pytest.mark.parametrize("launcher_platform", ['windows_editor']) class TestAutomation(EditorTestSuite): diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py index 92c555127a..ad9758d57c 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py @@ -7,28 +7,70 @@ SPDX-License-Identifier: Apache-2.0 OR MIT # fmt: off -class Tests : - camera_component_added = ("Camera component was added", "Camera component wasn't added") - camera_fov_set = ("Camera component FOV property set", "Camera component FOV property wasn't set") - directional_light_component_added = ("Directional Light component added", "Directional Light component wasn't added") - enter_game_mode = ("Entered game mode", "Failed to enter game mode") - exit_game_mode = ("Exited game mode", "Couldn't exit game mode") - global_skylight_component_added = ("Global Skylight (IBL) component added", "Global Skylight (IBL) component wasn't added") - global_skylight_diffuse_image_set = ("Global Skylight Diffuse Image property set", "Global Skylight Diffuse Image property wasn't set") - global_skylight_specular_image_set = ("Global Skylight Specular Image property set", "Global Skylight Specular Image property wasn't set") - ground_plane_material_asset_set = ("Ground Plane Material Asset was set", "Ground Plane Material Asset wasn't set") - ground_plane_material_component_added = ("Ground Plane Material component added", "Ground Plane Material component wasn't added") - ground_plane_mesh_asset_set = ("Ground Plane Mesh Asset property was set", "Ground Plane Mesh Asset property wasn't set") - hdri_skybox_component_added = ("HDRi Skybox component added", "HDRi Skybox component wasn't added") - hdri_skybox_cubemap_texture_set = ("HDRi Skybox Cubemap Texture property set", "HDRi Skybox Cubemap Texture property wasn't set") - mesh_component_added = ("Mesh component added", "Mesh component wasn't added") - no_assert_occurred = ("No asserts detected", "Asserts were detected") - no_error_occurred = ("No errors detected", "Errors were detected") - secondary_grid_spacing = ("Secondary Grid Spacing set", "Secondary Grid Spacing not set") - sphere_material_component_added = ("Sphere Material component added", "Sphere Material component wasn't added") - sphere_material_set = ("Sphere Material Asset was set", "Sphere Material Asset wasn't set") - sphere_mesh_asset_set = ("Sphere Mesh Asset was set", "Sphere Mesh Asset wasn't set") - viewport_set = ("Viewport set to correct size", "Viewport not set to correct size") +class Tests: + camera_component_added = ( + "Camera component was added", + "Camera component wasn't added") + camera_fov_set = ( + "Camera component FOV property set", + "Camera component FOV property wasn't set") + directional_light_component_added = ( + "Directional Light component added", + "Directional Light component wasn't added") + enter_game_mode = ( + "Entered game mode", + "Failed to enter game mode") + exit_game_mode = ( + "Exited game mode", + "Couldn't exit game mode") + global_skylight_component_added = ( + "Global Skylight (IBL) component added", + "Global Skylight (IBL) component wasn't added") + global_skylight_diffuse_image_set = ( + "Global Skylight Diffuse Image property set", + "Global Skylight Diffuse Image property wasn't set") + global_skylight_specular_image_set = ( + "Global Skylight Specular Image property set", + "Global Skylight Specular Image property wasn't set") + ground_plane_material_asset_set = ( + "Ground Plane Material Asset was set", + "Ground Plane Material Asset wasn't set") + ground_plane_material_component_added = ( + "Ground Plane Material component added", + "Ground Plane Material component wasn't added") + ground_plane_mesh_asset_set = ( + "Ground Plane Mesh Asset property was set", + "Ground Plane Mesh Asset property wasn't set") + hdri_skybox_component_added = ( + "HDRi Skybox component added", + "HDRi Skybox component wasn't added") + hdri_skybox_cubemap_texture_set = ( + "HDRi Skybox Cubemap Texture property set", + "HDRi Skybox Cubemap Texture property wasn't set") + mesh_component_added = ( + "Mesh component added", + "Mesh component wasn't added") + no_assert_occurred = ( + "No asserts detected", + "Asserts were detected") + no_error_occurred = ( + "No errors detected", + "Errors were detected") + secondary_grid_spacing = ( + "Secondary Grid Spacing set", + "Secondary Grid Spacing not set") + sphere_material_component_added = ( + "Sphere Material component added", + "Sphere Material component wasn't added") + sphere_material_set = ( + "Sphere Material Asset was set", + "Sphere Material Asset wasn't set") + sphere_mesh_asset_set = ( + "Sphere Mesh Asset was set", + "Sphere Mesh Asset wasn't set") + viewport_set = ( + "Viewport set to correct size", + "Viewport not set to correct size") # fmt: on @@ -77,12 +119,11 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): import os from math import isclose - import azlmbr.asset as asset - import azlmbr.bus as bus import azlmbr.legacy.general as general import azlmbr.math as math import azlmbr.paths + from editor_python_test_tools.asset_utils import Asset from editor_python_test_tools.editor_entity_utils import EditorEntity from editor_python_test_tools.utils import Report, Tracer, TestHelper as helper @@ -98,6 +139,11 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): def initial_viewport_setup(screen_width, screen_height): general.set_viewport_size(screen_width, screen_height) general.update_viewport() + helper.wait_for_condition( + function=lambda: isclose(a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) + and isclose(a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1), + timeout_in_seconds=4.0 + ) result = isclose( a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) and isclose( a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1) @@ -151,11 +197,10 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): # 8. Set the Cubemap Texture property of the HDRi Skybox component. global_skylight_image_asset_path = os.path.join( "LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage") - global_skylight_image_asset = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", global_skylight_image_asset_path, math.Uuid(), False) + global_skylight_image_asset = Asset.find_asset_by_path(global_skylight_image_asset_path, False) hdri_skybox_cubemap_texture_property = "Controller|Configuration|Cubemap Texture" hdri_skybox_component.set_component_property_value( - hdri_skybox_cubemap_texture_property, global_skylight_image_asset) + hdri_skybox_cubemap_texture_property, global_skylight_image_asset.id) Report.result( Tests.hdri_skybox_cubemap_texture_set, hdri_skybox_component.get_component_property_value( @@ -191,11 +236,10 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): # 12. Set the Material Asset property of the Material component for the Ground Plane Entity. ground_plane_entity.set_local_uniform_scale(32.0) ground_plane_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_chrome.azmaterial") - ground_plane_material_asset = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", ground_plane_material_asset_path, math.Uuid(), False) + ground_plane_material_asset = Asset.find_asset_by_path(ground_plane_material_asset_path, False) ground_plane_material_asset_property = "Default Material|Material Asset" ground_plane_material_component.set_component_property_value( - ground_plane_material_asset_property, ground_plane_material_asset) + ground_plane_material_asset_property, ground_plane_material_asset.id) Report.result( Tests.ground_plane_material_asset_set, ground_plane_material_component.get_component_property_value( @@ -205,11 +249,10 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): ground_plane_mesh_component = ground_plane_entity.add_component(MESH_COMPONENT_NAME) Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(MESH_COMPONENT_NAME)) ground_plane_mesh_asset_path = os.path.join("Objects", "plane.azmodel") - ground_plane_mesh_asset = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", ground_plane_mesh_asset_path, math.Uuid(), False) + ground_plane_mesh_asset = Asset.find_asset_by_path(ground_plane_mesh_asset_path, False) ground_plane_mesh_asset_property = "Controller|Configuration|Mesh Asset" ground_plane_mesh_component.set_component_property_value( - ground_plane_mesh_asset_property, ground_plane_mesh_asset) + ground_plane_mesh_asset_property, ground_plane_mesh_asset.id) Report.result( Tests.ground_plane_mesh_asset_set, ground_plane_mesh_component.get_component_property_value( @@ -235,20 +278,18 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): # 17. Set the Material Asset property of the Material component for the Sphere Entity. sphere_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_brass_polished.azmaterial") - sphere_material_asset = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", sphere_material_asset_path, math.Uuid(), False) + sphere_material_asset = Asset.find_asset_by_path(sphere_material_asset_path, False) sphere_material_asset_property = "Default Material|Material Asset" - sphere_material_component.set_component_property_value(sphere_material_asset_property, sphere_material_asset) + sphere_material_component.set_component_property_value(sphere_material_asset_property, sphere_material_asset.id) Report.result(Tests.sphere_material_set, sphere_material_component.get_component_property_value( sphere_material_asset_property) == sphere_material_asset) # 18. Add Mesh component to Sphere Entity and set the Mesh Asset property for the Mesh component. sphere_mesh_component = sphere_entity.add_component(MESH_COMPONENT_NAME) sphere_mesh_asset_path = os.path.join("Models", "sphere.azmodel") - sphere_mesh_asset = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", sphere_mesh_asset_path, math.Uuid(), False) + sphere_mesh_asset = Asset.find_asset_by_path(sphere_mesh_asset_path, False) sphere_mesh_asset_property = "Controller|Configuration|Mesh Asset" - sphere_mesh_component.set_component_property_value(sphere_mesh_asset_property, sphere_mesh_asset) + sphere_mesh_component.set_component_property_value(sphere_mesh_asset_property, sphere_mesh_asset.id) Report.result(Tests.sphere_mesh_asset_set, sphere_mesh_component.get_component_property_value( sphere_mesh_asset_property) == sphere_mesh_asset) From 06ac3049681b7ec5200d7d60ba440550e658d50b Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 4 Nov 2021 13:53:27 -0700 Subject: [PATCH 02/12] use smaller asset files, fix asset to use asset.id for tests Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../tests/hydra_AtomGPU_BasicLevelSetup.py | 122 +++++++++--------- .../tests/hydra_GPUTest_BasicLevelSetup.py | 3 +- 2 files changed, 60 insertions(+), 65 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py index ad9758d57c..80244c44af 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py @@ -127,10 +127,9 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): from editor_python_test_tools.editor_entity_utils import EditorEntity from editor_python_test_tools.utils import Report, Tracer, TestHelper as helper + from Atom.atom_utils.atom_constants import AtomComponentProperties from Atom.atom_utils.screenshot_utils import ScreenshotHelper - MATERIAL_COMPONENT_NAME = "Material" - MESH_COMPONENT_NAME = "Mesh" SCREENSHOT_NAME = "AtomBasicLevelSetup" SCREEN_WIDTH = 1280 SCREEN_HEIGHT = 720 @@ -141,14 +140,9 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): general.update_viewport() helper.wait_for_condition( function=lambda: isclose(a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) - and isclose(a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1), + and isclose(a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1), timeout_in_seconds=4.0 ) - result = isclose( - a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) and isclose( - a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1) - - return result with Tracer() as error_tracer: # Test setup begins. @@ -160,8 +154,8 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): # 1. Close error windows and display helpers then update the viewport size. helper.close_error_windows() helper.close_display_helpers() + initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT) general.update_viewport() - Report.critical_result(Tests.viewport_set, initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT)) # 2. Create Default Level Entity. default_level_entity_name = "Default Level" @@ -169,12 +163,11 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): math.Vector3(0.0, 0.0, 0.0), default_level_entity_name) # 3. Create Grid Entity as a child entity of the Default Level Entity. - grid_name = "Grid" - grid_entity = EditorEntity.create_editor_entity(grid_name, default_level_entity.id) + grid_entity = EditorEntity.create_editor_entity(AtomComponentProperties.grid(), default_level_entity.id) # 4. Add Grid component to Grid Entity and set Secondary Grid Spacing. - grid_component = grid_entity.add_component(grid_name) - secondary_grid_spacing_property = "Controller|Configuration|Secondary Grid Spacing" + grid_component = grid_entity.add_component(AtomComponentProperties.grid()) + secondary_grid_spacing_property = AtomComponentProperties.grid('Secondary Grid Spacing') secondary_grid_spacing_value = 1.0 grid_component.set_component_property_value(secondary_grid_spacing_property, secondary_grid_spacing_value) secondary_grid_spacing_set = grid_component.get_component_property_value( @@ -182,134 +175,137 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): Report.result(Tests.secondary_grid_spacing, secondary_grid_spacing_set) # 5. Create Global Skylight (IBL) Entity as a child entity of the Default Level Entity. - global_skylight_name = "Global Skylight (IBL)" - global_skylight_entity = EditorEntity.create_editor_entity(global_skylight_name, default_level_entity.id) + global_skylight_entity = EditorEntity.create_editor_entity( + AtomComponentProperties.global_skylight(), default_level_entity.id) # 6. Add HDRi Skybox component to the Global Skylight (IBL) Entity. - hdri_skybox_name = "HDRi Skybox" - hdri_skybox_component = global_skylight_entity.add_component(hdri_skybox_name) - Report.result(Tests.hdri_skybox_component_added, global_skylight_entity.has_component(hdri_skybox_name)) + hdri_skybox_component = global_skylight_entity.add_component(AtomComponentProperties.hdri_skybox()) + Report.result(Tests.hdri_skybox_component_added, global_skylight_entity.has_component( + AtomComponentProperties.hdri_skybox())) # 7. Add Global Skylight (IBL) component to the Global Skylight (IBL) Entity. - global_skylight_component = global_skylight_entity.add_component(global_skylight_name) - Report.result(Tests.global_skylight_component_added, global_skylight_entity.has_component(global_skylight_name)) + global_skylight_component = global_skylight_entity.add_component(AtomComponentProperties.global_skylight()) + Report.result(Tests.global_skylight_component_added, global_skylight_entity.has_component( + AtomComponentProperties.global_skylight())) # 8. Set the Cubemap Texture property of the HDRi Skybox component. - global_skylight_image_asset_path = os.path.join( - "LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage") + global_skylight_image_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") global_skylight_image_asset = Asset.find_asset_by_path(global_skylight_image_asset_path, False) - hdri_skybox_cubemap_texture_property = "Controller|Configuration|Cubemap Texture" hdri_skybox_component.set_component_property_value( - hdri_skybox_cubemap_texture_property, global_skylight_image_asset.id) + AtomComponentProperties.hdri_skybox('Cubemap Texture'), global_skylight_image_asset.id) Report.result( Tests.hdri_skybox_cubemap_texture_set, hdri_skybox_component.get_component_property_value( - hdri_skybox_cubemap_texture_property) == global_skylight_image_asset) + AtomComponentProperties.hdri_skybox('Cubemap Texture')) == global_skylight_image_asset.id) # 9. Set the Diffuse Image property of the Global Skylight (IBL) component. # Re-use the same image that was used in the previous test step. - global_skylight_diffuse_image_property = "Controller|Configuration|Diffuse Image" + global_skylight_diffuse_image_asset_path = os.path.join( + "LightingPresets", "default_iblskyboxcm_ibldiffuse.exr.streamingimage") + global_skylight_diffuse_image_asset = Asset.find_asset_by_path(global_skylight_diffuse_image_asset_path, False) global_skylight_component.set_component_property_value( - global_skylight_diffuse_image_property, global_skylight_image_asset) + AtomComponentProperties.global_skylight('Diffuse Image'), global_skylight_diffuse_image_asset.id) Report.result( Tests.global_skylight_diffuse_image_set, global_skylight_component.get_component_property_value( - global_skylight_diffuse_image_property) == global_skylight_image_asset) + AtomComponentProperties.global_skylight('Diffuse Image')) == global_skylight_diffuse_image_asset.id) # 10. Set the Specular Image property of the Global Skylight (IBL) component. # Re-use the same image that was used in the previous test step. - global_skylight_specular_image_property = "Controller|Configuration|Specular Image" + global_skylight_specular_image_asset_path = os.path.join( + "LightingPresets", "default_iblskyboxcm_iblspecular.exr.streamingimage") + global_skylight_specular_image_asset = Asset.find_asset_by_path( + global_skylight_specular_image_asset_path, False) global_skylight_component.set_component_property_value( - global_skylight_specular_image_property, global_skylight_image_asset) + AtomComponentProperties.global_skylight('Specular Image'), global_skylight_specular_image_asset.id) global_skylight_specular_image_set = global_skylight_component.get_component_property_value( - global_skylight_specular_image_property) + AtomComponentProperties.global_skylight('Specular Image')) Report.result( - Tests.global_skylight_specular_image_set, global_skylight_specular_image_set == global_skylight_image_asset) + Tests.global_skylight_specular_image_set, + global_skylight_specular_image_set == global_skylight_specular_image_asset.id) # 11. Create a Ground Plane Entity with a Material component that is a child entity of the Default Level Entity. ground_plane_name = "Ground Plane" ground_plane_entity = EditorEntity.create_editor_entity(ground_plane_name, default_level_entity.id) - ground_plane_material_component = ground_plane_entity.add_component(MATERIAL_COMPONENT_NAME) + ground_plane_material_component = ground_plane_entity.add_component(AtomComponentProperties.material()) Report.result( - Tests.ground_plane_material_component_added, ground_plane_entity.has_component(MATERIAL_COMPONENT_NAME)) + Tests.ground_plane_material_component_added, + ground_plane_entity.has_component(AtomComponentProperties.material())) # 12. Set the Material Asset property of the Material component for the Ground Plane Entity. ground_plane_entity.set_local_uniform_scale(32.0) ground_plane_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_chrome.azmaterial") ground_plane_material_asset = Asset.find_asset_by_path(ground_plane_material_asset_path, False) - ground_plane_material_asset_property = "Default Material|Material Asset" ground_plane_material_component.set_component_property_value( - ground_plane_material_asset_property, ground_plane_material_asset.id) + AtomComponentProperties.material('Material Asset'), ground_plane_material_asset.id) Report.result( Tests.ground_plane_material_asset_set, ground_plane_material_component.get_component_property_value( - ground_plane_material_asset_property) == ground_plane_material_asset) + AtomComponentProperties.material('Material Asset')) == ground_plane_material_asset.id) # 13. Add the Mesh component to the Ground Plane Entity and set the Mesh component Mesh Asset property. - ground_plane_mesh_component = ground_plane_entity.add_component(MESH_COMPONENT_NAME) - Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(MESH_COMPONENT_NAME)) - ground_plane_mesh_asset_path = os.path.join("Objects", "plane.azmodel") + ground_plane_mesh_component = ground_plane_entity.add_component(AtomComponentProperties.mesh()) + Report.result(Tests.mesh_component_added, ground_plane_entity.has_component(AtomComponentProperties.mesh())) + ground_plane_mesh_asset_path = os.path.join("TestData", "Objects", "plane.azmodel") ground_plane_mesh_asset = Asset.find_asset_by_path(ground_plane_mesh_asset_path, False) - ground_plane_mesh_asset_property = "Controller|Configuration|Mesh Asset" ground_plane_mesh_component.set_component_property_value( - ground_plane_mesh_asset_property, ground_plane_mesh_asset.id) + AtomComponentProperties.mesh('Mesh Asset'), ground_plane_mesh_asset.id) Report.result( Tests.ground_plane_mesh_asset_set, ground_plane_mesh_component.get_component_property_value( - ground_plane_mesh_asset_property) == ground_plane_mesh_asset) + AtomComponentProperties.mesh('Mesh Asset')) == ground_plane_mesh_asset.id) # 14. Create a Directional Light Entity as a child entity of the Default Level Entity. - directional_light_name = "Directional Light" directional_light_entity = EditorEntity.create_editor_entity_at( - math.Vector3(0.0, 0.0, 10.0), directional_light_name, default_level_entity.id) + math.Vector3(0.0, 0.0, 10.0), AtomComponentProperties.directional_light(), default_level_entity.id) # 15. Add Directional Light component to Directional Light Entity and set entity rotation. - directional_light_entity.add_component(directional_light_name) + directional_light_entity.add_component(AtomComponentProperties.directional_light()) directional_light_entity_rotation = math.Vector3(DEGREE_RADIAN_FACTOR * -90.0, 0.0, 0.0) directional_light_entity.set_local_rotation(directional_light_entity_rotation) Report.result( - Tests.directional_light_component_added, directional_light_entity.has_component(directional_light_name)) + Tests.directional_light_component_added, directional_light_entity.has_component( + AtomComponentProperties.directional_light())) # 16. Create a Sphere Entity as a child entity of the Default Level Entity then add a Material component. sphere_entity = EditorEntity.create_editor_entity_at( math.Vector3(0.0, 0.0, 1.0), "Sphere", default_level_entity.id) - sphere_material_component = sphere_entity.add_component(MATERIAL_COMPONENT_NAME) - Report.result(Tests.sphere_material_component_added, sphere_entity.has_component(MATERIAL_COMPONENT_NAME)) + sphere_material_component = sphere_entity.add_component(AtomComponentProperties.material()) + Report.result(Tests.sphere_material_component_added, sphere_entity.has_component( + AtomComponentProperties.material())) # 17. Set the Material Asset property of the Material component for the Sphere Entity. sphere_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_brass_polished.azmaterial") sphere_material_asset = Asset.find_asset_by_path(sphere_material_asset_path, False) - sphere_material_asset_property = "Default Material|Material Asset" - sphere_material_component.set_component_property_value(sphere_material_asset_property, sphere_material_asset.id) + sphere_material_component.set_component_property_value( + AtomComponentProperties.material('Material Asset'), sphere_material_asset.id) Report.result(Tests.sphere_material_set, sphere_material_component.get_component_property_value( - sphere_material_asset_property) == sphere_material_asset) + AtomComponentProperties.material('Material Asset')) == sphere_material_asset.id) # 18. Add Mesh component to Sphere Entity and set the Mesh Asset property for the Mesh component. - sphere_mesh_component = sphere_entity.add_component(MESH_COMPONENT_NAME) + sphere_mesh_component = sphere_entity.add_component(AtomComponentProperties.mesh()) sphere_mesh_asset_path = os.path.join("Models", "sphere.azmodel") sphere_mesh_asset = Asset.find_asset_by_path(sphere_mesh_asset_path, False) - sphere_mesh_asset_property = "Controller|Configuration|Mesh Asset" - sphere_mesh_component.set_component_property_value(sphere_mesh_asset_property, sphere_mesh_asset.id) + sphere_mesh_component.set_component_property_value( + AtomComponentProperties.mesh('Mesh Asset'), sphere_mesh_asset.id) Report.result(Tests.sphere_mesh_asset_set, sphere_mesh_component.get_component_property_value( - sphere_mesh_asset_property) == sphere_mesh_asset) + AtomComponentProperties.mesh('Mesh Asset')) == sphere_mesh_asset.id) # 19. Create a Camera Entity as a child entity of the Default Level Entity then add a Camera component. - camera_name = "Camera" camera_entity = EditorEntity.create_editor_entity_at( - math.Vector3(5.5, -12.0, 9.0), camera_name, default_level_entity.id) - camera_component = camera_entity.add_component(camera_name) - Report.result(Tests.camera_component_added, camera_entity.has_component(camera_name)) + math.Vector3(5.5, -12.0, 9.0), AtomComponentProperties.camera(), default_level_entity.id) + camera_component = camera_entity.add_component(AtomComponentProperties.camera()) + Report.result(Tests.camera_component_added, camera_entity.has_component(AtomComponentProperties.camera())) # 20. Set the Camera Entity rotation value and set the Camera component Field of View value. camera_entity_rotation = math.Vector3( DEGREE_RADIAN_FACTOR * -27.0, DEGREE_RADIAN_FACTOR * -12.0, DEGREE_RADIAN_FACTOR * 25.0) camera_entity.set_local_rotation(camera_entity_rotation) - camera_fov_property = "Controller|Configuration|Field of view" camera_fov_value = 60.0 - camera_component.set_component_property_value(camera_fov_property, camera_fov_value) + camera_component.set_component_property_value(AtomComponentProperties.camera('Field of view'), camera_fov_value) azlmbr.camera.EditorCameraViewRequestBus(azlmbr.bus.Event, "ToggleCameraAsActiveView", camera_entity.id) Report.result(Tests.camera_fov_set, camera_component.get_component_property_value( - camera_fov_property) == camera_fov_value) + AtomComponentProperties.camera('Field of view')) == camera_fov_value) # 21. Enter game mode. helper.enter_game_mode(Tests.enter_game_mode) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_GPUTest_BasicLevelSetup.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_GPUTest_BasicLevelSetup.py index 645447e6de..1641b529ae 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_GPUTest_BasicLevelSetup.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_GPUTest_BasicLevelSetup.py @@ -106,8 +106,7 @@ def run(): components=["HDRi Skybox", "Global Skylight (IBL)"], parent_id=default_level.id ) - global_skylight_image_asset_path = os.path.join( - "LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage") + global_skylight_image_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") global_skylight_image_asset = asset.AssetCatalogRequestBus( bus.Broadcast, "GetAssetIdByPath", global_skylight_image_asset_path, math.Uuid(), False) global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_image_asset) From fc3d2ce94cdca041d3aa896dfd487dc3480fea7e Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Fri, 5 Nov 2021 16:36:45 -0700 Subject: [PATCH 03/12] drop the 'as helper' for TestHelper and re-factor the helper. calls to TestHelper. Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../tests/hydra_AtomGPU_BasicLevelSetup.py | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py index 80244c44af..69fa9456f8 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py @@ -6,7 +6,6 @@ SPDX-License-Identifier: Apache-2.0 OR MIT """ -# fmt: off class Tests: camera_component_added = ( "Camera component was added", @@ -125,7 +124,7 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): from editor_python_test_tools.asset_utils import Asset from editor_python_test_tools.editor_entity_utils import EditorEntity - from editor_python_test_tools.utils import Report, Tracer, TestHelper as helper + from editor_python_test_tools.utils import Report, Tracer, TestHelper from Atom.atom_utils.atom_constants import AtomComponentProperties from Atom.atom_utils.screenshot_utils import ScreenshotHelper @@ -138,7 +137,7 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): def initial_viewport_setup(screen_width, screen_height): general.set_viewport_size(screen_width, screen_height) general.update_viewport() - helper.wait_for_condition( + TestHelper.wait_for_condition( function=lambda: isclose(a=general.get_viewport_size().x, b=SCREEN_WIDTH, rel_tol=0.1) and isclose(a=general.get_viewport_size().y, b=SCREEN_HEIGHT, rel_tol=0.1), timeout_in_seconds=4.0 @@ -147,13 +146,13 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): with Tracer() as error_tracer: # Test setup begins. # Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level. - helper.init_idle() - helper.open_level("", "Base") + TestHelper.init_idle() + TestHelper.open_level("", "Base") # Test steps begin. # 1. Close error windows and display helpers then update the viewport size. - helper.close_error_windows() - helper.close_display_helpers() + TestHelper.close_error_windows() + TestHelper.close_display_helpers() initial_viewport_setup(SCREEN_WIDTH, SCREEN_HEIGHT) general.update_viewport() @@ -308,20 +307,22 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): AtomComponentProperties.camera('Field of view')) == camera_fov_value) # 21. Enter game mode. - helper.enter_game_mode(Tests.enter_game_mode) - helper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0) + TestHelper.enter_game_mode(Tests.enter_game_mode) + TestHelper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0) # 22. Take screenshot. ScreenshotHelper(general.idle_wait_frames).capture_screenshot_blocking(f"{SCREENSHOT_NAME}.ppm") # 23. Exit game mode. - helper.exit_game_mode(Tests.exit_game_mode) - helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0) + TestHelper.exit_game_mode(Tests.exit_game_mode) + TestHelper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0) # 24. Look for errors. - helper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0) - Report.result(Tests.no_assert_occurred, not error_tracer.has_asserts) - Report.result(Tests.no_error_occurred, not error_tracer.has_errors) + TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0) + for error_info in error_tracer.errors: + Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}") + for assert_info in error_tracer.asserts: + Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}") if __name__ == "__main__": From 35e1317d906dbd00794f34603f5bb8cc3929507d Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Fri, 5 Nov 2021 17:05:22 -0700 Subject: [PATCH 04/12] add new component property paths to mesh, material, camera, hdri_skybox, and global_skylight components Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/atom_utils/atom_constants.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py index 70156b9375..870b565bc3 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py @@ -62,6 +62,7 @@ class AtomComponentProperties: """ properties = { 'name': 'Camera', + 'Field of view': 'Controller|Configuration|Field of view' } return properties[property] @@ -207,6 +208,7 @@ class AtomComponentProperties: """ properties = { 'name': 'Grid', + 'Secondary Grid Spacing': 'Controller|Configuration|Secondary Grid Spacing', } return properties[property] @@ -236,6 +238,7 @@ class AtomComponentProperties: """ properties = { 'name': 'HDRi Skybox', + 'Cubemap Texture': 'Controller|Configuration|Cubemap Texture', } return properties[property] @@ -280,6 +283,7 @@ class AtomComponentProperties: properties = { 'name': 'Material', 'requires': [AtomComponentProperties.actor(), AtomComponentProperties.mesh()], + 'Material Asset': 'Default Material|Material Asset', } return properties[property] From 5c566505167c52991e3ee6ef49f6b99fb7c6e972 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Mon, 8 Nov 2021 17:52:25 -0800 Subject: [PATCH 05/12] add new golden image that uses smaller asset file Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/golden_images/AtomBasicLevelSetup.ppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AtomBasicLevelSetup.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AtomBasicLevelSetup.ppm index ef41b6cf77..acfbe57900 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AtomBasicLevelSetup.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AtomBasicLevelSetup.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:07e09d3eb5bf0cee3d9b3752aaad40f3ead1dcc5ddd837a6226fadde55d57274 +oid sha256:5d4ee5641e19eef08dd6b93d2f4054a1aae2165325416ed2cbf0b8243f2c0b06 size 6220817 From 6d206f69212306bfd3ec36f5f9c385d02407901b Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Tue, 9 Nov 2021 14:59:43 -0800 Subject: [PATCH 06/12] saving progress on test fixes to swap branches Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py | 2 +- .../PythonTests/Atom/atom_utils/atom_component_helper.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py index 39fca5c7e4..568768e12e 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py @@ -16,7 +16,7 @@ from .atom_utils.atom_component_helper import create_screenshots_archive, golden DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots' -# @pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.parametrize("project", ["AutomatedTesting"]) @pytest.mark.parametrize("launcher_platform", ['windows_editor']) class TestAutomation(EditorTestSuite): diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py index 50cc15f7e8..c24f514c49 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py @@ -172,10 +172,9 @@ def create_basic_atom_level(level_name): entity_position=default_position, components=["HDRi Skybox", "Global Skylight (IBL)"], parent_id=default_level.id) - global_skylight_asset_path = os.path.join( - "LightingPresets", "greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage") - global_skylight_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", global_skylight_asset_path, math.Uuid(), False) + global_skylight_cubemap_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") + global_skylight_cubemap_asset_value = asset.AssetCatalogRequestBus( + bus.Broadcast, "GetAssetIdByPath", global_skylight_cubemap_asset_path, math.Uuid(), False) global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_asset_value) global_skylight.get_set_test(1, "Controller|Configuration|Diffuse Image", global_skylight_asset_value) global_skylight.get_set_test(1, "Controller|Configuration|Specular Image", global_skylight_asset_value) From 51cf98c23d7ef0efcfc51a0474c57d3c63730c53 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 11 Nov 2021 11:36:42 -0800 Subject: [PATCH 07/12] update golden images for spot light and area light tests, update asset used Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../PythonTests/Atom/atom_utils/atom_component_helper.py | 6 +++--- .../Gem/PythonTests/Atom/golden_images/AreaLight_1.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/AreaLight_2.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/AreaLight_3.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/AreaLight_4.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/AreaLight_5.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/SpotLight_1.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/SpotLight_2.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/SpotLight_3.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/SpotLight_4.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/SpotLight_5.ppm | 2 +- .../Gem/PythonTests/Atom/golden_images/SpotLight_6.ppm | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py index c24f514c49..9f37873557 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py @@ -172,9 +172,9 @@ def create_basic_atom_level(level_name): entity_position=default_position, components=["HDRi Skybox", "Global Skylight (IBL)"], parent_id=default_level.id) - global_skylight_cubemap_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") - global_skylight_cubemap_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", global_skylight_cubemap_asset_path, math.Uuid(), False) + global_skylight_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") + global_skylight_asset_value = asset.AssetCatalogRequestBus( + bus.Broadcast, "GetAssetIdByPath", global_skylight_asset_path, math.Uuid(), False) global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_asset_value) global_skylight.get_set_test(1, "Controller|Configuration|Diffuse Image", global_skylight_asset_value) global_skylight.get_set_test(1, "Controller|Configuration|Specular Image", global_skylight_asset_value) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_1.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_1.ppm index 0725999dcf..8695f6bb93 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_1.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_1.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:954d7d0df47c840a24e313893800eb3126d0c0d47c3380926776b51833778db7 +oid sha256:aee1fd4d5264e5ef1676b507409ce70af6358cf1ff368d9aeb17f7b2597dfbca size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_2.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_2.ppm index 3a45bd31e3..d45d3f1581 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_2.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_2.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e81c19128f42ba362a2d5f3ccf159dfbc942d67ceeb1ac8c21f295a6fd9d2ce5 +oid sha256:d4787cdafbcc2fe71c1cb3f1da53a249db839a9df539a9e88be43ccd6d8e4d6a size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_3.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_3.ppm index 15d679b784..0661ead69f 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_3.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_3.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e20801213e065b6ea8c95ede81c23faa9b6dc70a2002dc5bced293e1bed989f +oid sha256:5fac5bf41c9b16b6fbd762868e5cf514376af92d6ef7ebb9e819f024f1a3e1a7 size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_4.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_4.ppm index 85c083a386..a7fc77f0ec 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_4.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_4.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e250f812e594e5152bf2d6f23caa8b53b78276bfdf344d7a8d355dd96cb995c0 +oid sha256:7a23969670499524725535e8be7428b55b6f3e887cc24e2e903f7ea821a6d1a5 size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_5.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_5.ppm index d575de761e..7404ab3ccc 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_5.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/AreaLight_5.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95be359041f8291c74b335297a4dfe9902a180510f24a181b15e1a5ba4d3b024 +oid sha256:2f1f4d8865c56ed7f96f339c39e5feb4e0dbc6c6a8b4a7843b4166381b06b00d size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_1.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_1.ppm index bbbd127929..3104088689 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_1.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_1.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:118e43e4b915e262726183467cc4b82f244565213fea5b6bfe02be07f0851ab1 +oid sha256:55c8f0d1790bb12660b7557630efca297b2a1b59e6c93167a2563da79e0a8255 size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_2.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_2.ppm index 8e716fabcc..287ec406e1 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_2.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_2.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc2ce3256a6552975962c9e113c52c1a22bf3817d417151f6f60640dd568e0fa +oid sha256:082ff368b621e12b083d96562a0889b11a1d683767a74296cbe6d8732830e9e8 size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_3.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_3.ppm index 6b6a5a5d6e..9de8785f65 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_3.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_3.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:287d98890b35427688999760f9d066bcbff1a3bc9001534241dc212b32edabd8 +oid sha256:78cc62d89782899747875b41abee57c2efdfacf4c8af6511c88f82d76eaae4ca size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_4.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_4.ppm index eb05228cc2..93acc14dbc 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_4.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_4.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66e91c92c868167c850078cd91714db47e10a96e23cc30191994486bd79c353f +oid sha256:3d6719326f4dacae278d1723090ce1182193b793f250963af8be4b2c298e8841 size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_5.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_5.ppm index 5e12edc46d..9cd58caae5 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_5.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_5.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d950d173f5101820c5e18205401ca08ce5feeff2302ac2920b292750d86a8fa4 +oid sha256:9e492bb394fb18fb117f8a5b61cd2789922f9d6e88fc83189b5b6d59ffb1c3ef size 6220817 diff --git a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_6.ppm b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_6.ppm index d442d90287..136eecbaaf 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_6.ppm +++ b/AutomatedTesting/Gem/PythonTests/Atom/golden_images/SpotLight_6.ppm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72eddb7126eae0c839b933886e0fb69d78229f72d49ef13199de28df2b7879db +oid sha256:caca85f7728f660daae36afc81d681ba2de2377c516eb3c637599de5c94012aa size 6220817 From 01081fea32b159bde20f92ed5e87baeb1e9dd901 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 11 Nov 2021 11:55:04 -0800 Subject: [PATCH 08/12] update asset called in global skylight test as well Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../hydra_AtomEditorComponents_GlobalSkylightIBLAdded.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_GlobalSkylightIBLAdded.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_GlobalSkylightIBLAdded.py index db8f2daaee..7f0c38e289 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_GlobalSkylightIBLAdded.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_GlobalSkylightIBLAdded.py @@ -151,7 +151,7 @@ def AtomEditorComponents_GlobalSkylightIBL_AddedToEntity(): Report.result(Tests.is_visible, global_skylight_entity.is_visible() is True) # 8. Set the Diffuse Image asset on the Global Skylight (IBL) entity. - diffuse_image_path = os.path.join("LightingPresets", "greenwich_park_02_4k_iblskyboxcm.exr.streamingimage") + diffuse_image_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") diffuse_image_asset = Asset.find_asset_by_path(diffuse_image_path, False) global_skylight_component.set_component_property_value( AtomComponentProperties.global_skylight('Diffuse Image'), diffuse_image_asset.id) @@ -161,7 +161,7 @@ def AtomEditorComponents_GlobalSkylightIBL_AddedToEntity(): AtomComponentProperties.global_skylight('Diffuse Image'))) # 9. Set the Specular Image asset on the Global Light (IBL) entity. - specular_image_path = os.path.join("LightingPresets", "greenwich_park_02_4k_iblskyboxcm.exr.streamingimage") + specular_image_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") specular_image_asset = Asset.find_asset_by_path(specular_image_path, False) global_skylight_component.set_component_property_value( AtomComponentProperties.global_skylight('Specular Image'), specular_image_asset.id) From ad81c311d8effdeba5796bfd9b57f40816052cb9 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:23:38 -0800 Subject: [PATCH 09/12] add some docstring descriptions for Cubemap Texture, Material Asset, Secondary Grid Spacing, & Field of View component properties Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/atom_utils/atom_constants.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py index eead1bce21..0600b0cbc4 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py @@ -58,6 +58,7 @@ class AtomComponentProperties: """ Camera component properties. :param property: From the last element of the property tree path. Default 'name' for component name string. + - 'Field of view': Sets the value for the camera's FOV (Field of View), i.e. 60.0 :return: Full property path OR component name if no property specified. """ properties = { @@ -204,6 +205,7 @@ class AtomComponentProperties: """ Grid component properties. :param property: From the last element of the property tree path. Default 'name' for component name string. + - 'Secondary Grid Spacing': The spacing value for the secondary grid, i.e. 1.0 :return: Full property path OR component name if no property specified. """ properties = { @@ -234,6 +236,7 @@ class AtomComponentProperties: """ HDRi Skybox component properties. :param property: From the last element of the property tree path. Default 'name' for component name string. + - 'Cubemap Texture': Path to the asset file to use for the cubemap texture asset. :return: Full property path OR component name if no property specified. """ properties = { @@ -277,6 +280,7 @@ class AtomComponentProperties: Material component properties. Requires one of Actor OR Mesh component. - 'requires' a list of component names as strings required by this component. Only one of these is required at a time for this component.\n + - 'Material Asset': Path to the material asset file to use as the material asset. :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """ From d7c31184dc9616dcdd7cc78778429307bc994959 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:57:11 -0800 Subject: [PATCH 10/12] add AtomComponentProperties.grid('Secondary Grid Spacing') direct call, remove fmt:on comment Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Atom/tests/hydra_AtomGPU_BasicLevelSetup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py index 69fa9456f8..127b3e5b5f 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_BasicLevelSetup.py @@ -70,7 +70,6 @@ class Tests: viewport_set = ( "Viewport set to correct size", "Viewport not set to correct size") -# fmt: on def AtomGPU_BasicLevelSetup_SetsUpLevel(): @@ -166,11 +165,11 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel(): # 4. Add Grid component to Grid Entity and set Secondary Grid Spacing. grid_component = grid_entity.add_component(AtomComponentProperties.grid()) - secondary_grid_spacing_property = AtomComponentProperties.grid('Secondary Grid Spacing') secondary_grid_spacing_value = 1.0 - grid_component.set_component_property_value(secondary_grid_spacing_property, secondary_grid_spacing_value) + grid_component.set_component_property_value( + AtomComponentProperties.grid('Secondary Grid Spacing'), secondary_grid_spacing_value) secondary_grid_spacing_set = grid_component.get_component_property_value( - secondary_grid_spacing_property) == secondary_grid_spacing_value + AtomComponentProperties.grid('Secondary Grid Spacing')) == secondary_grid_spacing_value Report.result(Tests.secondary_grid_spacing, secondary_grid_spacing_set) # 5. Create Global Skylight (IBL) Entity as a child entity of the Default Level Entity. From 9edaa2172d412ac3cc924e70a63d027b2c5c20d0 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 11 Nov 2021 14:06:59 -0800 Subject: [PATCH 11/12] move component descriptions above the property param in the docstrings Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/atom_utils/atom_constants.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py index 0600b0cbc4..28297c025d 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py @@ -57,8 +57,8 @@ class AtomComponentProperties: def camera(property: str = 'name') -> str: """ Camera component properties. - :param property: From the last element of the property tree path. Default 'name' for component name string. - 'Field of view': Sets the value for the camera's FOV (Field of View), i.e. 60.0 + :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """ properties = { @@ -204,8 +204,8 @@ class AtomComponentProperties: def grid(property: str = 'name') -> str: """ Grid component properties. - :param property: From the last element of the property tree path. Default 'name' for component name string. - 'Secondary Grid Spacing': The spacing value for the secondary grid, i.e. 1.0 + :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """ properties = { @@ -235,8 +235,8 @@ class AtomComponentProperties: def hdri_skybox(property: str = 'name') -> str: """ HDRi Skybox component properties. - :param property: From the last element of the property tree path. Default 'name' for component name string. - 'Cubemap Texture': Path to the asset file to use for the cubemap texture asset. + :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """ properties = { From 96b42124397b65cd12382ffe69353f9fcf24b04f Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 11 Nov 2021 14:13:08 -0800 Subject: [PATCH 12/12] improve docstring descriptions for FOV degrees and Asset.id not asset paths for diff asset properties Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/atom_utils/atom_constants.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py index 28297c025d..6a32169040 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py @@ -57,7 +57,7 @@ class AtomComponentProperties: def camera(property: str = 'name') -> str: """ Camera component properties. - - 'Field of view': Sets the value for the camera's FOV (Field of View), i.e. 60.0 + - 'Field of view': Sets the value for the camera's FOV (Field of View) in degrees, i.e. 60.0 :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """ @@ -235,7 +235,7 @@ class AtomComponentProperties: def hdri_skybox(property: str = 'name') -> str: """ HDRi Skybox component properties. - - 'Cubemap Texture': Path to the asset file to use for the cubemap texture asset. + - 'Cubemap Texture': Asset.id for the cubemap texture to set. :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """ @@ -280,7 +280,7 @@ class AtomComponentProperties: Material component properties. Requires one of Actor OR Mesh component. - 'requires' a list of component names as strings required by this component. Only one of these is required at a time for this component.\n - - 'Material Asset': Path to the material asset file to use as the material asset. + - 'Material Asset': the material Asset.id of the material. :param property: From the last element of the property tree path. Default 'name' for component name string. :return: Full property path OR component name if no property specified. """