diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py
index 2583109573..382a6f27f7 100644
--- a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py
+++ b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/hydra_test_utils.py
@@ -6,13 +6,13 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
import logging
import os
-import tempfile
+import psutil
import ly_test_tools.log.log_monitor
import ly_test_tools.environment.process_utils as process_utils
import ly_test_tools.environment.waiter as waiter
-from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
from ly_remote_console.remote_console_commands import send_command_and_expect_response as send_command_and_expect_response
+
logger = logging.getLogger(__name__)
@@ -95,7 +95,7 @@ def launch_and_validate_results_launcher(launcher, level, remote_console_instanc
return port_listening
if null_renderer:
- launcher.args.extend(["-NullRenderer"])
+ launcher.args.extend(["-rhi=Null"])
# Start the Launcher
with launcher.start():
@@ -110,8 +110,8 @@ def launch_and_validate_results_launcher(launcher, level, remote_console_instanc
# Load the specified level in the launcher
send_command_and_expect_response(remote_console_instance,
- f"map {level}",
- "LEVEL_LOAD_COMPLETE", timeout=30)
+ f"LoadLevel {level}",
+ "LEVEL_LOAD_END", timeout=30)
# Monitor the console for expected lines
for line in expected_lines:
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
index 01974218b1..05eff871c1 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
@@ -77,7 +77,6 @@ class TestAllComponentsIndepthTests(object):
unexpected_lines=unexpected_lines,
halt_on_unexpected=True,
cfg_args=[level],
- auto_test_mode=False,
null_renderer=False,
)
diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py
index 26110cd954..c157c995c4 100644
--- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py
+++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py
@@ -60,24 +60,7 @@ class TestEditMenuOptions(EditorTestHelper):
("Modify", "Transform Mode", "Rotate"),
("Modify", "Transform Mode", "Scale"),
("Editor Settings", "Global Preferences"),
- ("Editor Settings", "Graphics Settings"),
("Editor Settings", "Editor Settings Manager"),
- ("Editor Settings", "Graphics Performance", "PC", "Very High"),
- ("Editor Settings", "Graphics Performance", "PC", "High"),
- ("Editor Settings", "Graphics Performance", "PC", "Medium"),
- ("Editor Settings", "Graphics Performance", "PC", "Low"),
- ("Editor Settings", "Graphics Performance", "OSX Metal", "Very High"),
- ("Editor Settings", "Graphics Performance", "OSX Metal", "High"),
- ("Editor Settings", "Graphics Performance", "OSX Metal", "Medium"),
- ("Editor Settings", "Graphics Performance", "OSX Metal", "Low"),
- ("Editor Settings", "Graphics Performance", "Android", "Very High"),
- ("Editor Settings", "Graphics Performance", "Android", "High"),
- ("Editor Settings", "Graphics Performance", "Android", "Medium"),
- ("Editor Settings", "Graphics Performance", "Android", "Low"),
- ("Editor Settings", "Graphics Performance", "iOS", "Very High"),
- ("Editor Settings", "Graphics Performance", "iOS", "High"),
- ("Editor Settings", "Graphics Performance", "iOS", "Medium"),
- ("Editor Settings", "Graphics Performance", "iOS", "Low"),
("Editor Settings", "Keyboard Customization", "Customize Keyboard"),
("Editor Settings", "Keyboard Customization", "Export Keyboard Settings"),
("Editor Settings", "Keyboard Customization", "Import Keyboard Settings"),
diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py b/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py
index 982f3617b5..cc5385f4ba 100644
--- a/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py
+++ b/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py
@@ -55,12 +55,7 @@ class TestMenus(object):
"Rotate Action triggered",
"Scale Action triggered",
"Global Preferences Action triggered",
- "Graphics Settings Action triggered",
"Editor Settings Manager Action triggered",
- "Very High Action triggered",
- "High Action triggered",
- "Medium Action triggered",
- "Low Action triggered",
"Customize Keyboard Action triggered",
"Export Keyboard Settings Action triggered",
"Import Keyboard Settings Action triggered",
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py
index bbdb925585..2fac361ced 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/AltitudeFilter_FilterStageToggle.py
@@ -36,8 +36,8 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
:return: None
"""
- PREPROCESS_INSTANCE_COUNT = 24
- POSTPROCESS_INSTANCE_COUNT = 18
+ PREPROCESS_INSTANCE_COUNT = 44
+ POSTPROCESS_INSTANCE_COUNT = 34
# Create empty level
self.test_success = self.create_level(
@@ -62,25 +62,7 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
dynveg.create_surface_entity("Surface_Entity_Parent", position, 16.0, 16.0, 1.0)
# Add entity with Mesh to replicate creation of hills
- hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 40.0, 40.0, 40.0)
-
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
-
- # Increase Box Shape size to encompass the hills
- vegetation.get_set_test(1, "Box Shape|Box Configuration|Dimensions", math.Vector3(100.0, 100.0, 100.0))
+ hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 10.0)
# Set a Min Altitude of 38 and Max of 40 in Vegetation Altitude Filter
vegetation.get_set_test(3, "Configuration|Altitude Min", 38.0)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py
index 4b0951acaf..6a99979a1f 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_Embedded_E2E.py
@@ -9,9 +9,10 @@ import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import azlmbr.asset as asset
+import azlmbr.components as components
import azlmbr.legacy.general as general
import azlmbr.bus as bus
-import azlmbr.entity as EntityId
+import azlmbr.entity as entity
import azlmbr.editor as editor
import azlmbr.math as math
import azlmbr.paths
@@ -83,18 +84,12 @@ class TestDynamicSliceInstanceSpawnerEmbeddedEditor(EditorTestHelper):
self.log(f"Expected {num_expected_instances} instances - Found {num_found} instances")
self.test_success = self.test_success and num_found == num_expected_instances
- # 5) Create a new entity with a Camera component for testing in the launcher
+ # 5) Move the default Camera entity for testing in the launcher
cam_position = math.Vector3(512.0, 500.0, 35.0)
- camera_component = ["Camera"]
- new_entity_id2 = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", cam_position, EntityId.EntityId()
- )
- if new_entity_id2.IsValid():
- self.log("Camera entity created")
- camera_entity = hydra.Entity("Camera Entity", new_entity_id2)
- camera_entity.components = []
- for component in camera_component:
- camera_entity.components.append(hydra.add_component(component, new_entity_id2))
+ search_filter = entity.SearchFilter()
+ search_filter.names = ["Camera"]
+ search_entity_ids = entity.SearchBus(bus.Broadcast, 'SearchEntities', search_filter)
+ components.TransformBus(bus.Event, "MoveEntity", search_entity_ids[0], cam_position)
# 6) Save and export to engine
general.save_level()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py
index 892549d414..70030ff359 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynamicSliceInstanceSpawner_External_E2E.py
@@ -11,7 +11,8 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import azlmbr.legacy.general as general
import azlmbr.asset as asset
import azlmbr.bus as bus
-import azlmbr.entity as EntityId
+import azlmbr.components as components
+import azlmbr.entity as entity
import azlmbr.editor as editor
import azlmbr.math as math
import azlmbr.paths
@@ -68,7 +69,7 @@ class TestDynamicSliceInstanceSpawnerExternalEditor(EditorTestHelper):
veg_area_required_components = ["Vegetation Layer Spawner", "Box Shape", "Vegetation Asset List",
"Script Canvas"]
new_entity_id = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
+ bus.Broadcast, "CreateNewEntityAtPosition", entity_position, entity.EntityId()
)
if new_entity_id.IsValid():
self.log("Spawner entity created")
@@ -106,18 +107,12 @@ class TestDynamicSliceInstanceSpawnerExternalEditor(EditorTestHelper):
self.log(f"Expected {num_expected_instances} instances - Found {num_found} instances")
self.test_success = self.test_success and num_found == num_expected_instances
- # 5) Create a new entity with a Camera component for testing in the launcher
- entity_position = math.Vector3(512.0, 500.0, 35.0)
- camera_component = ["Camera"]
- new_entity_id2 = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
- )
- if new_entity_id2.IsValid():
- self.log("Camera entity created")
- camera_entity = hydra.Entity("Camera Entity", new_entity_id2)
- camera_entity.components = []
- for component in camera_component:
- camera_entity.components.append(hydra.add_component(component, new_entity_id2))
+ # 5) Move the default Camera entity for testing in the launcher
+ cam_position = math.Vector3(512.0, 500.0, 35.0)
+ search_filter = entity.SearchFilter()
+ search_filter.names = ["Camera"]
+ search_entity_ids = entity.SearchBus(bus.Broadcast, 'SearchEntities', search_filter)
+ components.TransformBus(bus.Event, "MoveEntity", search_entity_ids[0], cam_position)
# 6) Save and export to engine
general.save_level()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py
index c4dfbbf4fe..3543b4c23c 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerBlender_E2E_Editor.py
@@ -18,9 +18,9 @@ import azlmbr.areasystem as areasystem
import azlmbr.legacy.general as general
import azlmbr
import azlmbr.bus as bus
-import azlmbr.editor as editor
+import azlmbr.components as components
import azlmbr.math as math
-import azlmbr.entity as EntityId
+import azlmbr.entity as entity
import azlmbr.paths
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
@@ -134,20 +134,14 @@ class TestVegLayerBlenderCreated(EditorTestHelper):
purple_count += 1
self.test_success = pink_count == purple_count and (pink_count + purple_count == num_expected) and self.test_success
- # 5) Create a new entity with a Camera component for testing in the launcher
- entity_position = math.Vector3(500.0, 500.0, 47.0)
- rot_degrees_vector = math.Vector3(radians(-55.0), radians(28.5), radians(-17.0))
- camera_component = ["Camera"]
- camera_id = editor.ToolsApplicationRequestBus(
- bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
- )
- if camera_id.IsValid():
- self.log("Camera entity created")
- camera_entity = hydra.Entity("Camera Entity", camera_id)
- camera_entity.components = []
- for component in camera_component:
- camera_entity.components.append(hydra.add_component(component, camera_id))
- azlmbr.components.TransformBus(bus.Event, "SetLocalRotation", camera_id, rot_degrees_vector)
+ # 5) Move the default Camera entity for testing in the launcher
+ cam_position = math.Vector3(500.0, 500.0, 47.0)
+ cam_rot_degrees_vector = math.Vector3(radians(-55.0), radians(28.5), radians(-17.0))
+ search_filter = entity.SearchFilter()
+ search_filter.names = ["Camera"]
+ search_entity_ids = entity.SearchBus(bus.Broadcast, 'SearchEntities', search_filter)
+ components.TransformBus(bus.Event, "MoveEntity", search_entity_ids[0], cam_position)
+ azlmbr.components.TransformBus(bus.Event, "SetLocalRotation", search_entity_ids[0], cam_rot_degrees_vector)
# 6) Save and export level
general.save_level()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py
index 0224f6bc0a..fb1ac5a5ce 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_FilterStageToggle.py
@@ -34,8 +34,8 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
:return: None
"""
- PREPROCESS_INSTANCE_COUNT = 425
- POSTPROCESS_INSTANCE_COUNT = 430
+ PREPROCESS_INSTANCE_COUNT = 21
+ POSTPROCESS_INSTANCE_COUNT = 19
# Create empty level
self.test_success = self.create_level(
@@ -56,7 +56,6 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
vegetation_entity.add_component("Vegetation Altitude Filter")
vegetation_entity.add_component("Vegetation Position Modifier")
-
# Create a child entity under vegetation area
child_entity = hydra.Entity("child_entity")
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
@@ -66,29 +65,13 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
vegetation_entity.get_set_test(4, "Configuration|Position X|Gradient|Gradient Entity Id", child_entity.id)
vegetation_entity.get_set_test(4, "Configuration|Position Y|Gradient|Gradient Entity Id", child_entity.id)
-
# Set the min and max values for Altitude Filter
- vegetation_entity.get_set_test(3, "Configuration|Altitude Min", 32.0)
- vegetation_entity.get_set_test(3, "Configuration|Altitude Max", 35.0)
+ vegetation_entity.get_set_test(3, "Configuration|Altitude Min", 34.0)
+ vegetation_entity.get_set_test(3, "Configuration|Altitude Max", 38.0)
# Add entity with Mesh to replicate creation of hills and a flat surface to plant on
dynveg.create_surface_entity("Flat Surface", position, 32.0, 32.0, 1.0)
- hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 4.0, 4.0, 4.0)
-
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
+ hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 4.0)
# Set the filter stage to preprocess and postprocess respectively and verify instance count
vegetation_entity.get_set_test(0, "Configuration|Filter Stage", 1)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py
index c99d180253..4752aeddbc 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py
@@ -13,7 +13,7 @@ import azlmbr.legacy.general as general
import azlmbr.math as math
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
-from automatedtesting_shared.editor_test_helper import EditorTestHelper
+from editor_python_test_tools.editor_test_helper import EditorTestHelper
from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py
index d23f811f58..89367ca475 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMesh.py
@@ -82,22 +82,7 @@ class test_MeshBlocker_InstancesBlockedByMesh(EditorTestHelper):
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "_primitives", "_box_1x1.azmodel"), math.Uuid(),
False)
blocker_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", cubeId)
- components.TransformBus(bus.Event, "SetLocalScale", blocker_entity.id, math.Vector3(2.0, 2.0, 2.0))
-
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
+ components.TransformBus(bus.Event, "SetLocalUniformScale", blocker_entity.id, 2.0)
# Verify spawned instance counts are accurate after addition of Blocker Entity
num_expected = 160 # Number of "PurpleFlower"s that plant on a 10 x 10 surface minus 2m blocker cube
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py
index ad57f80776..4a3edcd0e9 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/MeshBlocker_InstancesBlockedByMeshHeightTuning.py
@@ -88,24 +88,9 @@ class test_MeshBlocker_InstancesBlockedByMeshHeightTuning(EditorTestHelper):
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "_primitives", "_box_1x1.azmodel"), math.Uuid(),
False)
blocker_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", sphere_id)
- components.TransformBus(bus.Event, "SetLocalScale", blocker_entity.id, math.Vector3(5.0, 5.0, 5.0))
+ components.TransformBus(bus.Event, "SetLocalUniformScale", blocker_entity.id, 5.0)
components.TransformBus(bus.Event, "SetLocalRotation", blocker_entity.id, math.Vector3(0.0, y_rotation, 0.0))
- # Disable/Re-enable Mesh component due to ATOM-14299
- general.idle_wait(1.0)
- editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is still enabled")
- else:
- print("Mesh component was disabled")
- editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [blocker_entity.components[1]])
- is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
- if is_enabled:
- print("Mesh component is now enabled")
- else:
- print("Mesh component is still disabled")
-
# 5) Adjust the height Max percentage values of blocker
blocker_entity.get_set_test(0, "Configuration|Mesh Height Percent Max", 0.8)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py
index 053c4ccbfd..eb74a5a144 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_DynamicSliceInstanceSpawner.py
@@ -90,7 +90,6 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows'])
- @pytest.mark.skip # ATOM-14703
def test_DynamicSliceInstanceSpawner_Embedded_E2E_Launcher(self, workspace, launcher, level,
remote_console_instance, project, launcher_platform):
@@ -126,7 +125,6 @@ class TestDynamicSliceInstanceSpawner(object):
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
@pytest.mark.parametrize("launcher_platform", ['windows'])
- @pytest.mark.skip # ATOM-14703
def test_DynamicSliceInstanceSpawner_External_E2E_Launcher(self, workspace, launcher, level,
remote_console_instance, project, launcher_platform):
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py
index 3c16420a30..2620a7d50a 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerBlender.py
@@ -68,7 +68,6 @@ class TestLayerBlender(object):
"Entity has a Box Shape component",
"Blender Configuration|Vegetation Areas: SUCCESS",
"Blender Box Shape|Box Configuration|Dimensions: SUCCESS",
- "Camera entity created",
"LayerBlender_E2E_Editor: result=SUCCESS"
]
@@ -85,12 +84,11 @@ class TestLayerBlender(object):
@pytest.mark.BAT
@pytest.mark.SUITE_periodic
@pytest.mark.dynveg_area
- @pytest.mark.xfail
@pytest.mark.parametrize("launcher_platform", ['windows'])
def test_LayerBlender_E2E_Launcher(self, workspace, project, launcher, level, remote_console_instance,
launcher_platform):
- launcher.args.extend(["-NullRenderer"])
+ launcher.args.extend(["-rhi=Null"])
launcher.start()
assert launcher.is_alive(), "Launcher failed to start"
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py
index 410bdbafed..2af848ffb1 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_LayerSpawner.py
@@ -121,7 +121,7 @@ class TestLayerSpawner(object):
@pytest.mark.test_case_id("C30000751")
@pytest.mark.SUITE_sandbox
@pytest.mark.dynveg_misc
- @pytest.mark.skip # ATOM-14828
+ @pytest.mark.skip # https://github.com/o3de/o3de/issues/2038
def test_LayerSpawner_InstancesRefreshUsingCorrectViewportCamera(self, request, editor, level, launcher_platform):
expected_lines = [
@@ -136,5 +136,6 @@ class TestLayerSpawner(object):
editor,
"LayerSpawner_InstancesRefreshUsingCorrectViewportCamera.py",
expected_lines,
- cfg_args=[level]
+ cfg_args=[level],
+ null_renderer=False
)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py
index 515009cb3a..09d4746fa6 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py
@@ -34,7 +34,7 @@ def create_surface_entity(name, center_point, box_size_x, box_size_y, box_size_z
return surface_entity
-def create_mesh_surface_entity_with_slopes(name, center_point, scale_x, scale_y, scale_z):
+def create_mesh_surface_entity_with_slopes(name, center_point, uniform_scale):
# Creates an entity with the assigned mesh_asset as the specified scale and sets up as a planting surface
mesh_asset_path = os.path.join("models", "sphere.azmodel")
mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(),
@@ -47,7 +47,7 @@ def create_mesh_surface_entity_with_slopes(name, center_point, scale_x, scale_y,
if surface_entity.id.IsValid():
print(f"'{surface_entity.name}' created")
hydra.get_set_test(surface_entity, 0, "Controller|Configuration|Mesh Asset", mesh_asset)
- components.TransformBus(bus.Event, "SetLocalScale", surface_entity.id, math.Vector3(scale_x, scale_y, scale_z))
+ components.TransformBus(bus.Event, "SetLocalUniformScale", surface_entity.id, uniform_scale)
return surface_entity
diff --git a/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas b/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas
index f4ca23b882..10c40fbb9f 100644
--- a/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas
+++ b/AutomatedTesting/Levels/Physics/C14902098_ScriptCanvas_PostPhysicsUpdate/onpostphysicsupdate.scriptcanvas
@@ -742,14 +742,14 @@
-
+
-
+
diff --git a/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas b/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas
index b9f438a4f3..ffdac5dd8c 100644
--- a/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas
+++ b/AutomatedTesting/ScriptCanvas/C14195074_ScriptCanvas_PostUpdateEvent.scriptcanvas
@@ -1045,14 +1045,14 @@
-
+
-
+
diff --git a/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas b/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas
index 7db4f3a35c..4954eb4684 100644
--- a/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas
+++ b/AutomatedTesting/ScriptCanvas/C14902097_ScriptCanvas_PreUpdateEvent.scriptcanvas
@@ -1085,14 +1085,14 @@
-
+
-
+
diff --git a/Code/Editor/CMakeLists.txt b/Code/Editor/CMakeLists.txt
index 5a846a267a..13985cfb5e 100644
--- a/Code/Editor/CMakeLists.txt
+++ b/Code/Editor/CMakeLists.txt
@@ -138,7 +138,6 @@ ly_add_source_properties(
ly_add_source_properties(
SOURCES
Core/LevelEditorMenuHandler.cpp
- GraphicsSettingsDialog.cpp
MainWindow.cpp
PROPERTY COMPILE_DEFINITIONS
VALUES ${LY_PAL_TOOLS_DEFINES}
diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp
index ab1229dc6b..600691bdd6 100644
--- a/Code/Editor/Core/LevelEditorMenuHandler.cpp
+++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp
@@ -497,9 +497,15 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
// Hide Selection
editMenu.AddAction(AzToolsFramework::HideSelection);
- // Unhide All
+ // Show All
editMenu.AddAction(AzToolsFramework::ShowAll);
+ // Lock Selection
+ editMenu.AddAction(AzToolsFramework::LockSelection);
+
+ // UnLock All
+ editMenu.AddAction(AzToolsFramework::UnlockAll);
+
/*
* The following block of code is part of the feature "Isolation Mode" and is temporarily
* disabled for 1.10 release.
@@ -552,49 +558,9 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
// Global Preferences...
editorSettingsMenu.AddAction(ID_TOOLS_PREFERENCES);
- // Graphics Settings...
- editorSettingsMenu.AddAction(ID_GRAPHICS_SETTINGS);
-
// Editor Settings Manager
AddOpenViewPaneAction(editorSettingsMenu, LyViewPane::EditorSettingsManager);
- // Graphics Performance
- auto graphicPerformanceSubMenu = editorSettingsMenu.AddMenu(QObject::tr("Graphics Performance"));
-
- auto pcMenu = graphicPerformanceSubMenu.AddMenu(tr("PC"));
- pcMenu.AddAction(ID_GAME_PC_ENABLEVERYHIGHSPEC);
- pcMenu.AddAction(ID_GAME_PC_ENABLEHIGHSPEC);
- pcMenu.AddAction(ID_GAME_PC_ENABLEMEDIUMSPEC);
- pcMenu.AddAction(ID_GAME_PC_ENABLELOWSPEC);
-
- auto osxmetalMenu = graphicPerformanceSubMenu.AddMenu(tr("OSX Metal"));
- osxmetalMenu.AddAction(ID_GAME_OSXMETAL_ENABLEVERYHIGHSPEC);
- osxmetalMenu.AddAction(ID_GAME_OSXMETAL_ENABLEHIGHSPEC);
- osxmetalMenu.AddAction(ID_GAME_OSXMETAL_ENABLEMEDIUMSPEC);
- osxmetalMenu.AddAction(ID_GAME_OSXMETAL_ENABLELOWSPEC);
-
- auto androidMenu = graphicPerformanceSubMenu.AddMenu(tr("Android"));
- androidMenu.AddAction(ID_GAME_ANDROID_ENABLEVERYHIGHSPEC);
- androidMenu.AddAction(ID_GAME_ANDROID_ENABLEHIGHSPEC);
- androidMenu.AddAction(ID_GAME_ANDROID_ENABLEMEDIUMSPEC);
- androidMenu.AddAction(ID_GAME_ANDROID_ENABLELOWSPEC);
-
- auto iosMenu = graphicPerformanceSubMenu.AddMenu(tr("iOS"));
- iosMenu.AddAction(ID_GAME_IOS_ENABLEVERYHIGHSPEC);
- iosMenu.AddAction(ID_GAME_IOS_ENABLEHIGHSPEC);
- iosMenu.AddAction(ID_GAME_IOS_ENABLEMEDIUMSPEC);
- iosMenu.AddAction(ID_GAME_IOS_ENABLELOWSPEC);
-
-#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
-#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
- auto publicname##Menu = graphicPerformanceSubMenu.AddMenu(tr(PublicAuxName2));\
- publicname##Menu.AddAction(ID_GAME_##CODENAME##_ENABLEHIGHSPEC);\
- publicname##Menu.AddAction(ID_GAME_##CODENAME##_ENABLEMEDIUMSPEC);\
- publicname##Menu.AddAction(ID_GAME_##CODENAME##_ENABLELOWSPEC);
- AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS
-#undef AZ_RESTRICTED_PLATFORM_EXPANSION
-#endif
-
// Keyboard Customization
auto keyboardCustomizationMenu = editorSettingsMenu.AddMenu(tr("Keyboard Customization"));
keyboardCustomizationMenu.AddAction(ID_TOOLS_CUSTOMIZEKEYBOARD);
diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp
index 8efd4bc5b3..b0dddc94ae 100644
--- a/Code/Editor/CryEdit.cpp
+++ b/Code/Editor/CryEdit.cpp
@@ -111,7 +111,6 @@ AZ_POP_DISABLE_WARNING
#include "ToolBox.h"
#include "LevelInfo.h"
#include "EditorPreferencesDialog.h"
-#include "GraphicsSettingsDialog.h"
#include "AnimationContext.h"
#include "GotoPositionDlg.h"
@@ -440,7 +439,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_CLEAR_REGISTRY, OnClearRegistryData)
ON_COMMAND(ID_VALIDATELEVEL, OnValidatelevel)
ON_COMMAND(ID_TOOLS_PREFERENCES, OnToolsPreferences)
- ON_COMMAND(ID_GRAPHICS_SETTINGS, OnGraphicsSettings)
ON_COMMAND(ID_SWITCHCAMERA_DEFAULTCAMERA, OnSwitchToDefaultCamera)
ON_COMMAND(ID_SWITCHCAMERA_SEQUENCECAMERA, OnSwitchToSequenceCamera)
ON_COMMAND(ID_SWITCHCAMERA_SELECTEDCAMERA, OnSwitchToSelectedcamera)
@@ -453,14 +451,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView)
ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor)
- ON_COMMAND_RANGE(ID_GAME_PC_ENABLELOWSPEC, ID_GAME_PC_ENABLEVERYHIGHSPEC, OnChangeGameSpec)
-
- ON_COMMAND_RANGE(ID_GAME_OSXMETAL_ENABLELOWSPEC, ID_GAME_OSXMETAL_ENABLEVERYHIGHSPEC, OnChangeGameSpec)
-
- ON_COMMAND_RANGE(ID_GAME_ANDROID_ENABLELOWSPEC, ID_GAME_ANDROID_ENABLEVERYHIGHSPEC, OnChangeGameSpec)
-
- ON_COMMAND_RANGE(ID_GAME_IOS_ENABLELOWSPEC, ID_GAME_IOS_ENABLEVERYHIGHSPEC, OnChangeGameSpec)
-
#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
ON_COMMAND_RANGE(ID_GAME_##CODENAME##_ENABLELOWSPEC, ID_GAME_##CODENAME##_ENABLEHIGHSPEC, OnChangeGameSpec)
@@ -3674,13 +3664,6 @@ void CCryEditApp::OnToolsPreferences()
dlg.exec();
}
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnGraphicsSettings()
-{
- GraphicsSettingsDialog dlg(MainWindow::instance());
- dlg.exec();
-}
-
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToDefaultCamera()
{
@@ -3815,91 +3798,6 @@ void CCryEditApp::OnOpenUICanvasEditor()
QtViewPaneManager::instance()->OpenPane(LyViewPane::UiEditor);
}
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::SetGameSpecCheck(ESystemConfigSpec spec, ESystemConfigPlatform platform, int &nCheck, bool &enable)
-{
- if (GetIEditor()->GetEditorConfigSpec() == spec && GetIEditor()->GetEditorConfigPlatform() == platform)
- {
- nCheck = 1;
- }
- enable = spec <= GetIEditor()->GetSystem()->GetMaxConfigSpec();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateGameSpec(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
- int nCheck = 0;
- bool enable = true;
- switch (action->data().toInt())
- {
- case ID_GAME_PC_ENABLELOWSPEC:
- SetGameSpecCheck(CONFIG_LOW_SPEC, CONFIG_PC, nCheck, enable);
- break;
- case ID_GAME_PC_ENABLEMEDIUMSPEC:
- SetGameSpecCheck(CONFIG_MEDIUM_SPEC, CONFIG_PC, nCheck, enable);
- break;
- case ID_GAME_PC_ENABLEHIGHSPEC:
- SetGameSpecCheck(CONFIG_HIGH_SPEC, CONFIG_PC, nCheck, enable);
- break;
- case ID_GAME_PC_ENABLEVERYHIGHSPEC:
- SetGameSpecCheck(CONFIG_VERYHIGH_SPEC, CONFIG_PC, nCheck, enable);
- break;
- case ID_GAME_OSXMETAL_ENABLELOWSPEC:
- SetGameSpecCheck(CONFIG_LOW_SPEC, CONFIG_OSX_METAL, nCheck, enable);
- break;
- case ID_GAME_OSXMETAL_ENABLEMEDIUMSPEC:
- SetGameSpecCheck(CONFIG_MEDIUM_SPEC, CONFIG_OSX_METAL, nCheck, enable);
- break;
- case ID_GAME_OSXMETAL_ENABLEHIGHSPEC:
- SetGameSpecCheck(CONFIG_HIGH_SPEC, CONFIG_OSX_METAL, nCheck, enable);
- break;
- case ID_GAME_OSXMETAL_ENABLEVERYHIGHSPEC:
- SetGameSpecCheck(CONFIG_VERYHIGH_SPEC, CONFIG_OSX_METAL, nCheck, enable);
- break;
- case ID_GAME_ANDROID_ENABLELOWSPEC:
- SetGameSpecCheck(CONFIG_LOW_SPEC, CONFIG_ANDROID, nCheck, enable);
- break;
- case ID_GAME_ANDROID_ENABLEMEDIUMSPEC:
- SetGameSpecCheck(CONFIG_MEDIUM_SPEC, CONFIG_ANDROID, nCheck, enable);
- break;
- case ID_GAME_ANDROID_ENABLEHIGHSPEC:
- SetGameSpecCheck(CONFIG_HIGH_SPEC, CONFIG_ANDROID, nCheck, enable);
- break;
- case ID_GAME_ANDROID_ENABLEVERYHIGHSPEC:
- SetGameSpecCheck(CONFIG_VERYHIGH_SPEC, CONFIG_ANDROID, nCheck, enable);
- break;
- case ID_GAME_IOS_ENABLELOWSPEC:
- SetGameSpecCheck(CONFIG_LOW_SPEC, CONFIG_IOS, nCheck, enable);
- break;
- case ID_GAME_IOS_ENABLEMEDIUMSPEC:
- SetGameSpecCheck(CONFIG_MEDIUM_SPEC, CONFIG_IOS, nCheck, enable);
- break;
- case ID_GAME_IOS_ENABLEHIGHSPEC:
- SetGameSpecCheck(CONFIG_HIGH_SPEC, CONFIG_IOS, nCheck, enable);
- break;
- case ID_GAME_IOS_ENABLEVERYHIGHSPEC:
- SetGameSpecCheck(CONFIG_VERYHIGH_SPEC, CONFIG_IOS, nCheck, enable);
- break;
-#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
-#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
- case ID_GAME_##CODENAME##_ENABLELOWSPEC:\
- SetGameSpecCheck(CONFIG_LOW_SPEC, CONFIG_##CODENAME, nCheck, enable);\
- break;\
- case ID_GAME_##CODENAME##_ENABLEMEDIUMSPEC:\
- SetGameSpecCheck(CONFIG_MEDIUM_SPEC, CONFIG_##CODENAME, nCheck, enable);\
- break;\
- case ID_GAME_##CODENAME##_ENABLEHIGHSPEC:\
- SetGameSpecCheck(CONFIG_HIGH_SPEC, CONFIG_##CODENAME, nCheck, enable);\
- break;
- AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS
-#undef AZ_RESTRICTED_PLATFORM_EXPANSION
-#endif
- }
- action->setChecked(nCheck);
- action->setEnabled(enable);
-}
-
//////////////////////////////////////////////////////////////////////////
RecentFileList* CCryEditApp::GetRecentFileList()
{
diff --git a/Code/Editor/CryEdit.h b/Code/Editor/CryEdit.h
index 0628289897..5de8aa5e6c 100644
--- a/Code/Editor/CryEdit.h
+++ b/Code/Editor/CryEdit.h
@@ -403,7 +403,6 @@ private:
void OnClearRegistryData();
void OnValidatelevel();
void OnToolsPreferences();
- void OnGraphicsSettings();
void OnSwitchToDefaultCamera();
void OnUpdateSwitchToDefaultCamera(QAction* action);
void OnSwitchToSequenceCamera();
@@ -416,9 +415,6 @@ private:
void OnOpenTrackView();
void OnOpenAudioControlsEditor();
void OnOpenUICanvasEditor();
- void OnChangeGameSpec(UINT nID);
- void SetGameSpecCheck(ESystemConfigSpec spec, ESystemConfigPlatform platform, int &nCheck, bool &enable);
- void OnUpdateGameSpec(QAction* action);
void OnOpenQuickAccessBar();
public:
diff --git a/Code/Editor/CryEditPy.cpp b/Code/Editor/CryEditPy.cpp
index 02833a84e0..2e414da277 100644
--- a/Code/Editor/CryEditPy.cpp
+++ b/Code/Editor/CryEditPy.cpp
@@ -407,78 +407,6 @@ inline namespace Commands
}
}
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnChangeGameSpec(UINT nID)
-{
- switch (nID)
- {
- case ID_GAME_PC_ENABLELOWSPEC:
- Commands::PySetConfigSpec(CONFIG_LOW_SPEC, CONFIG_PC);
- break;
- case ID_GAME_PC_ENABLEMEDIUMSPEC:
- Commands::PySetConfigSpec(CONFIG_MEDIUM_SPEC, CONFIG_PC);
- break;
- case ID_GAME_PC_ENABLEHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_HIGH_SPEC, CONFIG_PC);
- break;
- case ID_GAME_PC_ENABLEVERYHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_VERYHIGH_SPEC, CONFIG_PC);
- break;
- case ID_GAME_OSXMETAL_ENABLELOWSPEC:
- Commands::PySetConfigSpec(CONFIG_LOW_SPEC, CONFIG_OSX_METAL);
- break;
- case ID_GAME_OSXMETAL_ENABLEMEDIUMSPEC:
- Commands::PySetConfigSpec(CONFIG_MEDIUM_SPEC, CONFIG_OSX_METAL);
- break;
- case ID_GAME_OSXMETAL_ENABLEHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_HIGH_SPEC, CONFIG_OSX_METAL);
- break;
- case ID_GAME_OSXMETAL_ENABLEVERYHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_VERYHIGH_SPEC, CONFIG_OSX_METAL);
- break;
- case ID_GAME_ANDROID_ENABLELOWSPEC:
- Commands::PySetConfigSpec(CONFIG_LOW_SPEC, CONFIG_ANDROID);
- break;
- case ID_GAME_ANDROID_ENABLEMEDIUMSPEC:
- Commands::PySetConfigSpec(CONFIG_MEDIUM_SPEC, CONFIG_ANDROID);
- break;
- case ID_GAME_ANDROID_ENABLEHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_HIGH_SPEC, CONFIG_ANDROID);
- break;
- case ID_GAME_ANDROID_ENABLEVERYHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_VERYHIGH_SPEC, CONFIG_ANDROID);
- break;
- case ID_GAME_IOS_ENABLELOWSPEC:
- Commands::PySetConfigSpec(CONFIG_LOW_SPEC, CONFIG_IOS);
- break;
- case ID_GAME_IOS_ENABLEMEDIUMSPEC:
- Commands::PySetConfigSpec(CONFIG_MEDIUM_SPEC, CONFIG_IOS);
- break;
- case ID_GAME_IOS_ENABLEHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_HIGH_SPEC, CONFIG_IOS);
- break;
- case ID_GAME_IOS_ENABLEVERYHIGHSPEC:
- Commands::PySetConfigSpec(CONFIG_VERYHIGH_SPEC, CONFIG_IOS);
- break;
-#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
-#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
- case ID_GAME_##CODENAME##_ENABLELOWSPEC:\
- Commands::PySetConfigSpec(CONFIG_LOW_SPEC, CONFIG_##CODENAME);\
- break;\
- case ID_GAME_##CODENAME##_ENABLEMEDIUMSPEC:\
- Commands::PySetConfigSpec(CONFIG_MEDIUM_SPEC, CONFIG_##CODENAME);\
- break;\
- case ID_GAME_##CODENAME##_ENABLEHIGHSPEC:\
- Commands::PySetConfigSpec(CONFIG_HIGH_SPEC, CONFIG_##CODENAME);\
- break;
- AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS
-#undef AZ_RESTRICTED_PLATFORM_EXPANSION
-#endif
- }
-}
-
-
-
namespace AzToolsFramework
{
void CryEditPythonHandler::Reflect(AZ::ReflectContext* context)
diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp
index 3f86260f8d..c2f16a84b1 100644
--- a/Code/Editor/EditorViewportWidget.cpp
+++ b/Code/Editor/EditorViewportWidget.cpp
@@ -1896,7 +1896,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
{
- CUndo undo("Move Camera");
+ AzToolsFramework::ScopedUndoBatch undo("Move Camera");
if (bMoveOnly)
{
// specify eObjectUpdateFlags_UserInput so that an undo command gets logged
@@ -1932,7 +1932,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
{
- CUndo undo("Move Camera");
+ AzToolsFramework::ScopedUndoBatch undo("Move Camera");
if (bMoveOnly)
{
AZ::TransformBus::Event(
@@ -1945,6 +1945,8 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
LYTransformToAZTransform(camMatrix));
}
+
+ AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequests::AddDirtyEntity, m_viewEntityId);
}
else
{
diff --git a/Code/Editor/GraphicsSettingsDialog.cpp b/Code/Editor/GraphicsSettingsDialog.cpp
deleted file mode 100644
index dbd7a7fc1a..0000000000
--- a/Code/Editor/GraphicsSettingsDialog.cpp
+++ /dev/null
@@ -1,1392 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#include
-#include
-#include
-#include "ProjectDefines.h"
-#include "EditorDefs.h"
-
-#include "GraphicsSettingsDialog.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-// AzFramework
-#include
-#include
-#include
-#include
-
-// Editor
-#include "Util/AutoDirectoryRestoreFileDialog.h"
-
-AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-#include "ui_graphicssettingsdialog.h"
-AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-QString groupNames[] =
-{
- "Game Effects",
- "Light",
- "Object Detail",
- "Particles",
- "Physics",
- "Post Processing",
- "Quality",
- "Shading",
- "Shadows",
- "Sound",
- "Texture",
- "Texture Resolution",
- "Volumetric Effects",
- "Water",
- "Miscellaneous"
-};
-
-GraphicsSettingsDialog::GraphicsSettingsDialog(QWidget* parent /* = nullptr */)
- : QDialog(parent)
- , m_ui(new Ui::GraphicsSettingsDialog())
-{
- //Update qlabel color when disabled
- setStyleSheet("QLabel::disabled{color: gray;}");
-
- // Start initialization the dialog
- m_ui->setupUi(this);
- setWindowTitle("Graphics Settings");
- m_ui->m_applyButton->setDefault(true);
- m_headerView = new GraphicsSettingsHeaderView(this, Qt::Horizontal);
- m_headerView->setMouseTracking(true);
- m_ui->m_graphicsSettingsTreeView->setHeader(m_headerView);
- /////////////////////////////////////////////
-
- m_currentPlatform = GetISystem()->GetConfigPlatform();
- m_currentSpecIndex = 0;
- m_dirtyCVarCount = 0;
-
- m_showCustomSpec = true;
- ShowCustomSpecOption(false);
-
- // Show categories, disable apply button
- m_showCategories = true;
- m_ui->m_applyButton->setEnabled(false);
-
- m_graphicsSettingsModel = new GraphicsSettingsModel(this);
- m_ui->m_graphicsSettingsTreeView->setModel(m_graphicsSettingsModel);
-
- m_cfgFiles[CONFIG_PC].push_back("pc_low.cfg");
- m_cfgFiles[CONFIG_PC].push_back("pc_medium.cfg");
- m_cfgFiles[CONFIG_PC].push_back("pc_high.cfg");
- m_cfgFiles[CONFIG_PC].push_back("pc_veryhigh.cfg");
- m_cfgFiles[CONFIG_OSX_METAL].push_back("osx_metal_low.cfg");
- m_cfgFiles[CONFIG_OSX_METAL].push_back("osx_metal_medium.cfg");
- m_cfgFiles[CONFIG_OSX_METAL].push_back("osx_metal_high.cfg");
- m_cfgFiles[CONFIG_OSX_METAL].push_back("osx_metal_veryhigh.cfg");
- m_cfgFiles[CONFIG_ANDROID].push_back("android_low.cfg");
- m_cfgFiles[CONFIG_ANDROID].push_back("android_medium.cfg");
- m_cfgFiles[CONFIG_ANDROID].push_back("android_high.cfg");
- m_cfgFiles[CONFIG_ANDROID].push_back("android_veryhigh.cfg");
- m_cfgFiles[CONFIG_IOS].push_back("ios_low.cfg");
- m_cfgFiles[CONFIG_IOS].push_back("ios_medium.cfg");
- m_cfgFiles[CONFIG_IOS].push_back("ios_high.cfg");
- m_cfgFiles[CONFIG_IOS].push_back("ios_veryhigh.cfg");
-#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
-#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
- m_cfgFiles[CONFIG_##CODENAME].push_back(#publicname "_low.cfg");\
- m_cfgFiles[CONFIG_##CODENAME].push_back(#publicname "_medium.cfg");\
- m_cfgFiles[CONFIG_##CODENAME].push_back(#publicname "_high.cfg");
- AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS
-#undef AZ_RESTRICTED_PLATFORM_EXPANSION
-#endif
- // Since the layout order is set by the .ui file we need to match the order here so that tabbing works correctly.
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_gameeffects.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_light.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_objectdetail.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_particles.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_physics.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_postprocessing.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_quality.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_shading.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_shadows.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_sound.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_texture.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_textureresolution.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_volumetriceffects.cfg");
- m_cvarGroupOrder.push_back("Config/CVarGroups/sys_spec_water.cfg");
- m_cvarGroupOrder.push_back("miscellaneous");
-
- m_platformStrings.push_back(AZStd::make_pair("PC", CONFIG_PC));
- m_platformStrings.push_back(AZStd::make_pair("OSX Metal", CONFIG_OSX_METAL));
- m_platformStrings.push_back(AZStd::make_pair("Android", CONFIG_ANDROID));
- m_platformStrings.push_back(AZStd::make_pair("iOS", CONFIG_IOS));
-#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
-#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
- m_platformStrings.push_back(AZStd::make_pair(PublicAuxName2, CONFIG_##CODENAME));
- AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS
-#undef AZ_RESTRICTED_PLATFORM_EXPANSION
-#endif
- m_platformStrings.push_back(AZStd::make_pair("Custom", CONFIG_INVALID_PLATFORM));
-
- for (auto& platformString : m_platformStrings)
- {
- QString platform = platformString.first.c_str();
- m_ui->m_platformEntry->addItem(platform);
- }
-
- QSettings settings("O3DE", "O3DE");
- settings.beginGroup("GraphicsSettingsDialog");
-
- if (settings.contains("Platform"))
- {
- QString platformName = settings.value("Platform").toString();
- AZStd::string azPlatform = platformName.toUtf8().data();
- m_currentPlatform = GetConfigPlatformFromName(azPlatform);
- if (m_currentPlatform == CONFIG_INVALID_PLATFORM)
- {
- ShowCustomSpecOption(true);
- }
- }
-
- settings.endGroup();
-
- SetPlatformEntry(m_currentPlatform);
-
- BuildUI();
-
- connect(m_ui->m_graphicsSettingsTreeView, &QTreeView::collapsed, this, [&](const QModelIndex& index) { SetCollapsed(index, true); });
- connect(m_ui->m_graphicsSettingsTreeView, &QTreeView::expanded, this, [&](const QModelIndex& index) { SetCollapsed(index, false); });
-
- AzQtComponents::StyleManager::setStyleSheet(this, "style:GraphicsSettingsDialog.qss");
-}
-
-GraphicsSettingsDialog::~GraphicsSettingsDialog()
-{
- QSettings settings("O3DE", "O3DE");
- settings.beginGroup("GraphicsSettingsDialog");
-
- auto platformCheck = [this](AZStd::pair& stringConfigPair) { return stringConfigPair.second == m_currentPlatform; };
- auto platformStringsIterator = AZStd::find_if(m_platformStrings.begin(), m_platformStrings.end(), platformCheck);
- if (platformStringsIterator != m_platformStrings.end())
- {
- settings.setValue("Platform", platformStringsIterator->first.c_str());
- }
- else
- {
- settings.remove("Platform");
- }
-
- settings.beginGroup("cvarGroup");
-
- for (auto& collapseIterator : m_uiCollapseGroup)
- {
- settings.setValue(collapseIterator->m_groupName, collapseIterator->m_isCollapsed);
- }
-
- settings.endGroup();
- settings.endGroup();
- settings.sync();
-
- for (CollapseGroup* group : m_uiCollapseGroup)
- {
- // Destructor of CollapseGroup will set the members
- // pointing to nullptr. The actually destruction of the
- // widgets will be done on destruction of m_ui
- delete group;
- }
-
- for (ParameterWidget* widget : m_parameterWidgets)
- {
- // Destructor of ParameterWidget will set the members
- // pointing to nullptr. The actually destruction of the
- // widgets will be done on destruction of m_ui
- delete widget;
- }
-
- // Delete m_ui will destruct all the UI elements with in the ui file
- // Since m_ui is a QScopedPointer which will cleanup itself on the end
- // of the scope.
-}
-
-void GraphicsSettingsDialog::SetSettingsTree(int numColumns)
-{
- m_graphicsSettingsModel->clear();
- m_uiCollapseGroup.clear();
- m_graphicsSettingsModel->setColumnCount(numColumns);
-
- for (int i = 1; i < numColumns; ++i)
- {
- m_ui->m_graphicsSettingsTreeView->header()->setSectionResizeMode(i, QHeaderView::Stretch);
- }
-
- m_ui->m_graphicsSettingsTreeView->setColumnWidth(0, 200);
- m_ui->m_graphicsSettingsTreeView->header()->setMinimumSectionSize(100);
-
- m_graphicsSettingsModel->setHeaderData(0, Qt::Horizontal, "Properties");
-
- auto parentItem = m_graphicsSettingsModel->invisibleRootItem();
-
- for (int i = 0; i < aznumeric_cast(GraphicsSettings::numSettings); ++i)
- {
- QStandardItem* row = new QStandardItem();
- row->setData(groupNames[i], Qt::DisplayRole);
- parentItem->appendRow(row);
- SetCollapsedLayout(groupNames[i].replace(" ", ""), row);
- }
- m_numColumns = numColumns;
-
- m_cvarGroupData["Config/CVarGroups/sys_spec_gameeffects.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::GameEffects));
- m_cvarGroupData["Config/CVarGroups/sys_spec_light.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Light));
- m_cvarGroupData["Config/CVarGroups/sys_spec_objectdetail.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::ObjectDetail));
- m_cvarGroupData["Config/CVarGroups/sys_spec_particles.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Particles));
- m_cvarGroupData["Config/CVarGroups/sys_spec_physics.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Physics));
- m_cvarGroupData["Config/CVarGroups/sys_spec_postprocessing.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::PostProcessing));
- m_cvarGroupData["Config/CVarGroups/sys_spec_quality.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Quality));
- m_cvarGroupData["Config/CVarGroups/sys_spec_shading.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Shading));
- m_cvarGroupData["Config/CVarGroups/sys_spec_shadows.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Shadows));
- m_cvarGroupData["Config/CVarGroups/sys_spec_sound.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Sound));
- m_cvarGroupData["Config/CVarGroups/sys_spec_texture.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Texture));
- m_cvarGroupData["Config/CVarGroups/sys_spec_textureresolution.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::TextureResolution));
- m_cvarGroupData["Config/CVarGroups/sys_spec_volumetriceffects.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::VolumetricEffects));
- m_cvarGroupData["Config/CVarGroups/sys_spec_water.cfg"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Water));
- m_cvarGroupData["miscellaneous"].m_treeRowItem = m_graphicsSettingsModel->item(aznumeric_cast(GraphicsSettings::Miscellaneous));
-}
-
-void GraphicsSettingsDialog::OnLoadConfigurationEntry(const char* strKey, const char* strValue, const char* strGroup)
-{
- AZStd::string key = strKey;
- ICVar* cvar = gEnv->pConsole->GetCVar(strKey);
-
- if (cvar)
- {
- AZStd::transform(key.begin(), key.end(), key.begin(), tolower);
- if (azstricmp(key.c_str(), "sys_spec_full") == 0 || key.find("sys_spec_") == key.npos)
- {
- int type = cvar->GetType();
- AZStd::any val;
- if (type == CVAR_INT)
- {
- val = atoi(strValue);
- }
- else if (type == CVAR_FLOAT)
- {
- val = static_cast(atof(strValue));
- }
- else
- {
- val = AZStd::string(strValue);
- }
-
- // Platform cfg file (ex. pc_veryhigh.cfg)
- if (strGroup[0] == '\0')
- {
- // New cvar loaded into map
- if (m_cVarTracker.find(key) == m_cVarTracker.end())
- {
- m_cVarTracker[key].type = type;
- m_cVarTracker[key].cvarGroup = "miscellaneous";
- AZStd::any empty;
- if (type == CVAR_INT)
- {
- empty = 0;
- }
- else if (type == CVAR_FLOAT)
- {
- empty = 0.0f;
- }
- else
- {
- empty = AZStd::string("");
- }
- m_cVarTracker[key].fileVals.resize(m_numSpecLevels, CVarFileStatus(empty, empty, empty));
- }
-
- m_cVarTracker[key].fileVals[m_currentSpecIndex].editedValue = val;
- m_cVarTracker[key].fileVals[m_currentSpecIndex].overwrittenValue = val;
- }
- // default group in sys_spec cfg file
- else if (azstricmp(strGroup, "default") == 0)
- {
- CVarFileStatus defaultVal(val, val, val);
- if (m_cVarTracker.find(key) == m_cVarTracker.end())
- {
- // New cvar loaded into map
- CVarInfo& currentCVar = m_cVarTracker[key];
- currentCVar.type = cvar->GetType();
- currentCVar.fileVals.resize(m_numSpecLevels, defaultVal);
- }
- else
- {
- // Reset values, if there's a platform override it always follows the sys_spec_*.cfg files.
- // Resetting avoids the issue where some spec levels are never set because of an extra platform
- // override load happening earlier just to store the value of sys_spec_full.
- for (int specLevel = 0; specLevel < m_numSpecLevels; ++specLevel)
- {
- m_cVarTracker[key].fileVals[specLevel] = defaultVal;
- }
- }
- // Overwrite miscellaneous if mentioned in platform config file
- m_cVarTracker[key].cvarGroup = m_currentConfigFilename;
- }
- // specific index in sys_spec cfg file
- else
- {
- int group = 0;
-
- if (azsscanf(strGroup, "%d", &group) == 1)
- {
- auto sysSpecFull = m_cVarTracker.find("sys_spec_full");
- if (sysSpecFull != m_cVarTracker.end())
- {
- CVarFileStatus indexAssignment(val, val, val);
- for (int specLevel = 0; specLevel < m_numSpecLevels; ++specLevel)
- {
- // Only apply cvar change to configurations with sys_spec_Full matching the index
- int overwrittenValue = 0;
- if (AZStd::any_numeric_cast(&sysSpecFull->second.fileVals[specLevel].overwrittenValue, overwrittenValue) && group == overwrittenValue)
- {
- m_cVarTracker[key].fileVals[specLevel] = indexAssignment;
- }
- }
- }
- }
- }
- }
- }
-}
-
-// Loads UI column for specific cfg file (ex. pc_low.cfg)
-void GraphicsSettingsDialog::BuildColumn(int specLevel)
-{
- if (specLevel < 0 || specLevel >= m_numSpecLevels)
- {
- return;
- }
-
- for (auto& it : m_cvarGroupData)
- {
- it.second.m_currentRow = 0;
- }
-
- for (auto& it : m_cVarTracker)
- {
- QString str = it.first.c_str();
- QWidget* input = nullptr;
- if (it.second.type == CVAR_INT)
- {
- AzQtComponents::SpinBox* intval = new AzQtComponents::SpinBox(nullptr);
- intval->setFocusPolicy(Qt::StrongFocus);
- intval->setMaximum(INT32_MAX);
- intval->setMinimum(INT32_MIN);
- int editedValue;
- if (AZStd::any_numeric_cast(&it.second.fileVals[specLevel].editedValue, editedValue))
- {
- intval->setValue(editedValue);
- }
- m_cvarGroupData[it.second.cvarGroup].m_cvarSpinBoxes.push_back(intval);
- connect(intval, SIGNAL(valueChanged(int)), this, SLOT(CVarChanged(int)));
- input = intval;
- }
- else if (it.second.type == CVAR_FLOAT)
- {
- AzQtComponents::DoubleSpinBox* doubleval = new AzQtComponents::DoubleSpinBox(nullptr);
- doubleval->setFocusPolicy(Qt::StrongFocus);
- doubleval->setMaximum(FLT_MAX);
- doubleval->setMinimum(-FLT_MAX);
- float editedValue;
- if (AZStd::any_numeric_cast(&it.second.fileVals[specLevel].editedValue, editedValue))
- {
- doubleval->setValue(editedValue);
- }
- m_cvarGroupData[it.second.cvarGroup].m_cvarDoubleSpinBoxes.push_back(doubleval);
- connect(doubleval, SIGNAL(valueChanged(double)), this, SLOT(CVarChanged(double)));
- input = doubleval;
- }
- else
- {
- QLineEdit* stringval = new QLineEdit(nullptr);
- AZStd::string* editedValue = AZStd::any_cast(&it.second.fileVals[specLevel].editedValue);
- stringval->setText(editedValue->c_str());
- m_cvarGroupData[it.second.cvarGroup].m_cvarLineEdits.push_back(stringval);
- connect(stringval, SIGNAL(textChanged(const QString&)), this, SLOT(CVarChanged(const QString&)));
- input = stringval;
- }
-
- if (input)
- {
- input->setObjectName(str);
- input->setProperty("specLevel", specLevel);
- QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- sizePolicy.setHeightForWidth(input->sizePolicy().hasHeightForWidth());
- input->setSizePolicy(sizePolicy);
- input->setMinimumSize(QSize(INPUT_MIN_WIDTH, INPUT_MIN_HEIGHT));
- QStandardItem* parentItem = m_cvarGroupData[it.second.cvarGroup].m_treeRowItem;
- QModelIndex parentIndex = parentItem->index();
- QModelIndex thisIndex = m_graphicsSettingsModel->index(m_cvarGroupData[it.second.cvarGroup].m_currentRow++, specLevel + CVAR_VALUE_COLUMN_OFFSET, parentIndex);
- m_ui->m_graphicsSettingsTreeView->setIndexWidget(thisIndex, input);
- m_parameterWidgets.push_back(new ParameterWidget(input, it.first.c_str()));
- m_cvarGroupData[it.second.cvarGroup].m_widgetInsertOrder.push_back(input);
- }
- }
-}
-
-void GraphicsSettingsDialog::LoadPlatformConfigurations()
-{
- const int numColumns = m_cfgFiles[m_currentPlatform].size() + 1;
- SetSettingsTree(numColumns);
-
- for (ParameterWidget* widget : m_parameterWidgets)
- {
- delete widget;
- }
- m_parameterWidgets.clear();
-
- m_ui->m_applyButton->setEnabled(false);
- m_dirtyCVarCount = 0;
-
- // Load platform cfg files to load in sys_spec_Full
- for (size_t cfgFileIndex = 0; cfgFileIndex < m_cfgFiles[m_currentPlatform].size(); ++cfgFileIndex)
- {
- m_currentSpecIndex = cfgFileIndex;
- m_currentConfigFilename = m_cfgFiles[m_currentPlatform][cfgFileIndex];
- GetISystem()->LoadConfiguration(m_currentConfigFilename.c_str(), this, true);
- }
-
- if (m_cVarTracker.find("sys_spec_full") == m_cVarTracker.end())
- {
- m_cVarTracker.clear();
- CleanUI();
- ShowCategories(false);
- QMessageBox::warning(this, "Warning", "Invalid custom spec file (missing sys_spec_full).",
- QMessageBox::Ok);
- return;
- }
-
- // Load sys_spec cfgs based on sys_spec_Full values
- LoadCVarGroupDirectory(m_cvarGroupsFolder);
-
- setUpdatesEnabled(false);
-
- // Reload platform cfg files to override sys_spec index assignments and load rows with filenames of given platform
- for (size_t cfgFileIndex = 0; cfgFileIndex < m_cfgFiles[m_currentPlatform].size(); ++cfgFileIndex)
- {
- m_currentSpecIndex = cfgFileIndex;
- m_currentConfigFilename = m_cfgFiles[m_currentPlatform][cfgFileIndex];
- GetISystem()->LoadConfiguration(m_currentConfigFilename.c_str(), this, true);
-
- /*CVarGroupInfo& specFileGroup =*/ m_cvarGroupData["SpecFile"];
- m_graphicsSettingsModel->setHeaderData(cfgFileIndex + CVAR_VALUE_COLUMN_OFFSET, Qt::Horizontal, QApplication::translate("GraphicsSettingsDialog", m_cfgFiles[m_currentPlatform][cfgFileIndex].c_str()));
- }
-
- // Loads column of cvar names
- for (auto& it : m_cVarTracker)
- {
- QLabel* cVarLabel = new QLabel(nullptr);
- QString str = it.first.c_str();
- QString strLabel = str + "Label";
- cVarLabel->setObjectName(strLabel);
- QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- sizePolicy.setHeightForWidth(cVarLabel->sizePolicy().hasHeightForWidth());
- cVarLabel->setSizePolicy(sizePolicy);
- cVarLabel->setMinimumSize(QSize(INPUT_MIN_WIDTH, INPUT_MIN_HEIGHT));
- cVarLabel->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
- QStandardItem* cVarItem = new QStandardItem();
- cVarItem->setData(QApplication::translate("GraphicsSettingsDialog", it.first.c_str(), 0), Qt::DisplayRole);
- QList items{ cVarItem };
- for (int i = 1; i < numColumns; ++i)
- {
- items << new QStandardItem();
- }
- m_cvarGroupData[it.second.cvarGroup].m_treeRowItem->appendRow(items);
- cVarLabel->setText(QApplication::translate("GraphicsSettingsDialog", it.first.c_str(), 0));
- m_cvarGroupData[it.second.cvarGroup].m_cvarLabels.push_back(cVarLabel);
-
- if (ICVar* cvar = gEnv->pConsole->GetCVar(it.first.c_str()))
- {
- cVarLabel->setToolTip(cvar->GetHelp());
- }
- }
-
- // Loads columns of cvar values for each platform cfg file
- for (int cfgFileIndex = 0; cfgFileIndex < m_cfgFiles[m_currentPlatform].size(); ++cfgFileIndex)
- {
- BuildColumn(cfgFileIndex);
- }
-
- // Remove any section that has no visible controls
- for (auto& it : m_cvarGroupData)
- {
- int totalControlCount = 0;
- CVarGroupInfo& currentCvarGroupInfo = it.second;
- totalControlCount += currentCvarGroupInfo.m_cvarDoubleSpinBoxes.size();
- totalControlCount += currentCvarGroupInfo.m_cvarSpinBoxes.size();
- totalControlCount += currentCvarGroupInfo.m_cvarLineEdits.size();
- totalControlCount += currentCvarGroupInfo.m_platformLabels.size();
-
- if (totalControlCount == 0)
- {
- if (currentCvarGroupInfo.m_treeRowItem)
- {
- int i = 0;
- for (auto& collapseIterator : m_uiCollapseGroup)
- {
- if (collapseIterator->m_groupRow == currentCvarGroupInfo.m_treeRowItem)
- {
- m_uiCollapseGroup.remove(i);
- break;
- }
- ++i;
- }
- m_graphicsSettingsModel->removeRow(currentCvarGroupInfo.m_treeRowItem->row());
- }
- }
- }
-
- setUpdatesEnabled(true);
-
- QSettings settings("O3DE", "O3DE");
- settings.beginGroup("GraphicsSettingsDialog");
- settings.beginGroup("cvarGroup");
-
- for (auto& collapseIterator : m_uiCollapseGroup)
- {
- bool groupCollapsed = settings.value(collapseIterator->m_groupName, collapseIterator->m_isCollapsed).toBool();
- if (collapseIterator->m_isCollapsed != groupCollapsed)
- {
- collapseIterator->ToggleCollapsed();
- }
- }
-
- settings.endGroup();
- settings.endGroup();
-}
-
-void GraphicsSettingsDialog::LoadCVarGroupDirectory(const AZStd::string& path)
-{
- AZ::IO::LocalFileIO::FindFilesCallbackType fileFinderCb;
- fileFinderCb = [&](const char* fullPath) -> bool
- {
- if (gEnv->pFileIO->IsDirectory(fullPath))
- {
- // recurse into subdirectory
- gEnv->pFileIO->FindFiles(fullPath, "*.cfg", fileFinderCb);
- }
- else
- {
- m_currentConfigFilename = fullPath;
- GetISystem()->LoadConfiguration(fullPath, this, false);
- }
-
- return true; // keep searching
- };
-
- gEnv->pFileIO->FindFiles(path.c_str(), "*.cfg", fileFinderCb);
-}
-
-//Build UI, link signals and set the data for device list.
-void GraphicsSettingsDialog::BuildUI()
-{
- connect(m_ui->m_cancelButton, &QPushButton::clicked, this, &GraphicsSettingsDialog::reject);
- connect(m_ui->m_applyButton, &QPushButton::clicked, this, &GraphicsSettingsDialog::accept);
- connect(m_ui->m_platformEntry, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(PlatformChanged(const QString&)));
- connect(m_ui->m_selectCustomSpecButton, &QPushButton::clicked, this, &GraphicsSettingsDialog::OpenCustomSpecDialog);
-
- if (!m_cfgFiles[m_currentPlatform].empty())
- {
- LoadPlatformConfigurations();
- }
- else
- {
- m_cVarTracker.clear();
- CleanUI();
- ShowCategories(false);
- }
-}
-
-void GraphicsSettingsDialog::CleanUI()
-{
- setUpdatesEnabled(false);
-
- QSettings settings("O3DE", "O3DE");
- settings.beginGroup("GraphicsSettingsDialog");
- settings.beginGroup("cvarGroup");
-
- for (auto& collapseIterator : m_uiCollapseGroup)
- {
- settings.setValue(collapseIterator->m_groupName, collapseIterator->m_isCollapsed);
- }
-
- settings.endGroup();
- settings.endGroup();
- settings.sync();
-
- m_cVarTracker.clear();
-
- // Uncollapse groups
- for (auto& collapseIt : m_uiCollapseGroup)
- {
- if (collapseIt->m_isCollapsed)
- {
- collapseIt->ToggleCollapsed();
- }
- }
-
- setUpdatesEnabled(true);
-}
-
-void GraphicsSettingsDialog::ShowCategories(bool show)
-{
- if (m_showCategories == show)
- {
- return;
- }
-
- m_showCategories = show;
- m_ui->m_graphicsSettingsTreeView->setVisible(show);
-}
-
-void GraphicsSettingsDialog::ShowCustomSpecOption(bool show)
-{
- if (m_showCustomSpec == show)
- {
- return;
- }
-
- m_showCustomSpec = show;
- m_ui->m_selectCustomSpecButton->setVisible(m_showCustomSpec);
- m_ui->m_lineSpacer->setVisible(m_showCustomSpec);
-}
-
-void GraphicsSettingsDialog::PlatformChanged(const QString& platform)
-{
- bool change = true;
- if (m_dirtyCVarCount > 0 && !SendUnsavedChangesWarning(false))
- {
- change = false;
- }
-
- if (change)
- {
- AZStd::string azPlatform = platform.toStdString().c_str();
-
- m_currentPlatform = GetConfigPlatformFromName(azPlatform);
- if (m_currentPlatform == CONFIG_INVALID_PLATFORM) // "Custom" selected
- {
- ShowCustomSpecOption(true);
- CleanUI();
- if (m_cfgFiles[CONFIG_INVALID_PLATFORM].empty()) // if we don't have a custom spec
- {
- ShowCategories(false);
- m_ui->m_applyButton->setEnabled(false);
- m_dirtyCVarCount = 0;
- }
- else
- {
- ShowCategories(true);
- LoadPlatformConfigurations();
- }
- }
- else
- {
- ShowCustomSpecOption(false);
- ShowCategories(true);
- CleanUI();
- LoadPlatformConfigurations();
- }
- }
- else
- {
- m_ui->m_platformEntry->blockSignals(true);
- SetPlatformEntry(m_currentPlatform);
- m_ui->m_platformEntry->blockSignals(false);
- }
-}
-
-bool GraphicsSettingsDialog::SendUnsavedChangesWarning(bool cancel)
-{
- int result = QMessageBox::Yes;
-
- if (cancel)
- {
- result = QMessageBox::question(this, "Warning", "There are currently unsaved changed. Are you sure you want to cancel?",
- QMessageBox::Yes, QMessageBox::No);
- }
- else
- {
- result = QMessageBox::question(this, "Warning", "There are currently unsaved changed. Are you sure you want to change configurations?",
- QMessageBox::Yes, QMessageBox::No);
- }
-
- return (result == QMessageBox::Yes);
-}
-
-bool GraphicsSettingsDialog::CVarChanged(AZStd::any val, const char* cvarName, int specLevel)
-{
- // Checking if the edited value (before change) is equal to the overwritten value
- bool dirtyBefore = false;
- AZStd::string azcvarName = cvarName;
- AZStd::pair cvarInfo = AZStd::make_pair(azcvarName, m_cVarTracker[cvarName]);
- if (CheckCVarStatesForDiff(&cvarInfo, specLevel, EDITED_OVERWRITTEN_COMPARE))
- {
- dirtyBefore = true;
- }
-
- if (azstricmp(cvarName, "sys_spec_full") == 0)
- {
- //Pop out the warning dialog for sys_spec_Full since all cvars will be changed
- int result = QMessageBox::Ok;
-
- result = QMessageBox::question(this, "Warning", "Modifying sys_spec_full will override any unsaved changes.",
- QMessageBox::Ok, QMessageBox::Cancel);
-
- // Cancel - Change sys_spec_full qspinbox value back
- if (result == QMessageBox::Cancel)
- {
- return false;
- }
- else // OK - reload column
- {
- // Updating sys_spec_full for when adding cvargroup directory
- m_cVarTracker[cvarName].fileVals[specLevel].editedValue = val;
- gEnv->pSystem->AddCVarGroupDirectory(m_cvarGroupsFolder);
- m_currentConfigFilename = m_cfgFiles[m_currentPlatform][specLevel];
- m_currentSpecIndex = specLevel;
- GetISystem()->LoadConfiguration(m_currentConfigFilename.c_str(), this, true);
- // Updating sys_spec_full since overwritten from loading platform cfg
- m_cVarTracker[cvarName].fileVals[specLevel].editedValue = val;
- BuildColumn(specLevel);
- }
- }
- else
- {
- m_cVarTracker[cvarName].fileVals[specLevel].editedValue = val;
- }
-
- // Checking if the newly edited value is equal to the overwritten value
- cvarInfo = AZStd::make_pair(azcvarName, m_cVarTracker[cvarName]);
- if (CheckCVarStatesForDiff(&cvarInfo, specLevel, EDITED_OVERWRITTEN_COMPARE))
- {
- if (!dirtyBefore)
- {
- m_ui->m_applyButton->setEnabled(true);
- m_dirtyCVarCount++;
- }
- }
- else
- {
- if (dirtyBefore)
- {
- m_dirtyCVarCount--;
- if (m_dirtyCVarCount == 0)
- {
- m_ui->m_applyButton->setEnabled(false);
- }
- }
- }
-
- return true;
-}
-
-void GraphicsSettingsDialog::CVarChanged(int i)
-{
- AzQtComponents::SpinBox* box = static_cast(sender());
- QString str = box->objectName();
- QByteArray ba = str.toUtf8();
- const char* cvarName = ba.data();
-
- int specLevel = box->property("specLevel").toInt();
-
- AZStd::any val;
- val = i;
-
- if (!CVarChanged(val, cvarName, specLevel))
- {
- // sys_spec_full warning cancelled
- box->blockSignals(true);
- int editedValue;
- if (AZStd::any_numeric_cast(&m_cVarTracker[cvarName].fileVals[specLevel].editedValue, editedValue))
- {
- box->setValue(editedValue);
- }
- box->blockSignals(false);
- }
-}
-
-void GraphicsSettingsDialog::CVarChanged(double d)
-{
- AzQtComponents::DoubleSpinBox* box = static_cast(sender());
- QString str = box->objectName();
- QByteArray ba = str.toUtf8();
- const char* cvarName = ba.data();
-
- AZStd::any val;
- val = d;
-
- int specLevel = box->property("specLevel").toInt();
-
- if (!CVarChanged(val, cvarName, specLevel))
- {
- // only can return false from sys_spec_full, which is an int cvar
- }
-}
-
-void GraphicsSettingsDialog::CVarChanged(const QString& s)
-{
- QLineEdit* box = qobject_cast(sender());
- QString str = box->objectName();
- QByteArray ba = str.toUtf8();
- const char* cvarName = ba.data();
-
- AZStd::any val;
- val = AZStd::string(s.toStdString().c_str());
-
- int specLevel = box->property("specLevel").toInt();
-
- if (!CVarChanged(val, cvarName, specLevel))
- {
- // only can return false from sys_spec_full, which is an int cvar
- }
-}
-
-// Returns true if there is a difference between the two cvar states
-bool GraphicsSettingsDialog::CheckCVarStatesForDiff(AZStd::pair* it, int cfgFileIndex, CVarStateComparison cmp)
-{
- if (it->second.type == CVAR_INT)
- {
- int editedVal, overwrittenVal, originalVal;
- if (AZStd::any_numeric_cast(&it->second.fileVals[cfgFileIndex].editedValue, editedVal) &&
- AZStd::any_numeric_cast(&it->second.fileVals[cfgFileIndex].overwrittenValue, overwrittenVal) &&
- AZStd::any_numeric_cast(&it->second.fileVals[cfgFileIndex].originalValue, originalVal))
- {
- if ((cmp == EDITED_OVERWRITTEN_COMPARE && editedVal != overwrittenVal) ||
- (cmp == EDITED_ORIGINAL_COMPARE && editedVal != originalVal) ||
- (cmp == OVERWRITTEN_ORIGINAL_COMPARE && overwrittenVal != originalVal))
- {
- return true;
- }
- }
- }
- else if (it->second.type == CVAR_FLOAT)
- {
- float editedVal, overwrittenVal, originalVal;
- if (AZStd::any_numeric_cast(&it->second.fileVals[cfgFileIndex].editedValue, editedVal) &&
- AZStd::any_numeric_cast(&it->second.fileVals[cfgFileIndex].overwrittenValue, overwrittenVal) &&
- AZStd::any_numeric_cast(&it->second.fileVals[cfgFileIndex].originalValue, originalVal))
- {
- if ((cmp == EDITED_OVERWRITTEN_COMPARE && editedVal != overwrittenVal) ||
- (cmp == EDITED_ORIGINAL_COMPARE && editedVal != originalVal) ||
- (cmp == OVERWRITTEN_ORIGINAL_COMPARE && overwrittenVal != originalVal))
- {
- return true;
- }
- }
- }
- else
- {
- AZStd::string editedVal = *AZStd::any_cast(&it->second.fileVals[cfgFileIndex].editedValue);
- AZStd::string overwrittenVal = *AZStd::any_cast(&it->second.fileVals[cfgFileIndex].overwrittenValue);
- AZStd::string originalVal = *AZStd::any_cast(&it->second.fileVals[cfgFileIndex].originalValue);
- if ((cmp == EDITED_OVERWRITTEN_COMPARE && editedVal.compare(overwrittenVal) != 0) ||
- (cmp == EDITED_ORIGINAL_COMPARE && editedVal.compare(originalVal) != 0) ||
- (cmp == OVERWRITTEN_ORIGINAL_COMPARE && overwrittenVal.compare(originalVal) != 0))
- {
- return true;
- }
- }
- return false;
-}
-
-///////////////////////////////////////////////////////////////////////
-// settings file management
-void GraphicsSettingsDialog::reject()
-{
- if (m_dirtyCVarCount > 0)
- {
- if (SendUnsavedChangesWarning(true))
- {
- QDialog::reject();
- }
- }
- else
- {
- QDialog::reject();
- }
-}
-
-void GraphicsSettingsDialog::accept()
-{
- int result = QMessageBox::Yes;
-
- //Pop out the warning dialog for customized setting
- result = QMessageBox::question(this, "Warning", "A non-tested setting could potentially crash the game if the setting does not match the device. Are you sure you want to apply the customized setting?",
- QMessageBox::Yes, QMessageBox::No);
-
- //Save and exit
- if (result == QMessageBox::Yes)
- {
- SaveSystemSettings();
- }
-}
-
-void GraphicsSettingsDialog::OpenCustomSpecDialog()
-{
- AZ::IO::FixedMaxPath projectPath = AZ::Utils::GetProjectPath();
- projectPath /= SETTINGS_FILE_PATH.toUtf8().constData();
- QString settingsPath = QString::fromUtf8(projectPath.c_str(), aznumeric_cast(projectPath.Native().size()));
-
- CAutoDirectoryRestoreFileDialog importCustomSpecDialog(QFileDialog::AcceptOpen, QFileDialog::ExistingFile, ".cfg", settingsPath, CFG_FILEFILTER, {}, {}, this);
-
- if (importCustomSpecDialog.exec())
- {
- QString file = importCustomSpecDialog.selectedFiles().first();
- if (!file.isEmpty())
- {
- ApplyCustomSpec(file);
- }
- }
-}
-
-void GraphicsSettingsDialog::ApplyCustomSpec(const QString& customFilePath)
-{
- if (customFilePath.isEmpty())
- {
- return;
- }
-
- QFile customFile(customFilePath);
- if (!customFile.exists())
- {
- QMessageBox::warning(this, "Warning", "Could not find custom spec file.",
- QMessageBox::Ok);
- return;
- }
-
- bool change = true;
- if (m_dirtyCVarCount > 0 && !SendUnsavedChangesWarning(false))
- {
- change = false;
- }
-
- if (change)
- {
- AZStd::string filename = customFilePath.toStdString().c_str();
- filename = filename.substr(filename.find_last_of('/') + 1);
-
- m_currentPlatform = CONFIG_INVALID_PLATFORM;
-
- bool alreadyLoaded = IsCustomSpecAlreadyLoaded(filename);
- if (m_cfgFiles[CONFIG_INVALID_PLATFORM].size() < m_numSpecLevels && !alreadyLoaded)
- {
- m_cfgFiles[CONFIG_INVALID_PLATFORM].push_back(filename);
- }
- else if (alreadyLoaded)
- {
- QMessageBox::warning(this, "Warning", "The selected custom spec file is already loaded. No changes have been made.",
- QMessageBox::Ok);
- return;
- }
-
- if (m_cfgFiles[CONFIG_INVALID_PLATFORM].size() == m_numSpecLevels)
- {
- m_ui->m_selectCustomSpecButton->setEnabled(false);
- }
-
- ShowCategories(true);
-
- CleanUI();
-
- LoadPlatformConfigurations();
- }
-}
-
-void GraphicsSettingsDialog::UnloadCustomSpec(int specLevel)
-{
- if (specLevel < 0 || specLevel >= m_cfgFiles[CONFIG_INVALID_PLATFORM].size())
- {
- return;
- }
-
- bool shouldUnload = m_dirtyCVarCount <= 0 || SendUnsavedChangesWarning(false);
-
- if (shouldUnload)
- {
- m_cfgFiles[CONFIG_INVALID_PLATFORM].erase(m_cfgFiles[CONFIG_INVALID_PLATFORM].begin() + specLevel);
-
- CleanUI();
-
- if (!m_cfgFiles[CONFIG_INVALID_PLATFORM].empty())
- {
- LoadPlatformConfigurations();
- }
- else
- {
- ShowCategories(false);
- }
- }
-}
-
-bool GraphicsSettingsDialog::IsCustomSpecAlreadyLoaded(const AZStd::string& filename) const
-{
- auto& customConfigFilenames = m_cfgFiles.at(CONFIG_INVALID_PLATFORM);
- const auto& findResult = AZStd::find(customConfigFilenames.begin(), customConfigFilenames.end(), filename.c_str());
-
- return findResult != customConfigFilenames.end();
-}
-
-void GraphicsSettingsDialog::SetCollapsedLayout(const QString& groupName, QStandardItem* groupRow)
-{
- CollapseGroup* cgroup = new CollapseGroup(m_ui->m_graphicsSettingsTreeView);
- cgroup->m_groupName = groupName;
- cgroup->m_groupRow = groupRow;
- m_uiCollapseGroup.push_back(cgroup);
-}
-
-void GraphicsSettingsDialog::SetPlatformEntry(ESystemConfigPlatform platform)
-{
- auto platformCheck = [&platform](AZStd::pair& stringConfigPair) { return stringConfigPair.second == platform; };
- auto platformStringsIterator = AZStd::find_if(m_platformStrings.begin(), m_platformStrings.end(), platformCheck);
- if (platformStringsIterator != m_platformStrings.end())
- {
- int platformIndex = m_ui->m_platformEntry->findText(platformStringsIterator->first.c_str());
- m_ui->m_platformEntry->setCurrentIndex(platformIndex);
- }
- else
- {
- AZ_Assert(false, "Platform not found in platform strings vector.");
- }
-}
-
-ESystemConfigPlatform GraphicsSettingsDialog::GetConfigPlatformFromName(const AZStd::string& platformName)
-{
- ESystemConfigPlatform configPlatform = CONFIG_INVALID_PLATFORM;
-
- auto platformNameCheck = [&platformName](AZStd::pair& stringConfigPair) { return (stringConfigPair.first == platformName); };
- auto configPlatformIterator = AZStd::find_if(m_platformStrings.begin(), m_platformStrings.end(), platformNameCheck);
- if (configPlatformIterator != m_platformStrings.end())
- {
- configPlatform = configPlatformIterator->second;
- }
- else
- {
- AZ_Assert(false, "Platform name not found in platform strings vector.");
- }
-
- return configPlatform;
-}
-
-// Save the current UI options to system qsettings
-void GraphicsSettingsDialog::SaveSystemSettings()
-{
- AZStd::vector successFiles;
- AZStd::vector nochangeFiles;
-
- for (int cfgFileIndex = 0; cfgFileIndex < m_cfgFiles[m_currentPlatform].size(); ++cfgFileIndex)
- {
- const QString eq = " = ";
- const QString cvarGroupString1 = "\n------------------------\n-- ";
- const QString cvarGroupString2 = "\n------------------------\n";
- QString commandList = "";
-
- int sysSpecFull;
- if (AZStd::any_numeric_cast(&m_cVarTracker["sys_spec_full"].fileVals[cfgFileIndex].editedValue, sysSpecFull))
- {
- commandList += "sys_spec_full" + eq + QString::number(sysSpecFull) + '\n';
- }
-
- QMap cvarGroupStrings;
-
- // Set to true as soon as cvar is found which is unique from current cfg file and index assignment
- bool saveOut = false;
-
- // Adding any dirty cvars not equal to sys_spec_full or any cvar in miscellaneous to command list
- for (auto& it : m_cVarTracker)
- {
- if ((CheckCVarStatesForDiff(&it, cfgFileIndex, EDITED_ORIGINAL_COMPARE) || it.second.cvarGroup == "miscellaneous") && azstricmp(it.first.c_str(), "sys_spec_full"))
- {
- AZStd::string cvarGroup = it.second.cvarGroup;
- if (azstricmp(cvarGroup.c_str(), "miscellaneous") != 0)
- {
- int fileIndex = cvarGroup.find_last_of('/') + 1;
- cvarGroup = cvarGroup.substr(fileIndex, cvarGroup.size() - fileIndex - 4);
- }
- QString qcvarGroup = cvarGroup.c_str();
- if (cvarGroupStrings.find(qcvarGroup) == cvarGroupStrings.end())
- {
- cvarGroupStrings[qcvarGroup] = cvarGroupString1 + qcvarGroup + cvarGroupString2;
- }
-
- if (it.second.type == CVAR_INT)
- {
- int val;
- if (AZStd::any_numeric_cast(&it.second.fileVals[cfgFileIndex].editedValue, val))
- {
- cvarGroupStrings[qcvarGroup] += it.first.c_str() + eq + QString::number(val) + '\n';
- }
- }
- else if (it.second.type == CVAR_FLOAT)
- {
- float val;
- if (AZStd::any_numeric_cast(&it.second.fileVals[cfgFileIndex].editedValue, val))
- {
- cvarGroupStrings[qcvarGroup] += it.first.c_str() + eq + QString::number(val) + '\n';
- }
- }
- else
- {
- cvarGroupStrings[qcvarGroup] += it.first.c_str() + eq + AZStd::any_cast(it.second.fileVals[cfgFileIndex].editedValue).c_str() + '\n';
- }
- }
-
- if (!saveOut)
- {
- saveOut = CheckCVarStatesForDiff(&it, cfgFileIndex, EDITED_OVERWRITTEN_COMPARE);
- }
- }
-
- // Adding the project name to the path so that the file is created there if it doesn't already exist
- // as we don't want to modify the version in Engine/config.
- AZ::IO::FixedMaxPath projectPath = AZ::Utils::GetProjectPath();
- projectPath /= SETTINGS_FILE_PATH.toUtf8().constData();
- QString settingsPath = QString::fromUtf8(projectPath.c_str(), aznumeric_cast(projectPath.Native().size()));
-
- QString settingsFile = settingsPath + m_cfgFiles[m_currentPlatform][cfgFileIndex].c_str();
-
- // Check if current settings differ from existing cfg
- if (saveOut)
- {
- // Adding any dirty cvars not equal to sys_spec_full to command list
- for (auto& it : cvarGroupStrings)
- {
- commandList += it;
- }
-
- if (CFileUtil::OverwriteFile(settingsFile.toStdString().c_str()))
- {
- if (!CFileUtil::CreateDirectory(settingsPath.toStdString().c_str()))
- {
- QMessageBox::warning(this, "Warning", "Could not create the directory for file \"" + settingsFile + "\". Failed to apply Graphics Setting.",
- QMessageBox::Ok);
- continue;
- }
-
- QByteArray dataArray = commandList.toUtf8().data();
-
- QFile file(settingsFile);
- if (!file.open(QIODevice::WriteOnly) || file.write(dataArray) != dataArray.size())
- {
- QMessageBox::warning(this, "Warning", "Could not write settings to file \"" + settingsFile + ". Failed to apply Graphics Setting.",
- QMessageBox::Ok);
- file.close();
- continue;
- }
-
- successFiles.push_back(settingsFile);
-
- // Update platform cvars to reflect new values
- for (auto& it : m_cVarTracker)
- {
- it.second.fileVals[cfgFileIndex].overwrittenValue = it.second.fileVals[cfgFileIndex].editedValue;
- }
-
- file.close();
- }
- else
- {
- QMessageBox::warning(this, "Warning", "Could not check out or make file writable: \"" + settingsFile + "\". Failed to apply Graphics Setting.",
- QMessageBox::Ok);
- }
- }
- else
- {
- nochangeFiles.push_back(settingsFile);
- }
- }
-
- // Print list of files which had no changes made
- if (nochangeFiles.size() > 0)
- {
- QString message = "No changes have been made to the following files:\n";
- for (int i = 0; i < nochangeFiles.size(); ++i)
- {
- message += nochangeFiles[i] + "\n";
- }
- QMessageBox::information(this, "Log", message, QMessageBox::Ok);
- }
-
- // Print list of files which were successfully saved
- if (successFiles.size() > 0)
- {
- QString message = "Updated the graphics setting correctly for the following files:\n";
- for (int i = 0; i < successFiles.size(); ++i)
- {
- message += successFiles[i] + "\n";
- }
- QMessageBox::information(this, "Log", message, QMessageBox::Ok);
- }
-
- // if we saved all of the files that we needed to then disable the save button again
- if (nochangeFiles.size() + successFiles.size() == m_cfgFiles[m_currentPlatform].size())
- {
- m_dirtyCVarCount = 0;
- m_ui->m_applyButton->setEnabled(false);
- }
-}
-
-void GraphicsSettingsDialog::SetCollapsed(const QModelIndex& index, bool flags)
-{
- QStandardItem* item = m_graphicsSettingsModel->itemFromIndex(index);
-
- for (auto& collapseIterator : m_uiCollapseGroup)
- {
- if (collapseIterator->m_groupRow == item)
- {
- collapseIterator->m_isCollapsed = flags;
- break;
- }
- }
-}
-
-/////////////////////////////////////////////////////////////////////////
-// Collapse Group
-GraphicsSettingsDialog::CollapseGroup::CollapseGroup(QTreeView* treeView)
- : m_treeView(treeView)
- , m_isCollapsed(true)
-{
-}
-
-void GraphicsSettingsDialog::CollapseGroup::ToggleCollapsed()
-{
- m_isCollapsed = !m_isCollapsed;
- const QModelIndex index = m_groupRow->index();
- if (m_isCollapsed)
- {
- m_treeView->collapse(index);
- }
- else
- {
- m_treeView->expand(index);
- }
-}
-
-///////////////////////////////////////////////////////////////////
-// ParameterWidget
-GraphicsSettingsDialog::ParameterWidget::ParameterWidget(QWidget* widget, QString parameterName)
- : m_widget(widget)
- , m_parameterName(parameterName)
-{
- m_widget->setToolTip(GetToolTip());
-}
-
-QString GraphicsSettingsDialog::ParameterWidget::GetToolTip() const
-{
- if (!m_parameterName.isEmpty())
- {
- QString tooltipText = QString(PARAMETER_TOOLTIP).arg(m_parameterName);
- return tooltipText;
- }
- return "";
-}
-
-GraphicsSettingsTreeView::GraphicsSettingsTreeView(QWidget* parent)
- : QTreeView(parent)
-{
-}
-
-GraphicsSettingsHeaderView::GraphicsSettingsHeaderView(GraphicsSettingsDialog* dialog, Qt::Orientation orientation, QWidget* parent)
- : QHeaderView(orientation, parent)
- , m_dialog(dialog)
-{
- setDefaultAlignment(Qt::AlignLeft);
-}
-
-bool GraphicsSettingsHeaderView::event(QEvent* e)
-{
- if (m_dialog->IsCustom())
- {
- GraphicsSettingsTreeView* treeView = qobject_cast(parent());
- if (treeView)
- {
- switch (e->type())
- {
- case QEvent::Enter:
- m_index = logicalIndexAt(static_cast(e)->pos());
- if (m_index > 0)
- {
- treeView->setSortingEnabled(true);
- treeView->sortByColumn(m_index, Qt::AscendingOrder);
- }
- break;
- case QEvent::Leave:
- treeView->setSortingEnabled(false);
- break;
- }
- }
- }
- return QHeaderView::event(e);
-}
-
-void GraphicsSettingsHeaderView::mouseReleaseEvent(QMouseEvent* e)
-{
- AZ_UNUSED(e);
- if (QMessageBox::question(
- this, QObject::tr("Unload Resource"),
- QObject::tr("Are you sure you want to unload the resource?"),
- QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Yes)
- {
- m_dialog->UnloadCustomSpec(m_index - 1);
- }
-
-}
-
-void GraphicsSettingsHeaderView::mouseMoveEvent(QMouseEvent* e)
-{
- AZ_UNUSED(e);
- if (m_dialog->IsCustom())
- {
- GraphicsSettingsTreeView* treeView = qobject_cast(parent());
- int index = logicalIndexAt(e->pos());
- if (index != m_index)
- {
- m_index = index;
- if (m_index > 0)
- {
- treeView->setSortingEnabled(true);
- treeView->sortByColumn(m_index, Qt::AscendingOrder);
- }
- else
- {
- treeView->setSortingEnabled(false);
- }
- }
- }
-}
-
-GraphicsSettingsModel::GraphicsSettingsModel(QObject* parent)
- : QStandardItemModel(parent)
-{
-}
-
-Qt::ItemFlags GraphicsSettingsModel::flags(const QModelIndex& index) const
-{
- Qt::ItemFlags flags = Qt::NoItemFlags;
-
- if (index.column() == 0)
- {
- flags |= Qt::ItemIsSelectable | Qt::ItemIsEnabled;
- }
- return flags;
-}
-
-#include
diff --git a/Code/Editor/GraphicsSettingsDialog.h b/Code/Editor/GraphicsSettingsDialog.h
deleted file mode 100644
index 66a498cd10..0000000000
--- a/Code/Editor/GraphicsSettingsDialog.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#if !defined(Q_MOC_RUN)
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-#endif
-
-class QGridLayout;
-class QLabel;
-
-namespace Ui
-{
- class GraphicsSettingsDialog;
-}
-
-// Description:
-// Status of cvar for a specifc platform and spec level
-// editedValue - current setting within Graphics Settings Dialog box
-// overwrittenValue - original setting from platform config file (set to originalValue if not found)
-// originalValue - original settings from sys_spec config file index
-
-struct CVarFileStatus
-{
- AZStd::any editedValue;
- AZStd::any overwrittenValue;
- AZStd::any originalValue;
- CVarFileStatus(AZStd::any edit, AZStd::any over, AZStd::any orig) : editedValue(edit), overwrittenValue(over), originalValue(orig) {}
-};
-
-// Description:
-// Status of specific cvar for Editor mapping
-// type - CVAR_INT / CVAR_FLOAT / CVAR_STRING
-// cvarGroup - source of cvar (sys_spec_particles, sys_spec_physics, etc.) or "miscellaneous" if only specified in platform config file
-// fileVals = CVarFileStatus for each spec level of a specific platform
-
-struct CVarInfo
-{
- int type;
- AZStd::string cvarGroup;
- AZStd::vector fileVals;
-};
-
-enum class GraphicsSettings
-{
- GameEffects,
- Light,
- ObjectDetail,
- Particles,
- Physics,
- PostProcessing,
- Quality,
- Shading,
- Shadows,
- Sound,
- Texture,
- TextureResolution,
- VolumetricEffects,
- Water,
- Miscellaneous,
- numSettings
-};
-
-class GraphicsSettingsHeaderView;
-
-class GraphicsSettingsTreeView
- : public QTreeView
-{
- Q_OBJECT
-
-public:
- GraphicsSettingsTreeView(QWidget* parent = nullptr);
-
-};
-
-class GraphicsSettingsModel
- : public QStandardItemModel
-{
- Q_OBJECT
-
-public:
- explicit GraphicsSettingsModel(QObject* parent = 0);
-
- Qt::ItemFlags flags(const QModelIndex& index) const override;
-};
-
-class GraphicsSettingsDialog
- : public QDialog,
- public ILoadConfigurationEntrySink
-{
- Q_OBJECT
-
-public:
-
- explicit GraphicsSettingsDialog(QWidget* parent = nullptr);
- virtual ~GraphicsSettingsDialog();
-
- bool IsCustom(void) { return m_showCustomSpec; }
- void UnloadCustomSpec(int specLevel);
-
- // ILoadConfigurationEntrySink
- void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup) override;
-
-public slots:
- //Accept and reject
- void reject() override;
- void accept() override;
-
-private slots:
- //Update UIs
- void PlatformChanged(const QString& platform);
- bool CVarChanged(AZStd::any val, const char* cvarName, int specLevel);
- void CVarChanged(int i);
- void CVarChanged(double d);
- void CVarChanged(const QString& s);
-
-private:
-
- // The struct ParameterWidget is used to store the parameter widget
- // m_parameterName will be the name of the parameter the widget represent.
- struct ParameterWidget
- {
- ParameterWidget(QWidget* widget, QString parameterName = "");
-
- QString GetToolTip() const;
-
- const char* PARAMETER_TOOLTIP = "The variable will update render parameter \"%1\".";
- QWidget* m_widget;
- QString m_parameterName;
- };
-
- struct CollapseGroup
- {
- QString m_groupName;
- QStandardItem* m_groupRow;
- QTreeView* m_treeView;
- bool m_isCollapsed;
-
- CollapseGroup(QTreeView* treeView);
-
- void ToggleCollapsed();
- };
-
- void OpenCustomSpecDialog();
- void ApplyCustomSpec(const QString& customFilePath);
- bool IsCustomSpecAlreadyLoaded(const AZStd::string& filename) const;
- void SetSettingsTree(int numColumns);
- void SetCollapsed(const QModelIndex& index, bool flag);
-
- enum CVarStateComparison
- {
- EDITED_OVERWRITTEN_COMPARE = 1,
- EDITED_ORIGINAL_COMPARE = 2,
- OVERWRITTEN_ORIGINAL_COMPARE = 3,
-
- END_CVARSTATE_COMPARE,
- };
-
- bool CheckCVarStatesForDiff(AZStd::pair* it, int cfgFileIndex, CVarStateComparison cmp);
-
- // Save out settings into project-level cfg files
- void SaveSystemSettings();
-
- // Load in project-level cfg files for current platform
- void LoadPlatformConfigurations();
- // Build UI column for spec level of current platform
- void BuildColumn(int specLevel);
- // Initial UI building
- void BuildUI();
- // Cleaning out UI before loading new platform information
- void CleanUI();
- // Shows/hides custom spec option
- void ShowCustomSpecOption(bool show);
- // Shows/hides category labels and dropdowns
- void ShowCategories(bool show);
- // Warns about unsaved changes (returns true if accepted)
- bool SendUnsavedChangesWarning(bool cancel);
-
- void LoadCVarGroupDirectory(const AZStd::string& path);
-
- /////////////////////////////////////////////
- // UI help functions
-
- // Setup collapsed buttons
- void SetCollapsedLayout(const QString& groupName, QStandardItem* groupItem);
- // Sets the platform entry index for the given platform
- void SetPlatformEntry(ESystemConfigPlatform platform);
- // Gets the platform enum given the platform name
- ESystemConfigPlatform GetConfigPlatformFromName(const AZStd::string& platformName);
-
- ////////////////////////////////////////////
- // Members
-
- // Qt values
- const int INPUT_MIN_WIDTH = 100;
- const int INPUT_MIN_HEIGHT = 20;
- const int INPUT_ROW_SPAN = 1;
- const int INPUT_COLUMN_SPAN = 1;
- const int CVAR_ROW_OFFSET = 2;
- const int CVAR_VALUE_COLUMN_OFFSET = 1;
- const int PLATFORM_LABEL_ROW = 1;
- const int CVAR_LABEL_COLUMN = 1;
-
- // Tool tips
- const QString SETTINGS_FILE_PATH = "Config/spec/";
- const char* CFG_FILEFILTER = "Cfg File(*.cfg);;All files(*)";
-
- const int m_numSpecLevels = 4;
-
- bool m_showCustomSpec;
- bool m_showCategories;
- GraphicsSettingsModel* m_graphicsSettingsModel;
- GraphicsSettingsHeaderView* m_headerView;
- int m_numColumns{ 0 };
-
- const char* m_cvarGroupsFolder = "Config/CVarGroups";
-
- QScopedPointer m_ui;
-
- QVector m_uiCollapseGroup;
-
- QVector m_parameterWidgets;
-
- AZStd::string m_currentConfigFilename;
- size_t m_currentSpecIndex;
-
- // cvar name --> pair(type, CVarStatus for each file)
- AZStd::unordered_map m_cVarTracker;
-
- AZStd::unordered_map > m_cfgFiles;
-
- AZStd::vector > m_platformStrings;
-
- struct CVarGroupInfo
- {
- QVector m_platformLabels;
- QVector m_cvarLabels;
- QVector m_cvarSpinBoxes;
- QVector m_cvarDoubleSpinBoxes;
- QVector m_cvarLineEdits;
- QVector m_specFileArea;
- QVector m_widgetInsertOrder;
- QStandardItem* m_treeRowItem;
- int m_currentRow;
- };
-
- AZStd::unordered_map m_cvarGroupData;
- AZStd::vector m_cvarGroupOrder;
-
- ESystemConfigPlatform m_currentPlatform;
-
- int m_dirtyCVarCount;
-};
-
-class GraphicsSettingsHeaderView
- : public QHeaderView
-{
- Q_OBJECT
-public:
- GraphicsSettingsHeaderView(GraphicsSettingsDialog* dialog, Qt::Orientation orientation, QWidget* parent = nullptr);
-
-private:
- bool event(QEvent* e) override;
- void mouseMoveEvent(QMouseEvent* e) override;
- void mouseReleaseEvent(QMouseEvent* e) override;
-
- GraphicsSettingsDialog* m_dialog;
- int m_index{ -1 };
-};
-
-
diff --git a/Code/Editor/LegacyViewportCameraController.cpp b/Code/Editor/LegacyViewportCameraController.cpp
index f437196548..b18e807942 100644
--- a/Code/Editor/LegacyViewportCameraController.cpp
+++ b/Code/Editor/LegacyViewportCameraController.cpp
@@ -83,9 +83,9 @@ AZ::RPI::ViewportContextPtr LegacyViewportCameraControllerInstance::GetViewportC
}
bool LegacyViewportCameraControllerInstance::HandleMouseMove(
- const AzFramework::ScreenPoint& currentMousePos, const AzFramework::ScreenPoint& previousMousePos)
+ int dx, int dy)
{
- if (previousMousePos == currentMousePos)
+ if (dx == 0 && dy == 0)
{
return false;
}
@@ -105,7 +105,7 @@ bool LegacyViewportCameraControllerInstance::HandleMouseMove(
if (m_inMoveMode || m_inOrbitMode || m_inRotateMode || m_inZoomMode)
{
- m_totalMouseMoveDelta += (QPoint(currentMousePos.m_x, currentMousePos.m_y)-QPoint(previousMousePos.m_x, previousMousePos.m_y)).manhattanLength();
+ m_totalMouseMoveDelta += AZStd::abs(dx) + AZStd::abs(dy);
}
if ((m_inRotateMode && m_inMoveMode) || m_inZoomMode)
@@ -115,7 +115,7 @@ bool LegacyViewportCameraControllerInstance::HandleMouseMove(
Vec3 ydir = m.GetColumn1().GetNormalized();
Vec3 pos = m.GetTranslation();
- const float posDelta = 0.2f * (previousMousePos.m_y - currentMousePos.m_y) * speedScale;
+ const float posDelta = 0.2f * dy * speedScale;
pos = pos - ydir * posDelta;
m_orbitDistance = m_orbitDistance + posDelta;
m_orbitDistance = fabs(m_orbitDistance);
@@ -126,7 +126,7 @@ bool LegacyViewportCameraControllerInstance::HandleMouseMove(
}
else if (m_inRotateMode)
{
- Ang3 angles(-currentMousePos.m_y + previousMousePos.m_y, 0, -currentMousePos.m_x + previousMousePos.m_x);
+ Ang3 angles(dy, 0, dx);
angles = angles * 0.002f * gSettings.cameraRotateSpeed;
if (gSettings.invertYRotation)
{
@@ -158,7 +158,7 @@ bool LegacyViewportCameraControllerInstance::HandleMouseMove(
}
Vec3 pos = m.GetTranslation();
- pos += 0.1f * xdir * (currentMousePos.m_x - previousMousePos.m_x) * speedScale + 0.1f * zdir * (previousMousePos.m_y - currentMousePos.m_y) * speedScale;
+ pos += 0.1f * xdir * dx * speedScale + 0.1f * zdir * dy * speedScale;
m.SetTranslation(pos);
AZ::Transform transform = viewportContext->GetCameraTransform();
@@ -168,7 +168,7 @@ bool LegacyViewportCameraControllerInstance::HandleMouseMove(
}
else if (m_inOrbitMode)
{
- Ang3 angles(-currentMousePos.m_y + previousMousePos.m_y, 0, -currentMousePos.m_x + previousMousePos.m_x);
+ Ang3 angles(dy, 0, dx);
angles = angles * 0.002f * gSettings.cameraRotateSpeed;
if (gSettings.invertPan)
@@ -302,20 +302,19 @@ bool LegacyViewportCameraControllerInstance::HandleInputChannelEvent(const AzFra
bool shouldCaptureCursor = m_capturingCursor;
bool shouldConsumeEvent = false;
- if (id == AzFramework::InputDeviceMouse::SystemCursorPosition)
+ if (id == AzFramework::InputDeviceMouse::Movement::X || id == AzFramework::InputDeviceMouse::Movement::Y)
{
- bool result = false;
- AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
- GetViewportId(),
- [this, &result](AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequests* mouseRequests)
- {
- if (auto previousMousePosition = mouseRequests->PreviousViewportCursorScreenPosition();
- previousMousePosition.has_value())
- {
- result = HandleMouseMove(mouseRequests->ViewportCursorScreenPosition(), previousMousePosition.value());
- }
- });
- return result;
+ int dx = 0;
+ int dy = 0;
+ if (id == AzFramework::InputDeviceMouse::Movement::X)
+ {
+ dx = -aznumeric_cast(event.m_inputChannel.GetValue());
+ }
+ else
+ {
+ dy = -aznumeric_cast(event.m_inputChannel.GetValue());
+ }
+ return HandleMouseMove(dx, dy);
}
else if (id == MouseButton::Left)
{
diff --git a/Code/Editor/LegacyViewportCameraController.h b/Code/Editor/LegacyViewportCameraController.h
index d3ff439b16..ff752e27ab 100644
--- a/Code/Editor/LegacyViewportCameraController.h
+++ b/Code/Editor/LegacyViewportCameraController.h
@@ -69,7 +69,7 @@ namespace SandboxEditor
AZ::RPI::ViewportContextPtr GetViewportContext();
- bool HandleMouseMove(const AzFramework::ScreenPoint& currentMousePos, const AzFramework::ScreenPoint& previousMousePos);
+ bool HandleMouseMove(int dx, int dy);
bool HandleMouseWheel(float zDelta);
bool IsKeyDown(Qt::Key key) const;
void UpdateCursorCapture(bool shouldCaptureCursor);
diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp
index 72f7ebf03b..c7e32fb82a 100644
--- a/Code/Editor/MainWindow.cpp
+++ b/Code/Editor/MainWindow.cpp
@@ -687,49 +687,6 @@ void MainWindow::InitActions()
am->AddAction(ID_FILE_PROJECT_MANAGER_SETTINGS, tr("Edit Project Settings..."));
am->AddAction(ID_FILE_PROJECT_MANAGER_NEW, tr("New Project..."));
am->AddAction(ID_FILE_PROJECT_MANAGER_OPEN, tr("Open Project..."));
- am->AddAction(ID_GAME_PC_ENABLEVERYHIGHSPEC, tr("Very High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_PC_ENABLEHIGHSPEC, tr("High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_PC_ENABLEMEDIUMSPEC, tr("Medium")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_PC_ENABLELOWSPEC, tr("Low")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_OSXMETAL_ENABLEVERYHIGHSPEC, tr("Very High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_OSXMETAL_ENABLEHIGHSPEC, tr("High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_OSXMETAL_ENABLEMEDIUMSPEC, tr("Medium")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_OSXMETAL_ENABLELOWSPEC, tr("Low")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_ANDROID_ENABLEVERYHIGHSPEC, tr("Very High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_ANDROID_ENABLEHIGHSPEC, tr("High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_ANDROID_ENABLEMEDIUMSPEC, tr("Medium")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_ANDROID_ENABLELOWSPEC, tr("Low")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_IOS_ENABLEVERYHIGHSPEC, tr("Very High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_IOS_ENABLEHIGHSPEC, tr("High")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_IOS_ENABLEMEDIUMSPEC, tr("Medium")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
- am->AddAction(ID_GAME_IOS_ENABLELOWSPEC, tr("Low")).SetCheckable(true)
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateGameSpec);
-#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
-#if defined(TOOLS_SUPPORT_JASPER)
-#include AZ_RESTRICTED_FILE_EXPLICIT(MainWindow_cpp, jasper)
-#endif
-#if defined(TOOLS_SUPPORT_PROVO)
-#include AZ_RESTRICTED_FILE_EXPLICIT(MainWindow_cpp, provo)
-#endif
-#if defined(TOOLS_SUPPORT_SALEM)
-#include AZ_RESTRICTED_FILE_EXPLICIT(MainWindow_cpp, salem)
-#endif
-#endif
am->AddAction(ID_TOOLS_CUSTOMIZEKEYBOARD, tr("Customize &Keyboard..."))
.Connect(&QAction::triggered, this, &MainWindow::ShowKeyboardCustomization);
am->AddAction(ID_TOOLS_EXPORT_SHORTCUTS, tr("&Export Keyboard Settings..."))
@@ -737,7 +694,6 @@ void MainWindow::InitActions()
am->AddAction(ID_TOOLS_IMPORT_SHORTCUTS, tr("&Import Keyboard Settings..."))
.Connect(&QAction::triggered, this, &MainWindow::ImportKeyboardShortcuts);
am->AddAction(ID_TOOLS_PREFERENCES, tr("Global Preferences..."));
- am->AddAction(ID_GRAPHICS_SETTINGS, tr("&Graphics Settings..."));
for (int i = ID_FILE_MRU_FIRST; i <= ID_FILE_MRU_LAST; ++i)
{
diff --git a/Code/Editor/Platform/Mac/gui_info.plist b/Code/Editor/Platform/Mac/gui_info.plist
index 0ec7b59e98..5b5f94e977 100644
--- a/Code/Editor/Platform/Mac/gui_info.plist
+++ b/Code/Editor/Platform/Mac/gui_info.plist
@@ -5,7 +5,7 @@
CFBundleExecutable
Editor
CFBundleIdentifier
- com.Amazon.Lumberyard.Editor
+ org.O3DE.Editor
CFBundlePackageType
APPL
CFBundleSignature
diff --git a/Code/Editor/Plugins/EditorCommon/CMakeLists.txt b/Code/Editor/Plugins/EditorCommon/CMakeLists.txt
index 96d9cce5b7..048f77cd0c 100644
--- a/Code/Editor/Plugins/EditorCommon/CMakeLists.txt
+++ b/Code/Editor/Plugins/EditorCommon/CMakeLists.txt
@@ -46,4 +46,8 @@ ly_add_target(
AZ::AzCore
AZ::AzToolsFramework
AZ::AzQtComponents
+ RUNTIME_DEPENDENCIES
+ AZ::AzCore
+ AZ::AzToolsFramework
+ AZ::AzQtComponents
)
diff --git a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp
index f4e4fed973..63ce446e97 100644
--- a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp
+++ b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.cpp
@@ -20,12 +20,12 @@
#include "ValidationHandler.h"
#include
+#include
-#include "AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.h"
+#include
#include
#include
#include
-#include
#include
#include
@@ -52,7 +52,7 @@ namespace ProjectSettingsTool
PlatformEnabled(PlatformId::Ios) ?
ProjectSettingsContainer::PlistInitVector({
ProjectSettingsContainer::PlatformAndPath
- { PlatformId::Ios, m_projectRoot + PlatformResourcesFolder(PlatformId::Ios) }
+ { PlatformId::Ios, GetPlatformResource(PlatformId::Ios) }
})
:
ProjectSettingsContainer::PlistInitVector())
@@ -647,33 +647,38 @@ namespace ProjectSettingsTool
// iOS can be disabled if the plist file is missing
if (platformId == PlatformId::Ios)
{
- const AZStd::string filename = m_projectRoot + PlatformResourcesFolder(platformId);
- return CFileUtil::FileExists(filename.c_str());
+ AZStd::string plistPath = GetPlatformResource(platformId);
+ return !plistPath.empty();
}
return true;
}
- const char* ProjectSettingsToolWindow::PlatformResourcesFolder(PlatformId platformId)
+ AZStd::string ProjectSettingsToolWindow::GetPlatformResource(PlatformId platformId)
{
if (platformId == PlatformId::Ios)
{
- const AZStd::string firstfilename = m_projectRoot + "/Gem/Resources/Platform/iOS/Info.plist";
- if (CFileUtil::FileExists(firstfilename.c_str()))
+ const char* searchPaths[] = {
+ "Resources/Platform/iOS/Info.plist",
+
+ // legacy paths
+ "Gem/Resources/Platform/iOS/Info.plist",
+ "Gem/Resources/IOSLauncher/Info.plist",
+ };
+
+ for (auto relPath : searchPaths)
{
- return "/Gem/Resources/Platform/iOS/Info.plist";
- }
- else
- {
- const AZStd::string filename = m_projectRoot + "/Gem/Resources/IOSLauncher/Info.plist";
- if (CFileUtil::FileExists(filename.c_str()))
+ AZ::IO::FixedMaxPath projectPlist{ m_projectRoot };
+ projectPlist /= relPath;
+
+ if (AZ::IO::SystemFile::Exists(projectPlist.c_str()))
{
- return "/Gem/Resources/IOSLauncher/Info.plist";
+ return projectPlist.LexicallyNormal().String();
}
}
}
- return nullptr;
+ return AZStd::string();
}
#include
diff --git a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h
index 8979672f99..64a6646e7f 100644
--- a/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h
+++ b/Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsToolWindow.h
@@ -137,8 +137,8 @@ namespace ProjectSettingsTool
// returns true if the platform is enabled
bool PlatformEnabled(PlatformId platformId);
- // returns the resource folder
- const char* PlatformResourcesFolder(PlatformId platformId);
+ // returns the main platform specific resource file e.g. for iOS it would be the Info.plist
+ AZStd::string GetPlatformResource(PlatformId platformId);
// The ui for the window
QScopedPointer m_ui;
diff --git a/Code/Editor/Resource.h b/Code/Editor/Resource.h
index 22bbece700..3ae1024550 100644
--- a/Code/Editor/Resource.h
+++ b/Code/Editor/Resource.h
@@ -187,7 +187,6 @@
#define ID_SWITCHCAMERA_SEQUENCECAMERA 33701
#define ID_SWITCHCAMERA_SELECTEDCAMERA 33702
#define ID_TV_RECORD_AUTO 33703
-#define ID_GRAPHICS_SETTINGS 33705
#define ID_VIEW_OPENVIEWPANE 33709
#define ID_VIEW_OPENPANE_FIRST 33712
#define ID_VIEW_OPENPANE_LAST 33811
@@ -219,10 +218,6 @@
#define ID_SPLINE_SNAP_GRID_X 33933
#define ID_SPLINE_SNAP_GRID_Y 33934
#define ID_FREEZE_TANGENTS 33935
-#define ID_GAME_PC_ENABLELOWSPEC 33960
-#define ID_GAME_PC_ENABLEMEDIUMSPEC 33961
-#define ID_GAME_PC_ENABLEHIGHSPEC 33962
-#define ID_GAME_PC_ENABLEVERYHIGHSPEC 33963
#define ID_PANEL_VEG_CREATE_SEL 33990
#define ID_TOOLS_UPDATEPROCEDURALVEGETATION 33999
#define ID_DISPLAY_GOTOPOSITION 34004
@@ -287,14 +282,6 @@
#define ID_CLEAR_REGISTRY 34470
#define ID_SOUND_STOPALLSOUNDS 34476
#define ID_AUDIO_REFRESH_AUDIO_SYSTEM 34477
-#define ID_GAME_ANDROID_ENABLELOWSPEC 34490
-#define ID_GAME_ANDROID_ENABLEMEDIUMSPEC 34491
-#define ID_GAME_ANDROID_ENABLEHIGHSPEC 34492
-#define ID_GAME_ANDROID_ENABLEVERYHIGHSPEC 34493
-#define ID_GAME_IOS_ENABLELOWSPEC 34494
-#define ID_GAME_IOS_ENABLEMEDIUMSPEC 34495
-#define ID_GAME_IOS_ENABLEHIGHSPEC 34496
-#define ID_GAME_IOS_ENABLEVERYHIGHSPEC 34497
#define ID_OPEN_AUDIO_CONTROLS_BROWSER 34580
#define ID_CREATE_GLOBAL_FG_MODULE_FROM_SELECTION 35076
#define ID_CREATE_LEVEL_FG_MODULE_FROM_SELECTION 35077
@@ -324,19 +311,6 @@
#define ID_DOCUMENTATION_FEEDBACK 36043
#define ID_OPEN_SUBSTANCE_EDITOR 36060
#define ID_IMPORT_ASSET 36069
-#define ID_GAME_PROVO_ENABLELOWSPEC 34603
-#define ID_GAME_PROVO_ENABLEMEDIUMSPEC 34604
-#define ID_GAME_PROVO_ENABLEHIGHSPEC 34605
-#define ID_GAME_OSXMETAL_ENABLELOWSPEC 34606
-#define ID_GAME_OSXMETAL_ENABLEMEDIUMSPEC 34607
-#define ID_GAME_OSXMETAL_ENABLEHIGHSPEC 34608
-#define ID_GAME_OSXMETAL_ENABLEVERYHIGHSPEC 34609
-#define ID_GAME_SALEM_ENABLELOWSPEC 34610
-#define ID_GAME_SALEM_ENABLEMEDIUMSPEC 34611
-#define ID_GAME_SALEM_ENABLEHIGHSPEC 34612
-#define ID_GAME_JASPER_ENABLELOWSPEC 34613
-#define ID_GAME_JASPER_ENABLEMEDIUMSPEC 34614
-#define ID_GAME_JASPER_ENABLEHIGHSPEC 34615
#define ID_FILE_RESAVESLICES 36210
#define FIRST_QT_ACTION 50000
#define ID_VIEW_CONSOLEWINDOW 50001
diff --git a/Code/Editor/Style/GraphicsSettingsDialog.qss b/Code/Editor/Style/GraphicsSettingsDialog.qss
deleted file mode 100644
index 3af8c4c05b..0000000000
--- a/Code/Editor/Style/GraphicsSettingsDialog.qss
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#GraphicsSettingsDialog QHeaderView::section
-{
- background: #2D2D2D;
-}
-
-#GraphicsSettingsDialog QHeaderView::down-arrow
-{
- width: 14px;
- height: 14px;
- image: url(:/Gallery/Delete.svg);
-}
-
-#GraphicsSettingsDialog QHeaderView::up-arrow
-{
- width: 14px;
- height: 14px;
- image: url(:/Gallery/Delete.svg);
-}
diff --git a/Code/Editor/Style/resources.qrc b/Code/Editor/Style/resources.qrc
index aec7e2cf68..24682d2be3 100644
--- a/Code/Editor/Style/resources.qrc
+++ b/Code/Editor/Style/resources.qrc
@@ -3,6 +3,5 @@
Editor.qss
EditorPreferencesDialog.qss
LayoutConfigDialog.qss
- GraphicsSettingsDialog.qss
diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake
index fc1694240e..3181474b35 100644
--- a/Code/Editor/editor_lib_files.cmake
+++ b/Code/Editor/editor_lib_files.cmake
@@ -583,9 +583,6 @@ set(FILES
SettingsManager.h
SettingsManagerDialog.h
SettingsManagerDialog.ui
- GraphicsSettingsDialog.h
- GraphicsSettingsDialog.cpp
- graphicssettingsdialog.ui
AboutDialog.cpp
ErrorReportTableModel.h
ErrorReportTableModel.cpp
diff --git a/Code/Editor/graphicssettingsdialog.ui b/Code/Editor/graphicssettingsdialog.ui
deleted file mode 100644
index ca8770e9e3..0000000000
--- a/Code/Editor/graphicssettingsdialog.ui
+++ /dev/null
@@ -1,270 +0,0 @@
-
-
- GraphicsSettingsDialog
-
-
-
- 0
- 0
- 1292
- 565
-
-
-
-
- 0
- 0
-
-
-
-
- 800
- 400
-
-
-
-
- 16777215
- 16777215
-
-
-
- Graphics Settings
-
-
- -
-
-
-
- 0
-
-
- 6
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 20
-
-
-
-
- 16777215
- 20
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
-
-
- -
-
-
-
- 100
- 0
-
-
-
-
- 16777215
- 20
-
-
-
- Add Resource
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 60
- 20
-
-
-
- Platform
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 13
- 0
-
-
-
- Qt::Vertical
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- true
-
-
-
-
- 0
- 0
- 1272
- 452
-
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- 8
-
-
- false
-
-
-
-
-
-
-
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- background-color: rgb(233, 118, 17);
-
-
- Save
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Cancel
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
-
- line
- m_scrollArea
- line_2
- widget
-
-
-
- GraphicsSettingsTreeView
- QTreeView
-
-
-
-
- m_cancelButton
- m_applyButton
- m_scrollArea
-
-
-
-
diff --git a/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp b/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp
index 46717440d5..82e230d54a 100644
--- a/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp
+++ b/Code/Framework/AzCore/AzCore/Math/MathReflection.cpp
@@ -116,7 +116,7 @@ namespace AZ
{
const char* uuidString = nullptr;
unsigned int uuidStringLength = 0;
- if (dc.ReadArg(0, uuidString) && dc.ReadValue(1, uuidStringLength))
+ if (dc.ReadArg(0, uuidString) && dc.ReadArg(1, uuidStringLength))
{
dc.PushResult(Uuid(uuidString, uuidStringLength));
}
diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp
index ae2dea4e48..15c3c8f71b 100644
--- a/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp
+++ b/Code/Framework/AzCore/Tests/Serialization/Json/TestCases_Patching.cpp
@@ -6,6 +6,7 @@
*/
#include
+#include
#include
#include
@@ -43,7 +44,9 @@ namespace JsonSerializationTests
}
void CheckApplyPatchOutcome(const char* target, const char* patch,
- AZ::JsonSerializationResult::Outcomes outcome, AZ::JsonSerializationResult::Processing processing)
+ AZ::JsonSerializationResult::Outcomes outcome,
+ AZ::JsonSerializationResult::Processing processing,
+ const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{})
{
m_jsonDocument->Parse(target);
ASSERT_FALSE(m_jsonDocument->HasParseError());
@@ -53,12 +56,24 @@ namespace JsonSerializationTests
ASSERT_FALSE(patchDocument.HasParseError());
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(*m_jsonDocument,
- m_jsonDocument->GetAllocator(), patchDocument, AZ::JsonMergeApproach::JsonPatch);
+ m_jsonDocument->GetAllocator(), patchDocument, AZ::JsonMergeApproach::JsonPatch, settings);
EXPECT_EQ(result.GetTask(), AZ::JsonSerializationResult::Tasks::Merge);
EXPECT_EQ(result.GetOutcome(), outcome);
EXPECT_EQ(result.GetProcessing(), processing);
}
+ void CheckApplyPatchOutcome(
+ const char* target,
+ const char* patch,
+ const char* expectedPatchedResult,
+ AZ::JsonSerializationResult::Outcomes outcome,
+ AZ::JsonSerializationResult::Processing processing,
+ const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{})
+ {
+ CheckApplyPatchOutcome(target, patch, outcome, processing, settings);
+ Expect_DocStrEq(expectedPatchedResult);
+ }
+
void CheckCreatePatch_Core(const char* source, AZStd::string_view patch, const char* target,
AZ::JsonMergeApproach approach)
{
@@ -262,6 +277,36 @@ namespace JsonSerializationTests
Outcomes::TypeMismatch, Processing::Halted);
}
+ TEST_F(JsonPatchingSerializationTests, ApplyPatch_UseJsonPatchWithCustomReportingCallback_ReportPartialSkip)
+ {
+ using namespace AZ::JsonSerializationResult;
+ auto issueReportingCallback = [](AZStd::string_view, AZ::JsonSerializationResult::ResultCode result,
+ AZStd::string_view) -> AZ::JsonSerializationResult::ResultCode
+ {
+ using namespace AZ::JsonSerializationResult;
+ if (result.GetProcessing() == Processing::Halted)
+ {
+ return ResultCode(result.GetTask(), Outcomes::PartialSkip);
+ }
+ return result;
+ };
+
+ AZ::JsonApplyPatchSettings applyPatchSettings;
+ applyPatchSettings.m_reporting = AZStd::move(issueReportingCallback);
+ CheckApplyPatchOutcome(
+ R"({})",
+ R"([
+ { "op": "add", "path": "/nonexistent_key/new_member", "value": "someValue" },
+ { "op": "add", "path": "/test", "value": "someValue" }
+ ])",
+ R"(
+ { "test": "someValue" }
+ )",
+ Outcomes::PartialSkip,
+ Processing::Completed,
+ AZStd::move(applyPatchSettings));
+ }
+
TEST_F(JsonPatchingSerializationTests, ApplyPatch_UseJsonPatchAddUnnamedMember_ReportsSuccess)
{
CheckApplyPatch(
diff --git a/Code/Framework/AzFramework/AzFramework/Windowing/WindowBus.h b/Code/Framework/AzFramework/AzFramework/Windowing/WindowBus.h
index f21993b80a..0369e703b5 100644
--- a/Code/Framework/AzFramework/AzFramework/Windowing/WindowBus.h
+++ b/Code/Framework/AzFramework/AzFramework/Windowing/WindowBus.h
@@ -97,6 +97,9 @@ namespace AzFramework
//! This is called when the window is deactivated from code or if the user closes the window.
virtual void OnWindowClosed() {};
+
+ //! This is called when vsync interval is changed.
+ virtual void OnVsyncIntervalChanged(uint32_t interval) { AZ_UNUSED(interval); };
};
using WindowNotificationBus = AZ::EBus;
diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocketManager_Select.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocketManager_Select.cpp
index 130739ca39..651eff820e 100644
--- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocketManager_Select.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocketManager_Select.cpp
@@ -41,7 +41,7 @@ namespace AzNetworking
void TcpSocketManager::ProcessEvents(AZ::TimeMs maxBlockMs, const SocketEventCallback& readCallback, const SocketEventCallback& writeCallback)
{
- if(static_cast(m_maxFd) <= 0 && m_socketFds.empty())
+ if(static_cast(m_maxFd) <= 0 || m_socketFds.empty())
{
// There are no available sockets to process
return;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h
index 51aecbd8e7..6dd6b0b448 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorPythonConsoleBus.h
@@ -63,6 +63,9 @@ namespace AzToolsFramework
//! Signal the Python handler to stop
virtual bool StopPython(bool silenceWarnings = false) = 0;
+ //! Query to determine if the Python VM has been initialized indicating an active state
+ virtual bool IsPythonActive() = 0;
+
//! Determines if the caller needs to wait for the Python VM to initialize (non-main thread only)
virtual void WaitForInitialization() {}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp
index eb5034fdd5..754c04e12f 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp
@@ -11,6 +11,7 @@
#include
#include
+#include
#include
#include
@@ -187,12 +188,6 @@ namespace AzToolsFramework
bool QtEventToAzInputMapper::HandlesInputEvent(const AzFramework::InputChannel& channel) const
{
- const AzFramework::InputChannelId& channelId = channel.GetInputChannelId();
- if (channelId == AzFramework::InputDeviceMouse::Movement::X || channelId == AzFramework::InputDeviceMouse::Movement::Y)
- {
- return false;
- }
-
// We map keyboard and mouse events from Qt, so flag all events coming from those devices
// as handled by our synthetic event system.
const AzFramework::InputDeviceId& deviceId = channel.GetInputDevice().GetInputDeviceId();
@@ -210,6 +205,22 @@ namespace AzToolsFramework
}
}
+ void QtEventToAzInputMapper::SetCursorCaptureEnabled(bool enabled)
+ {
+ if (m_capturingCursor != enabled)
+ {
+ m_capturingCursor = enabled;
+ if (m_capturingCursor)
+ {
+ qApp->setOverrideCursor(Qt::BlankCursor);
+ }
+ else
+ {
+ qApp->restoreOverrideCursor();
+ }
+ }
+ }
+
bool QtEventToAzInputMapper::eventFilter(QObject* object, QEvent* event)
{
// Abort if processing isn't enabled.
@@ -284,13 +295,25 @@ namespace AzToolsFramework
{
auto systemCursorChannel =
GetInputChannel(AzFramework::InputDeviceMouse::SystemCursorPosition);
+ auto movementXChannel =
+ GetInputChannel(AzFramework::InputDeviceMouse::Movement::X);
+ auto movementYChannel =
+ GetInputChannel(AzFramework::InputDeviceMouse::Movement::Y);
auto mouseWheelChannel =
GetInputChannel(AzFramework::InputDeviceMouse::Movement::Z);
systemCursorChannel->ProcessRawInputEvent(m_cursorPosition->m_normalizedPositionDelta.GetLength());
+ // Generate movement events based on the pixel delta divided by the DPI scaling factor, to calculate a rough approximation
+ // of cursor movement velocity.
+ movementXChannel->ProcessRawInputEvent(
+ m_cursorPosition->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / m_sourceWidget->devicePixelRatioF());
+ movementYChannel->ProcessRawInputEvent(
+ m_cursorPosition->m_normalizedPositionDelta.GetY() * aznumeric_cast(m_sourceWidget->height()) / m_sourceWidget->devicePixelRatioF());
mouseWheelChannel->ProcessRawInputEvent(0.f);
NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr);
+ NotifyUpdateChannelIfNotIdle(movementXChannel, nullptr);
+ NotifyUpdateChannelIfNotIdle(movementYChannel, nullptr);
NotifyUpdateChannelIfNotIdle(mouseWheelChannel, nullptr);
}
@@ -318,16 +341,42 @@ namespace AzToolsFramework
}
}
+ AZ::Vector2 QtEventToAzInputMapper::WidgetPositionToNormalizedPosition(QPoint position)
+ {
+ const float normalizedX = aznumeric_cast(position.x()) / aznumeric_cast(m_sourceWidget->width());
+ const float normalizedY = aznumeric_cast(position.y()) / aznumeric_cast(m_sourceWidget->height());
+ return AZ::Vector2{normalizedX, normalizedY};
+ }
+
+ QPoint QtEventToAzInputMapper::NormalizedPositionToWidgetPosition(AZ::Vector2 normalizedPosition)
+ {
+ const int denormalizedX = aznumeric_cast(normalizedPosition.GetX() * m_sourceWidget->width());
+ const int denormalizedY = aznumeric_cast(normalizedPosition.GetY() * m_sourceWidget->height());
+ return QPoint{denormalizedX, denormalizedY};
+ }
+
void QtEventToAzInputMapper::HandleMouseMoveEvent(QMouseEvent* mouseEvent)
{
+ AZ::Vector2 lastCursorPosition = m_cursorPosition->m_normalizedPosition;
+
const QPoint mousePos = mouseEvent->pos();
- const float normalizedX = aznumeric_cast(mousePos.x()) / aznumeric_cast(m_sourceWidget->width());
- const float normalizedY = aznumeric_cast(mousePos.y()) / aznumeric_cast(m_sourceWidget->height());
- const AZ::Vector2 normalizedPosition(normalizedX, normalizedY);
+ const AZ::Vector2 normalizedPosition = WidgetPositionToNormalizedPosition(mousePos);
m_cursorPosition->m_normalizedPositionDelta = normalizedPosition - m_cursorPosition->m_normalizedPosition;
m_cursorPosition->m_normalizedPosition = normalizedPosition;
ProcessPendingMouseEvents();
m_mouseChannelsNeedUpdate = true;
+
+ if (m_capturingCursor)
+ {
+ // Reset our cursor position to the previous point.
+ QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(NormalizedPositionToWidgetPosition(lastCursorPosition));
+ AzQtComponents::SetCursorPos(targetScreenPosition);
+
+ // Even though we just set the cursor position, there are edge cases such as remote desktop that will leave
+ // the cursor position unchanged. For safety, we re-cache our last cursor position for delta generation.
+ QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
+ m_cursorPosition->m_normalizedPosition = WidgetPositionToNormalizedPosition(actualWidgetPosition);
+ }
}
void QtEventToAzInputMapper::HandleKeyEvent(QKeyEvent* keyEvent)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h
index 6d95f3a4b0..6946a2c8e7 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h
@@ -47,6 +47,12 @@ namespace AzToolsFramework
//! Sets whether or not this input mapper should be updating its input channels from Qt events.
void SetEnabled(bool enabled);
+ //! Sets whether or not the cursor should be constrained to the source widget and invisible.
+ //! Internally, this will reset the cursor position after each move event to ensure movement
+ //! events don't allow the cursor to escape. This can be used for typical camera controls
+ //! like a dolly or rotation, where mouse movement is important but cursor location is not.
+ void SetCursorCaptureEnabled(bool enabled);
+
// QObject overrides...
bool eventFilter(QObject* object, QEvent* event) override;
@@ -106,6 +112,11 @@ namespace AzToolsFramework
// Processes any pending mouse movement events, this allows mouse movement channels to close themselves.
void ProcessPendingMouseEvents();
+ // Converts a point in logical source widget space [0..m_sourceWidget->size()] to normalized [0..1] space.
+ AZ::Vector2 WidgetPositionToNormalizedPosition(QPoint position);
+ // Converts a point in normalized [0..1] space to logical source widget space [0..m_sourceWidget->size()].
+ QPoint NormalizedPositionToWidgetPosition(AZ::Vector2 normalizedPosition);
+
// Handle mouse click events.
void HandleMouseButtonEvent(QMouseEvent* mouseEvent);
// Handle mouse move events.
@@ -144,6 +155,8 @@ namespace AzToolsFramework
bool m_mouseChannelsNeedUpdate = false;
// Flags whether or not Qt events should currently be processed.
bool m_enabled = true;
+ // Flags whether or not the cursor is being constrained to the source widget (for invisible mouse movement).
+ bool m_capturingCursor = false;
// Our viewport-specific AZ devices. We control their internal input channel states.
AZStd::unique_ptr m_mouseDevice;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp
index 720c14ed36..03d4b14190 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp
@@ -172,20 +172,23 @@ namespace AzToolsFramework
PrefabDom& templateDomReference = m_prefabSystemComponentInterface->FindTemplateDom(templateId);
//apply patch to template
- AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(templateDomReference,
- templateDomReference.GetAllocator(), providedPatch, AZ::JsonMergeApproach::JsonPatch);
+ AZ::JsonSerializationResult::ResultCode result =
+ PrefabDomUtils::ApplyPatches(templateDomReference, templateDomReference.GetAllocator(), providedPatch);
//trigger propagation
- if (result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success)
+ if (result.GetOutcome() != AZ::JsonSerializationResult::Outcomes::Success)
{
- m_prefabSystemComponentInterface->SetTemplateDirtyFlag(templateId, true);
- m_prefabSystemComponentInterface->PropagateTemplateChanges(templateId, instanceToExclude);
- return true;
+ AZ_Error("Prefab", false, "Patch was not successfully applied.");
+ return false;
}
else
{
- AZ_Error("Prefab", false, "Patch was not successfully applied");
- return false;
+ AZ_Error(
+ "Prefab", result.GetOutcome() != AZ::JsonSerializationResult::Outcomes::PartialSkip,
+ "Some of the patches are not successfully applied.");
+ m_prefabSystemComponentInterface->SetTemplateDirtyFlag(templateId, true);
+ m_prefabSystemComponentInterface->PropagateTemplateChanges(templateId, instanceToExclude);
+ return true;
}
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp
index 1d27fa6375..333c3f2dbc 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Link/Link.cpp
@@ -176,12 +176,17 @@ namespace AzToolsFramework
}
else
{
- AZ::JsonSerializationResult::ResultCode applyPatchResult = AZ::JsonSerialization::ApplyPatch(
- sourceTemplateDomCopy,
- targetTemplatePrefabDom.GetAllocator(),
- patchesReference->get(),
- AZ::JsonMergeApproach::JsonPatch);
+ AZ::JsonSerializationResult::ResultCode applyPatchResult =
+ PrefabDomUtils::ApplyPatches(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator(), patchesReference->get());
linkedInstanceDom.CopyFrom(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator());
+
+ PrefabDomValueReference sourceTemplateName =
+ PrefabDomUtils::FindPrefabDomValue(sourceTemplateDomCopy, PrefabDomUtils::SourceName);
+ AZ_Assert(sourceTemplateName && sourceTemplateName->get().IsString(), "A valid source template name couldn't be found");
+ PrefabDomValueReference targetTemplateName =
+ PrefabDomUtils::FindPrefabDomValue(targetTemplatePrefabDom, PrefabDomUtils::SourceName);
+ AZ_Assert(targetTemplateName && targetTemplateName->get().IsString(), "A valid target template name couldn't be found");
+
if (applyPatchResult.GetProcessing() != AZ::JsonSerializationResult::Processing::Completed)
{
AZ_Error(
@@ -190,6 +195,14 @@ namespace AzToolsFramework
m_sourceTemplateId, m_targetTemplateId);
return false;
}
+ if (applyPatchResult.GetOutcome() == AZ::JsonSerializationResult::Outcomes::PartialSkip)
+ {
+ AZ_Error(
+ "Prefab", false,
+ "Link::UpdateTarget - Some of the patches couldn't be applied on the source template '%s' present under the "
+ "target Template '%s'.",
+ sourceTemplateName->get().GetString(), targetTemplateName->get().GetString());
+ }
}
// This is a guardrail to ensure the linked instance dom always has the LinkId value
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.cpp
index bac63d94b4..86137ae547 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.cpp
@@ -236,6 +236,26 @@ namespace AzToolsFramework
return findInstancesResult->get();
}
+ AZ::JsonSerializationResult::ResultCode ApplyPatches(
+ PrefabDomValue& prefabDomToApplyPatchesOn, PrefabDom::AllocatorType& allocator, const PrefabDomValue& patches)
+ {
+ auto issueReportingCallback = [](AZStd::string_view, AZ::JsonSerializationResult::ResultCode result,
+ AZStd::string_view) -> AZ::JsonSerializationResult::ResultCode
+ {
+ using namespace AZ::JsonSerializationResult;
+ if (result.GetProcessing() == Processing::Halted)
+ {
+ return ResultCode(result.GetTask(), Outcomes::PartialSkip);
+ }
+ return result;
+ };
+
+ AZ::JsonApplyPatchSettings applyPatchSettings;
+ applyPatchSettings.m_reporting = AZStd::move(issueReportingCallback);
+ return AZ::JsonSerialization::ApplyPatch(
+ prefabDomToApplyPatchesOn, allocator, patches, AZ::JsonMergeApproach::JsonPatch, applyPatchSettings);
+ }
+
void PrintPrefabDomValue(
[[maybe_unused]] const AZStd::string_view printMessage,
[[maybe_unused]] const PrefabDomValue& prefabDomValue)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.h
index 709461022e..4d4b7a3e32 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.h
@@ -7,6 +7,7 @@
#pragma once
+#include
#include
#include
#include
@@ -122,6 +123,11 @@ namespace AzToolsFramework
*/
PrefabDomValueConstReference GetInstancesValue(const PrefabDomValue& prefabDom);
+ AZ::JsonSerializationResult::ResultCode ApplyPatches(
+ PrefabDomValue& prefabDomToApplyPatchesOn,
+ PrefabDom::AllocatorType& allocator,
+ const PrefabDomValue& patches);
+
/**
* Prints the contents of the given prefab DOM value to the debug output console in a readable format.
* @param printMessage The message that will be printed before printing the PrefabDomValue
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp
index e29c33a21f..7d9fb64c96 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp
@@ -261,8 +261,13 @@ namespace AzToolsFramework
instanceDom.CopyFrom(instanceDomRef->get(), instanceDom.GetAllocator());
//apply the patch to the template within the target
- AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(instanceDom,
- instanceDom.GetAllocator(), patch, AZ::JsonMergeApproach::JsonPatch);
+ AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(instanceDom, instanceDom.GetAllocator(), patch);
+
+ AZ_Error(
+ "Prefab",
+ result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::PartialSkip ||
+ result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success,
+ "Some of the patches are not successfully applied.");
//remove the link id placed into the instance
auto linkIdIter = instanceDom.FindMember(PrefabDomUtils::LinkIdName);
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h
index d9bf0c40b9..e08bb13cac 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ActionBus.h
@@ -22,11 +22,11 @@ namespace AzToolsFramework
/// @name Reverse URLs.
/// Used to identify common actions and override them when necessary.
//@{
- static const AZ::Crc32 s_backAction = AZ_CRC("com.amazon.action.common.back", 0xd772a2af);
- static const AZ::Crc32 s_deleteAction = AZ_CRC("com.amazon.action.common.delete", 0x5731f6cb);
- static const AZ::Crc32 s_duplicateAction = AZ_CRC("com.amazon.action.common.duplicate", 0x08ccf461);
- static const AZ::Crc32 s_nextComponentMode = AZ_CRC("com.amazon.action.common.nextComponentMode", 0xcc26094f);
- static const AZ::Crc32 s_previousComponentMode = AZ_CRC("com.amazon.action.common.previousComponentMode", 0x0d18ff39);
+ static const AZ::Crc32 s_backAction = AZ_CRC("com.o3de.action.common.back", 0xd772a2af);
+ static const AZ::Crc32 s_deleteAction = AZ_CRC("com.o3de.action.common.delete", 0x5731f6cb);
+ static const AZ::Crc32 s_duplicateAction = AZ_CRC("com.o3de.action.common.duplicate", 0x08ccf461);
+ static const AZ::Crc32 s_nextComponentMode = AZ_CRC("com.o3de.action.common.nextComponentMode", 0xcc26094f);
+ static const AZ::Crc32 s_previousComponentMode = AZ_CRC("com.o3de.action.common.previousComponentMode", 0x0d18ff39);
//@}
/// Specific Action properties to be sent to a type implementing
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportMessages.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportMessages.h
index 4d3af0e878..5b25034de8 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportMessages.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportMessages.h
@@ -276,11 +276,6 @@ namespace AzToolsFramework
virtual void EndCursorCapture() = 0;
//! Gets the most recent recorded cursor position in the viewport in screen space coordinates.
virtual AzFramework::ScreenPoint ViewportCursorScreenPosition() = 0;
- //! Gets the cursor position recorded prior to the most recent cursor position.
- //! Note: The cursor may be captured by the viewport, in which case this may not correspond to the last result
- //! from ViewportCursorScreenPosition. This method will always return the correct position to generate a mouse
- //! position delta.
- virtual AZStd::optional PreviousViewportCursorScreenPosition() = 0;
//! Is mouse over viewport.
virtual bool IsMouseOver() const = 0;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.h
index f92ee6b00b..73be188f2c 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.h
@@ -98,7 +98,7 @@ namespace AzToolsFramework
{
}
- AZ::Crc32 m_uri; //!< Unique identifier for the Action. (In the form 'com.amazon.action.---").
+ AZ::Crc32 m_uri; //!< Unique identifier for the Action. (In the form 'com.o3de.action.---").
AZStd::vector> m_callbacks; //!< Callbacks associated with this Action (note: with multi-selections
//!< there will be a callback per Entity/Component).
AZStd::unique_ptr m_action; //!< The QAction associated with the overrideWidget for all ComponentMode actions.
diff --git a/Code/Framework/AzToolsFramework/Tests/ComponentModeTestDoubles.cpp b/Code/Framework/AzToolsFramework/Tests/ComponentModeTestDoubles.cpp
index caf6411eda..844fbb3e7f 100644
--- a/Code/Framework/AzToolsFramework/Tests/ComponentModeTestDoubles.cpp
+++ b/Code/Framework/AzToolsFramework/Tests/ComponentModeTestDoubles.cpp
@@ -196,7 +196,7 @@ namespace AzToolsFramework
AZStd::vector PlaceHolderComponentMode::PopulateActionsImpl()
{
- const AZ::Crc32 placeHolderComponentModeAction = AZ_CRC_CE("com.amazon.action.placeholder.test");
+ const AZ::Crc32 placeHolderComponentModeAction = AZ_CRC_CE("com.o3de.action.placeholder.test");
return AZStd::vector
{
diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp
index cdc5faaef0..253671189d 100644
--- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp
+++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoLinkTests.cpp
@@ -96,8 +96,8 @@ namespace UnitTest
//apply the patch
PrefabDom& templateDomReference = m_prefabSystemComponent->FindTemplateDom(nestedTemplateId);
- AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(templateDomReference,
- templateDomReference.GetAllocator(), patch, AZ::JsonMergeApproach::JsonPatch);
+ AZ::JsonSerializationResult::ResultCode result =
+ PrefabDomUtils::ApplyPatches(templateDomReference, templateDomReference.GetAllocator(), patch);
AZ_Error("Prefab", result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success,
"Patch was not successfully applied");
diff --git a/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp b/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp
index 97802a1516..d92b72e11a 100644
--- a/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp
+++ b/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp
@@ -25,6 +25,8 @@ namespace AWSNativeSDKInit
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
void CustomizeSDKOptions(Aws::SDKOptions& options);
void CustomizeShutdown();
+
+ void CopyCaCertBundle();
#endif
}
@@ -44,6 +46,8 @@ namespace AWSNativeSDKInit
void InitializationManager::InitAwsApi()
{
s_initManager = AZ::Environment::CreateVariable(initializationManagerTag);
+
+ Platform::CopyCaCertBundle();
}
void InitializationManager::Shutdown()
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/Android/InitializeCerts_Android.cpp b/Code/Tools/AWSNativeSDKInit/source/Platform/Android/InitializeCerts_Android.cpp
new file mode 100644
index 0000000000..67cdee7edc
--- /dev/null
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/Android/InitializeCerts_Android.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include
+// The AWS Native SDK AWSAllocator triggers a warning due to accessing members of std::allocator directly.
+// AWSAllocator.h(70): warning C4996: 'std::allocator::pointer': warning STL4010: Various members of std::allocator are deprecated in
+// C++17. Use std::allocator_traits instead of accessing these members directly. You can define
+// _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received
+// this warning.
+AZ_PUSH_DISABLE_WARNING(4251 4996, "-Wunknown-warning-option")
+#include
+AZ_POP_DISABLE_WARNING
+#include
+#include
+#include
+#include
+
+namespace AWSNativeSDKInit
+{
+ namespace Platform
+ {
+ void CopyCaCertBundle()
+ {
+ AZStd::vector contents;
+ AZStd::string certificatePath = "@assets@/certificates/aws/cacert.pem";
+ AZStd::string publicStoragePath = AZ::Android::Utils::GetAppPublicStoragePath();
+ publicStoragePath.append("/certificates/aws/cacert.pem");
+
+ AZ::IO::FileIOBase* fileBase = AZ::IO::FileIOBase::GetInstance();
+
+ if (!fileBase->Exists(certificatePath.c_str()))
+ {
+ AZ_Error("AWSNativeSDKInit", false, "Certificate File(%s) does not exist.\n", certificatePath.c_str());
+ }
+
+ AZ::IO::HandleType fileHandle;
+ AZ::IO::Result fileResult = fileBase->Open(certificatePath.c_str(), AZ::IO::OpenMode::ModeRead, fileHandle);
+
+ if (!fileResult)
+ {
+ AZ_Error("AWSNativeSDKInit", false, "Failed to open certificate file with result %i\n", fileResult.GetResultCode());
+ }
+
+ AZ::u64 fileSize = 0;
+ fileBase->Size(fileHandle, fileSize);
+
+ if (fileSize == 0)
+ {
+ AZ_Error("AWSNativeSDKInit", false, "Given empty file(%s) as the certificate bundle.\n", certificatePath.c_str());
+ }
+
+ contents.resize(fileSize + 1);
+ fileResult = fileBase->Read(fileHandle, contents.data(), fileSize);
+
+ if (!fileResult)
+ {
+ AZ_Error(
+ "AWSNativeSDKInit", false, "Failed to read from the certificate bundle(%s) with result code(%i).\n", certificatePath.c_str(),
+ fileResult.GetResultCode());
+ }
+
+ AZ_Printf("AWSNativeSDKInit", "Certificate bundle is read successfully from %s", certificatePath.c_str());
+
+ AZ::IO::HandleType outFileHandle;
+
+ AZ::IO::Result outFileResult = fileBase->Open(publicStoragePath.c_str(), AZ::IO::OpenMode::ModeWrite, outFileHandle);
+
+ if (!outFileResult)
+ {
+ AZ_Error("AWSNativeSDKInit", false, "Failed to open the certificate bundle with result %i\n", fileResult.GetResultCode());
+ }
+
+ AZ::IO::Result writeFileResult = fileBase->Write(outFileHandle, contents.data(), fileSize);
+ if (!writeFileResult)
+ {
+ AZ_Error("AWSNativeSDKInit", false, "Failed to write the certificate bundle with result %i\n", writeFileResult.GetResultCode());
+ }
+
+ fileBase->Close(fileHandle);
+ fileBase->Close(outFileHandle);
+
+ AZ_Printf("AWSNativeSDKInit", "Certificate bundle successfully copied to %s", publicStoragePath.c_str());
+ }
+ } // namespace Platform
+}
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/Android/platform_android_files.cmake b/Code/Tools/AWSNativeSDKInit/source/Platform/Android/platform_android_files.cmake
index 0ec1f30fea..6e0370dd42 100644
--- a/Code/Tools/AWSNativeSDKInit/source/Platform/Android/platform_android_files.cmake
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/Android/platform_android_files.cmake
@@ -7,4 +7,5 @@
set(FILES
../Common/Default/AWSNativeSDKInit_Default.cpp
+ InitializeCerts_Android.cpp
)
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/Common/Default/InitializeCerts_Null.cpp b/Code/Tools/AWSNativeSDKInit/source/Platform/Common/Default/InitializeCerts_Null.cpp
new file mode 100644
index 0000000000..7981998327
--- /dev/null
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/Common/Default/InitializeCerts_Null.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+namespace AWSNativeSDKInit
+{
+ namespace Platform
+ {
+ void CopyCaCertBundle()
+ {
+ }
+ } // namespace Platform
+} // namespace AWSCore
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/Linux/platform_linux_files.cmake b/Code/Tools/AWSNativeSDKInit/source/Platform/Linux/platform_linux_files.cmake
index 0ec1f30fea..6209d3faac 100644
--- a/Code/Tools/AWSNativeSDKInit/source/Platform/Linux/platform_linux_files.cmake
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/Linux/platform_linux_files.cmake
@@ -7,4 +7,5 @@
set(FILES
../Common/Default/AWSNativeSDKInit_Default.cpp
+ ../Common/Default/InitializeCerts_Null.cpp
)
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/Mac/platform_mac_files.cmake b/Code/Tools/AWSNativeSDKInit/source/Platform/Mac/platform_mac_files.cmake
index 0ec1f30fea..6209d3faac 100644
--- a/Code/Tools/AWSNativeSDKInit/source/Platform/Mac/platform_mac_files.cmake
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/Mac/platform_mac_files.cmake
@@ -7,4 +7,5 @@
set(FILES
../Common/Default/AWSNativeSDKInit_Default.cpp
+ ../Common/Default/InitializeCerts_Null.cpp
)
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/Windows/platform_windows_files.cmake b/Code/Tools/AWSNativeSDKInit/source/Platform/Windows/platform_windows_files.cmake
index 0ec1f30fea..6209d3faac 100644
--- a/Code/Tools/AWSNativeSDKInit/source/Platform/Windows/platform_windows_files.cmake
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/Windows/platform_windows_files.cmake
@@ -7,4 +7,5 @@
set(FILES
../Common/Default/AWSNativeSDKInit_Default.cpp
+ ../Common/Default/InitializeCerts_Null.cpp
)
diff --git a/Code/Tools/AWSNativeSDKInit/source/Platform/iOS/platform_ios_files.cmake b/Code/Tools/AWSNativeSDKInit/source/Platform/iOS/platform_ios_files.cmake
index 0ec1f30fea..6209d3faac 100644
--- a/Code/Tools/AWSNativeSDKInit/source/Platform/iOS/platform_ios_files.cmake
+++ b/Code/Tools/AWSNativeSDKInit/source/Platform/iOS/platform_ios_files.cmake
@@ -7,4 +7,5 @@
set(FILES
../Common/Default/AWSNativeSDKInit_Default.cpp
+ ../Common/Default/InitializeCerts_Null.cpp
)
diff --git a/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp b/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp
index 62daba1197..911f469b2f 100644
--- a/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Components/ExportingComponent.cpp
@@ -7,6 +7,8 @@
#include
#include
+#include
+#include
namespace AZ
{
@@ -31,6 +33,12 @@ namespace AZ
{
serializeContext->Class()->Version(2);
}
+
+ AZ::BehaviorContext* behaviorContext = azrtti_cast(context);
+ if (behaviorContext)
+ {
+ Events::ExportProductList::Reflect(behaviorContext);
+ }
}
} // namespace SceneCore
} // namespace SceneAPI
diff --git a/Code/Tools/SceneAPI/SceneCore/DllMain.cpp b/Code/Tools/SceneAPI/SceneCore/DllMain.cpp
index 7874ada7be..ac3c307b6c 100644
--- a/Code/Tools/SceneAPI/SceneCore/DllMain.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/DllMain.cpp
@@ -211,6 +211,7 @@ namespace AZ
AZ::SceneAPI::Containers::SceneGraph::Reflect(context);
AZ::SceneAPI::Containers::SceneManifest::Reflect(context);
AZ::SceneAPI::Containers::RuleContainer::Reflect(context);
+ AZ::SceneAPI::SceneCore::ExportingComponent::Reflect(context);
}
void Activate()
diff --git a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp
index c3a9abcbd2..798978024e 100644
--- a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.cpp
@@ -6,6 +6,8 @@
*/
#include
+#include
+#include
namespace AZ
{
@@ -49,6 +51,45 @@ namespace AZ
return *this;
}
+ void ExportProductList::Reflect(ReflectContext* context)
+ {
+ if (auto* serializeContext = azrtti_cast(context))
+ {
+ serializeContext->Class()->Version(1);
+ serializeContext->Class()->Version(1);
+ }
+
+ if (auto* behaviorContext = azrtti_cast(context))
+ {
+ behaviorContext->Class("ExportProduct")
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Module, "scene")
+ ->Property("filename", BehaviorValueProperty(&ExportProduct::m_filename))
+ ->Property("sourceId", BehaviorValueProperty(&ExportProduct::m_id))
+ ->Property("assetType", BehaviorValueProperty(&ExportProduct::m_assetType))
+ ->Property("productDependencies", BehaviorValueProperty(&ExportProduct::m_productDependencies))
+ ->Property("subId",
+ [](ExportProduct* self) { return self->m_subId.has_value() ? self->m_subId.value() : 0; },
+ [](ExportProduct* self, u32 subId) { self->m_subId = AZStd::optional(subId); });
+
+ behaviorContext->Class("ExportProductList")
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Module, "scene")
+ ->Method("AddProduct", [](ExportProductList& self, ExportProduct& product)
+ {
+ self.AddProduct(
+ product.m_filename,
+ product.m_id,
+ product.m_assetType,
+ product.m_lod,
+ product.m_subId,
+ product.m_dependencyFlags);
+ })
+ ->Method("GetProducts", &ExportProductList::GetProducts)
+ ->Method("AddDependencyToProduct", &ExportProductList::AddDependencyToProduct);
+ }
+ }
+
ExportProduct& ExportProductList::AddProduct(const AZStd::string& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags)
{
diff --git a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h
index 38deea3f9f..a99303e08b 100644
--- a/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h
+++ b/Code/Tools/SceneAPI/SceneCore/Events/ExportProductList.h
@@ -14,6 +14,8 @@
namespace AZ
{
+ class ReflectContext;
+
namespace SceneAPI
{
namespace Events
@@ -24,6 +26,7 @@ namespace AZ
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags = Data::ProductDependencyInfo::CreateFlags(Data::AssetLoadBehavior::NoLoad));
SCENE_CORE_API ExportProduct(AZStd::string&& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags = Data::ProductDependencyInfo::CreateFlags(Data::AssetLoadBehavior::NoLoad));
+ ExportProduct() = default;
ExportProduct(const ExportProduct& rhs) = default;
SCENE_CORE_API ExportProduct(ExportProduct&& rhs);
@@ -54,6 +57,8 @@ namespace AZ
class ExportProductList
{
public:
+ static void Reflect(ReflectContext* context);
+
SCENE_CORE_API ExportProduct& AddProduct(const AZStd::string& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
Data::ProductDependencyInfo::ProductDependencyFlags dependencyFlags = Data::ProductDependencyInfo::CreateFlags(Data::AssetLoadBehavior::NoLoad));
SCENE_CORE_API ExportProduct& AddProduct(AZStd::string&& filename, Uuid id, Data::AssetType assetType, AZStd::optional lod, AZStd::optional subId,
@@ -69,3 +74,9 @@ namespace AZ
} // namespace Events
} // namespace SceneAPI
} // namespace AZ
+
+namespace AZ
+{
+ AZ_TYPE_INFO_SPECIALIZE(SceneAPI::Events::ExportProduct, "{6054EDCB-4C04-4D96-BF26-704999FFB725}");
+ AZ_TYPE_INFO_SPECIALIZE(SceneAPI::Events::ExportProductList, "{1C76A51F-431B-4987-B653-CFCC940D0D0F}");
+}
diff --git a/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp b/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp
index a4b002db7d..073f357ee6 100644
--- a/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Import/ManifestImportRequestHandler.cpp
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -75,15 +76,16 @@ namespace AZ
filename += s_extension;
filename += s_generated;
- AZStd::string altManifestPath = path;
+ AZStd::string altManifestFolder = path;
AzFramework::ApplicationRequests::Bus::Broadcast(
- &AzFramework::ApplicationRequests::Bus::Events::MakePathRootRelative,
- altManifestPath);
+ &AzFramework::ApplicationRequests::Bus::Events::MakePathRelative,
+ altManifestFolder,
+ AZ::Utils::GetProjectPath().c_str());
- AZ::StringFunc::Path::GetFolderPath(altManifestPath.c_str(), altManifestPath);
+ AZ::StringFunc::Path::GetFolderPath(altManifestFolder.c_str(), altManifestFolder);
AZStd::string generatedAssetInfoPath;
- AZ::StringFunc::Path::Join(assetCacheRoot.c_str(), altManifestPath.c_str(), generatedAssetInfoPath);
+ AZ::StringFunc::Path::Join(assetCacheRoot.c_str(), altManifestFolder.c_str(), generatedAssetInfoPath);
AZ::StringFunc::Path::ConstructFull(generatedAssetInfoPath.c_str(), filename.c_str(), generatedAssetInfoPath);
if (!AZ::IO::FileIOBase::GetInstance()->Exists(generatedAssetInfoPath.c_str()))
diff --git a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
index e1c72bc8b4..4e08181b83 100644
--- a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
@@ -28,710 +28,731 @@ extern "C" AZ_DLL_EXPORT void ReflectBehavior(AZ::BehaviorContext* context);
// the DLL entry point for SceneCore to reflect its serialize context
extern "C" AZ_DLL_EXPORT void ReflectTypes(AZ::SerializeContext* context);
-namespace AZ
+namespace AZ::SceneAPI::Containers
{
- namespace SceneAPI
+ class MockManifestRule : public DataTypes::IManifestObject
{
- namespace Containers
+ public:
+ AZ_RTTI(MockManifestRule, "{D6F96B48-4E6F-4EE8-A5A3-959B76F90DA8}", IManifestObject);
+ AZ_CLASS_ALLOCATOR(MockManifestRule, AZ::SystemAllocator, 0);
+
+ MockManifestRule() = default;
+
+ MockManifestRule(double value)
+ : m_value(value)
{
- class MockManifestRule : public DataTypes::IManifestObject
+ }
+
+ double GetValue() const
+ {
+ return m_value;
+ }
+
+ void SetValue(double value)
+ {
+ m_value = value;
+ }
+
+ static void Reflect(AZ::ReflectContext* context)
+ {
+ AZ::SerializeContext* serializeContext = azrtti_cast(context);
+ if (serializeContext)
{
- public:
- AZ_RTTI(MockManifestRule, "{D6F96B48-4E6F-4EE8-A5A3-959B76F90DA8}", IManifestObject);
- AZ_CLASS_ALLOCATOR(MockManifestRule, AZ::SystemAllocator, 0);
-
- MockManifestRule() = default;
-
- MockManifestRule(double value)
- : m_value(value)
- {
- }
-
- double GetValue() const
- {
- return m_value;
- }
-
- void SetValue(double value)
- {
- m_value = value;
- }
-
- static void Reflect(AZ::ReflectContext* context)
- {
- AZ::SerializeContext* serializeContext = azrtti_cast(context);
- if (serializeContext)
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("value", &MockManifestRule::m_value);
- }
- }
-
- private:
- double m_value = 0.0;
- };
-
- struct MockBuilder final
- {
- AZ_TYPE_INFO(MockBuilder, "{ECF0FB2C-E5C0-4B89-993C-8511A7EF6894}");
-
- AZStd::unique_ptr m_scene;
-
- MockBuilder()
- {
- m_scene = AZStd::make_unique("unit_scene");
- }
-
- ~MockBuilder()
- {
- m_scene.reset();
- }
-
- void BuildSceneGraph()
- {
- m_scene->SetManifestFilename("manifest_filename");
- m_scene->SetSource("unit_source_filename", azrtti_typeid());
-
- auto& graph = m_scene->GetGraph();
-
- /*----------------------------\
- | Root |
- | / \ |
- | | | |
- | A B |
- | | /|\ |
- | C I J K |
- | / | \ \ |
- | D E F L |
- | / \ |
- | G H |
- \----------------------------*/
-
- //Build up the graph
- const auto indexA = graph.AddChild(graph.GetRoot(), "A", AZStd::make_shared(1));
- const auto indexC = graph.AddChild(indexA, "C", AZStd::make_shared(3));
- const auto indexE = graph.AddChild(indexC, "E", AZStd::make_shared(4));
- graph.AddChild(indexC, "D", AZStd::make_shared(5));
- graph.AddChild(indexC, "F", AZStd::make_shared(6));
- graph.AddChild(indexE, "G", AZStd::make_shared(7));
- graph.AddChild(indexE, "H", AZStd::make_shared(8));
- const auto indexB = graph.AddChild(graph.GetRoot(), "B", AZStd::make_shared(2));
- const auto indexK = graph.AddChild(indexB, "K", AZStd::make_shared(2));
- graph.AddChild(indexB, "I", AZStd::make_shared(9));
- graph.AddChild(indexB, "J", AZStd::make_shared(10));
- graph.AddChild(indexK, "L", AZStd::make_shared(12));
-
- m_scene->GetManifest().AddEntry(AZStd::make_shared(0.1));
- m_scene->GetManifest().AddEntry(AZStd::make_shared(2.3));
- m_scene->GetManifest().AddEntry(AZStd::make_shared(4.5));
- }
-
- static void Reflect(ReflectContext* context)
- {
- BehaviorContext* behaviorContext = azrtti_cast(context);
- if (behaviorContext)
- {
- behaviorContext->Class()
- ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
- ->Attribute(AZ::Script::Attributes::Module, "scene")
- ->Method("BuildSceneGraph", [](MockBuilder& self)
- {
- return self.BuildSceneGraph();
- })
- ->Method("GetScene", [](MockBuilder& self)
- {
- return self.m_scene.get();
- });
- }
- }
- };
-
- class SceneGraphBehaviorTest
- : public ::testing::Test
- {
- public:
- void SetUp() override
- {
- m_behaviorContext = AZStd::make_unique();
- ReflectBehavior(m_behaviorContext.get());
- }
-
- void TearDown() override
- {
- m_behaviorContext.reset();
- }
-
- AZ::BehaviorClass* GetBehaviorClass(const AZ::TypeId& behaviorClassType)
- {
- auto entry = m_behaviorContext->m_typeToClassMap.find(behaviorClassType);
- return (entry != m_behaviorContext->m_typeToClassMap.end()) ? entry->second : nullptr;
- }
-
- AZ::BehaviorProperty* GetBehaviorProperty(AZ::BehaviorClass& behaviorClass, AZStd::string_view propertyName)
- {
- auto entry = behaviorClass.m_properties.find(propertyName);
- return (entry != behaviorClass.m_properties.end()) ? entry->second : nullptr;
- }
-
- bool HasBehaviorClass(const AZ::TypeId& behaviorClassType)
- {
- return GetBehaviorClass(behaviorClassType) != nullptr;
- }
-
- bool HasProperty(AZ::BehaviorClass& behaviorClass, AZStd::string_view propertyName, const AZ::TypeId& propertyClassType)
- {
- AZ::BehaviorProperty* behaviorProperty = GetBehaviorProperty(behaviorClass, propertyName);
- if (behaviorProperty)
- {
- return behaviorProperty->m_getter->GetResult()->m_typeId == propertyClassType;
- }
- return false;
- }
-
- using ArgList = AZStd::vector;
-
- bool HasMethodWithInput(AZ::BehaviorClass& behaviorClass, AZStd::string_view methodName, const ArgList& input)
- {
- auto entry = behaviorClass.m_methods.find(methodName);
- if (entry == behaviorClass.m_methods.end())
- {
- return false;
- }
- AZ::BehaviorMethod* method = entry->second;
-
- const size_t methodArgsCount = method->IsMember() ? method->GetNumArguments() - 1 : method->GetNumArguments();
- if (input.size() != methodArgsCount)
- {
- return false;
- }
-
- for (size_t argIndex = 0; argIndex < input.size(); ++argIndex)
- {
- const size_t thisPointerOffset = method->IsMember() ? 1 : 0;
- const auto argType = method->GetArgument(argIndex + thisPointerOffset)->m_typeId;
- const auto inputType = input[argIndex];
- if (inputType != argType)
- {
- return false;
- }
- }
- return true;
- }
-
- bool HasMethodWithOutput(AZ::BehaviorClass& behaviorClass, AZStd::string_view methodName, const AZ::TypeId& output, const ArgList& input)
- {
- auto entry = behaviorClass.m_methods.find(methodName);
- if (entry == behaviorClass.m_methods.end())
- {
- return false;
- }
- AZ::BehaviorMethod* method = entry->second;
- if (method->HasResult())
- {
- if (method->GetResult()->m_typeId != output)
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- return HasMethodWithInput(behaviorClass, methodName, input);
- }
-
- AZStd::unique_ptr m_behaviorContext;
- };
-
- TEST_F(SceneGraphBehaviorTest, SceneClass_BehaviorContext_Exists)
- {
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- }
-
- TEST_F(SceneGraphBehaviorTest, SceneClass_BehaviorContext_HasExpectedProperties)
- {
- AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
- ASSERT_NE(nullptr, behaviorClass);
- EXPECT_TRUE(HasProperty(*behaviorClass, "name", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "manifestFilename", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "sourceFilename", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "sourceGuid", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "graph", azrtti_typeid()));
- EXPECT_TRUE(HasProperty(*behaviorClass, "manifest", azrtti_typeid()));
- }
-
- TEST_F(SceneGraphBehaviorTest, SceneGraphClass_BehaviorContext_Exists)
- {
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- EXPECT_TRUE(HasBehaviorClass(azrtti_typeid()));
- }
-
- TEST_F(SceneGraphBehaviorTest, SceneGraphClass_BehaviorContext_HasExpectedProperties)
- {
- using namespace AZ::SceneAPI::Containers;
-
- AZ::BehaviorClass* behaviorClass = GetBehaviorClass(azrtti_typeid());
- ASSERT_NE(nullptr, behaviorClass);
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetNodeName", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetRoot", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeContent", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeSibling", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeChild", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "HasNodeParent", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "IsNodeEndPoint", azrtti_typeid(), { azrtti_typeid() }));
- EXPECT_TRUE(HasMethodWithOutput(*behaviorClass, "GetNodeCount", azrtti_typeid(), {}));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "GetNodeParent",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "GetNodeSibling",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "GetNodeChild",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "FindWithPath",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid() }
- ));
- EXPECT_TRUE(HasMethodWithOutput(
- *behaviorClass,
- "FindWithRootAndPath",
- azrtti_typeid(),
- { azrtti_typeid(), azrtti_typeid(), azrtti_typeid