Merge remote-tracking branch 'upstream/main' into AtomDebugDisplayFixes

This commit is contained in:
rgba16f
2021-04-28 19:05:48 -05:00
905 changed files with 46270 additions and 76876 deletions
@@ -15,9 +15,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from ActorSplitsAfterDamage import Tests
def run():
from ActorSplitsAfterDamage import run as internal_run
from editor_python_test_tools.utils import Constants
def ActorSplitsAfterCapsuleDamage():
from ActorSplitsAfterDamage import base_run as internal_run
from BlastUtils import Constants
def CapsuleDamage(target_id, position0):
position1 = azlmbr.object.construct('Vector3', position0.x + 1.0, position0.y, position0.z)
@@ -30,4 +30,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterCapsuleDamage)
@@ -22,7 +22,7 @@ class Tests():
# fmt: on
def run():
def ActorSplitsAfterCollision():
"""
Summary:
@@ -60,8 +60,8 @@ def run():
import azlmbr.legacy.general as general
import azlmbr.bus
from editor_python_test_tools.utils import CollisionHandler
from editor_python_test_tools.utils import BlastNotificationHandler
from BlastUtils import CollisionHandler
from BlastUtils import BlastNotificationHandler
# Constants
TIMEOUT = 2.0
@@ -107,4 +107,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterCollision)
@@ -20,7 +20,7 @@ class Tests():
# fmt: on
def run(damage_func):
def base_run(damage_func):
"""
Summary:
@@ -56,7 +56,7 @@ def run(damage_func):
import azlmbr.legacy.general as general
import azlmbr.bus
from editor_python_test_tools.utils import BlastNotificationHandler
from BlastUtils import BlastNotificationHandler
# Constants
TIMEOUT = 2.0
@@ -15,9 +15,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from ActorSplitsAfterDamage import Tests
def run():
from ActorSplitsAfterDamage import run as internal_run
from editor_python_test_tools.utils import Constants
def ActorSplitsAfterImpactSpreadDamage():
from ActorSplitsAfterDamage import base_run as internal_run
from BlastUtils import Constants
def ImpactSpreadDamage(target_id, position):
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Impact Spread Damage", target_id,
@@ -28,4 +28,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterImpactSpreadDamage)
@@ -15,9 +15,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from ActorSplitsAfterDamage import Tests
def run():
from ActorSplitsAfterDamage import run as internal_run
from editor_python_test_tools.utils import Constants
def ActorSplitsAfterRadialDamage():
from ActorSplitsAfterDamage import base_run as internal_run
from BlastUtils import Constants
def RadialDamage(target_id, position):
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Radial Damage", target_id,
@@ -28,4 +28,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterRadialDamage)
@@ -15,9 +15,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from ActorSplitsAfterDamage import Tests
def run():
from ActorSplitsAfterDamage import run as internal_run
from editor_python_test_tools.utils import Constants
def ActorSplitsAfterShearDamage():
from ActorSplitsAfterDamage import base_run as internal_run
from BlastUtils import Constants
def ShearDamage(target_id, position):
normal = azlmbr.object.construct('Vector3', 1.0, 0.0, 0.0)
@@ -29,4 +29,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterShearDamage)
@@ -15,9 +15,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from ActorSplitsAfterDamage import Tests
def run():
from ActorSplitsAfterDamage import run as internal_run
from editor_python_test_tools.utils import Constants
def ActorSplitsAfterStressDamage():
from ActorSplitsAfterDamage import base_run as internal_run
from BlastUtils import Constants
def StressDamage(target_id, position):
force = azlmbr.object.construct('Vector3', 0.0, 0.0, -100.0) # Should be enough to break `brittle` objects
@@ -28,4 +28,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterStressDamage)
@@ -15,9 +15,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from ActorSplitsAfterDamage import Tests
def run():
from ActorSplitsAfterDamage import run as internal_run
from editor_python_test_tools.utils import Constants
def ActorSplitsAfterTriangleDamage():
from ActorSplitsAfterDamage import base_run as internal_run
from BlastUtils import Constants
def TriangleDamage(target_id, position):
# Some points that form a triangle that contains the given position
@@ -32,4 +32,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(ActorSplitsAfterTriangleDamage)
+21 -27
View File
@@ -95,23 +95,22 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
endif()
## White Box ##
# DISABLED - See LYN-2663
#if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
# ly_add_pytest(
# NAME AutomatedTesting::WhiteBoxTests
# TEST_SUITE main
# TEST_SERIAL
# PATH ${CMAKE_CURRENT_LIST_DIR}/WhiteBox/TestSuite_Active.py
# TIMEOUT 3600
# RUNTIME_DEPENDENCIES
# Legacy::Editor
# Legacy::CryRenderNULL
# AZ::AssetProcessor
# AutomatedTesting.Assets
# COMPONENT
# WhiteBox
# )
#endif()
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_pytest(
NAME AutomatedTesting::WhiteBoxTests
TEST_SUITE main
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/WhiteBox/TestSuite_Active.py
TIMEOUT 3600
RUNTIME_DEPENDENCIES
Legacy::Editor
Legacy::CryRenderNULL
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
WhiteBox
)
endif()
## NvCloth ##
# [TODO LYN-1928] Enable when AutomatedTesting runs with Atom
@@ -171,7 +170,7 @@ endif()
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_pytest(
NAME AutomatedTesting::BlastTests
TEST_SUITE periodic
TEST_SUITE main
TEST_SERIAL TRUE
PATH ${CMAKE_CURRENT_LIST_DIR}/Blast/TestSuite_Active.py
TIMEOUT 3600
@@ -179,6 +178,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT Blast
)
endif()
@@ -191,8 +191,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
## DynVeg ##
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Main_GPU
TEST_REQUIRES gpu
NAME AutomatedTesting::DynamicVegetationTests_Main
TEST_SERIAL
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
@@ -208,8 +207,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Sandbox_GPU
TEST_REQUIRES gpu
NAME AutomatedTesting::DynamicVegetationTests_Sandbox
TEST_SERIAL
TEST_SUITE sandbox
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
@@ -225,8 +223,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
)
ly_add_pytest(
NAME AutomatedTesting::DynamicVegetationTests_Periodic_GPU
TEST_REQUIRES gpu
NAME AutomatedTesting::DynamicVegetationTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/dyn_veg
@@ -243,7 +240,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
## LandscapeCanvas ##
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Main
TEST_REQUIRES gpu
TEST_SERIAL
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas
@@ -259,7 +255,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Periodic
TEST_REQUIRES gpu
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/landscape_canvas
@@ -276,7 +271,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
## GradientSignal ##
ly_add_pytest(
NAME AutomatedTesting::GradientSignalTests_Periodic
TEST_REQUIRES gpu
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/largeworlds/gradient_signal
@@ -32,7 +32,7 @@ def teardown_editor(editor):
def launch_and_validate_results(request, test_directory, editor, editor_script, expected_lines, unexpected_lines=[],
halt_on_unexpected=False, run_python="--runpythontest", auto_test_mode=True, null_renderer=False, cfg_args=[],
halt_on_unexpected=False, run_python="--runpythontest", auto_test_mode=True, null_renderer=True, cfg_args=[],
timeout=300):
"""
Runs the Editor with the specified script, and monitors for expected log lines.
@@ -58,7 +58,7 @@ def launch_and_validate_results(request, test_directory, editor, editor_script,
if auto_test_mode:
editor.args.extend(["--autotest_mode"])
if null_renderer:
editor.args.extend(["-rhi=null"])
editor.args.extend(["-rhi=Null"])
with editor.start():
@@ -22,10 +22,10 @@ class Tests():
# fmt:on
def run():
def C28798177_WhiteBox_AddComponentToEntity():
import os
import sys
import WhiteBoxInit as init
from Gems.WhiteBox.Editor.Scripts import WhiteBoxInit as init
import ImportPathHelper as imports
imports.init()
@@ -58,4 +58,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(C28798177_WhiteBox_AddComponentToEntity)
@@ -22,13 +22,13 @@ class Tests():
# fmt:on
def run():
def C28798205_WhiteBox_SetInvisible():
# note: This automated test does not fully replicate the test case in Test Rail as it's
# not currently possible using the Hydra API to get an EntityComponentIdPair at runtime,
# in future game_mode will be activated and a runtime White Box Component queried
import os
import sys
import WhiteBoxInit as init
from Gems.WhiteBox.Editor.Scripts import WhiteBoxInit as init
import ImportPathHelper as imports
import editor_python_test_tools.hydra_editor_utils as hydra
imports.init()
@@ -68,4 +68,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(C28798205_WhiteBox_SetInvisible)
@@ -26,10 +26,10 @@ class Tests():
critical_shape_check = ("Default shape has more than 0 sides", "default shape has 0 sides")
def run():
def C29279329_WhiteBox_SetDefaultShape():
import os
import sys
import WhiteBoxInit as init
from Gems.WhiteBox.Editor.Scripts import WhiteBoxInit as init
import ImportPathHelper as imports
imports.init()
@@ -107,4 +107,8 @@ def run():
if __name__ == "__main__":
run()
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(C29279329_WhiteBox_SetDefaultShape)
@@ -7,25 +7,10 @@ distribution (the "License"). All use of this software is governed by the Licens
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Hydra script that creates an entity and attaches Atom components to it for test verification.
"""
# This module does a bulk test and update of many components at once.
# Each test case is listed below in the format:
# "Test Case ID: Test Case Title (URL)"
# C32078130: Tone Mapper (https://testrail.agscollab.com/index.php?/cases/view/32078130)
# C32078129: Light (https://testrail.agscollab.com/index.php?/cases/view/32078129)
# C32078131: Radius Weight Modifier (https://testrail.agscollab.com/index.php?/cases/view/32078131)
# C32078127: PostFX Layer (https://testrail.agscollab.com/index.php?/cases/view/32078127)
# C32078126: Point Light (https://testrail.agscollab.com/index.php?/cases/view/32078126)
# C32078125: Physical Sky (https://testrail.agscollab.com/index.php?/cases/view/32078125)
# C32078115: Global Skylight (IBL) (https://testrail.agscollab.com/index.php?/cases/view/32078115)
# C32078121: Exposure Control (https://testrail.agscollab.com/index.php?/cases/view/32078121)
# C32078120: Directional Light (https://testrail.agscollab.com/index.php?/cases/view/32078120)
# C32078119: DepthOfField (https://testrail.agscollab.com/index.php?/cases/view/32078119)
# C32078118: Decal (https://testrail.agscollab.com/index.php?/cases/view/32078118)
# C32078117: Area Light (https://testrail.agscollab.com/index.php?/cases/view/32078117)
import os
import sys
@@ -41,10 +26,6 @@ sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "P
import editor_python_test_tools.hydra_editor_utils as hydra
from editor_python_test_tools.utils import TestHelper
from editor_python_test_tools.editor_test_helper import EditorTestHelper
EditorTestHelper = EditorTestHelper(log_prefix="AtomEditorComponents")
def run():
@@ -151,28 +132,6 @@ def run():
# Wait for Editor idle loop before executing Python hydra scripts.
TestHelper.init_idle()
# Create a new level.
new_level_name = "tmp_level" # Specified in TestAllComponentsBasicTests.py
heightmap_resolution = 512
heightmap_meters_per_pixel = 1
terrain_texture_resolution = 412
use_terrain = False
# Return codes are ECreateLevelResult defined in CryEdit.h
return_code = general.create_level_no_prompt(
new_level_name, heightmap_resolution, heightmap_meters_per_pixel, terrain_texture_resolution, use_terrain)
if return_code == 1:
general.log(f"{new_level_name} level already exists")
elif return_code == 2:
general.log("Failed to create directory")
elif return_code == 3:
general.log("Directory length is too long")
elif return_code != 0:
general.log("Unknown error, failed to create level")
else:
general.log(f"{new_level_name} level created successfully")
EditorTestHelper.after_level_load(bypass_viewport_resize=True)
# Delete all existing entities initially
search_filter = azlmbr.entity.SearchFilter()
all_entities = entity.SearchBus(azlmbr.bus.Broadcast, "SearchEntities", search_filter)
@@ -209,12 +168,12 @@ def run():
entity_obj, ["Capsule Shape"], area_light))
# Decal Component
material_asset_path = os.path.join("Materials", "decal", "aiirship_nose_number_decal.material")
material_asset_path = os.path.join("AutomatedTesting", "Materials", "basic_grey.material")
material_asset = asset.AssetCatalogRequestBus(
bus.Broadcast, "GetAssetIdByPath", material_asset_path, math.Uuid(), False)
ComponentTests(
"Decal", lambda entity_obj: verify_set_property(
entity_obj, "Settings|Decal Settings|Material", material_asset))
"Decal (Atom)", lambda entity_obj: verify_set_property(
entity_obj, "Controller|Configuration|Material", material_asset))
# DepthOfField Component
camera_entity = hydra.Entity("camera_entity")
@@ -263,9 +222,12 @@ def run():
# Radius Weight Modifier Component
ComponentTests("Radius Weight Modifier")
# Spot Light Component
# Light Component
ComponentTests("Light")
# Display Mapper Component
ComponentTests("Display Mapper")
if __name__ == "__main__":
run()
@@ -7,38 +7,214 @@ distribution (the "License"). All use of this software is governed by the Licens
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
Main suite tests for the Atom renderer.
"""
import logging
import os
import pytest
import ly_test_tools.environment.file_system as file_system
import pytest
import editor_python_test_tools.hydra_test_utils as hydra
logger = logging.getLogger(__name__)
EDITOR_TIMEOUT = 60
EDITOR_TIMEOUT = 120
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("level", ["tmp_level"])
class TestAtomEditorComponents(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request, workspace, project, level):
# Cleanup our temp level
file_system.delete(
[os.path.join(workspace.paths.engine_root(), project, "Levels", "AtomLevels", level)], True, True)
@pytest.mark.parametrize("level", ["auto_test"])
class TestAtomEditorComponentsMain(object):
def teardown():
# Cleanup our temp level
file_system.delete(
[os.path.join(workspace.paths.engine_root(), project, "Levels", "AtomLevels", level)], True, True)
@pytest.mark.test_case_id(
"C32078117", # Area Light
"C32078130", # Display Mapper
"C32078129", # Light
"C32078131", # Radius Weight Modifier
"C32078127", # PostFX Layer
"C32078126", # Point Light
"C32078125", # Physical Sky
"C32078115", # Global Skylight (IBL)
"C32078121", # Exposure Control
"C32078120", # Directional Light
"C32078119", # DepthOfField
"C32078118") # Decal
def test_AtomEditorComponents_AddedToEntity(self, request, editor, level, workspace, project, launcher_platform):
cfg_args = [level]
request.addfinalizer(teardown)
expected_lines = [
# Area Light Component
"Area Light Entity successfully created",
"Area Light_test: Component added to the entity: True",
"Area Light_test: Component removed after UNDO: True",
"Area Light_test: Component added after REDO: True",
"Area Light_test: Entered game mode: True",
"Area Light_test: Entity enabled after adding required components: True",
"Area Light_test: Entity is hidden: True",
"Area Light_test: Entity is shown: True",
"Area Light_test: Entity deleted: True",
"Area Light_test: UNDO entity deletion works: True",
"Area Light_test: REDO entity deletion works: True",
# Decal Component
"Decal (Atom) Entity successfully created",
"Decal (Atom)_test: Component added to the entity: True",
"Decal (Atom)_test: Component removed after UNDO: True",
"Decal (Atom)_test: Component added after REDO: True",
"Decal (Atom)_test: Entered game mode: True",
"Decal (Atom)_test: Exit game mode: True",
"Decal (Atom) Controller|Configuration|Material: SUCCESS",
"Decal (Atom)_test: Entity is hidden: True",
"Decal (Atom)_test: Entity is shown: True",
"Decal (Atom)_test: Entity deleted: True",
"Decal (Atom)_test: UNDO entity deletion works: True",
"Decal (Atom)_test: REDO entity deletion works: True",
# DepthOfField Component
"DepthOfField Entity successfully created",
"DepthOfField_test: Component added to the entity: True",
"DepthOfField_test: Component removed after UNDO: True",
"DepthOfField_test: Component added after REDO: True",
"DepthOfField_test: Entered game mode: True",
"DepthOfField_test: Exit game mode: True",
"DepthOfField_test: Entity disabled initially: True",
"DepthOfField_test: Entity enabled after adding required components: True",
"DepthOfField Controller|Configuration|Camera Entity: SUCCESS",
"DepthOfField_test: Entity is hidden: True",
"DepthOfField_test: Entity is shown: True",
"DepthOfField_test: Entity deleted: True",
"DepthOfField_test: UNDO entity deletion works: True",
"DepthOfField_test: REDO entity deletion works: True",
# Directional Light Component
"Directional Light Entity successfully created",
"Directional Light_test: Component added to the entity: True",
"Directional Light_test: Component removed after UNDO: True",
"Directional Light_test: Component added after REDO: True",
"Directional Light_test: Entered game mode: True",
"Directional Light_test: Exit game mode: True",
"Directional Light Controller|Configuration|Shadow|Camera: SUCCESS",
"Directional Light_test: Entity is hidden: True",
"Directional Light_test: Entity is shown: True",
"Directional Light_test: Entity deleted: True",
"Directional Light_test: UNDO entity deletion works: True",
"Directional Light_test: REDO entity deletion works: True",
# Exposure Control Component
"Exposure Control Entity successfully created",
"Exposure Control_test: Component added to the entity: True",
"Exposure Control_test: Component removed after UNDO: True",
"Exposure Control_test: Component added after REDO: True",
"Exposure Control_test: Entered game mode: True",
"Exposure Control_test: Exit game mode: True",
"Exposure Control_test: Entity disabled initially: True",
"Exposure Control_test: Entity enabled after adding required components: True",
"Exposure Control_test: Entity is hidden: True",
"Exposure Control_test: Entity is shown: True",
"Exposure Control_test: Entity deleted: True",
"Exposure Control_test: UNDO entity deletion works: True",
"Exposure Control_test: REDO entity deletion works: True",
# Global Skylight (IBL) Component
"Global Skylight (IBL) Entity successfully created",
"Global Skylight (IBL)_test: Component added to the entity: True",
"Global Skylight (IBL)_test: Component removed after UNDO: True",
"Global Skylight (IBL)_test: Component added after REDO: True",
"Global Skylight (IBL)_test: Entered game mode: True",
"Global Skylight (IBL)_test: Exit game mode: True",
"Global Skylight (IBL) Controller|Configuration|Diffuse Image: SUCCESS",
"Global Skylight (IBL) Controller|Configuration|Specular Image: SUCCESS",
"Global Skylight (IBL)_test: Entity is hidden: True",
"Global Skylight (IBL)_test: Entity is shown: True",
"Global Skylight (IBL)_test: Entity deleted: True",
"Global Skylight (IBL)_test: UNDO entity deletion works: True",
"Global Skylight (IBL)_test: REDO entity deletion works: True",
# Physical Sky Component
"Physical Sky Entity successfully created",
"Physical Sky component was added to entity",
"Entity has a Physical Sky component",
"Physical Sky_test: Component added to the entity: True",
"Physical Sky_test: Component removed after UNDO: True",
"Physical Sky_test: Component added after REDO: True",
"Physical Sky_test: Entered game mode: True",
"Physical Sky_test: Exit game mode: True",
"Physical Sky_test: Entity is hidden: True",
"Physical Sky_test: Entity is shown: True",
"Physical Sky_test: Entity deleted: True",
"Physical Sky_test: UNDO entity deletion works: True",
"Physical Sky_test: REDO entity deletion works: True",
# Point Light Component
"Point Light Entity successfully created",
"Point Light_test: Component added to the entity: True",
"Point Light_test: Component removed after UNDO: True",
"Point Light_test: Component added after REDO: True",
"Point Light_test: Entered game mode: True",
"Point Light_test: Exit game mode: True",
"Point Light_test: Entity is hidden: True",
"Point Light_test: Entity is shown: True",
"Point Light_test: Entity deleted: True",
"Point Light_test: UNDO entity deletion works: True",
"Point Light_test: REDO entity deletion works: True",
# PostFX Layer Component
"PostFX Layer Entity successfully created",
"PostFX Layer_test: Component added to the entity: True",
"PostFX Layer_test: Component removed after UNDO: True",
"PostFX Layer_test: Component added after REDO: True",
"PostFX Layer_test: Entered game mode: True",
"PostFX Layer_test: Exit game mode: True",
"PostFX Layer_test: Entity is hidden: True",
"PostFX Layer_test: Entity is shown: True",
"PostFX Layer_test: Entity deleted: True",
"PostFX Layer_test: UNDO entity deletion works: True",
"PostFX Layer_test: REDO entity deletion works: True",
# Radius Weight Modifier Component
"Radius Weight Modifier Entity successfully created",
"Radius Weight Modifier_test: Component added to the entity: True",
"Radius Weight Modifier_test: Component removed after UNDO: True",
"Radius Weight Modifier_test: Component added after REDO: True",
"Radius Weight Modifier_test: Entered game mode: True",
"Radius Weight Modifier_test: Exit game mode: True",
"Radius Weight Modifier_test: Entity is hidden: True",
"Radius Weight Modifier_test: Entity is shown: True",
"Radius Weight Modifier_test: Entity deleted: True",
"Radius Weight Modifier_test: UNDO entity deletion works: True",
"Radius Weight Modifier_test: REDO entity deletion works: True",
# Light Component
"Light Entity successfully created",
"Light_test: Component added to the entity: True",
"Light_test: Component removed after UNDO: True",
"Light_test: Component added after REDO: True",
"Light_test: Entered game mode: True",
"Light_test: Exit game mode: True",
"Light_test: Entity is hidden: True",
"Light_test: Entity is shown: True",
"Light_test: Entity deleted: True",
"Light_test: UNDO entity deletion works: True",
"Light_test: REDO entity deletion works: True",
# Display Mapper Component
"Display Mapper Entity successfully created",
"Display Mapper_test: Component added to the entity: True",
"Display Mapper_test: Component removed after UNDO: True",
"Display Mapper_test: Component added after REDO: True",
"Display Mapper_test: Entered game mode: True",
"Display Mapper_test: Exit game mode: True",
"Display Mapper_test: Entity is hidden: True",
"Display Mapper_test: Entity is shown: True",
"Display Mapper_test: Entity deleted: True",
"Display Mapper_test: UNDO entity deletion works: True",
"Display Mapper_test: REDO entity deletion works: True",
]
# It requires at least one test
def test_Dummy(self, request, editor, level, workspace, project, launcher_platform):
pass
unexpected_lines = [
"failed to open",
"Traceback (most recent call last):",
]
hydra.launch_and_validate_results(
request,
TEST_DIRECTORY,
editor,
"hydra_AtomEditorComponents_AddedToEntity.py",
timeout=EDITOR_TIMEOUT,
expected_lines=expected_lines,
unexpected_lines=unexpected_lines,
halt_on_unexpected=True,
null_renderer=True,
cfg_args=cfg_args,
)
@@ -7,213 +7,18 @@ distribution (the "License"). All use of this software is governed by the Licens
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Sandbox suite tests for the Atom renderer.
"""
import logging
import os
import pytest
import ly_test_tools.environment.file_system as file_system
import editor_python_test_tools.hydra_test_utils as hydra
logger = logging.getLogger(__name__)
EDITOR_TIMEOUT = 60
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("level", ["tmp_level"])
class TestAtomEditorComponents(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request, workspace, project, level):
# Cleanup our temp level
file_system.delete(
[os.path.join(workspace.paths.engine_root(), project, "Levels", "AtomLevels", level)], True, True)
@pytest.mark.parametrize("level", ["auto_test"])
class TestAtomEditorComponentsSandbox(object):
def teardown():
# Cleanup our temp level
file_system.delete(
[os.path.join(workspace.paths.engine_root(), project, "Levels", "AtomLevels", level)], True, True)
request.addfinalizer(teardown)
@pytest.mark.test_case_id(
"C32078130", # Tone Mapper
"C32078129", # Light
"C32078131", # Radius Weight Modifier
"C32078127", # PostFX Layer
"C32078126", # Point Light
"C32078125", # Physical Sky
"C32078115", # Global Skylight (IBL)
"C32078121", # Exposure Control
"C32078120", # Directional Light
"C32078119", # DepthOfField
"C32078118") # Decal
def test_AtomEditorComponents_AddedToEntity(self, request, editor, level, workspace, project, launcher_platform):
cfg_args = [level]
expected_lines = [
# Area Light Component
"Area Light Entity successfully created",
"Area Light_test: Component added to the entity: True",
"Area Light_test: Component removed after UNDO: True",
"Area Light_test: Component added after REDO: True",
"Area Light_test: Entered game mode: True",
"Area Light_test: Entity enabled after adding required components: True",
"Area Light_test: Entity is hidden: True",
"Area Light_test: Entity is shown: True",
"Area Light_test: Entity deleted: True",
"Area Light_test: UNDO entity deletion works: True",
"Area Light_test: REDO entity deletion works: True",
# Decal Component
"Decal Entity successfully created",
"Decal_test: Component added to the entity: True",
"Decal_test: Component removed after UNDO: True",
"Decal_test: Component added after REDO: True",
"Decal_test: Entered game mode: True",
"Decal_test: Exit game mode: True",
"Decal Settings|Decal Settings|Material: SUCCESS",
"Decal_test: Entity is hidden: True",
"Decal_test: Entity is shown: True",
"Decal_test: Entity deleted: True",
"Decal_test: UNDO entity deletion works: True",
"Decal_test: REDO entity deletion works: True",
# DepthOfField Component
"DepthOfField Entity successfully created",
"DepthOfField_test: Component added to the entity: True",
"DepthOfField_test: Component removed after UNDO: True",
"DepthOfField_test: Component added after REDO: True",
"DepthOfField_test: Entered game mode: True",
"DepthOfField_test: Exit game mode: True",
"DepthOfField_test: Entity disabled initially: True",
"DepthOfField_test: Entity enabled after adding required components: True",
"DepthOfField Controller|Configuration|Camera Entity: SUCCESS",
"DepthOfField_test: Entity is hidden: True",
"DepthOfField_test: Entity is shown: True",
"DepthOfField_test: Entity deleted: True",
"DepthOfField_test: UNDO entity deletion works: True",
"DepthOfField_test: REDO entity deletion works: True",
# Directional Light Component
"Directional Light Entity successfully created",
"Directional Light_test: Component added to the entity: True",
"Directional Light_test: Component removed after UNDO: True",
"Directional Light_test: Component added after REDO: True",
"Directional Light_test: Entered game mode: True",
"Directional Light_test: Exit game mode: True",
"Directional Light Controller|Configuration|Shadow|Camera: SUCCESS",
"Directional Light_test: Entity is hidden: True",
"Directional Light_test: Entity is shown: True",
"Directional Light_test: Entity deleted: True",
"Directional Light_test: UNDO entity deletion works: True",
"Directional Light_test: REDO entity deletion works: True",
# Exposure Control Component
"Exposure Control Entity successfully created",
"Exposure Control_test: Component added to the entity: True",
"Exposure Control_test: Component removed after UNDO: True",
"Exposure Control_test: Component added after REDO: True",
"Exposure Control_test: Entered game mode: True",
"Exposure Control_test: Exit game mode: True",
"Exposure Control_test: Entity disabled initially: True",
"Exposure Control_test: Entity enabled after adding required components: True",
"Exposure Control_test: Entity is hidden: True",
"Exposure Control_test: Entity is shown: True",
"Exposure Control_test: Entity deleted: True",
"Exposure Control_test: UNDO entity deletion works: True",
"Exposure Control_test: REDO entity deletion works: True",
# Global Skylight (IBL) Component
"Global Skylight (IBL) Entity successfully created",
"Global Skylight (IBL)_test: Component added to the entity: True",
"Global Skylight (IBL)_test: Component removed after UNDO: True",
"Global Skylight (IBL)_test: Component added after REDO: True",
"Global Skylight (IBL)_test: Entered game mode: True",
"Global Skylight (IBL)_test: Exit game mode: True",
"Global Skylight (IBL) Controller|Configuration|Diffuse Image: SUCCESS",
"Global Skylight (IBL) Controller|Configuration|Specular Image: SUCCESS",
"Global Skylight (IBL)_test: Entity is hidden: True",
"Global Skylight (IBL)_test: Entity is shown: True",
"Global Skylight (IBL)_test: Entity deleted: True",
"Global Skylight (IBL)_test: UNDO entity deletion works: True",
"Global Skylight (IBL)_test: REDO entity deletion works: True",
# Physical Sky Component
"Physical Sky Entity successfully created",
"Physical Sky component was added to entity",
"Entity has a Physical Sky component",
"Physical Sky_test: Component added to the entity: True",
"Physical Sky_test: Component removed after UNDO: True",
"Physical Sky_test: Component added after REDO: True",
"Physical Sky_test: Entered game mode: True",
"Physical Sky_test: Exit game mode: True",
"Physical Sky_test: Entity is hidden: True",
"Physical Sky_test: Entity is shown: True",
"Physical Sky_test: Entity deleted: True",
"Physical Sky_test: UNDO entity deletion works: True",
"Physical Sky_test: REDO entity deletion works: True",
# Point Light Component
"Point Light Entity successfully created",
"Point Light_test: Component added to the entity: True",
"Point Light_test: Component removed after UNDO: True",
"Point Light_test: Component added after REDO: True",
"Point Light_test: Entered game mode: True",
"Point Light_test: Exit game mode: True",
"Point Light_test: Entity is hidden: True",
"Point Light_test: Entity is shown: True",
"Point Light_test: Entity deleted: True",
"Point Light_test: UNDO entity deletion works: True",
"Point Light_test: REDO entity deletion works: True",
# PostFX Layer Component
"PostFX Layer Entity successfully created",
"PostFX Layer_test: Component added to the entity: True",
"PostFX Layer_test: Component removed after UNDO: True",
"PostFX Layer_test: Component added after REDO: True",
"PostFX Layer_test: Entered game mode: True",
"PostFX Layer_test: Exit game mode: True",
"PostFX Layer_test: Entity is hidden: True",
"PostFX Layer_test: Entity is shown: True",
"PostFX Layer_test: Entity deleted: True",
"PostFX Layer_test: UNDO entity deletion works: True",
"PostFX Layer_test: REDO entity deletion works: True",
# Radius Weight Modifier Component
"Radius Weight Modifier Entity successfully created",
"Radius Weight Modifier_test: Component added to the entity: True",
"Radius Weight Modifier_test: Component removed after UNDO: True",
"Radius Weight Modifier_test: Component added after REDO: True",
"Radius Weight Modifier_test: Entered game mode: True",
"Radius Weight Modifier_test: Exit game mode: True",
"Radius Weight Modifier_test: Entity is hidden: True",
"Radius Weight Modifier_test: Entity is shown: True",
"Radius Weight Modifier_test: Entity deleted: True",
"Radius Weight Modifier_test: UNDO entity deletion works: True",
"Radius Weight Modifier_test: REDO entity deletion works: True",
# Light Component
"Light Entity successfully created",
"Light_test: Component added to the entity: True",
"Light_test: Component removed after UNDO: True",
"Light_test: Component added after REDO: True",
"Light_test: Entered game mode: True",
"Light_test: Exit game mode: True",
"Light_test: Entity is hidden: True",
"Light_test: Entity is shown: True",
"Light_test: Entity deleted: True",
"Light_test: UNDO entity deletion works: True",
"Light_test: REDO entity deletion works: True",
]
unexpected_lines = [
"failed to open",
"Traceback (most recent call last):",
]
hydra.launch_and_validate_results(
request,
TEST_DIRECTORY,
editor,
"hydra_AtomEditorComponents_AddedToEntity.py",
timeout=EDITOR_TIMEOUT,
expected_lines=expected_lines,
unexpected_lines=unexpected_lines,
halt_on_unexpected=True,
null_renderer=True,
cfg_args=cfg_args,
)
# It requires at least one test
def test_Dummy(self, request, editor, level, workspace, project, launcher_platform):
pass
@@ -21,8 +21,8 @@ import azlmbr.legacy.general as general
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
from automatedtesting_shared.editor_test_helper import EditorTestHelper
import automatedtesting_shared.pyside_utils as pyside_utils
from editor_python_test_tools.editor_test_helper import EditorTestHelper
import editor_python_test_tools.pyside_utils as pyside_utils
class AssetBrowserTreeNavigationTest(EditorTestHelper):
@@ -66,7 +66,7 @@ class AssetBrowserTreeNavigationTest(EditorTestHelper):
return collapse_success and expand_success
# This is the hierarchy we are expanding (4 steps inside)
self.file_path = ("AutomatedTesting", "Assets", "ImageGradients", "lumberyard_gsi.png")
self.file_path = ("AutomatedTesting", "Assets", "ImageGradients", "image_grad_test_gsi.png")
# 1) Open a new level
self.test_success = self.create_level(
@@ -22,8 +22,8 @@ import azlmbr.entity as entity
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
from automatedtesting_shared.editor_test_helper import EditorTestHelper
import automatedtesting_shared.pyside_utils as pyside_utils
from editor_python_test_tools.editor_test_helper import EditorTestHelper
import editor_python_test_tools.pyside_utils as pyside_utils
class TestDockingBasicDockedTools(EditorTestHelper):
@@ -19,8 +19,8 @@ import sys
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
from automatedtesting_shared.editor_test_helper import EditorTestHelper
import automatedtesting_shared.pyside_utils as pyside_utils
from editor_python_test_tools.editor_test_helper import EditorTestHelper
import editor_python_test_tools.pyside_utils as pyside_utils
class TestEditMenuOptions(EditorTestHelper):
@@ -20,8 +20,8 @@ import sys
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
from automatedtesting_shared.editor_test_helper import EditorTestHelper
import automatedtesting_shared.pyside_utils as pyside_utils
from editor_python_test_tools.editor_test_helper import EditorTestHelper
import editor_python_test_tools.pyside_utils as pyside_utils
class TestFileMenuOptions(EditorTestHelper):
@@ -19,8 +19,8 @@ import sys
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
from automatedtesting_shared.editor_test_helper import EditorTestHelper
import automatedtesting_shared.pyside_utils as pyside_utils
from editor_python_test_tools.editor_test_helper import EditorTestHelper
import editor_python_test_tools.pyside_utils as pyside_utils
class TestViewMenuOptions(EditorTestHelper):
@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
layout = {
'path': r'Software\Amazon\Lumberyard\Editor\fancyWindowLayouts',
'path': r'Software\Amazon\O3DE\Editor\fancyWindowLayouts',
'value': 'last'
}
restore_camera = {
@@ -1,71 +0,0 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
C13660194 : Asset Browser - Filtering
"""
import os
import pytest
# Bail on the test if ly_test_tools doesn't exist.
pytest.importorskip('ly_test_tools')
import ly_test_tools.environment.file_system as file_system
import editor_python_test_tools.hydra_test_utils as hydra
test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts")
log_monitor_timeout = 90
@pytest.mark.parametrize('project', ['AutomatedTesting'])
@pytest.mark.parametrize('level', ['tmp_level'])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
class TestSearchFiltering(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request, workspace, project, level):
def teardown():
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
request.addfinalizer(teardown)
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
@pytest.mark.test_case_id("C13660194")
@pytest.mark.SUITE_periodic
def test_SearchFiltering_Asset_Browser_Filtering(self, request, editor, level, launcher_platform):
expected_lines = [
"cedar.fbx asset is filtered in Asset Browser",
"Animation file type(s) is present in the file tree: True",
"FileTag file type(s) and Animation file type(s) is present in the file tree: True",
"FileTag file type(s) is present in the file tree after removing Animation filter: True",
]
unexpected_lines = [
"Asset Browser opened: False",
"Animation file type(s) is present in the file tree: False",
"FileTag file type(s) and Animation file type(s) is present in the file tree: False",
"FileTag file type(s) is present in the file tree after removing Animation filter: False",
]
hydra.launch_and_validate_results(
request,
test_directory,
editor,
"AssetBrowser_SearchFiltering.py",
expected_lines,
unexpected_lines=unexpected_lines,
cfg_args=[level],
auto_test_mode=False,
run_python="--runpython",
timeout=log_monitor_timeout,
)
@@ -1,62 +0,0 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
C13660195: Asset Browser - File Tree Navigation
"""
import os
import pytest
# Bail on the test if ly_test_tools doesn't exist.
pytest.importorskip('ly_test_tools')
import ly_test_tools.environment.file_system as file_system
import editor_python_test_tools.hydra_test_utils as hydra
test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts")
log_monitor_timeout = 90
@pytest.mark.parametrize('project', ['AutomatedTesting'])
@pytest.mark.parametrize('level', ['tmp_level'])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
class TestTreeNavigation(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request, workspace, project, level):
def teardown():
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
request.addfinalizer(teardown)
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
@pytest.mark.test_case_id("C13660195")
@pytest.mark.SUITE_periodic
def test_TreeNavigation_Asset_Browser(self, request, editor, level, launcher_platform):
expected_lines = [
"Collapse/Expand tests: True",
"Asset visibility test: True",
"Scrollbar visibility test: True",
"TreeNavigation_Asset_Browser: result=SUCCESS"
]
hydra.launch_and_validate_results(
request,
test_directory,
editor,
"TreeNavigation_Asset_Browser.py",
expected_lines,
run_python="--runpython",
cfg_args=[level],
timeout=log_monitor_timeout,
)
@@ -85,7 +85,8 @@ class TestAltitudeFilter(object):
@pytest.mark.test_case_id("C4847478")
@pytest.mark.SUITE_periodic
def test_AltitudeFilterFilterStageToggle(self, request, editor, level, workspace, launcher_platform):
@pytest.mark.xfail # LYN-3275
def test_AltitudeFilter_FilterStageToggle(self, request, editor, level, workspace, launcher_platform):
cfg_args = [level]
expected_lines = [
@@ -41,7 +41,7 @@ class TestDynamicSliceInstanceSpawner(object):
return console
@pytest.mark.test_case_id("C28851763")
@pytest.mark.SUITE_main
@pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
def test_DynamicSliceInstanceSpawner_DynamicSliceSpawnerWorks(self, request, editor, level, workspace, project,
launcher_platform):
@@ -36,8 +36,13 @@ class TestEmptyInstanceSpawner(object):
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
@pytest.mark.test_case_id("C28851762")
# Main suite needs at least one test
@pytest.mark.SUITE_main
def test_EmptyInstanceSpawner_Dummy(self, request, editor, level, workspace, project, launcher_platform):
pass
@pytest.mark.test_case_id("C28851762")
@pytest.mark.SUITE_sandbox
def test_EmptyInstanceSpawner_EmptySpawnerWorks(self, request, editor, level, launcher_platform):
cfg_args = [level]
@@ -101,6 +101,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C4765973")
@pytest.mark.SUITE_periodic
@pytest.mark.xfail # LYN-3275
def test_LayerSpawner_FilterStageToggle(self, request, editor, level, workspace, launcher_platform):
expected_lines = [
@@ -46,6 +46,7 @@ class TestMeshBlocker(object):
"""
@pytest.mark.test_case_id("C3980834")
@pytest.mark.SUITE_periodic
@pytest.mark.xfail # LYN-3273
def test_MeshBlocker_InstancesBlockedByMesh(self, request, editor, level, launcher_platform):
expected_lines = [
"'Instance Spawner' created",
@@ -69,6 +70,7 @@ class TestMeshBlocker(object):
"""
@pytest.mark.test_case_id("C4766030")
@pytest.mark.SUITE_periodic
@pytest.mark.xfail # LYN-3273
def test_MeshBlocker_InstancesBlockedByMeshHeightTuning(self, request, editor, level, launcher_platform):
expected_lines = [
"'Instance Spawner' created",
@@ -60,6 +60,7 @@ class TestPositionModifier(object):
@pytest.mark.test_case_id("C4874100")
@pytest.mark.SUITE_sandbox
@pytest.mark.xfail # LYN-3275
def test_PositionModifier_AutoSnapToSurfaceWorks(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -21,7 +21,7 @@ import azlmbr.math as math
import azlmbr.paths
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
editorId = azlmbr.globals.property.LANDSCAPE_CANVAS_EDITOR_ID
createdEntityId = None
@@ -22,7 +22,7 @@ import pytest
# Bail on the test if ly_test_tools doesn't exist.
pytest.importorskip('ly_test_tools')
import ly_test_tools.environment.file_system as file_system
import automateeditor_python_test_toolsdtesting_shared.hydra_test_utils as hydra
import editor_python_test_tools.hydra_test_utils as hydra
test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts')
@@ -269,6 +269,8 @@ class TestAutomation(TestAutomationBase):
from . import C18977601_Material_FrictionCombinePriority as test_module
self._run_test(request, workspace, editor, test_module)
@pytest.mark.xfail(
reason="Something with the CryRenderer disabling is causing this test to fail now.")
@revert_physics_config
def test_C13895144_Ragdoll_ChangeLevel(self, request, workspace, editor, launcher_platform):
from . import C13895144_Ragdoll_ChangeLevel as test_module
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -9,7 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# Cmake version 3.17 is the minimum version needed for all of Open 3D Engine's supported platforms
# Cmake version 3.19 is the minimum version needed for all of Open 3D Engine's supported platforms
cmake_minimum_required(VERSION 3.19)
# CMP0111 introduced in 3.19 has a bug that produces the policy to warn every time there is an
+1 -1
View File
@@ -247,7 +247,7 @@ CUNIXConsole* pUnixConsole;
#define LOCALIZATION_TRANSLATIONS_LIST_FILE_NAME "Libs/Localization/localization.xml"
#define LOAD_LEGACY_RENDERER_FOR_EDITOR true // If you set this to false you must for now also set 'ed_useAtomNativeViewport' to true (see /Code/Sandbox/Editor/ViewManager.cpp)
#define LOAD_LEGACY_RENDERER_FOR_EDITOR false // If you set this to true you must also set 'ed_useAtomNativeViewport' to false (see /Code/Sandbox/Editor/ViewManager.cpp)
#define LOAD_LEGACY_RENDERER_FOR_LAUNCHER false
//////////////////////////////////////////////////////////////////////////
@@ -118,6 +118,7 @@ namespace AZ
const static AZ::Crc32 StringLineEditingCompleteNotify = AZ_CRC("StringLineEditingCompleteNotify", 0x139e5fa9);
const static AZ::Crc32 NameLabelOverride = AZ_CRC("NameLabelOverride", 0x9ff79cab);
const static AZ::Crc32 AssetPickerTitle = AZ_CRC_CE("AssetPickerTitle");
const static AZ::Crc32 ChildNameLabelOverride = AZ_CRC("ChildNameLabelOverride", 0x73dd2909);
//! Container attribute that is used to override labels for its elements given the index of the element
const static AZ::Crc32 IndexedChildNameLabelOverride = AZ_CRC("IndexedChildNameLabelOverride", 0x5f313ac2);
@@ -10,91 +10,75 @@
*
*/
#include "ByteStreamSerializer.h"
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Serialization/Json/ByteStreamSerializer.h>
#include <AzCore/Serialization/Json/JsonSerialization.h>
#include <AzCore/StringFunc/StringFunc.h>
namespace AZ
{
namespace ByteSerializerInternal
{
static JsonSerializationResult::Result Load(void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
{
using JsonSerializationResult::Outcomes;
using JsonSerializationResult::Tasks;
AZ_Assert(outputValue, "Expected a valid pointer to load from json value.");
switch (inputValue.GetType())
{
case rapidjson::kStringType: {
JsonByteStream buffer;
if (AZ::StringFunc::Base64::Decode(buffer, inputValue.GetString(), inputValue.GetStringLength()))
{
JsonByteStream* valAsByteStream = static_cast<JsonByteStream*>(outputValue);
*valAsByteStream = AZStd::move(buffer);
return context.Report(Tasks::ReadField, Outcomes::Success, "Successfully read ByteStream.");
}
return context.Report(Tasks::ReadField, Outcomes::Invalid, "Decode of Base64 encoded ByteStream failed.");
}
case rapidjson::kArrayType:
case rapidjson::kObjectType:
case rapidjson::kNullType:
case rapidjson::kFalseType:
case rapidjson::kTrueType:
case rapidjson::kNumberType:
return context.Report(
Tasks::ReadField, Outcomes::Unsupported,
"Unsupported type. ByteStream values cannot be read from arrays, objects, nulls, booleans or numbers.");
default:
return context.Report(Tasks::ReadField, Outcomes::Unknown, "Unknown json type encountered for ByteStream value.");
}
}
static JsonSerializationResult::Result StoreWithDefault(
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, JsonSerializerContext& context)
{
using JsonSerializationResult::Outcomes;
using JsonSerializationResult::Tasks;
const JsonByteStream& valAsByteStream = *static_cast<const JsonByteStream*>(inputValue);
if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast<const JsonByteStream*>(defaultValue)))
{
const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size());
outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator());
return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored.");
}
return context.Report(Tasks::WriteValue, Outcomes::DefaultsUsed, "Default ByteStream used.");
}
} // namespace ByteSerializerInternal
AZ_CLASS_ALLOCATOR_IMPL(JsonByteStreamSerializer, SystemAllocator, 0);
JsonSerializationResult::Result JsonByteStreamSerializer::Load(
void* outputValue, [[maybe_unused]] const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
JsonDeserializerContext& context)
{
using JsonSerializationResult::Outcomes;
using JsonSerializationResult::Tasks;
AZ_Assert(
azrtti_typeid<JsonByteStream>() == outputValueTypeId,
"Unable to deserialize AZStd::vector<AZ::u8>> to json because the provided type is %s",
outputValueTypeId.ToString<AZStd::string>().c_str());
AZ_Assert(outputValue, "Expected a valid pointer to load from json value.");
return ByteSerializerInternal::Load(outputValue, inputValue, context);
switch (inputValue.GetType())
{
case rapidjson::kStringType: {
JsonByteStream buffer;
if (AZ::StringFunc::Base64::Decode(buffer, inputValue.GetString(), inputValue.GetStringLength()))
{
JsonByteStream* valAsByteStream = static_cast<JsonByteStream*>(outputValue);
*valAsByteStream = AZStd::move(buffer);
return context.Report(Tasks::ReadField, Outcomes::Success, "Successfully read ByteStream.");
}
return context.Report(Tasks::ReadField, Outcomes::Invalid, "Decode of Base64 encoded ByteStream failed.");
}
case rapidjson::kArrayType:
case rapidjson::kObjectType:
case rapidjson::kNullType:
case rapidjson::kFalseType:
case rapidjson::kTrueType:
case rapidjson::kNumberType:
return context.Report(
Tasks::ReadField, Outcomes::Unsupported,
"Unsupported type. ByteStream values cannot be read from arrays, objects, nulls, booleans or numbers.");
default:
return context.Report(Tasks::ReadField, Outcomes::Unknown, "Unknown json type encountered for ByteStream value.");
}
}
JsonSerializationResult::Result JsonByteStreamSerializer::Store(
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, [[maybe_unused]] const Uuid& valueTypeId,
JsonSerializerContext& context)
{
using JsonSerializationResult::Outcomes;
using JsonSerializationResult::Tasks;
AZ_Assert(
azrtti_typeid<JsonByteStream>() == valueTypeId,
"Unable to serialize AZStd::vector<AZ::u8> to json because the provided type is %s",
valueTypeId.ToString<AZStd::string>().c_str());
return ByteSerializerInternal::StoreWithDefault(outputValue, inputValue, defaultValue, context);
const JsonByteStream& valAsByteStream = *static_cast<const JsonByteStream*>(inputValue);
if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast<const JsonByteStream*>(defaultValue)))
{
const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size());
outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator());
return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored.");
}
return context.Report(Tasks::WriteValue, Outcomes::DefaultsUsed, "Default ByteStream used.");
}
} // namespace AZ
@@ -104,13 +104,12 @@ namespace AZ
auto serializer = context.GetRegistrationContext()->GetSerializerForType(classData.m_typeId);
if (serializer)
{
if (storeTypeId == StoreTypeId::Yes)
ResultCode result = serializer->Store(node, object, defaultObject, classData.m_typeId, context);
if (storeTypeId == StoreTypeId::Yes && result.GetProcessing() != Processing::Halted)
{
return context.Report(Tasks::WriteValue, Outcomes::Catastrophic,
"Unable to store type information in a JSON Serializer primitive.");
result.Combine(InsertTypeId(node, classData, context));
}
return serializer->Store(node, object, defaultObject, classData.m_typeId, context);
return result;
}
if (classData.m_azRtti && (classData.m_azRtti->GetTypeTraits() & AZ::TypeTraits::is_enum) == AZ::TypeTraits::is_enum)
@@ -128,13 +127,12 @@ namespace AZ
serializer = context.GetRegistrationContext()->GetSerializerForType(classData.m_azRtti->GetGenericTypeId());
if (serializer)
{
if (storeTypeId == StoreTypeId::Yes)
ResultCode result = serializer->Store(node, object, defaultObject, classData.m_typeId, context);
if (storeTypeId == StoreTypeId::Yes && result.GetProcessing() != Processing::Halted)
{
return context.Report(Tasks::WriteValue, Outcomes::Catastrophic,
"Unable to store type information in a JSON Serializer primitive.");
result.Combine(InsertTypeId(node, classData, context));
}
return serializer->Store(node, object, defaultObject, classData.m_typeId, context);
return result;
}
}
@@ -149,6 +147,7 @@ namespace AZ
ResultCode result(Tasks::WriteValue);
if (storeTypeId == StoreTypeId::Yes)
{
// Not using InsertTypeId here to avoid needing to create the temporary value and swap it in that call.
node.AddMember(rapidjson::StringRef(JsonSerialization::TypeIdFieldIdentifier),
StoreTypeName(classData, context), context.GetJsonAllocator());
result = ResultCode(Tasks::WriteValue, Outcomes::Success);
@@ -569,6 +568,31 @@ namespace AZ
}
}
JsonSerializationResult::ResultCode JsonSerializer::InsertTypeId(
rapidjson::Value& output, const SerializeContext::ClassData& classData, JsonSerializerContext& context)
{
using namespace JsonSerializationResult;
if (output.IsObject())
{
rapidjson::Value insertedObject(rapidjson::kObjectType);
insertedObject.AddMember(
rapidjson::StringRef(JsonSerialization::TypeIdFieldIdentifier), StoreTypeName(classData, context),
context.GetJsonAllocator());
for (auto& element : output.GetObject())
{
insertedObject.AddMember(AZStd::move(element.name), AZStd::move(element.value), context.GetJsonAllocator());
}
output = AZStd::move(insertedObject);
return ResultCode(Tasks::WriteValue, Outcomes::Success);
}
else
{
return context.Report(Tasks::WriteValue, Outcomes::Catastrophic, "Only able to store type information in a JSON Object.");
}
}
rapidjson::Value JsonSerializer::GetExplicitDefault()
{
return rapidjson::Value(rapidjson::kObjectType);
@@ -80,6 +80,9 @@ namespace AZ
static JsonSerializationResult::ResultCode StoreTypeName(rapidjson::Value& output,
const Uuid& typeId, JsonSerializerContext& context);
static JsonSerializationResult::ResultCode InsertTypeId(
rapidjson::Value& output, const SerializeContext::ClassData& classData, JsonSerializerContext& context);
static rapidjson::Value GetExplicitDefault();
};
} // namespace AZ
@@ -449,6 +449,46 @@ namespace JsonSerializationTests
}
TEST_F(JsonSerializationTests, Load_PrimitiveForInheritedClass_LoadsCorrectClass)
{
using namespace AZ::JsonSerializationResult;
using namespace ::testing;
AZStd::string json = AZStd::string::format(R"(
{
"%s": "SimpleInheritence",
"base_var": -88.0,
"var1": 88,
"var2": 42
})",
AZ::JsonSerialization::TypeIdFieldIdentifier);
m_jsonDocument->Parse(json.c_str());
SimpleInheritence::Reflect(m_serializeContext, true);
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
JsonSerializerMock* mock =
reinterpret_cast<JsonSerializerMock*>(m_jsonRegistrationContext->GetSerializerForType(azrtti_typeid<SimpleInheritence>()));
EXPECT_CALL(*mock, Load(_, _, _, _))
.Times(Exactly(1))
.WillRepeatedly(Return(Result(m_deserializationSettings->m_reporting, "Test", Tasks::ReadField, Outcomes::Success, "")));
AZStd::unique_ptr<BaseClass> instance;
ResultCode result = AZ::JsonSerialization::Load(instance, *m_jsonDocument, *m_deserializationSettings);
EXPECT_NE(Processing::Halted, result.GetProcessing());
EXPECT_EQ(azrtti_typeid<SimpleInheritence>(), azrtti_typeid(*instance));
m_serializeContext->EnableRemoveReflection();
SimpleInheritence::Reflect(m_serializeContext, true);
m_serializeContext->DisableRemoveReflection();
m_jsonRegistrationContext->EnableRemoveReflection();
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
m_jsonRegistrationContext->DisableRemoveReflection();
}
TEST_F(JsonSerializationTests, Store_TemplatedClassWithRegisteredHandler_StoreOnHandlerCalled)
{
using namespace AZ::JsonSerializationResult;
@@ -474,6 +514,52 @@ namespace JsonSerializationTests
m_jsonRegistrationContext->DisableRemoveReflection();
}
TEST_F(JsonSerializationTests, Store_PrimitiveForInheritedClass_StoreSucceedsAndTypeIdIsAdded)
{
using namespace AZ::JsonSerializationResult;
using namespace ::testing;
SimpleInheritence::Reflect(m_serializeContext, true);
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
JsonSerializerMock* mock =
reinterpret_cast<JsonSerializerMock*>(m_jsonRegistrationContext->GetSerializerForType(azrtti_typeid<SimpleInheritence>()));
EXPECT_CALL(*mock, Store(_, _, _, _, _))
.Times(Exactly(1))
.WillRepeatedly(Invoke([](rapidjson::Value& output, const void*, const void*, const AZ::Uuid&, AZ::JsonSerializerContext& context)
{
// Insert some values to allow verification later on.
output.SetObject();
output.AddMember("base_var", -88.0, context.GetJsonAllocator());
output.AddMember("var1", 88, context.GetJsonAllocator());
output.AddMember("var2", 42, context.GetJsonAllocator());
return context.Report(Tasks::WriteValue, Outcomes::Success, "");
}));
AZStd::unique_ptr<BaseClass> instance{ aznew SimpleInheritence() };
ResultCode result = AZ::JsonSerialization::Store(*m_jsonDocument, m_jsonDocument->GetAllocator(), instance, *m_serializationSettings);
EXPECT_NE(Processing::Halted, result.GetProcessing());
AZStd::string compare = AZStd::string::format(R"(
{
"%s": "SimpleInheritence",
"base_var": -88.0,
"var1": 88,
"var2": 42
})",
AZ::JsonSerialization::TypeIdFieldIdentifier);
Expect_DocStrEq(compare.c_str());
m_serializeContext->EnableRemoveReflection();
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
SimpleInheritence::Reflect(m_serializeContext, true);
m_serializeContext->DisableRemoveReflection();
m_jsonRegistrationContext->EnableRemoveReflection();
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
m_jsonRegistrationContext->DisableRemoveReflection();
}
TEST_F(JsonSerializationTests, Store_StoreWithNullPtr_ReturnsCatastrophic)
{
using namespace AZ::JsonSerializationResult;
@@ -78,7 +78,7 @@ namespace Physics
float m_minimumMovementDistance = 0.001f; //!< To avoid jittering, the controller will not attempt to move distances below this.
float m_maximumSpeed = 100.0f; //!< If the accumulated requested velocity for a tick exceeds this magnitude, it will be clamped.
AZStd::string m_colliderTag; //!< Used to identify the collider associated with the character controller.
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfig = nullptr; //!< The shape to use when creating the character controller.
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfig; //!< The shape to use when creating the character controller.
AZStd::vector<AZStd::shared_ptr<Physics::Shape>> m_colliders; //!< The list of colliders to attach to the character controller.
};
@@ -55,7 +55,7 @@ namespace AzPhysics
//! Flag to determine if the body is part of the simulation.
//! When true the body will be affected by any forces, collisions, and found with scene queries.
bool m_simulating = true;
bool m_simulating = false;
//! Helper functions for setting user data.
//! @param userData Can be a pointer to any type as internally will be cast to a void*. Object lifetime not managed by the SimulatedBody.
@@ -46,6 +46,7 @@ namespace AzPhysics
->Field("orientation", &SimulatedBodyConfiguration::m_orientation)
->Field("scale", &SimulatedBodyConfiguration::m_scale)
->Field("entityId", &SimulatedBodyConfiguration::m_entityId)
->Field("startSimulationEnabled", &SimulatedBodyConfiguration::m_startSimulationEnabled)
;
}
}
@@ -39,6 +39,7 @@ namespace AzPhysics
AZ::Vector3 m_position = AZ::Vector3::CreateZero();
AZ::Quaternion m_orientation = AZ::Quaternion::CreateIdentity();
AZ::Vector3 m_scale = AZ::Vector3::CreateOne();
bool m_startSimulationEnabled = true;
// Entity/object association.
AZ::EntityId m_entityId = AZ::EntityId(AZ::EntityId::InvalidEntityId);
@@ -52,6 +52,11 @@ namespace Physics
}
}
RagdollConfiguration::RagdollConfiguration()
{
m_startSimulationEnabled = false; //ragdolls do not start enabled.
}
void RagdollConfiguration::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
@@ -24,6 +24,8 @@
namespace Physics
{
using ParentIndices = AZStd::vector<size_t>;
class RagdollNodeConfiguration
: public AzPhysics::RigidBodyConfiguration
{
@@ -46,7 +48,7 @@ namespace Physics
AZ_RTTI(RagdollConfiguration, "{7C96D332-61D8-4C58-A2BF-707716D38D14}", AzPhysics::SimulatedBodyConfiguration);
static void Reflect(AZ::ReflectContext* context);
RagdollConfiguration() = default;
RagdollConfiguration();
explicit RagdollConfiguration(const RagdollConfiguration& settings) = default;
RagdollNodeConfiguration* FindNodeConfigByName(const AZStd::string& nodeName) const;
@@ -56,6 +58,8 @@ namespace Physics
AZStd::vector<RagdollNodeConfiguration> m_nodes;
CharacterColliderConfiguration m_colliders;
RagdollState m_initialState;
ParentIndices m_parentIndices;
};
/// Represents a single rigid part of a ragdoll.
@@ -79,7 +83,7 @@ namespace Physics
{
public:
AZ_CLASS_ALLOCATOR(Ragdoll, AZ::SystemAllocator, 0);
AZ_RTTI(Ragdoll, "{01F09602-80EC-4693-A0E7-C2719239044B}", AzPhysics::SimulatedBody);
AZ_RTTI(Physics::Ragdoll, "{01F09602-80EC-4693-A0E7-C2719239044B}", AzPhysics::SimulatedBody);
virtual ~Ragdoll() = default;
/// Inserts the ragdoll into the physics simulation.
@@ -24,5 +24,5 @@ QProgressBar
QProgressBar::chunk
{
background: #54AFD0;
background: #1E70EB;
}
@@ -13,14 +13,14 @@ Width=24;
ArrowWidth=10;
[PrimaryColorSet]
Disabled\Start=#7092A7
Disabled\End=#7092A7
Sunken\Start=#0073BB
Sunken\End=#0073BB
Hovered\Start=#44BAFF
Hovered\End=#4AB2F8
Disabled\Start=#2A4875
Disabled\End=#2A4875
Sunken\Start=#1E70EB
Sunken\End=#1E70EB
Hovered\Start=#4ABAFF
Hovered\End=#94D2FF
Normal\Start=#0095F2
Normal\End=#0073BB
Normal\End=#1E70EB
[SecondaryColorSet]
Disabled\Start=#666666
@@ -42,10 +42,10 @@ Color=#3D000000
[FocusedBorder]
Thickness=1
Color=#00A1C9
Color=#4B8CEF
[IconButton]
ActiveColor=#00A1C9
ActiveColor=#1E70EB
DisabledColor=#999999
SelectedColor=#FFFFFF
@@ -12,7 +12,7 @@ HandleBorder\Color=#FFFFFF
HandleBorder\Radius=1.5
[Slider]
Handle\Color=#0185D7
Handle\Color=#1E70EB
Handle\ColorDisabled=#999999
Handle\Size=12
Handle\SizeMinusMargin=8
@@ -46,7 +46,7 @@ namespace AzQtComponents
Text::Config Text::defaultConfig()
{
Config config;
config.hyperlinkColor = QStringLiteral("#44B2F8");
config.hyperlinkColor = QStringLiteral("#94D2FF");
return config;
}
@@ -1,2 +1,2 @@
[Hyperlink]
Color=#44B2F8
Color=#94D2FF
@@ -4,7 +4,7 @@
<title>Selection Controls / Checkbox / Off</title>
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-Off" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="checkbox-(off)" stroke="#00A1C9">
<g id="checkbox-(off)" stroke="#4B8CEF">
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape"></path>
</g>
</g>

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-On---Disabled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="checkbox-(on)">
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#7092A7"></path>
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#2A4875"></path>
<polygon id="Path" fill="#BBBBBB" points="1 8.19230769 2.4 6.84615385 6 10.3076923 13.6 3 15 4.34615385 6 13"></polygon>
</g>
</g>

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 914 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-On-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="checkbox-(on)">
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#00A1C9" fill="#0073BB"></path>
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#4B8CEF" fill="#1E70EB"></path>
<polygon id="Path" fill="#FFFFFF" points="1 8.19230769 2.4 6.84615385 6 10.3076923 13.6 3 15 4.34615385 6 13"></polygon>
</g>
</g>

Before

Width:  |  Height:  |  Size: 1007 B

After

Width:  |  Height:  |  Size: 1007 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="checkbox-(on)">
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#0073BB"></path>
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#1E70EB"></path>
<polygon id="Path" fill="#FFFFFF" points="1 8.19230769 2.4 6.84615385 6 10.3076923 13.6 3 15 4.34615385 6 13"></polygon>
</g>
</g>

Before

Width:  |  Height:  |  Size: 892 B

After

Width:  |  Height:  |  Size: 892 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-Partial-Selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group">
<rect id="Rectangle-10" fill="#7092A7" x="0" y="0" width="16" height="16" rx="2"></rect>
<rect id="Rectangle-10" fill="#2A4875" x="0" y="0" width="16" height="16" rx="2"></rect>
<rect id="Rectangle-9" fill="#BBBBBB" x="3" y="7" width="10" height="2"></rect>
</g>
</g>

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-Partial-Selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group">
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#00A1C9" fill="#0073BB"></path>
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#4B8CEF" fill="#1E70EB"></path>
<rect id="Rectangle-9" fill="#FFFFFF" x="3" y="7" width="10" height="2"></rect>
</g>
</g>

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 974 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Checkbox-/-Partial-Selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group">
<rect id="Rectangle-10" fill="#0073BB" x="0" y="0" width="16" height="16" rx="2"></rect>
<rect id="Rectangle-10" fill="#1E70EB" x="0" y="0" width="16" height="16" rx="2"></rect>
<rect id="Rectangle-9" fill="#FFFFFF" x="3" y="7" width="10" height="2"></rect>
</g>
</g>

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

@@ -4,7 +4,7 @@
<title>Selection Controls / Radio Button / On - Disabled</title>
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Radio-Button-/-On---Disabled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<circle id="Oval" fill="#7092A7" cx="8" cy="8" r="8"></circle>
<circle id="Oval" fill="#2A4875" cx="8" cy="8" r="8"></circle>
<circle id="Oval" fill="#BBBBBB" cx="8" cy="8" r="4"></circle>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

@@ -4,7 +4,7 @@
<title>Selection Controls / Radio Button / On-focus</title>
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Radio-Button-/-On-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<circle id="Oval" stroke="#00A1C9" fill="#0073BB" cx="9" cy="9" r="8.5"></circle>
<circle id="Oval" stroke="#4B8CEF" fill="#1E70EB" cx="9" cy="9" r="8.5"></circle>
<circle id="Oval" fill="#FFFFFF" cx="9" cy="9" r="4"></circle>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 647 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Radio-Button-/-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="radio-button-(on)">
<circle id="Oval" fill="#0073BB" cx="8" cy="8" r="8"></circle>
<circle id="Oval" fill="#1E70EB" cx="8" cy="8" r="8"></circle>
<circle id="Oval" fill="#FFFFFF" cx="8" cy="8" r="4"></circle>
</g>
</g>

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 677 B

@@ -4,7 +4,7 @@
<title>Selection Controls / Radio Button / Off-focus</title>
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Radio-Button-/-Off-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="radio-button-(off)" transform="translate(1.000000, 1.000000)" stroke="#00A1C9">
<g id="radio-button-(off)" transform="translate(1.000000, 1.000000)" stroke="#4B8CEF">
<circle id="Oval" cx="8" cy="8" r="8.5"></circle>
</g>
</g>

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 658 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Switch-/-On---Disabled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="switch-(on)">
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#7092A7"></path>
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#2A4875"></path>
<circle id="knob" fill="#BBBBBB" cx="24" cy="8" r="6"></circle>
</g>
</g>

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Switch-/-On-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="switch-(on)" transform="translate(1.000000, 1.000000)">
<path d="M25.4117647,16.5 L6.58823529,16.5 C2.61773665,16.5 -0.5,12.7141769 -0.5,8 C-0.5,3.28582307 2.61773665,-0.5 6.58823529,-0.5 L25.4117647,-0.5 C29.3822634,-0.5 32.5,3.28582307 32.5,8 C32.5,12.7141769 29.3822634,16.5 25.4117647,16.5 Z" id="track" stroke="#00A1C9" fill="#0073BB"></path>
<path d="M25.4117647,16.5 L6.58823529,16.5 C2.61773665,16.5 -0.5,12.7141769 -0.5,8 C-0.5,3.28582307 2.61773665,-0.5 6.58823529,-0.5 L25.4117647,-0.5 C29.3822634,-0.5 32.5,3.28582307 32.5,8 C32.5,12.7141769 29.3822634,16.5 25.4117647,16.5 Z" id="track" stroke="#4B8CEF" fill="#1E70EB"></path>
<circle id="knob" fill="#FFFFFF" cx="24" cy="8" r="6"></circle>
</g>
</g>

Before

Width:  |  Height:  |  Size: 938 B

After

Width:  |  Height:  |  Size: 938 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Switch-/-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="switch-(on)">
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#0073BB"></path>
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#1E70EB"></path>
<circle id="knob" fill="#FFFFFF" cx="24" cy="8" r="6"></circle>
</g>
</g>

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 835 B

@@ -5,7 +5,7 @@
<desc>Created with Sketch.</desc>
<g id="Selection-Controls-/-Switch-/-Off-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="switch-(off)" transform="translate(1.000000, 1.000000)">
<path d="M25.0231909,16.5 L7.01632718,16.5 C2.97419648,16.5 -0.5,12.6299076 -0.5,8 C-0.5,3.37009242 2.97419648,-0.5 7.01632718,-0.5 L25.0231909,-0.5 C29.0586432,-0.5 32.5,3.36297526 32.5,8 C32.5,12.6370247 29.0586432,16.5 25.0231909,16.5 Z" id="track" stroke="#00A1C9"></path>
<path d="M25.0231909,16.5 L7.01632718,16.5 C2.97419648,16.5 -0.5,12.6299076 -0.5,8 C-0.5,3.37009242 2.97419648,-0.5 7.01632718,-0.5 L25.0231909,-0.5 C29.0586432,-0.5 32.5,3.36297526 32.5,8 C32.5,12.6370247 29.0586432,16.5 25.0231909,16.5 Z" id="track" stroke="#4B8CEF"></path>
<circle id="knob" fill="#FFFFFF" cx="8" cy="8" r="6"></circle>
</g>
</g>

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 925 B

@@ -1,6 +1,6 @@
<svg version="1.1" class="loader" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<path fill="#54AFD0" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
<path fill="#1E70EB" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
<animateTransform attributeType="xml"
attributeName="transform"
type="rotate"

Before

Width:  |  Height:  |  Size: 878 B

After

Width:  |  Height:  |  Size: 878 B

@@ -348,6 +348,11 @@ namespace AzToolsFramework
*/
virtual bool AreAnyEntitiesSelected() = 0;
/*!
* Returns the number of selected entities.
*/
virtual int GetSelectedEntitiesCount() = 0;
/*!
* Retrieves the set of selected entities.
* \return a list of entity Ids.
@@ -395,6 +395,7 @@ namespace AzToolsFramework
->Event("MarkEntityDeselected", &ToolsApplicationRequests::MarkEntityDeselected)
->Event("IsSelected", &ToolsApplicationRequests::IsSelected)
->Event("AreAnyEntitiesSelected", &ToolsApplicationRequests::AreAnyEntitiesSelected)
->Event("GetSelectedEntitiesCount", &ToolsApplicationRequests::GetSelectedEntitiesCount)
;
behaviorContext->EBus<ToolsApplicationNotificationBus>("ToolsApplicationNotificationBus")
@@ -101,6 +101,7 @@ namespace AzToolsFramework
SourceControlFileInfo GetSceneSourceControlInfo() override;
bool AreAnyEntitiesSelected() override { return !m_selectedEntities.empty(); }
int GetSelectedEntitiesCount() override { return m_selectedEntities.size(); }
const EntityIdList& GetSelectedEntities() override { return m_selectedEntities; }
const EntityIdList& GetHighlightedEntities() override { return m_highlightedEntities; }
void SetSelectedEntities(const EntityIdList& selectedEntities) override;
@@ -53,8 +53,8 @@ namespace AzToolsFramework
static constexpr const char* FolderIconPath = "Editor/Icons/AssetBrowser/Folder_16.svg";
static constexpr const char* GemIconPath = "Editor/Icons/AssetBrowser/GemFolder_16.svg";
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key, int thumbnailSize)
: Thumbnail(key, thumbnailSize)
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key)
: Thumbnail(key)
{}
void FolderThumbnail::LoadThread()
@@ -69,7 +69,8 @@ namespace AzToolsFramework
AZStd::string absoluteIconPath;
AZ::StringFunc::Path::Join(engineRoot, folderIcon, absoluteIconPath);
m_icon = QIcon(absoluteIconPath.c_str());
m_pixmap.load(absoluteIconPath.c_str());
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
}
//////////////////////////////////////////////////////////////////////////
@@ -47,7 +47,7 @@ namespace AzToolsFramework
{
Q_OBJECT
public:
FolderThumbnail(SharedThumbnailKey key, int thumbnailSize);
FolderThumbnail(SharedThumbnailKey key);
void LoadThread() override;
};
@@ -57,8 +57,8 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
static const char* DEFAULT_PRODUCT_ICON_PATH = "Editor/Icons/AssetBrowser/DefaultProduct_16.svg";
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
: Thumbnail(key, thumbnailSize)
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key)
: Thumbnail(key)
{}
void ProductThumbnail::LoadThread()
@@ -96,12 +96,8 @@ namespace AzToolsFramework
iconPath = QString::fromUtf8(DEFAULT_PRODUCT_ICON_PATH);
}
m_icon = QIcon(iconPath);
if (m_icon.isNull())
{
m_state = State::Failed;
}
m_pixmap.load(iconPath);
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
}
//////////////////////////////////////////////////////////////////////////
@@ -44,7 +44,7 @@ namespace AzToolsFramework
{
Q_OBJECT
public:
ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize);
ProductThumbnail(Thumbnailer::SharedThumbnailKey key);
protected:
void LoadThread() override;
@@ -58,8 +58,8 @@ namespace AzToolsFramework
static constexpr const char* DefaultFileIconPath = "Editor/Icons/AssetBrowser/Default_16.svg";
QMutex SourceThumbnail::m_mutex;
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key, int thumbnailSize)
: Thumbnail(key, thumbnailSize)
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key)
: Thumbnail(key)
{
}
@@ -124,7 +124,8 @@ namespace AzToolsFramework
iconPathToUse = iconPath.c_str();
}
m_icon = QIcon(iconPathToUse);
m_pixmap.load(iconPathToUse);
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
}
//////////////////////////////////////////////////////////////////////////
@@ -44,7 +44,7 @@ namespace AzToolsFramework
{
Q_OBJECT
public:
SourceThumbnail(SharedThumbnailKey key, int thumbnailSize);
SourceThumbnail(SharedThumbnailKey key);
protected:
void LoadThread() override;
@@ -140,7 +140,7 @@ namespace AzToolsFramework
else
{
// Scaling and centering pixmap within bounds to preserve aspect ratio
const QPixmap pixmap = thumbnail->GetPixmap(size).scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
const QPixmap pixmap = thumbnail->GetPixmap().scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
const QSize sizeDelta = size - pixmap.size();
const QPoint pointDelta = QPoint(sizeDelta.width() / 2, sizeDelta.height() / 2);
painter->drawPixmap(point + pointDelta, pixmap);
@@ -242,19 +242,6 @@ namespace AzToolsFramework
return false;
}
}
else
{
// The template is already loaded, this is the case of either saving as same name or different name(loaded from before).
// Update the template with the changes
AzToolsFramework::Prefab::PrefabDom dom;
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
if (!success)
{
AZ_Error("Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
return false;
}
m_prefabSystemComponent->UpdatePrefabTemplate(templateId, dom);
}
Prefab::TemplateId prevTemplateId = m_rootInstance->GetTemplateId();
m_rootInstance->SetTemplateId(templateId);
@@ -36,8 +36,7 @@ namespace AzToolsFramework
using namespace Thumbnailer;
using namespace AssetBrowser;
const char* contextName = "MaterialBrowser";
int thumbnailSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize);
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterContext, contextName, thumbnailSize);
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterContext, contextName);
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(FolderThumbnailCache), contextName);
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(SourceThumbnailCache), contextName);
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(MaterialThumbnailCache), contextName);
@@ -24,8 +24,8 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// MaterialThumbnail
//////////////////////////////////////////////////////////////////////////
MaterialThumbnail::MaterialThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
: Thumbnail(key, thumbnailSize)
MaterialThumbnail::MaterialThumbnail(Thumbnailer::SharedThumbnailKey key)
: Thumbnail(key)
{
auto productKey = azrtti_cast<const AzToolsFramework::AssetBrowser::ProductThumbnailKey*>(m_key.data());
AZ_Assert(productKey, "Incorrect key type, excpected ProductThumbnailKey");
@@ -34,7 +34,8 @@ namespace AzToolsFramework
MaterialBrowserRequestBus::BroadcastResult(multiMat, &MaterialBrowserRequests::IsMultiMaterial, productKey->GetAssetId());
QString iconPath = multiMat ? MultiMaterialIconPath : SimpleMaterialIconPath;
m_pixmap = QPixmap(iconPath).scaled(m_thumbnailSize, m_thumbnailSize, Qt::KeepAspectRatio);
m_pixmap.load(iconPath);
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
}
//////////////////////////////////////////////////////////////////////////
@@ -28,7 +28,7 @@ namespace AzToolsFramework
{
Q_OBJECT
public:
MaterialThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize);
MaterialThumbnail(Thumbnailer::SharedThumbnailKey key);
};
namespace
@@ -16,7 +16,6 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiInterface.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationBus.h>
namespace AzToolsFramework
@@ -200,7 +200,7 @@ namespace AzToolsFramework
}
return context.Report(result,
result.GetProcessing() == JSR::Processing::Completed ? "Succesfully loaded instance information for prefab." :
result.GetProcessing() == JSR::Processing::Completed ? "Successfully loaded instance information for prefab." :
"Failed to load instance information for prefab");
}
@@ -21,9 +21,9 @@
#include <AzToolsFramework/Prefab/Instance/TemplateInstanceMapperInterface.h>
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
#include <AzToolsFramework/Prefab/Template/Template.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
namespace AzToolsFramework
{
@@ -90,17 +90,13 @@ namespace AzToolsFramework
if (instanceCountToUpdateInBatch > 0)
{
// Notify Propagation has begun
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationBegin);
EntityIdList selectedEntityIds;
ToolsApplicationRequestBus::BroadcastResult(selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, EntityIdList());
// Disable the Outliner to avoid showing the propagation steps
EntityOutlinerWidgetInterface* entityOutlinerWidgetInterface = AZ::Interface<EntityOutlinerWidgetInterface>::Get();
if (entityOutlinerWidgetInterface)
{
entityOutlinerWidgetInterface->SetUpdatesEnabled(false);
}
for (int i = 0; i < instanceCountToUpdateInBatch; ++i)
{
Instance* instanceToUpdate = m_instancesUpdateQueue.front();
@@ -168,18 +164,8 @@ namespace AzToolsFramework
}
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selectedEntityIds);
// Enable the Outliner
if (entityOutlinerWidgetInterface)
{
entityOutlinerWidgetInterface->SetUpdatesEnabled(true);
auto prefabPublicInterface = AZ::Interface<PrefabPublicInterface>::Get();
if (prefabPublicInterface)
{
AZ::EntityId rootEntityId = prefabPublicInterface->GetLevelInstanceContainerEntityId();
entityOutlinerWidgetInterface->ExpandEntityChildren(rootEntityId);
}
}
// Notify Propagation has ended
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationEnd);
}
m_updatingTemplateInstancesInQueue = false;
@@ -108,11 +108,9 @@ namespace AzToolsFramework
m_targetTemplateId = id;
}
void Link::SetTemplatePatches(const PrefabDomValue& patches)
void Link::SetLinkDom(const PrefabDomValue& linkDom)
{
PrefabDom newPatches;
newPatches.CopyFrom(patches, newPatches.GetAllocator());
m_linkDom.Swap(newPatches);
m_linkDom.CopyFrom(linkDom, m_linkDom.GetAllocator());
}
void Link::SetInstanceName(const char* instanceName)
@@ -230,6 +228,10 @@ namespace AzToolsFramework
AZ_Assert(instanceDom.IsObject(), "Link Id '%u' cannot be added because the DOM of the instance is not an object.", m_id);
instanceDom.AddMember(rapidjson::StringRef(PrefabDomUtils::LinkIdName), rapidjson::Value().SetUint64(m_id), allocator);
}
else
{
linkIdReference->get().SetUint64(m_id);
}
}
} // namespace Prefab
@@ -47,7 +47,7 @@ namespace AzToolsFramework
void SetSourceTemplateId(TemplateId id);
void SetTargetTemplateId(TemplateId id);
void SetTemplatePatches(const PrefabDomValue& patches);
void SetLinkDom(const PrefabDomValue& linkDom);
void SetInstanceName(const char* instanceName);
bool IsValid() const;
@@ -392,12 +392,27 @@ namespace AzToolsFramework
if (patch.IsArray() && !patch.Empty() && beforeState.IsObject())
{
// Update the state of the entity
PrefabUndoEntityUpdate* state = aznew PrefabUndoEntityUpdate(AZStd::to_string(static_cast<AZ::u64>(entityId)));
state->SetParent(parentUndoBatch);
state->Capture(beforeState, afterState, entityId);
if (IsInstanceContainerEntity(entityId) && !IsLevelInstanceContainerEntity(entityId))
{
m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, entityId);
state->Redo();
// Save these changes as patches to the link
PrefabUndoLinkUpdate* linkUpdate =
aznew PrefabUndoLinkUpdate(AZStd::to_string(static_cast<AZ::u64>(entityId)));
linkUpdate->SetParent(parentUndoBatch);
linkUpdate->Capture(patch, owningInstance->get().GetLinkId());
linkUpdate->Redo();
}
else
{
// Update the state of the entity
PrefabUndoEntityUpdate* state = aznew PrefabUndoEntityUpdate(AZStd::to_string(static_cast<AZ::u64>(entityId)));
state->SetParent(parentUndoBatch);
state->Capture(beforeState, afterState, entityId);
state->Redo();
}
}
// Update the cache
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
namespace AzToolsFramework
{
namespace Prefab
{
class PrefabPublicNotifications
: public AZ::EBusTraits
{
public:
virtual ~PrefabPublicNotifications() = default;
virtual void OnPrefabInstancePropagationBegin() {}
virtual void OnPrefabInstancePropagationEnd() {}
};
using PrefabPublicNotificationBus = AZ::EBus<PrefabPublicNotifications>;
} // namespace Prefab
} // namespace AzToolsFramework
@@ -782,22 +782,21 @@ namespace AzToolsFramework
link.SetInstanceName(instanceName.data());
PrefabDomValue& instance = instanceIterator->value;
AZ_Assert(instance.IsObject(), "Nested instance DOM provided is not a valid JSON object.");
PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName);
AZ_Assert(sourceTemplateName, "Couldn't find source template name in the DOM of the nested instance while creating a link.");
AZ_Assert(
sourceTemplateName->get() == sourceTemplate.GetFilePath().c_str(),
"The name of the source template in the nested instance DOM does not match the name of the source template already loaded");
PrefabDomValueReference patchesReference = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::PatchesName);
if (!patchesReference.has_value())
if (patchesReference.has_value())
{
PrefabDom& newLinkDom = link.GetLinkDom();
newLinkDom.SetObject();
newLinkDom.AddMember(rapidjson::StringRef(PrefabDomUtils::SourceName),
rapidjson::StringRef(sourceTemplate.GetFilePath().c_str()), newLinkDom.GetAllocator());
}
else
{
link.SetTemplatePatches(patchesReference->get());
AZ_Assert(patchesReference->get().IsArray(), "Patches in the nested instance DOM are not represented as an array.");
}
link.SetLinkDom(instance);
if (!link.UpdateTarget())
{
AZ_Error("Prefab", false,
@@ -18,13 +18,15 @@ namespace AzToolsFramework
{
namespace Thumbnailer
{
static constexpr const int LoadingThumbnailSize = 128;
//////////////////////////////////////////////////////////////////////////
// LoadingThumbnail
//////////////////////////////////////////////////////////////////////////
static const char* LoadingIconPath = "Editor/Icons/AssetBrowser/in_progress.gif";
LoadingThumbnail::LoadingThumbnail(int thumbnailSize)
: Thumbnail(MAKE_TKEY(ThumbnailKey), thumbnailSize)
LoadingThumbnail::LoadingThumbnail()
: Thumbnail(MAKE_TKEY(ThumbnailKey))
, m_angle(0)
{
const char* engineRoot = nullptr;
@@ -34,7 +36,7 @@ namespace AzToolsFramework
AZ::StringFunc::Path::Join(engineRoot, LoadingIconPath, iconPath);
m_loadingMovie.setFileName(iconPath.c_str());
m_loadingMovie.setCacheMode(QMovie::CacheMode::CacheAll);
m_loadingMovie.setScaledSize(QSize(m_thumbnailSize, m_thumbnailSize));
m_loadingMovie.setScaledSize(QSize(LoadingThumbnailSize, LoadingThumbnailSize));
m_loadingMovie.start();
m_pixmap = m_loadingMovie.currentPixmap();
m_state = State::Ready;
@@ -29,7 +29,7 @@ namespace AzToolsFramework
{
Q_OBJECT
public:
explicit LoadingThumbnail(int thumbnailSize);
LoadingThumbnail();
~LoadingThumbnail() override;
void UpdateTime(float /*deltaTime*/) override;
@@ -18,11 +18,11 @@ namespace AzToolsFramework
{
static const char* MISSING_ICON_PATH = "Editor/Icons/AssetBrowser/Default_16.svg";
MissingThumbnail::MissingThumbnail(int thumbnailSize)
: Thumbnail(MAKE_TKEY(ThumbnailKey), thumbnailSize)
MissingThumbnail::MissingThumbnail()
: Thumbnail(MAKE_TKEY(ThumbnailKey))
{
m_icon = QIcon(MISSING_ICON_PATH);
m_state = State::Ready;
m_pixmap.load(MISSING_ICON_PATH);
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
}
} // namespace Thumbnailer

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