diff --git a/Assets/Editor/Prefabs/Default_Level.prefab b/Assets/Editor/Prefabs/Default_Level.prefab
index 64656e1e2f..d02d669f53 100644
--- a/Assets/Editor/Prefabs/Default_Level.prefab
+++ b/Assets/Editor/Prefabs/Default_Level.prefab
@@ -212,10 +212,10 @@
"Configuration": {
"ModelAsset": {
"assetId": {
- "guid": "{935F694A-8639-515B-8133-81CDC7948E5B}",
- "subId": 277333723
+ "guid": "{0CD745C0-6AA8-569A-A68A-73A3270986C4}",
+ "subId": 277889906
},
- "assetHint": "objects/groudplane/groundplane_521x521m.azmodel"
+ "assetHint": "objects/groudplane/groundplane_512x512m.azmodel"
}
}
}
diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts
index f057ba2f30..937f6a4d96 100644
--- a/Assets/Editor/Translation/scriptcanvas_en_us.ts
+++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts
@@ -2771,6 +2771,80 @@
VECTOR2_CREATEONE_OUTPUT0_TOOLTIP
+
+ VECTOR2_DIRECTIONTO_NAME
+ Class/Bus: Vector2 Event/Method: DirectionTo
+ Get Direction Vector
+
+
+ VECTOR2_DIRECTIONTO_TOOLTIP
+ Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0
+
+
+ VECTOR2_DIRECTIONTO_CATEGORY
+
+
+
+ VECTOR2_DIRECTIONTO_OUT_NAME
+
+
+
+ VECTOR2_DIRECTIONTO_OUT_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTOL_IN_NAME
+
+
+
+ VECTOR2_DIRECTIONTO_IN_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT0_NAME
+ C++ Type: const Vector2
+ Direction
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT0_TOOLTIP
+ The direction between To and From normalized and optionally scaled
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT1_NAME
+ C++ Type: float
+ Distance
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT1_TOOLTIP
+ The distance between To and From
+
+
+ VECTOR2_DIRECTIONTO_PARAM0_NAME
+ Simple Type: Vector2 C++ Type: Vector2*
+ From
+
+
+ VECTOR2_DIRECTIONTO_PARAM0_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTO_PARAM1_NAME
+ Simple Type: Vector2 C++ Type: Vector2*
+ To
+
+
+ VECTOR2_DIRECTIONTO_PARAM1_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTO_PARAM2_NAME
+ Simple Type: Vector2 C++ Type: Vector2*
+ Scale
+
+
+ VECTOR2_DIRECTIONTO_PARAM2_TOOLTIP
+
+
VECTOR2_GETPROJECTED_NAME
Class/Bus: Vector2 Event/Method: GetProjected
@@ -32262,6 +32336,80 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
VECTOR4_GETRECIPROCAL_PARAM0_TOOLTIP
+
+ VECTOR4_DIRECTIONTO_NAME
+ Class/Bus: Vector4 Event/Method: DirectionTo
+ Get Direction Vector
+
+
+ VECTOR4_DIRECTIONTO_TOOLTIP
+ Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0
+
+
+ VECTOR4_DIRECTIONTO_CATEGORY
+
+
+
+ VECTOR4_DIRECTIONTO_OUT_NAME
+
+
+
+ VECTOR4_DIRECTIONTO_OUT_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTOL_IN_NAME
+
+
+
+ VECTOR4_DIRECTIONTO_IN_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT0_NAME
+ C++ Type: const Vector4
+ Direction
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT0_TOOLTIP
+ The direction between To and From normalized and optionally scaled
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT1_NAME
+ C++ Type: float
+ Distance
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT1_TOOLTIP
+ The distance between To and From
+
+
+ VECTOR4_DIRECTIONTO_PARAM0_NAME
+ Simple Type: Vector4 C++ Type: Vector4*
+ From
+
+
+ VECTOR4_DIRECTIONTO_PARAM0_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTO_PARAM1_NAME
+ Simple Type: Vector4 C++ Type: Vector4*
+ To
+
+
+ VECTOR4_DIRECTIONTO_PARAM1_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTO_PARAM2_NAME
+ Simple Type: Vector4 C++ Type: Vector4*
+ Scale
+
+
+ VECTOR4_DIRECTIONTO_PARAM2_TOOLTIP
+
+
VECTOR4_AXISX_NAME
Class/Bus: Vector4 Event/Method: CreateAxisX
@@ -37469,6 +37617,80 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
VECTOR3_GETRECIPROCAL_PARAM0_TOOLTIP
+
+ VECTOR3_DIRECTIONTO_NAME
+ Class/Bus: Vector3 Event/Method: DirectionTo
+ Get Direction Vector
+
+
+ VECTOR3_DIRECTIONTO_TOOLTIP
+ Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0
+
+
+ VECTOR3_DIRECTIONTO_CATEGORY
+
+
+
+ VECTOR3_DIRECTIONTO_OUT_NAME
+
+
+
+ VECTOR3_DIRECTIONTO_OUT_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTOL_IN_NAME
+
+
+
+ VECTOR3_DIRECTIONTO_IN_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT0_NAME
+ C++ Type: const Vector3
+ Direction
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT0_TOOLTIP
+ The direction between To and From normalized and optionally scaled
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT1_NAME
+ C++ Type: float
+ Distance
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT1_TOOLTIP
+ The distance between To and From
+
+
+ VECTOR3_DIRECTIONTO_PARAM0_NAME
+ Simple Type: Vector3 C++ Type: Vector3*
+ From
+
+
+ VECTOR3_DIRECTIONTO_PARAM0_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTO_PARAM1_NAME
+ Simple Type: Vector3 C++ Type: Vector3*
+ To
+
+
+ VECTOR3_DIRECTIONTO_PARAM1_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTO_PARAM2_NAME
+ Simple Type: Vector3 C++ Type: Vector3*
+ Scale
+
+
+ VECTOR3_DIRECTIONTO_PARAM2_TOOLTIP
+
+
VECTOR3_PROJECT_NAME
Class/Bus: Vector3 Event/Method: Project
diff --git a/AutomatedTesting/surfacetypemateriallibrary.physmaterial b/AutomatedTesting/Assets/Physics/SurfaceTypeMaterialLibrary.physmaterial
similarity index 100%
rename from AutomatedTesting/surfacetypemateriallibrary.physmaterial
rename to AutomatedTesting/Assets/Physics/SurfaceTypeMaterialLibrary.physmaterial
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt
index 8b9de91906..0170d73af0 100644
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt
@@ -97,7 +97,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
PATH ${CMAKE_CURRENT_LIST_DIR}/asset_bundler_batch_tests.py
EXCLUDE_TEST_RUN_TARGET_FROM_IDE
TEST_SERIAL
- TIMEOUT 1500
+ TIMEOUT 2400
TEST_SUITE periodic
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py
index 13b899dfdd..2c805f0291 100755
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py
@@ -113,7 +113,7 @@ class TestsAssetBuilder_WindowsAndMac(object):
if listening_port:
corrupted_slice_command.append(f'-port={listening_port}')
if workspace.project:
- corrupted_slice_command.append(f'-gamename={workspace.project}')
+ corrupted_slice_command.append(f'--project-path={workspace.project}')
corrupted_slice_output = utils.safe_subprocess(corrupted_slice_command)
# Verify corrupted slice produced error
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py
index 768dd985fd..7f85e5e317 100755
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py
@@ -902,7 +902,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
second_input_arg = asset_lists_to_string(second_asset_list) # --secondAssetList
output_arg = asset_lists_to_string(output_file) # --output
- def generate_compare_command(platform_arg: str) -> object:
+ def generate_compare_command(platform_arg: str, project_name : str) -> object:
"""Creates a string containing a full Compare command. This string can be executed as-is."""
cmd = [helper["bundler_batch"], "compare", f"--firstassetFile={first_input_arg}", f"--output={output_arg}"]
if platform_arg is not None:
@@ -918,6 +918,8 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
if comp_type == "4":
# Extra arguments for pattern comparison
cmd.extend([f"--filePatternType={pattern_type}", f"--filePattern={pattern}"])
+ if workspace.project:
+ cmd.append(f'--project-path={project_name}')
return cmd
# End generate_compare_command()
@@ -936,6 +938,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# End verify_asset_list_contents()
def run_compare_command_and_verify(platform_arg: str, expect_pc_output: bool, expect_mac_output: bool) -> None:
+
# Expected asset list to equal result of comparison
expected_pc_asset_list = None
expected_mac_asset_list = None
@@ -957,7 +960,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
output_mac_asset_list = helper.platform_file_name(last_output_arg, platform)
# Build execution command
- cmd = generate_compare_command(platform_arg)
+ cmd = generate_compare_command(platform_arg, workspace.project)
# Execute command
subprocess.check_call(cmd)
@@ -992,10 +995,12 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
f"--comparisonRulesFile={rule_file}",
f"--comparisonType={args[1]}",
r"--addComparison",
+ f"--project-path={workspace.project}",
]
if args[1] == "4":
# If pattern comparison, append a few extra arguments
cmd.extend(["--filePatternType=0", "--filePattern=*.dat"])
+
subprocess.check_call(cmd)
assert os.path.exists(rule_file), f"Rule file {args[0]} was not created at location: {rule_file}"
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt
index a342d95d98..d4f036faeb 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt
@@ -17,7 +17,7 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_MainSuite.py
TEST_SERIAL
- TIMEOUT 400
+ TIMEOUT 600
RUNTIME_DEPENDENCIES
AssetProcessor
AutomatedTesting.Assets
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_AtomEditorComponents_LightComponent.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_AtomEditorComponents_LightComponent.py
new file mode 100644
index 0000000000..ec8dc199ae
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_AtomEditorComponents_LightComponent.py
@@ -0,0 +1,217 @@
+"""
+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
+
+Hydra script that creates an entity, attaches the Light component to it for test verifications.
+The test verifies that each light type option is available and can be selected without errors.
+"""
+
+import os
+import sys
+
+import azlmbr.bus as bus
+import azlmbr.editor as editor
+import azlmbr.math as math
+import azlmbr.paths
+import azlmbr.legacy.general as general
+
+sys.path.append(os.path.join(azlmbr.paths.devassets, "Gem", "PythonTests"))
+
+import editor_python_test_tools.hydra_editor_utils as hydra
+from atom_renderer.atom_utils.atom_component_helper import LIGHT_TYPES
+
+LIGHT_TYPE_PROPERTY = 'Controller|Configuration|Light type'
+SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Shadows|Enable shadow", True),
+ ("Controller|Configuration|Shadows|Shadowmap size", 0), # 256
+ ("Controller|Configuration|Shadows|Shadowmap size", 1), # 512
+ ("Controller|Configuration|Shadows|Shadowmap size", 2), # 1024
+ ("Controller|Configuration|Shadows|Shadowmap size", 3), # 2048
+ ("Controller|Configuration|Shadows|Shadow filter method", 1), # PCF
+ ("Controller|Configuration|Shadows|Filtering sample count", 4.0),
+ ("Controller|Configuration|Shadows|Filtering sample count", 64.0),
+ ("Controller|Configuration|Shadows|PCF method", 0), # Bicubic
+ ("Controller|Configuration|Shadows|PCF method", 1), # Boundary search
+ ("Controller|Configuration|Shadows|Shadow filter method", 2), # ECM
+ ("Controller|Configuration|Shadows|ESM exponent", 50),
+ ("Controller|Configuration|Shadows|ESM exponent", 5000),
+ ("Controller|Configuration|Shadows|Shadow filter method", 3), # ESM+PCF
+]
+QUAD_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Both directions", True),
+ ("Controller|Configuration|Fast approximation", True),
+]
+SIMPLE_POINT_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Attenuation radius|Mode", 0),
+ ("Controller|Configuration|Attenuation radius|Radius", 100.0),
+]
+SIMPLE_SPOT_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Shutters|Inner angle", 45.0),
+ ("Controller|Configuration|Shutters|Outer angle", 90.0),
+]
+
+
+def verify_required_component_property_value(entity_name, component, property_path, expected_property_value):
+ """
+ Compares the property value of component against the expected_property_value.
+ :param entity_name: name of the entity to use (for test verification purposes).
+ :param component: component to check on a given entity for its current property value.
+ :param property_path: the path to the property inside the component.
+ :param expected_property_value: The value expected from the value inside property_path.
+ :return: None, but prints to general.log() which the test uses to verify against.
+ """
+ property_value = editor.EditorComponentAPIBus(
+ bus.Broadcast, "GetComponentProperty", component, property_path).GetValue()
+ general.log(f"{entity_name}_test: Property value is {property_value} "
+ f"which matches {expected_property_value}")
+
+
+def run():
+ """
+ Test Case - Light Component
+ 1. Creates a "light_entity" Entity and attaches a "Light" component to it.
+ 2. Updates the Light component to each light type option from the LIGHT_TYPES constant.
+ 3. The test will check the Editor log to ensure each light type was selected.
+ 4. Prints the string "Light component test (non-GPU) completed" after completion.
+
+ Tests will fail immediately if any of these log lines are found:
+ 1. Trace::Assert
+ 2. Trace::Error
+ 3. Traceback (most recent call last):
+
+ :return: None
+ """
+ # Create a "light_entity" entity with "Light" component.
+ light_entity_name = "light_entity"
+ light_component = "Light"
+ light_entity = hydra.Entity(light_entity_name)
+ light_entity.create_entity(math.Vector3(-1.0, -2.0, 3.0), [light_component])
+ general.log(
+ f"{light_entity_name}_test: Component added to the entity: "
+ f"{hydra.has_components(light_entity.id, [light_component])}")
+
+ # Populate the light_component_id_pair value so that it can be used to select all Light component options.
+ light_component_id_pair = None
+ component_type_id_list = azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast, 'FindComponentTypeIdsByEntityType', [light_component], 0)
+ if len(component_type_id_list) < 1:
+ general.log(f"ERROR: A component class with name {light_component} doesn't exist")
+ light_component_id_pair = None
+ elif len(component_type_id_list) > 1:
+ general.log(f"ERROR: Found more than one component classes with same name: {light_component}")
+ light_component_id_pair = None
+ entity_component_id_pair = azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast, 'GetComponentOfType', light_entity.id, component_type_id_list[0])
+ if entity_component_id_pair.IsSuccess():
+ light_component_id_pair = entity_component_id_pair.GetValue()
+
+ # Test each Light component option can be selected and it's properties updated.
+ # Point (sphere) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['sphere'],
+ light_properties=SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Spot (disk) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['spot_disk'],
+ light_properties=SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Capsule light type checks.
+ azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast,
+ 'SetComponentProperty',
+ light_component_id_pair,
+ LIGHT_TYPE_PROPERTY,
+ LIGHT_TYPES['capsule']
+ )
+ verify_required_component_property_value(
+ entity_name=light_entity_name,
+ component=light_entity.components[0],
+ property_path=LIGHT_TYPE_PROPERTY,
+ expected_property_value=LIGHT_TYPES['capsule']
+ )
+
+ # Quad light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['quad'],
+ light_properties=QUAD_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Polygon light type checks.
+ azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast,
+ 'SetComponentProperty',
+ light_component_id_pair,
+ LIGHT_TYPE_PROPERTY,
+ LIGHT_TYPES['polygon']
+ )
+ verify_required_component_property_value(
+ entity_name=light_entity_name,
+ component=light_entity.components[0],
+ property_path=LIGHT_TYPE_PROPERTY,
+ expected_property_value=LIGHT_TYPES['polygon']
+ )
+
+ # Point (simple punctual) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['simple_point'],
+ light_properties=SIMPLE_POINT_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Spot (simple punctual) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['simple_spot'],
+ light_properties=SIMPLE_SPOT_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ general.log("Light component test (non-GPU) completed.")
+
+
+def light_type_property_test(light_type, light_properties, light_component_id_pair, light_entity_name, light_entity):
+ """
+ Updates the current light type and modifies its properties, then verifies they are accurate to what was set.
+ :param light_type: The type of light to update, must match a value in LIGHT_TYPES
+ :param light_properties: List of tuples detailing properties to modify with update values.
+ :param light_component_id_pair: Entity + component ID pair for updating the light component on a given entity.
+ :param light_entity_name: the name of the Entity holding the light component.
+ :param light_entity: the Entity object containing the light component.
+ :return: None
+ """
+ azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast,
+ 'SetComponentProperty',
+ light_component_id_pair,
+ LIGHT_TYPE_PROPERTY,
+ light_type
+ )
+ verify_required_component_property_value(
+ entity_name=light_entity_name,
+ component=light_entity.components[0],
+ property_path=LIGHT_TYPE_PROPERTY,
+ expected_property_value=light_type
+ )
+
+ for light_property in light_properties:
+ light_entity.get_set_test(0, light_property[0], light_property[1])
+
+
+if __name__ == "__main__":
+ run()
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/atom_component_helper.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/atom_component_helper.py
new file mode 100644
index 0000000000..de4e28bb36
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/atom_component_helper.py
@@ -0,0 +1,19 @@
+"""
+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
+
+File to assist with common hydra component functions or constants used across various Atom tests.
+"""
+
+# Light type options for the Light component.
+LIGHT_TYPES = {
+ 'unknown': 0,
+ 'sphere': 1,
+ 'spot_disk': 2,
+ 'capsule': 3,
+ 'quad': 4,
+ 'polygon': 5,
+ 'simple_point': 6,
+ 'simple_spot': 7,
+}
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py
index ed5d057626..98d2ba0632 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py
@@ -12,9 +12,10 @@ import os
import pytest
import editor_python_test_tools.hydra_test_utils as hydra
+from atom_renderer.atom_utils.atom_component_helper import LIGHT_TYPES
logger = logging.getLogger(__name__)
-EDITOR_TIMEOUT = 300
+EDITOR_TIMEOUT = 120
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
@@ -180,3 +181,64 @@ class TestAtomEditorComponentsMain(object):
null_renderer=True,
cfg_args=cfg_args,
)
+
+ def test_AtomEditorComponents_LightComponent(
+ self, request, editor, workspace, project, launcher_platform, level):
+ """
+ Please review the hydra script run by this test for more specific test info.
+ Tests that the Light component has the expected property options available to it.
+ """
+ cfg_args = [level]
+
+ expected_lines = [
+ "light_entity Entity successfully created",
+ "Entity has a Light component",
+ "light_entity_test: Component added to the entity: True",
+ f"light_entity_test: Property value is {LIGHT_TYPES['sphere']} which matches {LIGHT_TYPES['sphere']}",
+ "Controller|Configuration|Shadows|Enable shadow set to True",
+ "light_entity Controller|Configuration|Shadows|Shadowmap size: SUCCESS",
+ "Controller|Configuration|Shadows|Shadow filter method set to 1", # PCF
+ "Controller|Configuration|Shadows|Filtering sample count set to 4",
+ "Controller|Configuration|Shadows|Filtering sample count set to 64",
+ "Controller|Configuration|Shadows|PCF method set to 0",
+ "Controller|Configuration|Shadows|PCF method set to 1",
+ "Controller|Configuration|Shadows|Shadow filter method set to 2", # ESM
+ "Controller|Configuration|Shadows|ESM exponent set to 50.0",
+ "Controller|Configuration|Shadows|ESM exponent set to 5000.0",
+ "Controller|Configuration|Shadows|Shadow filter method set to 3", # ESM+PCF
+ f"light_entity_test: Property value is {LIGHT_TYPES['spot_disk']} which matches {LIGHT_TYPES['spot_disk']}",
+ f"light_entity_test: Property value is {LIGHT_TYPES['capsule']} which matches {LIGHT_TYPES['capsule']}",
+ f"light_entity_test: Property value is {LIGHT_TYPES['quad']} which matches {LIGHT_TYPES['quad']}",
+ "light_entity Controller|Configuration|Fast approximation: SUCCESS",
+ "light_entity Controller|Configuration|Both directions: SUCCESS",
+ f"light_entity_test: Property value is {LIGHT_TYPES['polygon']} which matches {LIGHT_TYPES['polygon']}",
+ f"light_entity_test: Property value is {LIGHT_TYPES['simple_point']} "
+ f"which matches {LIGHT_TYPES['simple_point']}",
+ "Controller|Configuration|Attenuation radius|Mode set to 0",
+ "Controller|Configuration|Attenuation radius|Radius set to 100.0",
+ f"light_entity_test: Property value is {LIGHT_TYPES['simple_spot']} "
+ f"which matches {LIGHT_TYPES['simple_spot']}",
+ "Controller|Configuration|Shutters|Outer angle set to 45.0",
+ "Controller|Configuration|Shutters|Outer angle set to 90.0",
+ "light_entity_test: Component added to the entity: True",
+ "Light component test (non-GPU) completed.",
+ ]
+
+ unexpected_lines = [
+ "Trace::Assert",
+ "Trace::Error",
+ "Traceback (most recent call last):",
+ ]
+
+ hydra.launch_and_validate_results(
+ request,
+ TEST_DIRECTORY,
+ editor,
+ "hydra_AtomEditorComponents_LightComponent.py",
+ timeout=EDITOR_TIMEOUT,
+ expected_lines=expected_lines,
+ unexpected_lines=unexpected_lines,
+ halt_on_unexpected=True,
+ null_renderer=True,
+ cfg_args=cfg_args,
+ )
diff --git a/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py b/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py
index 060779082c..341597e36a 100755
--- a/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py
+++ b/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py
@@ -64,7 +64,8 @@ def C15096740_Material_LibraryUpdatedCorrectly():
# Constants
library_property_path = "Configuration|Physics Material|Library"
- default_material_path = "surfacetypemateriallibrary.physmaterial"
+
+ default_material_path = os.path.join("assets", "physics", "surfacetypemateriallibrary.physmaterial")
new_material_path = os.path.join("physicssurfaces", "default_phys_materials.physmaterial")
helper.init_idle()
@@ -82,7 +83,7 @@ def C15096740_Material_LibraryUpdatedCorrectly():
default_asset = Asset.find_asset_by_path(default_material_path)
test_component.set_component_property_value(library_property_path, default_asset.id)
default_asset.id = test_component.get_component_property_value(library_property_path)
- Report.result(Tests.override_default_library, default_asset.get_path() == default_material_path)
+ Report.result(Tests.override_default_library, default_asset.get_path() == default_material_path.replace(os.sep, '/'))
# 4) Switch it back again to the default material library.
test_component.set_component_property_value(library_property_path, azasset.AssetId())
diff --git a/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py b/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py
index 54ea3c7f15..cff8ae8377 100755
--- a/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py
+++ b/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py
@@ -133,7 +133,7 @@ class Physmaterial_Editor:
def _set_path(self):
# type: (str) -> str
if self.document_filename == None:
- self.document_filename = os.path.join(self.project_folder, "surfacetypemateriallibrary.physmaterial")
+ self.document_filename = os.path.join(self.project_folder, "assets", "physics", "surfacetypemateriallibrary.physmaterial")
else:
for (root, directories, root_files) in os.walk(self.project_folder):
for root_file in root_files:
diff --git a/AutomatedTesting/Passes/MainPipeline.pass b/AutomatedTesting/Passes/MainPipeline.pass
new file mode 100644
index 0000000000..aa9f3757c4
--- /dev/null
+++ b/AutomatedTesting/Passes/MainPipeline.pass
@@ -0,0 +1,483 @@
+{
+ "Type": "JsonSerialization",
+ "Version": 1,
+ "ClassName": "PassAsset",
+ "ClassData": {
+ "PassTemplate": {
+ "Name": "MainPipeline",
+ "PassClass": "ParentPass",
+ "Slots": [
+ {
+ "Name": "SwapChainOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "RenderTarget"
+ }
+ ],
+ "PassRequests": [
+ {
+ "Name": "MorphTargetPass",
+ "TemplateName": "MorphTargetPassTemplate"
+ },
+ {
+ "Name": "SkinningPass",
+ "TemplateName": "SkinningPassTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshOutputStream",
+ "AttachmentRef": {
+ "Pass": "MorphTargetPass",
+ "Attachment": "MorphTargetDeltaOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "RayTracingAccelerationStructurePass",
+ "TemplateName": "RayTracingAccelerationStructurePassTemplate"
+ },
+ {
+ "Name": "DiffuseProbeGridUpdatePass",
+ "TemplateName": "DiffuseProbeGridUpdatePassTemplate",
+ "ExecuteAfter": [
+ "RayTracingAccelerationStructurePass"
+ ]
+ },
+ {
+ "Name": "DepthPrePass",
+ "TemplateName": "DepthMSAAParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "MotionVectorPass",
+ "TemplateName": "MotionVectorParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "Depth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LightCullingPass",
+ "TemplateName": "LightCullingParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "DepthMSAA",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthMSAA"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "ShadowPass",
+ "TemplateName": "ShadowParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "OpaquePass",
+ "TemplateName": "OpaqueParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "DirectionalShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "DirectionalESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalESM"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedESM"
+ }
+ },
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "LightListRemapped",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "LightListRemapped"
+ }
+ },
+ {
+ "LocalSlot": "DepthLinear",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthLinear"
+ }
+ },
+ {
+ "LocalSlot": "DepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthMSAA"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "TransparentPass",
+ "TemplateName": "TransparentParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "DirectionalShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "DirectionalESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalESM"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedESM"
+ }
+ },
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "LightListRemapped",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "LightListRemapped"
+ }
+ },
+ {
+ "LocalSlot": "InputLinearDepth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthLinear"
+ }
+ },
+ {
+ "LocalSlot": "DepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "OpaquePass",
+ "Attachment": "Output"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "DeferredFogPass",
+ "TemplateName": "DeferredFogPassTemplate",
+ "Enabled": false,
+ "Connections": [
+ {
+ "LocalSlot": "InputLinearDepth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthLinear"
+ }
+ },
+ {
+ "LocalSlot": "InputDepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "RenderTargetInputOutput",
+ "AttachmentRef": {
+ "Pass": "TransparentPass",
+ "Attachment": "InputOutput"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "FullscreenTrianglePassData",
+ "ShaderAsset": {
+ "FilePath": "Shaders/ScreenSpace/DeferredFog.shader"
+ },
+ "PipelineViewTag": "MainCamera"
+ }
+ },
+ {
+ "Name": "ReflectionCopyFrameBufferPass",
+ "TemplateName": "ReflectionCopyFrameBufferPassTemplate",
+ "Enabled": false,
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "DeferredFogPass",
+ "Attachment": "RenderTargetInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "PostProcessPass",
+ "TemplateName": "PostProcessParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "LightingInput",
+ "AttachmentRef": {
+ "Pass": "DeferredFogPass",
+ "Attachment": "RenderTargetInputOutput"
+ }
+ },
+ {
+ "LocalSlot": "Depth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "MotionVectors",
+ "AttachmentRef": {
+ "Pass": "MotionVectorPass",
+ "Attachment": "MotionVectorOutput"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "AuxGeomPass",
+ "TemplateName": "AuxGeomPassTemplate",
+ "Enabled": true,
+ "Connections": [
+ {
+ "LocalSlot": "ColorInputOutput",
+ "AttachmentRef": {
+ "Pass": "PostProcessPass",
+ "Attachment": "Output"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "RasterPassData",
+ "DrawListTag": "auxgeom",
+ "PipelineViewTag": "MainCamera"
+ }
+ },
+ {
+ "Name": "DebugOverlayPass",
+ "TemplateName": "DebugOverlayParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "RawLightingInput",
+ "AttachmentRef": {
+ "Pass": "PostProcessPass",
+ "Attachment": "RawLightingOutput"
+ }
+ },
+ {
+ "LocalSlot": "LuminanceMipChainInput",
+ "AttachmentRef": {
+ "Pass": "PostProcessPass",
+ "Attachment": "LuminanceMipChainOutput"
+ }
+ },
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "AuxGeomPass",
+ "Attachment": "ColorInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LyShinePass",
+ "TemplateName": "LyShineParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "ColorInputOutput",
+ "AttachmentRef": {
+ "Pass": "DebugOverlayPass",
+ "Attachment": "InputOutput"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "UIPass",
+ "TemplateName": "UIParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "LyShinePass",
+ "Attachment": "ColorInputOutput"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "CopyToSwapChain",
+ "TemplateName": "FullscreenCopyTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "UIPass",
+ "Attachment": "InputOutput"
+ }
+ },
+ {
+ "LocalSlot": "Output",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override b/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override
+++ b/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override b/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override
index afbe6a9d38..e53d3893f8 100644
--- a/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override
+++ b/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override
@@ -109,9 +109,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override b/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override
+++ b/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override b/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override
+++ b/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override b/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override
+++ b/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/physxsystemconfiguration.setreg b/AutomatedTesting/Registry/physxsystemconfiguration.setreg
index 02f65b685b..83aad307a6 100644
--- a/AutomatedTesting/Registry/physxsystemconfiguration.setreg
+++ b/AutomatedTesting/Registry/physxsystemconfiguration.setreg
@@ -103,9 +103,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp
index 9c13aa7328..01f6d24c6e 100644
--- a/Code/Editor/Controls/ConsoleSCB.cpp
+++ b/Code/Editor/Controls/ConsoleSCB.cpp
@@ -338,6 +338,8 @@ CConsoleSCB::CConsoleSCB(QWidget* parent)
connect(findPreviousAction, &QAction::triggered, this, &CConsoleSCB::findPrevious);
ui->findPrevButton->addAction(findPreviousAction);
+ GetIEditor()->RegisterNotifyListener(this);
+
connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor);
connect(ui->findButton, &QPushButton::clicked, this, &CConsoleSCB::toggleConsoleSearch);
connect(ui->textEdit, &ConsoleTextEdit::searchBarRequested, this, [this]
@@ -376,6 +378,8 @@ CConsoleSCB::~CConsoleSCB()
{
AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect();
+ GetIEditor()->UnregisterNotifyListener(this);
+
s_consoleSCB = nullptr;
CLogFile::AttachEditBox(nullptr);
}
@@ -1352,4 +1356,19 @@ CConsoleSCB* CConsoleSCB::GetCreatedInstance()
return s_consoleSCB;
}
+void CConsoleSCB::OnEditorNotifyEvent(EEditorNotifyEvent event)
+{
+ switch (event)
+ {
+ case eNotify_OnBeginGameMode:
+ if (gSettings.clearConsoleOnGameModeStart)
+ {
+ ui->textEdit->clear();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
#include
diff --git a/Code/Editor/Controls/ConsoleSCB.h b/Code/Editor/Controls/ConsoleSCB.h
index 98bf4b391d..f51786e2a5 100644
--- a/Code/Editor/Controls/ConsoleSCB.h
+++ b/Code/Editor/Controls/ConsoleSCB.h
@@ -159,6 +159,7 @@ private:
class CConsoleSCB
: public QWidget
, private AzToolsFramework::EditorPreferencesNotificationBus::Handler
+ , public IEditorNotifyListener
{
Q_OBJECT
public:
@@ -187,6 +188,8 @@ private Q_SLOTS:
void findNext();
private:
+ void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
+
QScopedPointer ui;
int m_richEditTextLength;
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h
index 0abf7d295c..9bd34f3f7c 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h
@@ -122,7 +122,7 @@ protected:
public:
//! Get number of child nodes.
- int GetChildCount() const { return m_childs.size(); };
+ int GetChildCount() const { return static_cast(m_childs.size()); };
//! Get Child by id.
ReflectedPropertyItem* GetChild(int index) const { return m_childs[index]; }
PropertyType GetType() const { return m_type; }
diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp
index 3c27c25c9a..70ff51c3d6 100644
--- a/Code/Editor/Core/LevelEditorMenuHandler.cpp
+++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp
@@ -544,12 +544,12 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
- snapMenu.AddAction(ID_SNAPANGLE);
+ snapMenu.AddAction(AzToolsFramework::SnapAngle);
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
- transformModeMenu.AddAction(ID_EDITMODE_MOVE);
- transformModeMenu.AddAction(ID_EDITMODE_ROTATE);
- transformModeMenu.AddAction(ID_EDITMODE_SCALE);
+ transformModeMenu.AddAction(AzToolsFramework::EditModeMove);
+ transformModeMenu.AddAction(AzToolsFramework::EditModeRotate);
+ transformModeMenu.AddAction(AzToolsFramework::EditModeScale);
editMenu.AddSeparator();
diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp
index 3673367c12..63f6908fdb 100644
--- a/Code/Editor/CryEdit.cpp
+++ b/Code/Editor/CryEdit.cpp
@@ -375,9 +375,6 @@ void CCryEditApp::RegisterActionHandlers()
});
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
- ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
- ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate)
- ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale)
ON_COMMAND(ID_UNDO, OnUndo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
@@ -2574,75 +2571,6 @@ void CCryEditApp::OnRenameObj()
{
}
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnEditmodeMove()
-{
- using namespace AzToolsFramework;
- EditorTransformComponentSelectionRequestBus::Event(
- GetEntityContextId(),
- &EditorTransformComponentSelectionRequests::SetTransformMode,
- EditorTransformComponentSelectionRequests::Mode::Translation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnEditmodeRotate()
-{
- using namespace AzToolsFramework;
- EditorTransformComponentSelectionRequestBus::Event(
- GetEntityContextId(),
- &EditorTransformComponentSelectionRequests::SetTransformMode,
- EditorTransformComponentSelectionRequests::Mode::Rotation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnEditmodeScale()
-{
- using namespace AzToolsFramework;
- EditorTransformComponentSelectionRequestBus::Event(
- GetEntityContextId(),
- &EditorTransformComponentSelectionRequests::SetTransformMode,
- EditorTransformComponentSelectionRequests::Mode::Scale);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateEditmodeMove(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
-
- AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
- AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
- mode, AzToolsFramework::GetEntityContextId(),
- &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
-
- action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateEditmodeRotate(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
-
- AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
- AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
- mode, AzToolsFramework::GetEntityContextId(),
- &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
-
- action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateEditmodeScale(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
-
- AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
- AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
- mode, AzToolsFramework::GetEntityContextId(),
- &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
-
- action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
-}
-
void CCryEditApp::OnViewSwitchToGame()
{
if (IsInPreviewMode())
@@ -2896,7 +2824,14 @@ void CCryEditApp::OpenProjectManager(const AZStd::string& screen)
{
// provide the current project path for in case we want to update the project
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
- const AZStd::string commandLineOptions = AZStd::string::format(" --screen %s --project-path %s", screen.c_str(), projectPath.c_str());
+#if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
+ const char* argumentQuoteString = R"(")";
+#else
+ const char* argumentQuoteString = R"(\")";
+#endif
+ const AZStd::string commandLineOptions = AZStd::string::format(R"( --screen %s --project-path %s%s%s)",
+ screen.c_str(),
+ argumentQuoteString, projectPath.c_str(), argumentQuoteString);
bool launchSuccess = AzFramework::ProjectManager::LaunchProjectManager(commandLineOptions);
if (!launchSuccess)
{
diff --git a/Code/Editor/CryEdit.h b/Code/Editor/CryEdit.h
index 431a9cb817..5bb9326782 100644
--- a/Code/Editor/CryEdit.h
+++ b/Code/Editor/CryEdit.h
@@ -208,12 +208,6 @@ public:
void DeleteSelectedEntities(bool includeDescendants);
void OnMoveObject();
void OnRenameObj();
- void OnEditmodeMove();
- void OnEditmodeRotate();
- void OnEditmodeScale();
- void OnUpdateEditmodeMove(QAction* action);
- void OnUpdateEditmodeRotate(QAction* action);
- void OnUpdateEditmodeScale(QAction* action);
void OnUndo();
void OnOpenAssetImporter();
void OnUpdateSelected(QAction* action);
diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp
index 5438f44f37..881a047320 100644
--- a/Code/Editor/CryEditDoc.cpp
+++ b/Code/Editor/CryEditDoc.cpp
@@ -108,21 +108,12 @@ namespace Internal
// CCryEditDoc construction/destruction
CCryEditDoc::CCryEditDoc()
- : doc_validate_surface_types(0)
+ : doc_validate_surface_types(nullptr)
, m_modifiedModuleFlags(eModifiedNothing)
- // It assumes loaded levels have already been exported. Can be a big fat lie, though.
- // The right way would require us to save to the level folder the export status of the
- // level.
- , m_boLevelExported(true)
- , m_modified(false)
- , m_envProbeHeight(200.0f)
- , m_envProbeSliceRelativePath("EngineAssets/Slices/DefaultLevelSetup.slice")
{
////////////////////////////////////////////////////////////////////////
// Set member variables to initial values
////////////////////////////////////////////////////////////////////////
- m_bLoadFailed = false;
- m_waterColor = QColor(0, 0, 255);
m_fogTemplate = GetIEditor()->FindTemplate("Fog");
m_environmentTemplate = GetIEditor()->FindTemplate("Environment");
@@ -136,7 +127,6 @@ CCryEditDoc::CCryEditDoc()
m_environmentTemplate = XmlHelpers::CreateXmlNode("Environment");
}
- m_bDocumentReady = false;
GetIEditor()->SetDocument(this);
CLogFile::WriteLine("Document created");
RegisterConsoleVariables();
@@ -195,7 +185,7 @@ CCryEditDoc::DocumentEditingMode CCryEditDoc::GetEditMode() const
QString CCryEditDoc::GetActivePathName() const
{
- return DocumentEditingMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
+ return GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
}
QString CCryEditDoc::GetTitle() const
@@ -260,9 +250,9 @@ void CCryEditDoc::DeleteContents()
GetIEditor()->FlushUndo();
// Notify listeners.
- for (std::list::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
+ for (IDocListener* listener : m_listeners)
{
- (*it)->OnCloseDocument();
+ listener->OnCloseDocument();
}
GetIEditor()->ResetViews();
@@ -458,7 +448,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
//////////////////////////////////////////////////////////////////////////
// Load water color.
//////////////////////////////////////////////////////////////////////////
- (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
+ (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
//////////////////////////////////////////////////////////////////////////
// Load View Settings
@@ -507,9 +497,9 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
CAutoLogTime logtime("Post Load");
// Notify listeners.
- for (std::list::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
+ for (IDocListener* listener : m_listeners)
{
- (*it)->OnLoadDocument();
+ listener->OnLoadDocument();
}
}
@@ -708,7 +698,8 @@ bool CCryEditDoc::SaveModified()
return true;
}
- auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+ auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
switch (button)
{
case QMessageBox::Cancel:
@@ -933,8 +924,7 @@ bool CCryEditDoc::OnSaveDocument(const QString& lpszPathName)
}
TSaveDocContext context;
- if (shouldSaveLevel &&
- BeforeSaveDocument(lpszPathName, context))
+ if (shouldSaveLevel && BeforeSaveDocument(lpszPathName, context))
{
DoSaveDocument(lpszPathName, context);
saveSuccess = AfterSaveDocument(lpszPathName, context);
@@ -972,7 +962,7 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex
return TRUE;
}
-bool CCryEditDoc::HasLayerNameConflicts()
+bool CCryEditDoc::HasLayerNameConflicts() const
{
AZStd::vector editorEntities;
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
@@ -1004,43 +994,42 @@ bool CCryEditDoc::HasLayerNameConflicts()
bool CCryEditDoc::DoSaveDocument(const QString& filename, TSaveDocContext& context)
{
bool& bSaved = context.bSaved;
- if (bSaved)
+ if (!bSaved)
{
- // Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
- // If nothing is loaded, we don't need to save anything
- if (filename.isEmpty())
- {
- bSaved = false;
- }
- else
- {
- // Save Tag Point locations to file if auto save of tag points disabled
- if (!gSettings.bAutoSaveTagPoints)
- {
- CCryEditApp::instance()->SaveTagLocations();
- }
-
- QString normalizedPath = Path::ToUnixPath(filename);
- if (IsSliceFile(normalizedPath))
- {
- bSaved = SaveSlice(normalizedPath);
- }
- else
- {
- bSaved = SaveLevel(normalizedPath);
- }
-
- // Changes filename for this document.
- SetPathName(normalizedPath);
- }
+ return false;
+ }
+ // Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
+ // If nothing is loaded, we don't need to save anything
+ if (filename.isEmpty())
+ {
+ bSaved = false;
+ return false;
}
+ // Save Tag Point locations to file if auto save of tag points disabled
+ if (!gSettings.bAutoSaveTagPoints)
+ {
+ CCryEditApp::instance()->SaveTagLocations();
+ }
+
+ QString normalizedPath = Path::ToUnixPath(filename);
+ if (IsSliceFile(normalizedPath))
+ {
+ bSaved = SaveSlice(normalizedPath);
+ }
+ else
+ {
+ bSaved = SaveLevel(normalizedPath);
+ }
+
+ // Changes filename for this document.
+ SetPathName(normalizedPath);
return bSaved;
}
bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt)
{
- bool& bSaved = context.bSaved;
+ bool bSaved = context.bSaved;
GetIEditor()->Notify(eNotify_OnEndSceneSave);
@@ -1067,8 +1056,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings)
{
const char* pUserName = GetISystem()->GetUserName();
- QString fileName;
- fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
+ QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
userSettings = Path::Make(levelFolder, fileName);
}
@@ -1182,9 +1170,9 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
}
QString oldFilePath = QDir(oldLevelFolder).absoluteFilePath(sourceName);
- QString newFilePath = QDir(newLevelFolder).absoluteFilePath(sourceName);
+ QString newFilePath = QDir(newLevelFolder).absoluteFilePath(destName);
CFileUtil::CopyFile(oldFilePath, newFilePath);
- } while (findHandle = pIPak->FindNext(findHandle));
+ } while ((findHandle = pIPak->FindNext(findHandle)));
pIPak->FindClose(findHandle);
}
@@ -1506,7 +1494,7 @@ bool CCryEditDoc::LoadEntitiesFromLevel(const QString& levelPakFile)
{
AZStd::vector fileBuffer;
fileBuffer.resize(entitiesFile.GetLength());
- if (fileBuffer.size() > 0)
+ if (!fileBuffer.empty())
{
if (fileBuffer.size() == entitiesFile.ReadRaw(fileBuffer.begin(), fileBuffer.size()))
{
@@ -1910,7 +1898,7 @@ void CCryEditDoc::UnregisterListener(IDocListener* listener)
m_listeners.remove(listener);
}
-void CCryEditDoc::LogLoadTime(int time)
+void CCryEditDoc::LogLoadTime(int time) const
{
QString appFilePath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
QString exePath = Path::GetPath(appFilePath);
@@ -1922,21 +1910,18 @@ void CCryEditDoc::LogLoadTime(int time)
SetFileAttributesW(filename.toStdWString().c_str(), FILE_ATTRIBUTE_ARCHIVE);
#endif
- FILE* file = nullptr;
- azfopen(&file, filename.toUtf8().data(), "at");
-
- if (file)
+ QFile file(filename);
+ if (!file.open(QFile::Append | QFile::Text))
{
- char version[50];
- GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
-
- QString text;
-
- time = time / 1000;
- text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
- fwrite(text.toUtf8().data(), text.toUtf8().length(), 1, file);
- fclose(file);
+ return;
}
+
+ char version[50];
+ GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
+
+ time = time / 1000;
+ QString text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
+ file.write(text.toUtf8());
}
void CCryEditDoc::SetDocumentReady(bool bReady)
@@ -1944,7 +1929,7 @@ void CCryEditDoc::SetDocumentReady(bool bReady)
m_bDocumentReady = bReady;
}
-void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer)
+void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer) const
{
{
SIZER_COMPONENT_NAME(pSizer, "UndoManager(estimate)");
@@ -2068,12 +2053,9 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
{
// Notify listeners.
std::list listeners = m_listeners;
- std::list::iterator it, next;
- for (it = listeners.begin(); it != listeners.end(); it = next)
+ for (IDocListener* listener : listeners)
{
- next = it;
- next++;
- (*it)->OnNewDocument();
+ listener->OnNewDocument();
}
}
@@ -2134,25 +2116,23 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
{
return;
}
+ QString childValue;
if (pVar->GetDataType() == IVariable::DT_COLOR)
{
Vec3 value;
pVar->Get(value);
- QString buff;
QColor gammaColor = ColorLinearToGamma(ColorF(value.x, value.y, value.z));
- buff = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
- childNode->setAttr("value", buff.toUtf8().data());
+ childValue = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
}
else
{
- QString value;
- pVar->Get(value);
- childNode->setAttr("value", value.toUtf8().data());
+ pVar->Get(childValue);
}
+ childNode->setAttr("value", childValue.toUtf8().data());
}
-QString CCryEditDoc::GetCryIndexPath(const char* levelFilePath)
+QString CCryEditDoc::GetCryIndexPath(const char* levelFilePath) const
{
QString levelPath = Path::GetPath(levelFilePath);
QString levelName = Path::GetFileName(levelFilePath);
@@ -2183,8 +2163,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
}
CPakFile pakFile;
- bool loadFromPakSuccess;
- loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
+ bool loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
if (!loadFromPakSuccess)
{
diff --git a/Code/Editor/CryEditDoc.h b/Code/Editor/CryEditDoc.h
index 9d86f62489..2ae2948b0d 100644
--- a/Code/Editor/CryEditDoc.h
+++ b/Code/Editor/CryEditDoc.h
@@ -91,7 +91,7 @@ public: // Create from serialization only
// ClassWizard generated virtual function overrides
virtual bool OnOpenDocument(const QString& lpszPathName);
- const bool IsLevelLoadFailed() const { return m_bLoadFailed; }
+ bool IsLevelLoadFailed() const { return m_bLoadFailed; }
//! Marks this document as having errors.
void SetHasErrors() { m_hasErrors = true; }
@@ -121,7 +121,7 @@ public: // Create from serialization only
CClouds* GetClouds() { return m_pClouds; }
void SetWaterColor(const QColor& col) { m_waterColor = col; }
- QColor GetWaterColor() { return m_waterColor; }
+ QColor GetWaterColor() const { return m_waterColor; }
XmlNodeRef& GetFogTemplate() { return m_fogTemplate; }
XmlNodeRef& GetEnvironmentTemplate() { return m_environmentTemplate; }
void OnEnvironmentPropertyChanged(IVariable* pVar);
@@ -129,7 +129,7 @@ public: // Create from serialization only
void RegisterListener(IDocListener* listener);
void UnregisterListener(IDocListener* listener);
- void GetMemoryUsage(ICrySizer* pSizer);
+ void GetMemoryUsage(ICrySizer* pSizer) const;
static bool IsBackupOrTempLevelSubdirectory(const QString& folderName);
protected:
@@ -161,14 +161,14 @@ protected:
void SerializeFogSettings(CXmlArchive& xmlAr);
virtual void SerializeViewSettings(CXmlArchive& xmlAr);
void SerializeNameSelection(CXmlArchive& xmlAr);
- void LogLoadTime(int time);
+ void LogLoadTime(int time) const;
struct TSaveDocContext
{
bool bSaved;
};
bool BeforeSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
- bool HasLayerNameConflicts();
+ bool HasLayerNameConflicts() const;
bool DoSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
bool AfterSaveDocument(const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt = true);
@@ -180,7 +180,7 @@ protected:
void OnStartLevelResourceList();
static void OnValidateSurfaceTypesChanged(ICVar*);
- QString GetCryIndexPath(const char* levelFilePath);
+ QString GetCryIndexPath(const char* levelFilePath) const;
//////////////////////////////////////////////////////////////////////////
// SliceEditorEntityOwnershipServiceNotificationBus::Handler
@@ -188,24 +188,26 @@ protected:
void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
//////////////////////////////////////////////////////////////////////////
- bool m_bLoadFailed;
- QColor m_waterColor;
+ bool m_bLoadFailed = false;
+ QColor m_waterColor = QColor(0, 0, 255);
XmlNodeRef m_fogTemplate;
XmlNodeRef m_environmentTemplate;
CClouds* m_pClouds;
std::list m_listeners;
- bool m_bDocumentReady;
- ICVar* doc_validate_surface_types;
+ bool m_bDocumentReady = false;
+ ICVar* doc_validate_surface_types = nullptr;
int m_modifiedModuleFlags;
- bool m_boLevelExported;
- bool m_modified;
+ // On construction, it assumes loaded levels have already been exported. Can be a big fat lie, though.
+ // The right way would require us to save to the level folder the export status of the level.
+ bool m_boLevelExported = true;
+ bool m_modified = false;
QString m_pathName;
QString m_slicePathName;
QString m_title;
AZ::Data::AssetId m_envProbeSliceAssetId;
float m_terrainSize;
- const char* m_envProbeSliceRelativePath;
- const float m_envProbeHeight;
+ const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
+ const float m_envProbeHeight = 200.0f;
bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save.
};
diff --git a/Code/Editor/EditorPreferencesPageGeneral.cpp b/Code/Editor/EditorPreferencesPageGeneral.cpp
index 70ac0fd46f..79ecfbdfc7 100644
--- a/Code/Editor/EditorPreferencesPageGeneral.cpp
+++ b/Code/Editor/EditorPreferencesPageGeneral.cpp
@@ -32,6 +32,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->Field("PreviewPanel", &GeneralSettings::m_previewPanel)
->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec)
->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl)
+ ->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart)
->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme)
->Field("AutoloadLastLevel", &GeneralSettings::m_autoLoadLastLevel)
->Field("ShowTimeInConsole", &GeneralSettings::m_bShowTimeInConsole)
@@ -77,6 +78,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control")
+ ->DataElement(
+ AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts")
->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background")
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light")
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark")
@@ -142,6 +145,7 @@ void CEditorPreferencesPage_General::OnApply()
gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel;
gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec;
gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl;
+ gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart;
gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme;
gSettings.bShowTimeInConsole = m_generalSettings.m_bShowTimeInConsole;
gSettings.bShowDashboardAtStartup = m_messaging.m_showDashboard;
@@ -176,6 +180,7 @@ void CEditorPreferencesPage_General::InitializeSettings()
m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow;
m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor;
m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl;
+ m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart;
m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme;
m_generalSettings.m_bShowTimeInConsole = gSettings.bShowTimeInConsole;
m_generalSettings.m_autoLoadLastLevel = gSettings.bAutoloadLastLevelAtStartup;
diff --git a/Code/Editor/EditorPreferencesPageGeneral.h b/Code/Editor/EditorPreferencesPageGeneral.h
index f22cfdd424..9a3a0f21e8 100644
--- a/Code/Editor/EditorPreferencesPageGeneral.h
+++ b/Code/Editor/EditorPreferencesPageGeneral.h
@@ -46,6 +46,7 @@ private:
bool m_previewPanel;
bool m_applyConfigSpec;
bool m_enableSourceControl;
+ bool m_clearConsoleOnGameModeStart;
AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme;
bool m_autoLoadLastLevel;
bool m_bShowTimeInConsole;
diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp
index 357c27fd72..4c638e1f82 100644
--- a/Code/Editor/EditorViewportWidget.cpp
+++ b/Code/Editor/EditorViewportWidget.cpp
@@ -472,6 +472,12 @@ void EditorViewportWidget::Update()
m_Camera.SetZRange(cameraState.m_nearClip, cameraState.m_farClip);
}
+ // Ensure the FOV matches our internally stored setting if we're using the Editor camera
+ if (!m_viewEntityId.IsValid() && !GetIEditor()->IsInGameMode())
+ {
+ SetFOV(GetFOV());
+ }
+
// Reset the camera update flag now that we're finished updating our viewport context
m_updateCameraPositionNextTick = false;
@@ -1234,6 +1240,13 @@ AZStd::shared_ptr CreateMod
AzFramework::ViewportId viewportId)
{
auto controller = AZStd::make_shared();
+
+ controller->SetCameraPriorityBuilderCallback(
+ [](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
+ {
+ cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority;
+ });
+
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
@@ -2624,8 +2637,6 @@ void EditorViewportWidget::DestroyRenderContext()
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::SetDefaultCamera()
{
- // Ensure the FOV matches our internally stored setting
- SetFOV(GetFOV());
if (IsDefaultCamera())
{
return;
diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h
index 1829995d02..b682de1cc3 100644
--- a/Code/Editor/EditorViewportWidget.h
+++ b/Code/Editor/EditorViewportWidget.h
@@ -258,19 +258,19 @@ public:
m_relCameraRotX = 0;
m_relCameraRotZ = 0;
- uint32 numSample6 = m_arrAnimatedCharacterPath.size();
+ uint32 numSample6 = static_cast(m_arrAnimatedCharacterPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
}
- numSample6 = m_arrSmoothEntityPath.size();
+ numSample6 = static_cast(m_arrSmoothEntityPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrSmoothEntityPath[i] = Vec3(ZERO);
}
- uint32 numSample7 = m_arrRunStrafeSmoothing.size();
+ uint32 numSample7 = static_cast(m_arrRunStrafeSmoothing.size());
for (uint32 i = 0; i < numSample7; i++)
{
m_arrRunStrafeSmoothing[i] = 0;
diff --git a/Code/Editor/ErrorReport.h b/Code/Editor/ErrorReport.h
index dec5cd4fb8..2bef4105f8 100644
--- a/Code/Editor/ErrorReport.h
+++ b/Code/Editor/ErrorReport.h
@@ -105,7 +105,7 @@ public:
bool IsEmpty() const;
//! Get number of contained error records.
- int GetErrorCount() const { return m_errors.size(); };
+ int GetErrorCount() const { return static_cast(m_errors.size()); };
//! Get access to indexed error record.
CErrorRecord& GetError(int i);
//! Clear all error records.
diff --git a/Code/Editor/GameEngine.cpp b/Code/Editor/GameEngine.cpp
index dff6476ff9..173c13c235 100644
--- a/Code/Editor/GameEngine.cpp
+++ b/Code/Editor/GameEngine.cpp
@@ -566,7 +566,7 @@ void CGameEngine::SwitchToInGame()
streamer->QueueRequest(flush);
wait.acquire();
}
-
+
GetIEditor()->Notify(eNotify_OnBeginGameMode);
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp
index c5352cbc4c..7e66df3ab6 100644
--- a/Code/Editor/MainWindow.cpp
+++ b/Code/Editor/MainWindow.cpp
@@ -46,6 +46,7 @@ AZ_POP_DISABLE_WARNING
#include
#include
#include
+#include
// AzQtComponents
#include
@@ -731,32 +732,84 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Restore saved state (Fetch)"));
// Modify actions
- am->AddAction(ID_EDITMODE_MOVE, tr("Move"))
+ am->AddAction(AzToolsFramework::EditModeMove, tr("Move"))
.SetIcon(Style::icon("Move"))
.SetApplyHoverEffect()
.SetShortcut(tr("1"))
.SetToolTip(tr("Move (1)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and move selected object(s)"))
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeMove);
- am->AddAction(ID_EDITMODE_ROTATE, tr("Rotate"))
+ .RegisterUpdateCallback([](QAction* action)
+ {
+ Q_ASSERT(action->isCheckable());
+
+ AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ mode, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
+
+ action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
+ })
+ .Connect(
+ &QAction::triggered,
+ []()
+ {
+ EditorTransformComponentSelectionRequestBus::Event(
+ GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
+ EditorTransformComponentSelectionRequests::Mode::Translation);
+ });
+ am->AddAction(AzToolsFramework::EditModeRotate, tr("Rotate"))
.SetIcon(Style::icon("Translate"))
.SetApplyHoverEffect()
.SetShortcut(tr("2"))
.SetToolTip(tr("Rotate (2)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and rotate selected object(s)"))
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeRotate);
- am->AddAction(ID_EDITMODE_SCALE, tr("Scale"))
+ .RegisterUpdateCallback([](QAction* action)
+ {
+ Q_ASSERT(action->isCheckable());
+
+ AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ mode, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
+
+ action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
+ })
+ .Connect(
+ &QAction::triggered,
+ []()
+ {
+ EditorTransformComponentSelectionRequestBus::Event(
+ GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
+ EditorTransformComponentSelectionRequests::Mode::Rotation);
+ });
+ am->AddAction(AzToolsFramework::EditModeScale, tr("Scale"))
.SetIcon(Style::icon("Scale"))
.SetApplyHoverEffect()
.SetShortcut(tr("3"))
.SetToolTip(tr("Scale (3)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and scale selected object(s)"))
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale);
+ .RegisterUpdateCallback([](QAction* action)
+ {
+ Q_ASSERT(action->isCheckable());
- am->AddAction(ID_SNAP_TO_GRID, tr("Snap to grid"))
+ AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ mode, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
+
+ action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
+ })
+ .Connect( &QAction::triggered,[]()
+ {
+ EditorTransformComponentSelectionRequestBus::Event(
+ GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
+ EditorTransformComponentSelectionRequests::Mode::Scale);
+ });
+
+ am->AddAction(AzToolsFramework::SnapToGrid, tr("Snap to grid"))
.SetIcon(Style::icon("Grid"))
.SetApplyHoverEffect()
.SetShortcut(tr("G"))
@@ -769,7 +822,7 @@ void MainWindow::InitActions()
})
.Connect(&QAction::triggered, []() { SandboxEditor::SetGridSnapping(!SandboxEditor::GridSnappingEnabled()); });
- am->AddAction(ID_SNAPANGLE, tr("Snap angle"))
+ am->AddAction(AzToolsFramework::SnapAngle, tr("Snap angle"))
.SetIcon(Style::icon("Angle"))
.SetApplyHoverEffect()
.SetStatusTip(tr("Snap angle"))
diff --git a/Code/Editor/MainWindow.h b/Code/Editor/MainWindow.h
index e70355827c..1e375b08f2 100644
--- a/Code/Editor/MainWindow.h
+++ b/Code/Editor/MainWindow.h
@@ -59,11 +59,17 @@ namespace AzQtComponents
namespace AzToolsFramework
{
class Ticker;
-}
-
-namespace AzToolsFramework
-{
class QtSourceControlNotificationHandler;
+
+ //! @name Reverse URLs.
+ //! Used to identify common actions and override them when necessary.
+ //@{
+ constexpr inline AZ::Crc32 EditModeMove = AZ_CRC_CE("com.o3de.action.editor.editmode.move");
+ constexpr inline AZ::Crc32 EditModeRotate = AZ_CRC_CE("com.o3de.action.editor.editmode.rotate");
+ constexpr inline AZ::Crc32 EditModeScale = AZ_CRC_CE("com.o3de.action.editor.editmode.scale");
+ constexpr inline AZ::Crc32 SnapToGrid = AZ_CRC_CE("com.o3de.action.editor.snaptogrid");
+ constexpr inline AZ::Crc32 SnapAngle = AZ_CRC_CE("com.o3de.action.editor.snapangle");
+ //@}
}
#define MAINFRM_LAYOUT_NORMAL "NormalLayout"
diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl
index 1791c22443..a602d8eca9 100644
--- a/Code/Editor/Objects/DisplayContextShared.inl
+++ b/Code/Editor/Objects/DisplayContextShared.inl
@@ -74,12 +74,12 @@ void DisplayContext::DrawTri(const Vec3& p1, const Vec3& p2, const Vec3& p3)
void DisplayContext::DrawTriangles(const AZStd::vector& vertices, const ColorB& color)
{
- pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), color);
+ pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast(vertices.size()), color);
}
void DisplayContext::DrawTrianglesIndexed(const AZStd::vector& vertices, const AZStd::vector& indices, const ColorB& color)
{
- pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), indices.begin(), indices.size(), color);
+ pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast(vertices.size()), indices.begin(), static_cast(indices.size()), color);
}
//////////////////////////////////////////////////////////////////////////
@@ -862,7 +862,7 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawLines(const AZStd::vector& points, const ColorF& color)
{
- pRenderAuxGeom->DrawLines(points.begin(), points.size(), color, m_thickness);
+ pRenderAuxGeom->DrawLines(points.begin(), static_cast(points.size()), color, m_thickness);
}
//////////////////////////////////////////////////////////////////////////
@@ -1287,8 +1287,8 @@ void DisplayContext::Flush2D()
uvs[3] = 0;
uvt[3] = 0;
- int nLabels = m_textureLabels.size();
- for (int i = 0; i < nLabels; i++)
+ const size_t nLabels = m_textureLabels.size();
+ for (size_t i = 0; i < nLabels; i++)
{
STextureLabel& t = m_textureLabels[i];
float w2 = t.w * 0.5f;
diff --git a/Code/Editor/Objects/EntityObject.h b/Code/Editor/Objects/EntityObject.h
index 76bd71a1f1..34d3342ad4 100644
--- a/Code/Editor/Objects/EntityObject.h
+++ b/Code/Editor/Objects/EntityObject.h
@@ -163,7 +163,7 @@ public:
//////////////////////////////////////////////////////////////////////////
//! Return number of event targets of Script.
- int GetEventTargetCount() const { return m_eventTargets.size(); };
+ int GetEventTargetCount() const { return static_cast(m_eventTargets.size()); };
CEntityEventTarget& GetEventTarget(int index) { return m_eventTargets[index]; };
//! Add new event target, returns index of created event target.
//! Event targets are Always entities.
@@ -176,7 +176,7 @@ public:
// Entity Links.
//////////////////////////////////////////////////////////////////////////
//! Return number of event targets of Script.
- int GetEntityLinkCount() const { return m_links.size(); };
+ int GetEntityLinkCount() const { return static_cast(m_links.size()); };
CEntityLink& GetEntityLink(int index) { return m_links[index]; };
virtual int AddEntityLink(const QString& name, GUID targetEntityId);
virtual bool EntityLinkExists(const QString& name, GUID targetEntityId);
diff --git a/Code/Editor/Objects/ObjectLoader.h b/Code/Editor/Objects/ObjectLoader.h
index 350ffa10a9..ccfaeb78f0 100644
--- a/Code/Editor/Objects/ObjectLoader.h
+++ b/Code/Editor/Objects/ObjectLoader.h
@@ -70,7 +70,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = NULL);
//////////////////////////////////////////////////////////////////////////
- int GetLoadedObjectsCount() { return m_loadedObjects.size(); }
+ int GetLoadedObjectsCount() { return static_cast(m_loadedObjects.size()); }
CBaseObject* GetLoadedObject(int nIndex) const { return m_loadedObjects[nIndex].pObject; }
//! If true new loaded objects will be assigned new GUIDs.
diff --git a/Code/Editor/Objects/ObjectManager.h b/Code/Editor/Objects/ObjectManager.h
index f59f6c43b8..aa9faab0e4 100644
--- a/Code/Editor/Objects/ObjectManager.h
+++ b/Code/Editor/Objects/ObjectManager.h
@@ -58,7 +58,7 @@ public:
class CBaseObjectsCache
{
public:
- int GetObjectCount() const { return m_objects.size(); }
+ int GetObjectCount() const { return static_cast(m_objects.size()); }
CBaseObject* GetObject(int nIndex) const { return m_objects[nIndex]; }
void AddObject(CBaseObject* object);
diff --git a/Code/Editor/Objects/SelectionGroup.h b/Code/Editor/Objects/SelectionGroup.h
index 8f6feb32ad..600bce5f26 100644
--- a/Code/Editor/Objects/SelectionGroup.h
+++ b/Code/Editor/Objects/SelectionGroup.h
@@ -71,7 +71,7 @@ public:
//! And save resulting objects to saveTo selection.
void FilterParents();
//! Get number of child filtered objects.
- int GetFilteredCount() const { return m_filtered.size(); }
+ int GetFilteredCount() const { return static_cast(m_filtered.size()); }
CBaseObject* GetFilteredObject(int i) const { return m_filtered[i]; }
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
index 874868b5bc..ead320367e 100644
--- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
+++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
@@ -803,7 +803,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu)
menu->addSeparator();
- const int selectedLayerCount = layersInSelection.size();
+ const int selectedLayerCount = static_cast(layersInSelection.size());
QString saveTitle = QObject::tr("Save layer");
if(selectedLayerCount > 1)
{
diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp
index 50d111d9b3..02d2174fb8 100644
--- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp
+++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp
@@ -259,7 +259,7 @@ QVariant OutlinerListModel::dataForName(const QModelIndex& index, int role) cons
if (highlightTextIndex >= 0)
{
const QString BACKGROUND_COLOR{ "#707070" };
- label.insert(highlightTextIndex + m_filterString.length(), "");
+ label.insert(static_cast(highlightTextIndex + m_filterString.length()), "");
label.insert(highlightTextIndex, "");
}
} while(highlightTextIndex > 0);
diff --git a/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp b/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp
index f1f742949c..6e9c0a42b0 100644
--- a/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp
+++ b/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp
@@ -53,7 +53,7 @@ namespace PerforceConnection
setEnabled(false);
- int numSettingsToGet = m_retrievedSettings.size();
+ int numSettingsToGet = static_cast(m_retrievedSettings.size());
auto applySettingResultFunction = [this, &numSettingsToGet](AZStd::string setting, const SourceControlSettingInfo& info) -> void
{
diff --git a/Code/Editor/RenderHelpers/AxisHelperShared.inl b/Code/Editor/RenderHelpers/AxisHelperShared.inl
index 9db4c82e84..2ceac98eae 100644
--- a/Code/Editor/RenderHelpers/AxisHelperShared.inl
+++ b/Code/Editor/RenderHelpers/AxisHelperShared.inl
@@ -546,7 +546,7 @@ bool CAxisHelper::HitTestForRotationCircle(const Matrix34& worldTM, IDisplayView
Vec3 vShortestHitPos;
float shortestDist = 3e11f;
- for (int i = 0, iCount(vList.size()); i < iCount; ++i)
+ for (int i = 0, iCount(static_cast(vList.size())); i < iCount; ++i)
{
const Vec3& v0 = vList[i];
const Vec3& v1 = vList[(i + 1) % iCount];
diff --git a/Code/Editor/RenderViewport.cpp b/Code/Editor/RenderViewport.cpp
index d268a57684..47e5106221 100644
--- a/Code/Editor/RenderViewport.cpp
+++ b/Code/Editor/RenderViewport.cpp
@@ -2342,7 +2342,7 @@ bool CRenderViewport::AddCameraMenuItems(QMenu* menu)
AZ::EBusAggregateResults getCameraResults;
Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras);
- const int numCameras = getCameraResults.values.size();
+ const int numCameras = static_cast(getCameraResults.values.size());
// only enable if we're editing a sequence in Track View and have cameras in the level
bool enableSequenceCameraMenu = (GetIEditor()->GetAnimation()->GetSequence() && numCameras);
@@ -2354,7 +2354,7 @@ bool CRenderViewport::AddCameraMenuItems(QMenu* menu)
connect(action, &QAction::triggered, this, &CRenderViewport::SetSequenceCamera);
QVector additionalCameras;
- additionalCameras.reserve(getCameraResults.values.size());
+ additionalCameras.reserve(static_cast(getCameraResults.values.size()));
for (const AZ::EntityId& entityId : getCameraResults.values)
{
@@ -2930,7 +2930,7 @@ void CRenderViewport::RenderSelectedRegion()
// Draw volume
dc.DepthWriteOff();
dc.CullOff();
- dc.pRenderAuxGeom->DrawTriangles(&verts[0], verts.size(), &inds[0], numInds, &colors[0]);
+ dc.pRenderAuxGeom->DrawTriangles(&verts[0], static_cast(verts.size()), &inds[0], numInds, &colors[0]);
dc.CullOn();
dc.DepthWriteOn();
}
diff --git a/Code/Editor/RenderViewport.h b/Code/Editor/RenderViewport.h
index c66d56176e..d63f319276 100644
--- a/Code/Editor/RenderViewport.h
+++ b/Code/Editor/RenderViewport.h
@@ -275,19 +275,19 @@ public:
m_relCameraRotX = 0;
m_relCameraRotZ = 0;
- uint32 numSample6 = m_arrAnimatedCharacterPath.size();
+ uint32 numSample6 = static_cast(m_arrAnimatedCharacterPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
}
- numSample6 = m_arrSmoothEntityPath.size();
+ numSample6 = static_cast(m_arrSmoothEntityPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrSmoothEntityPath[i] = Vec3(ZERO);
}
- uint32 numSample7 = m_arrRunStrafeSmoothing.size();
+ uint32 numSample7 = static_cast(m_arrRunStrafeSmoothing.size());
for (uint32 i = 0; i < numSample7; i++)
{
m_arrRunStrafeSmoothing[i] = 0;
diff --git a/Code/Editor/Resource.h b/Code/Editor/Resource.h
index a6f714afa4..b3640fac70 100644
--- a/Code/Editor/Resource.h
+++ b/Code/Editor/Resource.h
@@ -82,7 +82,6 @@
#define ID_TOOLS_CUSTOMIZEKEYBOARD 32914
#define ID_EXPORT_INDOORS 32915
#define ID_VIEW_CYCLE2DVIEWPORT 32916
-#define ID_SNAPANGLE 32917
#define ID_PHYSICS_GETPHYSICSSTATE 32937
#define ID_PHYSICS_RESETPHYSICSSTATE 32938
#define ID_GAME_SYNCPLAYER 32941
@@ -108,9 +107,6 @@
#define ID_MOVE_OBJECT 33481
#define ID_RENAME_OBJ 33483
#define ID_FETCH 33496
-#define ID_EDITMODE_ROTATE 33506
-#define ID_EDITMODE_SCALE 33507
-#define ID_EDITMODE_MOVE 33508
#define ID_SELECTION_DELETE 33512
#define ID_EDIT_ESCAPE 33513
#define ID_UNDO 33524
@@ -137,7 +133,6 @@
#define ID_ADDNODE 33570
#define ID_ADDSCENETRACK 33573
#define ID_FIND 33574
-#define ID_SNAP_TO_GRID 33575
#define ID_TAG_LOC1 33576
#define ID_TAG_LOC2 33577
#define ID_TAG_LOC3 33578
diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp
index ae4fa75d41..50b1e77150 100644
--- a/Code/Editor/Settings.cpp
+++ b/Code/Editor/Settings.cpp
@@ -189,6 +189,7 @@ SEditorSettings::SEditorSettings()
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
bShowTimeInConsole = false;
+ clearConsoleOnGameModeStart = false;
enableSceneInspector = false;
@@ -527,6 +528,8 @@ void SEditorSettings::Save()
SaveValue("Settings", "ConsoleBackgroundColorThemeV2", (int)consoleBackgroundColorTheme);
+ SaveValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart);
+
SaveValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
SaveValue("Settings", "EnableSceneInspector", enableSceneInspector);
@@ -729,6 +732,8 @@ void SEditorSettings::Load()
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
}
+ LoadValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart);
+
LoadValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
LoadValue("Settings", "EnableSceneInspector", enableSceneInspector);
@@ -1067,7 +1072,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st
AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::GetValue(const AZStd::string_view path)
{
- if (path.find("|") < 0)
+ if (path.find("|") == AZStd::string_view::npos)
{
return { AZStd::string("Invalid Path - could not find separator \"|\"") };
}
@@ -1085,7 +1090,7 @@ AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::Get
AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::SetValue(const AZStd::string_view path, const AZStd::any& value)
{
- if (path.find("|") < 0)
+ if (path.find("|") == AZStd::string_view::npos)
{
return { AZStd::string("Invalid Path - could not find separator \"|\"") };
}
diff --git a/Code/Editor/Settings.h b/Code/Editor/Settings.h
index 979820e5e6..39a4093915 100644
--- a/Code/Editor/Settings.h
+++ b/Code/Editor/Settings.h
@@ -380,6 +380,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
//! Source Control Enabling.
bool enableSourceControl;
+ bool clearConsoleOnGameModeStart;
//! Text editor.
QString textEditorForScript;
diff --git a/Code/Editor/TrackView/TrackViewAnimNode.h b/Code/Editor/TrackView/TrackViewAnimNode.h
index 475307ffa9..466e60bcf0 100644
--- a/Code/Editor/TrackView/TrackViewAnimNode.h
+++ b/Code/Editor/TrackView/TrackViewAnimNode.h
@@ -27,7 +27,7 @@ class QWidget;
class CTrackViewAnimNodeBundle
{
public:
- unsigned int GetCount() const { return m_animNodes.size(); }
+ unsigned int GetCount() const { return static_cast(m_animNodes.size()); }
CTrackViewAnimNode* GetNode(const unsigned int index) { return m_animNodes[index]; }
const CTrackViewAnimNode* GetNode(const unsigned int index) const { return m_animNodes[index]; }
diff --git a/Code/Editor/TrackView/TrackViewNode.h b/Code/Editor/TrackView/TrackViewNode.h
index 600a66877f..2c289049e9 100644
--- a/Code/Editor/TrackView/TrackViewNode.h
+++ b/Code/Editor/TrackView/TrackViewNode.h
@@ -123,7 +123,7 @@ public:
virtual bool AreAllKeysOfSameType() const override { return m_bAllOfSameType; }
- virtual unsigned int GetKeyCount() const override { return m_keys.size(); }
+ virtual unsigned int GetKeyCount() const override { return static_cast(m_keys.size()); }
virtual CTrackViewKeyHandle GetKey(unsigned int index) override { return m_keys[index]; }
virtual void SelectKeys(const bool bSelected) override;
@@ -174,7 +174,7 @@ public:
CTrackViewNode* GetParentNode() const { return m_pParentNode; }
// Children
- unsigned int GetChildCount() const { return m_childNodes.size(); }
+ unsigned int GetChildCount() const { return static_cast(m_childNodes.size()); }
CTrackViewNode* GetChild(unsigned int index) const { return m_childNodes[index].get(); }
// Snap time value to prev/next key in sequence
diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.h b/Code/Editor/TrackView/TrackViewSequenceManager.h
index b181cf54b1..21c10f009a 100644
--- a/Code/Editor/TrackView/TrackViewSequenceManager.h
+++ b/Code/Editor/TrackView/TrackViewSequenceManager.h
@@ -29,7 +29,7 @@ public:
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
- unsigned int GetCount() const { return m_sequences.size(); }
+ unsigned int GetCount() const { return static_cast(m_sequences.size()); }
void CreateSequence(QString name, SequenceType sequenceType);
void DeleteSequence(CTrackViewSequence* pSequence);
diff --git a/Code/Editor/TrackView/TrackViewTrack.h b/Code/Editor/TrackView/TrackViewTrack.h
index 0c1f13274c..bbe81f6377 100644
--- a/Code/Editor/TrackView/TrackViewTrack.h
+++ b/Code/Editor/TrackView/TrackViewTrack.h
@@ -27,7 +27,7 @@ public:
: m_bAllOfSameType(true)
, m_bHasRotationTrack(false) {}
- unsigned int GetCount() const { return m_tracks.size(); }
+ unsigned int GetCount() const { return static_cast(m_tracks.size()); }
CTrackViewTrack* GetTrack(const unsigned int index) { return m_tracks[index]; }
const CTrackViewTrack* GetTrack(const unsigned int index) const { return m_tracks[index]; }
diff --git a/Code/Editor/Undo/Undo.h b/Code/Editor/Undo/Undo.h
index 3f943f7a82..594d3b3f3d 100644
--- a/Code/Editor/Undo/Undo.h
+++ b/Code/Editor/Undo/Undo.h
@@ -61,12 +61,12 @@ public:
// Confetti: Get the size of m_undoObjects
virtual int GetCount() const
{
- return m_undoObjects.size();
+ return static_cast(m_undoObjects.size());
}
virtual bool IsEmpty() const { return m_undoObjects.empty(); };
virtual void Undo(bool bUndo)
{
- for (int i = m_undoObjects.size() - 1; i >= 0; i--)
+ for (int i = static_cast(m_undoObjects.size() - 1); i >= 0; i--)
{
m_undoObjects[i]->Undo(bUndo);
}
diff --git a/Code/Editor/ViewManager.h b/Code/Editor/ViewManager.h
index 22f9f6804f..434c38df2f 100644
--- a/Code/Editor/ViewManager.h
+++ b/Code/Editor/ViewManager.h
@@ -86,7 +86,7 @@ public:
//////////////////////////////////////////////////////////////////////////
//! Get number of currently existing viewports.
- virtual int GetViewCount() { return m_viewports.size(); };
+ virtual int GetViewCount() { return static_cast(m_viewports.size()); };
//! Get viewport by index.
//! @param index 0 <= index < GetViewportCount()
virtual CViewport* GetView(int index) { return m_viewports[index]; }
diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp
index 4d27506929..c1e1afb908 100644
--- a/Code/Editor/ViewportTitleDlg.cpp
+++ b/Code/Editor/ViewportTitleDlg.cpp
@@ -953,13 +953,13 @@ void CViewportTitleDlg::CheckForCameraSpeedUpdate()
void CViewportTitleDlg::OnGridSnappingToggled()
{
m_gridSizeActionWidget->setEnabled(m_enableGridSnappingAction->isChecked());
- MainWindow::instance()->GetActionManager()->GetAction(ID_SNAP_TO_GRID)->trigger();
+ MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->trigger();
}
void CViewportTitleDlg::OnAngleSnappingToggled()
{
m_angleSizeActionWidget->setEnabled(m_enableAngleSnappingAction->isChecked());
- MainWindow::instance()->GetActionManager()->GetAction(ID_SNAPANGLE)->trigger();
+ MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->trigger();
}
void CViewportTitleDlg::OnGridSpinBoxChanged(double value)
@@ -974,14 +974,14 @@ void CViewportTitleDlg::OnAngleSpinBoxChanged(double value)
void CViewportTitleDlg::UpdateOverFlowMenuState()
{
- bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(ID_SNAP_TO_GRID)->isChecked();
+ bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->isChecked();
{
QSignalBlocker signalBlocker(m_enableGridSnappingAction);
m_enableGridSnappingAction->setChecked(gridSnappingActive);
}
m_gridSizeActionWidget->setEnabled(gridSnappingActive);
- bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(ID_SNAPANGLE)->isChecked();
+ bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->isChecked();
{
QSignalBlocker signalBlocker(m_enableAngleSnappingAction);
m_enableAngleSnappingAction->setChecked(angleSnappingActive);
diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp
index 6e46b930b6..f358370be5 100644
--- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp
+++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp
@@ -47,7 +47,7 @@ namespace AZ
}
auto stackEntry = AZStd::make_shared(
- cacheSize, blockSize, aznumeric_caster(hardware.m_maxPhysicalSectorSize), false);
+ cacheSize, aznumeric_cast(blockSize), aznumeric_cast(hardware.m_maxPhysicalSectorSize), false);
stackEntry->SetNext(AZStd::move(parent));
return stackEntry;
}
diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp
index 5b67c8c255..6ec3fb295c 100644
--- a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp
+++ b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp
@@ -45,7 +45,7 @@ namespace AZ
}
auto stackEntry = AZStd::make_shared(
- cacheSize, blockSize, aznumeric_caster(hardware.m_maxPhysicalSectorSize), m_writeOnlyEpilog);
+ cacheSize, aznumeric_cast(blockSize), aznumeric_cast(hardware.m_maxPhysicalSectorSize), m_writeOnlyEpilog);
stackEntry->SetNext(AZStd::move(parent));
return stackEntry;
}
diff --git a/Code/Framework/AzCore/AzCore/Math/Aabb.h b/Code/Framework/AzCore/AzCore/Math/Aabb.h
index 8d8ded7b2d..488808bc4c 100644
--- a/Code/Framework/AzCore/AzCore/Math/Aabb.h
+++ b/Code/Framework/AzCore/AzCore/Math/Aabb.h
@@ -43,7 +43,7 @@ namespace AZ
static Aabb CreateCenterRadius(const Vector3& center, float radius);
//! Creates an AABB which contains the specified points.
- static Aabb CreatePoints(const Vector3* pts, int numPts);
+ static Aabb CreatePoints(const Vector3* pts, size_t numPts);
//! Creates an AABB which contains the specified OBB.
static Aabb CreateFromObb(const Obb& obb);
diff --git a/Code/Framework/AzCore/AzCore/Math/Aabb.inl b/Code/Framework/AzCore/AzCore/Math/Aabb.inl
index 5806857bb1..3ce7b99792 100644
--- a/Code/Framework/AzCore/AzCore/Math/Aabb.inl
+++ b/Code/Framework/AzCore/AzCore/Math/Aabb.inl
@@ -60,10 +60,10 @@ namespace AZ
}
- AZ_MATH_INLINE Aabb Aabb::CreatePoints(const Vector3* pts, int numPts)
+ AZ_MATH_INLINE Aabb Aabb::CreatePoints(const Vector3* pts, size_t numPts)
{
Aabb aabb = Aabb::CreateFromPoint(pts[0]);
- for (int i = 1; i < numPts; ++i)
+ for (size_t i = 1; i < numPts; ++i)
{
aabb.AddPoint(pts[i]);
}
diff --git a/Code/Framework/AzCore/AzCore/Module/Environment.cpp b/Code/Framework/AzCore/AzCore/Module/Environment.cpp
index f3a3533f4a..bec530e2d1 100644
--- a/Code/Framework/AzCore/AzCore/Module/Environment.cpp
+++ b/Code/Framework/AzCore/AzCore/Module/Environment.cpp
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
namespace AZ
{
@@ -75,6 +76,42 @@ namespace AZ
bool operator==(const OSStdAllocator& a, const OSStdAllocator& b) { (void)a; (void)b; return true; }
bool operator!=(const OSStdAllocator& a, const OSStdAllocator& b) { (void)a; (void)b; return false; }
+ void EnvironmentVariableHolderBase::UnregisterAndDestroy(DestructFunc destruct, bool moduleRelease)
+ {
+ const bool releaseByUseCount = (--m_useCount == 0);
+ // We take over the lock, and release it before potentially destroying/freeing ourselves
+ {
+ AZStd::scoped_lock envLockHolder(AZStd::adopt_lock, m_mutex);
+ const bool releaseByModule = (moduleRelease && !m_canTransferOwnership && m_moduleOwner == AZ::Environment::GetModuleId());
+
+ if (!releaseByModule && !releaseByUseCount)
+ {
+ return;
+ }
+ // if the environment that created us is gone the owner can be null
+ // which means (assuming intermodule allocator) that the variable is still alive
+ // but can't be found as it's not part of any environment.
+ if (m_environmentOwner)
+ {
+ m_environmentOwner->RemoveVariable(m_guid);
+ m_environmentOwner = nullptr;
+ }
+ if (m_isConstructed)
+ {
+ destruct(this, DestroyTarget::Member); // destruct the value
+ }
+ }
+ // m_mutex is no longer held here, envLockHolder has released it above.
+ if (releaseByUseCount)
+ {
+ // m_mutex is unlocked before this is deleted
+ Environment::AllocatorInterface* allocator = m_allocator;
+ // Call child class dtor and clear the memory
+ destruct(this, DestroyTarget::Self);
+ allocator->DeAllocate(this);
+ }
+ }
+
// instance of the environment
EnvironmentInterface* EnvironmentInterface::s_environment = nullptr;
@@ -110,7 +147,7 @@ namespace AZ
#ifdef AZ_ENVIRONMENT_VALIDATE_ON_EXIT
AZ_Assert(m_numAttached == 0, "We should not delete an environment while there are %d modules attached! Unload all DLLs first!", m_numAttached);
#endif
-
+
for (auto variableIt : m_variableMap)
{
EnvironmentVariableHolderBase* holder = reinterpret_cast(variableIt.second);
diff --git a/Code/Framework/AzCore/AzCore/Module/Environment.h b/Code/Framework/AzCore/AzCore/Module/Environment.h
index b0711b1bbe..e87ff81446 100644
--- a/Code/Framework/AzCore/AzCore/Module/Environment.h
+++ b/Code/Framework/AzCore/AzCore/Module/Environment.h
@@ -200,6 +200,11 @@ namespace AZ
class EnvironmentVariableHolderBase
{
friend class EnvironmentImpl;
+ protected:
+ enum class DestroyTarget {
+ Member,
+ Self
+ };
public:
EnvironmentVariableHolderBase(u32 guid, AZ::Internal::EnvironmentInterface* environmentOwner, bool canOwnershipTransfer, Environment::AllocatorInterface* allocator)
: m_environmentOwner(environmentOwner)
@@ -217,12 +222,21 @@ namespace AZ
return m_isConstructed;
}
+ bool IsOwner() const
+ {
+ return m_moduleOwner == Environment::GetModuleId();
+ }
+
u32 GetId() const
{
return m_guid;
}
-
protected:
+ using DestructFunc = void (*)(EnvironmentVariableHolderBase *, DestroyTarget);
+ // Assumes the m_mutex is already locked.
+ // On return m_mutex is in an unlocked state.
+ void UnregisterAndDestroy(DestructFunc destruct, bool moduleRelease);
+
AZ::Internal::EnvironmentInterface* m_environmentOwner; ///< Used to know which environment we should use to free the variable if we can't transfer ownership
void* m_moduleOwner; ///< Used when the variable can't transfered across module and we need to destruct the variable when the module is going away
bool m_canTransferOwnership; ///< True if variable can be allocated in one module and freed in other. Usually true for POD types when they share allocator.
@@ -242,41 +256,29 @@ namespace AZ
memset(&m_value, 0, sizeof(T));
}
- template
+ template
void ConstructImpl(const AZStd::false_type& /* AZStd::has_trivial_constructor */, Args&&... args)
{
// Construction of non-trivial types is left up to the type's constructor.
new(&m_value) T(AZStd::forward(args)...);
}
-
- void DestructImpl(const AZStd::true_type& /* AZStd::is_trivially_destructible */)
+ static void DestructDispatchNoLock(EnvironmentVariableHolderBase *base, DestroyTarget selfDestruct)
{
- // do nothing
- }
-
- void DestructImpl(const AZStd::false_type& /* AZStd::is_trivially_destructible */)
- {
- reinterpret_cast(&m_value)->~T();
- }
-
- // Assumes the lock is already held
- void UnregisterAndDestruct()
- {
- // if the environment that created us is gone the owner can be null
- // which means (assuming intermodule allocator) that the variable is still alive
- // but can't be found as it's not part of any environment.
- if (m_environmentOwner)
+ auto *self = reinterpret_cast(base);
+ if (selfDestruct == DestroyTarget::Self)
{
- m_environmentOwner->RemoveVariable(m_guid);
- m_environmentOwner = nullptr;
+ self->~EnvironmentVariableHolder();
+ return;
}
- if (m_isConstructed)
+ AZ_Assert(self->m_isConstructed, "Variable is not constructed. Please check your logic and guard if needed!");
+ self->m_isConstructed = false;
+ self->m_moduleOwner = nullptr;
+ if constexpr(!AZStd::is_trivially_destructible_v)
{
- DestructNoLock();
+ reinterpret_cast(&self->m_value)->~T();
}
}
-
public:
EnvironmentVariableHolder(u32 guid, bool isOwnershipTransfer, Environment::AllocatorInterface* allocator)
: EnvironmentVariableHolderBase(guid, Environment::GetInstance(), isOwnershipTransfer, allocator)
@@ -287,12 +289,6 @@ namespace AZ
{
AZ_Assert(!m_isConstructed, "To get the destructor we should have already destructed the variable!");
}
-
- bool IsOwner() const
- {
- return m_moduleOwner == Environment::GetModuleId();
- }
-
void AddRef()
{
AZStd::lock_guard lock(m_mutex);
@@ -303,30 +299,8 @@ namespace AZ
void Release()
{
m_mutex.lock();
-
- if (--s_moduleUseCount == 0)
- {
- if (!m_canTransferOwnership && m_moduleOwner == AZ::Environment::GetModuleId())
- {
- UnregisterAndDestruct();
- }
- }
-
- if (--m_useCount == 0)
- {
- UnregisterAndDestruct();
-
- // unlock before this is deleted
- m_mutex.unlock();
-
- Environment::AllocatorInterface* allocator = m_allocator;
- // Call dtor and clear the memory
- this->~EnvironmentVariableHolder();
- allocator->DeAllocate(this);
- return;
- }
-
- m_mutex.unlock();
+ const bool moduleRelease = (--s_moduleUseCount == 0);
+ UnregisterAndDestroy(DestructDispatchNoLock, moduleRelease);
}
void Construct()
@@ -352,18 +326,10 @@ namespace AZ
}
}
- void DestructNoLock()
- {
- AZ_Assert(m_isConstructed, "Variable is not constructed. Please check your logic and guard if needed!");
- m_isConstructed = false;
- m_moduleOwner = nullptr;
- DestructImpl(typename AZStd::is_trivially_destructible::type());
- }
-
void Destruct()
{
AZStd::lock_guard lock(m_mutex);
- DestructNoLock();
+ DestructDispatchNoLock(this, DestroyTarget::Member);
}
// variable storage
diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp
index c6fe112c6f..1c472ef901 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/Json/ByteStreamSerializer.cpp
@@ -71,7 +71,7 @@ namespace AZ
if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast(defaultValue)))
{
const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size());
- outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator());
+ outputValue.SetString(base64ByteStream.c_str(), static_cast(base64ByteStream.size()), context.GetJsonAllocator());
return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored.");
}
diff --git a/Code/Framework/AzCore/AzCore/std/chrono/types.h b/Code/Framework/AzCore/AzCore/std/chrono/types.h
index c86c684426..19ef2c8469 100644
--- a/Code/Framework/AzCore/AzCore/std/chrono/types.h
+++ b/Code/Framework/AzCore/AzCore/std/chrono/types.h
@@ -211,7 +211,7 @@ namespace AZStd
// 20.9.3.2, observer:
constexpr rep count() const { return m_rep; }
// 20.9.3.3, arithmetic:
- constexpr duration operator+() const { *this; }
+ constexpr duration operator+() const { return *this; }
constexpr duration operator-() const { return duration(-m_rep); }
constexpr duration& operator++() { ++m_rep; return *this; }
constexpr duration operator++(int) { return duration(m_rep++); }
diff --git a/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h b/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h
index 746af8974e..31fbdd85e9 100644
--- a/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h
+++ b/Code/Framework/AzCore/AzCore/std/containers/ring_buffer.h
@@ -1056,7 +1056,7 @@ namespace AZStd
inline void insert(const iterator& pos, ForwardIterator first, ForwardIterator last, const AZStd::forward_iterator_tag&)
{
size_type size = AZStd::distance(first, last);
- AZSTD_CONTAINER_ASSERT(size >= 0, "AZStd::ring_buffer::insert - there are no elements to insert!");
+ AZSTD_CONTAINER_ASSERT(first > last, "AZStd::ring_buffer::insert - there are no elements to insert!");
if (size == 0)
{
return;
diff --git a/Code/Framework/AzCore/AzCore/std/hash.cpp b/Code/Framework/AzCore/AzCore/std/hash.cpp
index c2f7a104d4..b5277de2f4 100644
--- a/Code/Framework/AzCore/AzCore/std/hash.cpp
+++ b/Code/Framework/AzCore/AzCore/std/hash.cpp
@@ -21,6 +21,7 @@ namespace AZStd
1610612741ul, 3221225473ul, 4294967291ul
};
+ // Bucket size suitable to hold n elements.
AZStd::size_t hash_next_bucket_size(AZStd::size_t n)
{
const AZStd::size_t* first = prime_list;
diff --git a/Code/Framework/AzCore/AzCore/std/hash_table.h b/Code/Framework/AzCore/AzCore/std/hash_table.h
index 5b76b6cb82..c364720b3b 100644
--- a/Code/Framework/AzCore/AzCore/std/hash_table.h
+++ b/Code/Framework/AzCore/AzCore/std/hash_table.h
@@ -134,6 +134,7 @@ namespace AZStd
void rehash(HashTable* table, size_type numBucketsMin)
{
size_type num_buckets = 0;
+
numBucketsMin = (AZStd::max)(numBucketsMin, (size_type)ceilf((float)m_list.size() / m_max_load_factor));
if (numBucketsMin != 0)
@@ -143,7 +144,7 @@ namespace AZStd
if (num_buckets == m_numBuckets)
{
- return; // no point
+ return; // no need yet to rehash
}
m_numBuckets = num_buckets;
@@ -165,32 +166,43 @@ namespace AZStd
while (!m_list.empty())
{
cur = m_list.begin();
+ typename list_type::iterator insertIter, curEnd(cur);
+ const typename HashTable::key_type& valueKey = Traits::key_from_value(*cur);
- typename list_type::iterator newIter, iter(cur);
size_type numValues = 1;
- for (++iter; iter != last && table->m_keyEqual(Traits::key_from_value(*cur), Traits::key_from_value(*iter)); ++iter, ++numValues)
+ // Get the number of same consecutive elements in the table with same key,
+ // this allows range insertion of elements at once
+ for (++curEnd; curEnd != last && table->m_keyEqual(valueKey, Traits::key_from_value(*curEnd)); ++curEnd, ++numValues)
{
}
- ;
- const typename HashTable::key_type& valueKey = Traits::key_from_value(*cur);
size_type newBucketIndex = table->bucket_from_hash(table->m_hasher(valueKey));
+
+ // newBucket.first holds the total number of elements in the bucket
+ // newBucket.second contains the pointer to the first element in the bucket
vector_value_type& newBucket = newBuckets[newBucketIndex];
size_type numElements = newBucket.first;
- newIter = newBucket.second;
+ insertIter = newBucket.second;
+
+ // If we don't have elements in the bucket yet, transfer the elements directly
if (numElements == 0)
{
- newList.splice(newList.begin(), m_list, cur, iter);
+ newList.splice(newList.begin(), m_list, cur, curEnd);
newBucket.second = newList.begin();
}
else
{
- if (!table->find_insert_position(valueKey, table->m_keyEqual, newIter, numElements, integral_constant()))
+ // Since there are elements already in the bucket, update `insertIter` to where the elements will need to be inserted.
+ if (!table->find_insert_position(valueKey, table->m_keyEqual, insertIter, numElements, integral_constant()))
{
- continue;
+ // An element was found but we don't allow for duplicate elements in this table.
+ // This happens when there was an insertion of two elements that are equal but have different hashes,
+ // which is undefined behavior for a hash table: ISO C++ N4713, section 23.14.15 - 5.3
+ AZ_Assert(false, "Found a duplicate element when rehashing. "
+ "Review the hashing function for this type and make sure two equal elements always have the same hash");
}
- newList.splice(newIter, m_list, cur, iter);
+ newList.splice(insertIter, m_list, cur, curEnd);
}
newBucket.first += numValues;
@@ -251,15 +263,15 @@ namespace AZStd
m_vector.set_allocator(typename vector_type::allocator_type(&m_allocator));
}
- allocator_type m_allocator; ///< The single instance of the allocator shared between list and vector containers.
- list_type m_list; ///< List with elements.
- vector_type m_vector; ///< Buckets with list iterators.
+ allocator_type m_allocator; //!< The single instance of the allocator shared between list and vector containers.
+ list_type m_list; //!< List with elements.
+ vector_type m_vector; //!< Buckets with list iterators.
private:
- vector_value_type* m_buckets; ///< Current buckets array. (can point to the m_vector or m_startBucket).
- size_type m_numBuckets; ///< Current number of buckets.
- float m_max_load_factor;
- vector_value_type m_startBucket; ///< Start bucket used for before we start dynamically allocate memory from m_vector.
+ vector_value_type* m_buckets; //!< Current buckets array. (can point to the m_vector or m_startBucket).
+ size_type m_numBuckets; //!< Current number of buckets.
+ float m_max_load_factor; //!< Maximum load (elements/buckets) before rehashing.
+ vector_value_type m_startBucket; //!< Start bucket used for before we start dynamically allocate memory from m_vector.
};
/**
@@ -321,8 +333,8 @@ namespace AZStd
template
AZ_FORCE_INLINE void rehash(HashTable*, size_type) {}
- vector_type m_vector; ///< Buckets with list iterators.
- list_type m_list; ///< List with elements.
+ vector_type m_vector; //!< Buckets with list iterators.
+ list_type m_list; //!< List with elements.
};
}
@@ -972,28 +984,32 @@ namespace AZStd
rhs.clear();
}
+ // find_insert_position sets insertIter to where the element should be inserted
+ // and returns true if the element should be inserted, otherwise false
template
- bool find_insert_position(const ComparableToKey& keyCmp, const KeyEq& keyEq, iterator& iter, size_type numElements, const true_type& /* is multi elements */)
+ bool find_insert_position(const ComparableToKey& keyCmp, const KeyEq& keyEq, iterator& insertIter, size_type numElements, const true_type& /* is multi elements */)
{
- for (size_type i = 0; i < numElements; ++i, ++iter)
+ for (size_type i = 0; i < numElements; ++i, ++insertIter)
{
- if (keyEq(keyCmp, Traits::key_from_value(*iter)))
+ if (keyEq(keyCmp, Traits::key_from_value(*insertIter)))
{
- ++iter;
+ ++insertIter;
break;
}
}
+ // always return true since multi elements (like multiset) allow repeated elements
return true;
}
template
- bool find_insert_position(const ComparableToKey& keyCmp, const KeyEq& keyEq, iterator& iter, size_type numElements, const false_type& /* !is multi elements */)
+ bool find_insert_position(const ComparableToKey& keyCmp, const KeyEq& keyEq, iterator& insertIter, size_type numElements, const false_type& /* !is multi elements */)
{
- for (size_type i = 0; i < numElements; ++i, ++iter)
+ for (size_type i = 0; i < numElements; ++i, ++insertIter)
{
- if (keyEq(keyCmp, Traits::key_from_value(*iter)))
+ if (keyEq(keyCmp, Traits::key_from_value(*insertIter)))
{
+ // Element already exists, it shouldn't be inserted as we don't allow more than one repeated element for this specialization
return false;
}
}
diff --git a/Code/Framework/AzCore/AzCore/std/utils.h b/Code/Framework/AzCore/AzCore/std/utils.h
index 2d098af55e..0de56cedcb 100644
--- a/Code/Framework/AzCore/AzCore/std/utils.h
+++ b/Code/Framework/AzCore/AzCore/std/utils.h
@@ -294,7 +294,7 @@ namespace AZStd
T& m_v;
constexpr addr_impl_ref(T& v)
: m_v(v) {}
- constexpr addr_impl_ref& operator=(const addr_impl_ref& v) { m_v = v; }
+ constexpr addr_impl_ref& operator=(const addr_impl_ref& v) { m_v = v; return *this; }
constexpr operator T& () const { return m_v; }
};
diff --git a/Code/Framework/AzCore/Tests/AZStd/Hashed.cpp b/Code/Framework/AzCore/Tests/AZStd/Hashed.cpp
index f2558289ea..4e4dfc1f89 100644
--- a/Code/Framework/AzCore/Tests/AZStd/Hashed.cpp
+++ b/Code/Framework/AzCore/Tests/AZStd/Hashed.cpp
@@ -287,6 +287,55 @@ namespace UnitTest
}
}
+ TEST_F(HashedContainers, HashTable_InsertionDuplicateOnRehash)
+ {
+ struct TwoPtrs
+ {
+ void* m_ptr1;
+ void* m_ptr2;
+
+ bool operator==(const TwoPtrs& other) const
+ {
+ if (m_ptr1 == other.m_ptr1)
+ {
+ return m_ptr2 == other.m_ptr2;
+ }
+ else if (m_ptr1 == other.m_ptr2)
+ {
+ return m_ptr2 == other.m_ptr1;
+ }
+ return false;
+ }
+ };
+
+ // This hashing function produces different hashes for two equal values,
+ // which violates the requirement for hashing functions.
+ // The test makes sure that this does not reproduce an issue that caused the insert() function to loop infinitely.
+ struct TwoPtrsHasher
+ {
+ size_t operator()(const TwoPtrs& p) const
+ {
+ size_t hash{ 0 };
+ AZStd::hash_combine(hash, p.m_ptr1, p.m_ptr2);
+ return hash;
+ }
+ };
+ using PairSet = AZStd::unordered_set;
+ PairSet set;
+ set.insert({ (void*)1, (void*)2 });
+ set.insert({ (void*)3, (void*)4 });
+ set.insert({ (void*)5, (void*)6 });
+ set.insert({ (void*)7, (void*)8 });
+ // Elements with different hashes, but equal
+ set.insert({ (void*)0x000001ceddd9ca20, (void*)0x000001ceddd9cba0 }); // hash(148335135725641)
+ set.insert({ (void*)0x000001ceddd9cba0, (void*)0x000001ceddd9ca20 }); // hash(148335135764189)
+ AZ_TEST_START_TRACE_SUPPRESSION;
+ // This will trigger the assertion of duplicated elements found
+ // A bucket size of 23 since is where the collision between different hashes happens
+ set.rehash(23);
+ AZ_TEST_STOP_TRACE_SUPPRESSION(1); // 1 assertion
+ }
+
TEST_F(HashedContainers, HashTable_Fixed)
{
array elements = {
diff --git a/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp
index 156719b8a7..e25c3dbcf7 100644
--- a/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp
+++ b/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp
@@ -1150,7 +1150,7 @@ namespace UnitTest
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
TEST_F(AssetJobsFloodTest, DISABLED_ContainerFilterTest_ContainersWithAndWithoutFiltering_Success)
#else
- TEST_F(AssetJobsFloodTest, ContainerFilterTest_ContainersWithAndWithoutFiltering_Success)
+ TEST_F(AssetJobsFloodTest, DISABLED_ContainerFilterTest_ContainersWithAndWithoutFiltering_Success)
#endif // !AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
{
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusConnect();
diff --git a/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp b/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp
index 14ce16163a..f9411a1f8d 100644
--- a/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp
+++ b/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp
@@ -163,7 +163,11 @@ namespace AzFramework
AZ_TracePrintfOnce("AssetSystemComponent", "Failed to find asset platform, setting 'pc'\n");
outputConnectionSettings.m_assetPlatform = "pc";
}
- outputConnectionSettings.m_assetPlatform = assetsPlatform;
+ else
+ {
+ outputConnectionSettings.m_assetPlatform = assetsPlatform;
+ }
+
if (outputConnectionSettings.m_assetPlatform.empty())
{
assetsPlatform = AzFramework::OSPlatformToDefaultAssetPlatform(AZ_TRAIT_OS_PLATFORM_CODENAME);
diff --git a/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp b/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp
index 87353c5807..617eb3a0b9 100644
--- a/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp
+++ b/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableEntitiesInterface.cpp
@@ -227,8 +227,10 @@ namespace AzFramework
EntitySpawnTicket::EntitySpawnTicket(EntitySpawnTicket&& rhs)
: m_payload(rhs.m_payload)
+ , m_id(rhs.m_id)
{
rhs.m_payload = nullptr;
+ rhs.m_id = 0;
}
EntitySpawnTicket::EntitySpawnTicket(AZ::Data::Asset spawnable)
diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp
index 51c256a9b3..8deed820d3 100644
--- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp
+++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp
@@ -269,7 +269,7 @@ namespace AzFramework
int numEnvironmentVars = 0;
if (processLaunchInfo.m_environmentVariables)
{
- const int numEnvironmentVars = processLaunchInfo.m_environmentVariables->size();
+ numEnvironmentVars = processLaunchInfo.m_environmentVariables->size();
// Adding one more as exec expects the array to have a nullptr as the last element
environmentVariables = new char*[numEnvironmentVars + 1];
for (int i = 0; i < numEnvironmentVars; i++)
diff --git a/Code/Framework/AzFramework/Tests/OctreeTests.cpp b/Code/Framework/AzFramework/Tests/OctreeTests.cpp
index 3faf98adfb..f248dbfa66 100644
--- a/Code/Framework/AzFramework/Tests/OctreeTests.cpp
+++ b/Code/Framework/AzFramework/Tests/OctreeTests.cpp
@@ -98,7 +98,7 @@ namespace UnitTest
// If an entry is removed from the octree as an unintended side effect of updating an existing entry,
// GetEntryCount can't be relied upon to report the actual entry count.
// So manually count the entries when using the entry count for validation.
- uint32_t manualEntryCount = 0;
+ size_t manualEntryCount = 0;
visScene->EnumerateNoCull([&manualEntryCount](const AzFramework::IVisibilityScene::NodeData& nodeData) { manualEntryCount += nodeData.m_entries.size(); });
EXPECT_EQ(manualEntryCount, expectedEntryCount);
@@ -409,7 +409,7 @@ namespace UnitTest
}
// Expect all the entries to be in the scene
- ValidateEntryCountEqualsExpectedCount(m_octreeScene, visEntries.size());
+ ValidateEntryCountEqualsExpectedCount(m_octreeScene, static_cast(visEntries.size()));
// Update them, without making any actual changes
for (AzFramework::VisibilityEntry& entry : visEntries)
@@ -418,6 +418,6 @@ namespace UnitTest
}
// Expect all the entries to be in the scene
- ValidateEntryCountEqualsExpectedCount(m_octreeScene, visEntries.size());
+ ValidateEntryCountEqualsExpectedCount(m_octreeScene, static_cast(visEntries.size()));
}
}
diff --git a/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp b/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp
index 7eff4b5eeb..f68af08f4a 100644
--- a/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp
+++ b/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp
@@ -366,6 +366,24 @@ namespace UnitTest
}
}
+ TEST_F(SpawnableEntitiesManagerTest, EntitySpawnTicket_Move_Works)
+ {
+ AzFramework::EntitySpawnTicket ticket1(*m_spawnableAsset);
+ AzFramework::EntitySpawnTicket ticket2(*m_spawnableAsset);
+
+ const AzFramework::EntitySpawnTicket::Id ticket1Id = ticket1.GetId();
+ const AzFramework::EntitySpawnTicket::Id ticket2Id = ticket2.GetId();
+
+ AzFramework::EntitySpawnTicket ticketMoveConstructor(AZStd::move(ticket1));
+ EXPECT_TRUE(ticketMoveConstructor.IsValid());
+ EXPECT_EQ(ticketMoveConstructor.GetId(), ticket1Id);
+
+ AzFramework::EntitySpawnTicket ticketMoveOperator;
+ ticketMoveOperator = AZStd::move(ticket2);
+ EXPECT_TRUE(ticketMoveOperator.IsValid());
+ EXPECT_EQ(ticketMoveOperator.GetId(), ticket2Id);
+ }
+
TEST_F(SpawnableEntitiesManagerTest, SpawnAllEntities_DeleteTicketBeforeCall_NoCrash)
{
{
diff --git a/Code/Framework/AzNetworking/AzNetworking/Framework/INetworkInterface.h b/Code/Framework/AzNetworking/AzNetworking/Framework/INetworkInterface.h
index d47f76ceb8..09aa62f7d7 100644
--- a/Code/Framework/AzNetworking/AzNetworking/Framework/INetworkInterface.h
+++ b/Code/Framework/AzNetworking/AzNetworking/Framework/INetworkInterface.h
@@ -103,6 +103,14 @@ namespace AzNetworking
//! @return boolean true on success
virtual bool Disconnect(ConnectionId connectionId, DisconnectReason reason) = 0;
+ //! Sets whether this connection interface can disconnect by virtue of a timeout
+ //! @param timeoutEnabled If this connection interface will automatically disconnect due to a timeout
+ virtual void SetTimeoutEnabled(bool timeoutEnabled) = 0;
+
+ //! Whether this connection interface will disconnect by virtue of a time out (does not account for cvars affecting all connections)
+ //! @return boolean true if this connection will not disconnect on timeout (does not account for cvars affecting all connections)
+ virtual bool IsTimeoutEnabled() const = 0;
+
//! Const access to the metrics tracked by this network interface.
//! @return const reference to the metrics tracked by this network interface
const NetworkInterfaceMetrics& GetMetrics() const;
diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp
index 1beb83e19f..6d7358a425 100644
--- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpConnection.cpp
@@ -170,7 +170,7 @@ namespace AzNetworking
}
timeoutItem->UpdateTimeoutTime(startTimeMs);
- NetworkOutputSerializer serializer(buffer.GetBuffer(), buffer.GetSize());
+ NetworkOutputSerializer serializer(buffer.GetBuffer(), static_cast(buffer.GetSize()));
if (m_state == ConnectionState::Connecting)
{
const ConnectResult connectResult = m_networkInterface.GetConnectionListener().ValidateConnect(GetRemoteAddress(), header, serializer);
@@ -198,7 +198,7 @@ namespace AzNetworking
{
TcpPacketEncodingBuffer buffer;
{
- NetworkInputSerializer serializer(buffer.GetBuffer(), buffer.GetCapacity());
+ NetworkInputSerializer serializer(buffer.GetBuffer(), static_cast(buffer.GetCapacity()));
if (!const_cast(packet).Serialize(serializer))
{
AZ_Assert(false, "SendReliablePacket: Unable to serialize packet [Type: %d]", packet.GetPacketType());
@@ -272,7 +272,7 @@ namespace AzNetworking
{
TcpPacketHeader header(packetType, aznumeric_cast(payloadBuffer.GetSize()));
header.SetPacketFlag(PacketFlag::Compressed, shouldCompress);
- NetworkInputSerializer serializer(headerBuffer.GetBuffer(), headerBuffer.GetCapacity());
+ NetworkInputSerializer serializer(headerBuffer.GetBuffer(), static_cast(headerBuffer.GetCapacity()));
if (!header.Serialize(serializer))
{
return false;
@@ -313,7 +313,7 @@ namespace AzNetworking
m_networkInterface.GetMetrics().m_sendBytesCompressedDelta += (payloadSize - compressionMemBytesUsed);
writeBuffer.Resize(aznumeric_cast(compressionMemBytesUsed));
- payloadSize = writeBuffer.GetSize();
+ payloadSize = static_cast(writeBuffer.GetSize());
srcData = writeBuffer.GetBuffer();
}
diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.cpp
index f9569b5c7e..62335a9b39 100644
--- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.cpp
@@ -174,6 +174,16 @@ namespace AzNetworking
return connection->Disconnect(reason, TerminationEndpoint::Local);
}
+ void TcpNetworkInterface::SetTimeoutEnabled(bool timeoutEnabled)
+ {
+ m_timeoutEnabled = timeoutEnabled;
+ }
+
+ bool TcpNetworkInterface::IsTimeoutEnabled() const
+ {
+ return m_timeoutEnabled;
+ }
+
void TcpNetworkInterface::QueueNewConnection(const PendingConnection& pendingConnection)
{
m_pendingConnections.PushBackItem(pendingConnection);
@@ -306,7 +316,7 @@ namespace AzNetworking
{
tcpConnection->SendReliablePacket(CorePackets::HeartbeatPacket());
}
- else if (net_TcpTimeoutConnections)
+ else if (net_TcpTimeoutConnections && m_networkInterface.IsTimeoutEnabled())
{
tcpConnection->Disconnect(DisconnectReason::Timeout, TerminationEndpoint::Local);
return TimeoutResult::Delete;
diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.h b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.h
index 1d590da2aa..b9ea88974d 100644
--- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.h
+++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpNetworkInterface.h
@@ -99,6 +99,8 @@ namespace AzNetworking
bool WasPacketAcked(ConnectionId connectionId, PacketId packetId) override;
bool StopListening() override;
bool Disconnect(ConnectionId connectionId, DisconnectReason reason) override;
+ void SetTimeoutEnabled(bool timeoutEnabled) override;
+ bool IsTimeoutEnabled() const override;
//! @}
//! Queues a new incoming connection for this network interface.
@@ -154,6 +156,7 @@ namespace AzNetworking
AZ::Name m_name;
TrustZone m_trustZone;
uint16_t m_port = 0;
+ bool m_timeoutEnabled = true;
IConnectionListener& m_connectionListener;
TcpConnectionSet m_connectionSet;
TcpSocketManager m_tcpSocketManager;
diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl
index 322a4e6abf..9c4b2f1a17 100644
--- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl
+++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpRingBuffer.inl
@@ -12,7 +12,7 @@ namespace AzNetworking
{
template
inline TcpRingBuffer::TcpRingBuffer()
- : m_impl(m_buffer.data(), m_buffer.size())
+ : m_impl(m_buffer.data(), static_cast(m_buffer.size()))
{
;
}
diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp
index 37c952cf30..bd5e62983f 100644
--- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsEndpoint.cpp
@@ -84,7 +84,7 @@ namespace AzNetworking
if (dtlsData.GetSize() > 0)
{
const uint8_t* encryptedData = dtlsData.GetBuffer();
- const uint32_t encryptedSize = dtlsData.GetSize();
+ const uint32_t encryptedSize = static_cast(dtlsData.GetSize());
BIO_write(m_readBio, encryptedData, encryptedSize);
}
DtlsEndpoint::HandshakeState prevState = m_state;
@@ -196,7 +196,7 @@ namespace AzNetworking
// Need to do this... connection negotiation may have left data in the write bio that we need to send out
if (BIO_ctrl_pending(m_writeBio) > 0)
{
- const uint32_t maxBufferSize = outHandshakeData.GetCapacity();
+ const uint32_t maxBufferSize = static_cast(outHandshakeData.GetCapacity());
outHandshakeData.Resize(maxBufferSize);
const int32_t dataSize = BIO_read(m_writeBio, outHandshakeData.GetBuffer(), maxBufferSize);
outHandshakeData.Resize(dataSize);
diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp
index 831c35552c..66fe6f30eb 100644
--- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp
@@ -108,7 +108,7 @@ namespace AzNetworking
return true;
}
- totalPacketSize += packetFragments[index]->GetChunkBuffer().GetSize();
+ totalPacketSize += static_cast(packetFragments[index]->GetChunkBuffer().GetSize());
}
// We now mark this sequence as delivered, so if by some chance all the individual chunks get redelivered again we don't double deliver the reconstructed packet
@@ -125,7 +125,7 @@ namespace AzNetworking
uint8_t* bufferPointer = buffer.GetBuffer();
for (uint32_t index = 0; index < packetFragments.size(); ++index)
{
- const uint32_t chunkSize = packetFragments[index]->GetChunkBuffer().GetSize();
+ const uint32_t chunkSize = static_cast(packetFragments[index]->GetChunkBuffer().GetSize());
memcpy(bufferPointer, packetFragments[index]->GetChunkBuffer().GetBuffer(), chunkSize);
bufferPointer += chunkSize;
}
@@ -133,7 +133,7 @@ namespace AzNetworking
// We can erase all the chunks now, packet is completed
m_packetFragments.erase(fragmentSequence);
- NetworkOutputSerializer networkSerializer(buffer.GetBuffer(), buffer.GetSize());
+ NetworkOutputSerializer networkSerializer(buffer.GetBuffer(), static_cast(buffer.GetSize()));
{
ISerializer& networkISerializer = networkSerializer; // To get the default typeinfo parameters in ISerializer
diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp
index a3ddb856d2..d50b20831f 100644
--- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp
@@ -249,7 +249,7 @@ namespace AzNetworking
continue;
}
decodedPacketData = m_decompressBuffer.GetBuffer();
- decodedPacketSize = m_decompressBuffer.GetSize();
+ decodedPacketSize = static_cast(m_decompressBuffer.GetSize());
}
GetMetrics().m_recvBytesUncompressed += decodedPacketSize;
@@ -397,6 +397,16 @@ namespace AzNetworking
return connection->Disconnect(reason, TerminationEndpoint::Local);
}
+ void UdpNetworkInterface::SetTimeoutEnabled(bool timeoutEnabled)
+ {
+ m_timeoutEnabled = timeoutEnabled;
+ }
+
+ bool UdpNetworkInterface::IsTimeoutEnabled() const
+ {
+ return m_timeoutEnabled;
+ }
+
bool UdpNetworkInterface::IsEncrypted() const
{
return m_socket->IsEncrypted();
@@ -494,7 +504,7 @@ namespace AzNetworking
{
buffer.Resize(buffer.GetCapacity());
- NetworkInputSerializer networkSerializer(buffer.GetBuffer(), buffer.GetCapacity());
+ NetworkInputSerializer networkSerializer(buffer.GetBuffer(), static_cast(buffer.GetCapacity()));
ISerializer& serializer = networkSerializer; // To get the default typeinfo parameters in ISerializer
if (!header.SerializePacketFlags(serializer))
@@ -517,7 +527,7 @@ namespace AzNetworking
buffer.Resize(serializer.GetSize());
}
- uint32_t packetSize = buffer.GetSize();
+ uint32_t packetSize = static_cast(buffer.GetSize());
uint8_t* packetData = buffer.GetBuffer();
// If the packet doesn't fit within our MTU (minus potential SSL encryption overhead), break it up
@@ -549,7 +559,7 @@ namespace AzNetworking
UdpPacketEncodingBuffer writeBuffer;
if (m_compressor && shouldCompress)
{
- NetworkInputSerializer flagSerializer(writeBuffer.GetBuffer(), writeBuffer.GetCapacity());
+ NetworkInputSerializer flagSerializer(writeBuffer.GetBuffer(), static_cast(writeBuffer.GetCapacity()));
ISerializer& serializer = flagSerializer; // To get the default typeinfo parameters in ISerializer
header.SetPacketFlag(PacketFlag::Compressed, true);
@@ -562,7 +572,7 @@ namespace AzNetworking
AZ_Assert(flagSize == 1, "Flag bitfield should serialize to one byte");
// Compress the packet, make sure to offset by the size of the flag which is now serialized
- const uint32_t payloadSize = buffer.GetSize() - flagSize;
+ const uint32_t payloadSize = static_cast(buffer.GetSize() - flagSize);
uint8_t* payload = buffer.GetBuffer() + flagSize;
const AZStd::size_t maxSizeNeeded = m_compressor->GetMaxCompressedBufferSize(payloadSize);
AZStd::size_t compressionMemBytesUsed = 0;
@@ -578,7 +588,7 @@ namespace AzNetworking
if (compressionMemBytesUsed < payloadSize)
{
writeBuffer.Resize(aznumeric_cast(flagSize + compressionMemBytesUsed));
- packetSize = writeBuffer.GetSize();
+ packetSize = static_cast(writeBuffer.GetSize());
packetData = writeBuffer.GetBuffer();
// Track byte delta caused by compression
GetMetrics().m_sendBytesCompressedDelta += (packetSize - compressionMemBytesUsed);
@@ -729,7 +739,7 @@ namespace AzNetworking
{
udpConnection->SendUnreliablePacket(CorePackets::HeartbeatPacket());
}
- else if (net_UdpTimeoutConnections)
+ else if (net_UdpTimeoutConnections && m_networkInterface.IsTimeoutEnabled())
{
udpConnection->Disconnect(DisconnectReason::Timeout, TerminationEndpoint::Local);
return TimeoutResult::Delete;
diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.h b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.h
index 7a391c152e..949914da91 100644
--- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.h
+++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.h
@@ -104,6 +104,8 @@ namespace AzNetworking
bool WasPacketAcked(ConnectionId connectionId, PacketId packetId) override;
bool StopListening() override;
bool Disconnect(ConnectionId connectionId, DisconnectReason reason) override;
+ void SetTimeoutEnabled(bool timeoutEnabled) override;
+ bool IsTimeoutEnabled() const override;
//! @}
//! Returns true if this is an encrypted socket, false if not.
@@ -179,6 +181,7 @@ namespace AzNetworking
TrustZone m_trustZone;
uint16_t m_port = 0;
bool m_allowIncomingConnections = false;
+ bool m_timeoutEnabled = true;
IConnectionListener& m_connectionListener;
UdpConnectionSet m_connectionSet;
TimeoutQueue m_connectionTimeoutQueue;
diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp
index 8b535e01aa..b1474bc10f 100644
--- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpReaderThread.cpp
@@ -177,7 +177,7 @@ namespace AzNetworking
}
IpAddress address;
- const uint32_t bufferHead = receiveBuffer.GetSize();
+ const uint32_t bufferHead = static_cast(receiveBuffer.GetSize());
if (bufferHead + MaxUdpTransmissionUnit >= receiveBuffer.GetCapacity())
{
AZLOG_INFO("Receive buffer full, leaving data on the socket. Size exceeded by %d",
diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp
index 29a99f96a1..997fc323a9 100644
--- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp
@@ -241,7 +241,7 @@ namespace AzNetworking
#ifdef ENABLE_LATENCY_DEBUG
int32_t UdpSocket::SendInternalDeferred(const DeferredData& data) const
{
- return SendInternal(data.m_address, data.m_dataBuffer.GetBuffer(), data.m_dataBuffer.GetSize(), data.m_encrypt, *data.m_dtlsEndpoint);
+ return SendInternal(data.m_address, data.m_dataBuffer.GetBuffer(), static_cast(data.m_dataBuffer.GetSize()), data.m_encrypt, *data.m_dtlsEndpoint);
}
#endif
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h
index e95b306d43..e7fa543faf 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.h
@@ -98,7 +98,7 @@ namespace AzToolsFramework
SourceControlFileInfo GetSceneSourceControlInfo() override;
bool AreAnyEntitiesSelected() override { return !m_selectedEntities.empty(); }
- int GetSelectedEntitiesCount() override { return m_selectedEntities.size(); }
+ int GetSelectedEntitiesCount() override { return static_cast(m_selectedEntities.size()); }
const EntityIdList& GetSelectedEntities() override { return m_selectedEntities; }
const EntityIdList& GetHighlightedEntities() override { return m_highlightedEntities; }
void SetSelectedEntities(const EntityIdList& selectedEntities) override;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp
index 69ee4e6188..92c8d37540 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp
@@ -34,8 +34,6 @@ namespace AzToolsFramework::AssetUtils::Internal
return {};
}
- const int pathLen = sourceFolder.length() + 1;
-
AZ::IO::Path sourceWildcard{ sourceFolder };
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp
index 2d97689610..b5cf5fb878 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp
@@ -72,15 +72,8 @@ namespace AzToolsFramework
if (m_rootInstance != nullptr)
{
- // Need to save off the template id to remove the template after the instance is deleted.
- Prefab::TemplateId templateId = m_rootInstance->GetTemplateId();
m_rootInstance.reset();
- if (templateId != Prefab::InvalidTemplateId)
- {
- // Remove the template here so that if we're in a Deactivate/Activate cycle, it can recreate the template/rootInstance
- // correctly
- m_prefabSystemComponent->RemoveTemplate(templateId);
- }
+ m_prefabSystemComponent->RemoveAllTemplates();
}
}
@@ -95,7 +88,7 @@ namespace AzToolsFramework
if (templateId != Prefab::InvalidTemplateId)
{
m_rootInstance->SetTemplateId(Prefab::InvalidTemplateId);
- m_prefabSystemComponent->RemoveTemplate(templateId);
+ m_prefabSystemComponent->RemoveAllTemplates();
}
m_rootInstance->SetContainerEntityName("Level");
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp
index 8f93ebb6df..814c4e2a7f 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp
@@ -164,7 +164,7 @@ namespace AzToolsFramework
AZStd::string path = prefix + pathIter->value.GetString();
- pathIter->value.SetString(path.c_str(), path.length(), providedPatch.GetAllocator());
+ pathIter->value.SetString(path.c_str(), static_cast(path.length()), providedPatch.GetAllocator());
}
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp
index 1c389f6b97..9ef74167a6 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp
@@ -97,7 +97,7 @@ namespace AzToolsFramework
m_updatingTemplateInstancesInQueue = true;
const int instanceCountToUpdateInBatch =
- m_instanceCountToUpdateInBatch == 0 ? m_instancesUpdateQueue.size() : m_instanceCountToUpdateInBatch;
+ m_instanceCountToUpdateInBatch == 0 ? static_cast(m_instancesUpdateQueue.size()) : m_instanceCountToUpdateInBatch;
TemplateId currentTemplateId = InvalidTemplateId;
TemplateReference currentTemplateReference = AZStd::nullopt;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp
index a03e48062c..69efe33d72 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp
@@ -1458,7 +1458,7 @@ namespace AzToolsFramework
if (&owningInstance->get() == &commonRootEntityOwningInstance)
{
// If it's the same instance, we can add this entity to the new instance entities.
- int priorEntitiesSize = entities.size();
+ size_t priorEntitiesSize = entities.size();
entities.insert(entity);
@@ -1645,7 +1645,7 @@ namespace AzToolsFramework
entityDomAfter.Parse(newEntityDomString.toUtf8().constData());
// Add the new Entity DOM to the Entities member of the instance
- rapidjson::Value aliasName(newEntityAlias.c_str(), newEntityAlias.length(), domToAddDuplicatedEntitiesUnder.GetAllocator());
+ rapidjson::Value aliasName(newEntityAlias.c_str(), static_cast(newEntityAlias.length()), domToAddDuplicatedEntitiesUnder.GetAllocator());
entitiesIter->value.AddMember(AZStd::move(aliasName), entityDomAfter, domToAddDuplicatedEntitiesUnder.GetAllocator());
}
@@ -1717,7 +1717,7 @@ namespace AzToolsFramework
nestedInstanceDomAfter.Parse(newInstanceDomString.toUtf8().constData());
// Add the new Instance DOM to the Instances member of the instance
- rapidjson::Value aliasName(newInstanceAlias.c_str(), newInstanceAlias.length(), domToAddDuplicatedInstancesUnder.GetAllocator());
+ rapidjson::Value aliasName(newInstanceAlias.c_str(), static_cast(newInstanceAlias.length()), domToAddDuplicatedInstancesUnder.GetAllocator());
instancesIter->value.AddMember(AZStd::move(aliasName), nestedInstanceDomAfter, domToAddDuplicatedInstancesUnder.GetAllocator());
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp
index 0a2fbb14f6..ea13d368cd 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/PythonTerminal/ScriptHelpDialog.cpp
@@ -251,7 +251,7 @@ namespace AzToolsFramework
{
EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection;
editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection);
- m_items.reserve(globalFunctionCollection.size());
+ m_items.reserve(static_cast(globalFunctionCollection.size()));
for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection)
{
Item item;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp
index 30b3f8915b..4115fe409e 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp
@@ -247,7 +247,7 @@ namespace AzToolsFramework
if (highlightTextIndex >= 0)
{
const QString BACKGROUND_COLOR{ "#707070" };
- label.insert(highlightTextIndex + m_filterString.length(), "");
+ label.insert(highlightTextIndex + static_cast(m_filterString.length()), "");
label.insert(highlightTextIndex, "");
}
} while(highlightTextIndex > 0);
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp
index 17155076ec..f166e85ff9 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp
@@ -2643,22 +2643,22 @@ namespace AzToolsFramework
m_gui->m_statusComboBox->setItalic(false);
if (allActive)
{
- m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[StatusTypeToIndex(StatusType::StatusStartActive)]);
- m_gui->m_statusComboBox->setCurrentIndex(StatusTypeToIndex(StatusType::StatusStartActive));
+ m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[static_cast(StatusTypeToIndex(StatusType::StatusStartActive))]);
+ m_gui->m_statusComboBox->setCurrentIndex(static_cast(StatusTypeToIndex(StatusType::StatusStartActive)));
m_comboItems[StatusTypeToIndex(StatusType::StatusStartActive)]->setCheckState(Qt::Checked);
}
else
if (allInactive)
{
- m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[StatusTypeToIndex(StatusType::StatusStartInactive)]);
- m_gui->m_statusComboBox->setCurrentIndex(StatusTypeToIndex(StatusType::StatusStartInactive));
+ m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[static_cast(StatusTypeToIndex(StatusType::StatusStartInactive))]);
+ m_gui->m_statusComboBox->setCurrentIndex(static_cast(StatusTypeToIndex(StatusType::StatusStartInactive)));
m_comboItems[StatusTypeToIndex(StatusType::StatusStartInactive)]->setCheckState(Qt::Checked);
}
else
if (allEditorOnly)
{
- m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[StatusTypeToIndex(StatusType::StatusEditorOnly)]);
- m_gui->m_statusComboBox->setCurrentIndex(StatusTypeToIndex(StatusType::StatusEditorOnly));
+ m_gui->m_statusComboBox->setHeaderOverride(m_itemNames[static_cast(StatusTypeToIndex(StatusType::StatusEditorOnly))]);
+ m_gui->m_statusComboBox->setCurrentIndex(static_cast(StatusTypeToIndex(StatusType::StatusEditorOnly)));
m_comboItems[StatusTypeToIndex(StatusType::StatusEditorOnly)]->setCheckState(Qt::Checked);
}
else // Some marked active, some not
diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp
index 51a044e9c1..7e47fa9569 100644
--- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp
+++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabBenchmarkFixture.cpp
@@ -110,8 +110,8 @@ namespace Benchmark
void BM_Prefab::SetUpMockValidatorForReadPrefab()
{
- int pathCount = m_paths.size();
- for (int number = 0; number < pathCount; ++number)
+ const size_t pathCount = m_paths.size();
+ for (size_t number = 0; number < pathCount; ++number)
{
m_mockIOActionValidator->ReadPrefabDom(
m_paths[number], UnitTest::PrefabTestDomUtils::CreatePrefabDom());
diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp
index e3b65db97e..8379992553 100644
--- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp
+++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstanceToTemplatePropagatorTests.cpp
@@ -245,7 +245,9 @@ namespace UnitTest
m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomBeforeUpdate, *firstInstance);
//remove instance from instance
- firstInstance->DetachNestedInstance(addedAlias);
+ AZStd::unique_ptr detachedInstance = firstInstance->DetachNestedInstance(addedAlias);
+ ASSERT_TRUE(detachedInstance != nullptr);
+ m_prefabSystemComponent->RemoveLink(detachedInstance->GetLinkId());
//create document with after change snapshot
PrefabDom instanceDomAfterUpdate;
diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h
index 66ad2fbe44..f90a91ea3c 100644
--- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h
+++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.h
@@ -38,7 +38,7 @@ namespace UnitTest
const EntityAlias& entityAlias)
{
return GetPrefabDomEntitiesPath()
- .Append(entityAlias.c_str(), entityAlias.length());
+ .Append(entityAlias.c_str(), static_cast(entityAlias.length()));
};
inline PrefabDomPath GetPrefabDomEntityNamePath(
@@ -62,7 +62,7 @@ namespace UnitTest
inline PrefabDomPath GetPrefabDomInstancePath(
const InstanceAlias& instanceAlias)
{
- return GetPrefabDomInstancesPath().Append(instanceAlias.c_str(), instanceAlias.length());
+ return GetPrefabDomInstancesPath().Append(instanceAlias.c_str(), static_cast(instanceAlias.length()));
};
inline PrefabDomPath GetPrefabDomInstancePath(
diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp
index 0d955789ac..baded6d43e 100644
--- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp
+++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateInstancesTests.cpp
@@ -309,6 +309,7 @@ namespace UnitTest
// and use the updated enclosing Instance to update the PrefabDom of Template.
AZStd::unique_ptr detachedInstance = newEnclosingInstance->DetachNestedInstance(nestedInstanceAliases.front());
ASSERT_TRUE(detachedInstance);
+ m_prefabSystemComponent->RemoveLink(detachedInstance->GetLinkId());
PrefabDom updatedTemplateDom;
ASSERT_TRUE(PrefabDomUtils::StoreInstanceInPrefabDom(*newEnclosingInstance, updatedTemplateDom));
diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp
index 4e7d9d95d1..6f90e245f7 100644
--- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp
+++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUpdateTemplateTests.cpp
@@ -274,6 +274,7 @@ namespace UnitTest
InstanceAlias aliasOfWheelInstanceToRetain = wheelInstanceAliasesUnderAxle.front();
AZStd::unique_ptr detachedInstance = axleInstance->DetachNestedInstance(wheelInstanceAliasesUnderAxle.back());
ASSERT_TRUE(detachedInstance);
+ m_prefabSystemComponent->RemoveLink(detachedInstance->GetLinkId());
PrefabDom updatedAxleInstanceDom;
ASSERT_TRUE(PrefabDomUtils::StoreInstanceInPrefabDom(*axleInstance, updatedAxleInstanceDom));
m_prefabSystemComponent->UpdatePrefabTemplate(axleTemplateId, updatedAxleInstanceDom);
diff --git a/Code/Legacy/CryCommon/CryArray.h b/Code/Legacy/CryCommon/CryArray.h
index 8b0cea3de6..61224784a2 100644
--- a/Code/Legacy/CryCommon/CryArray.h
+++ b/Code/Legacy/CryCommon/CryArray.h
@@ -11,7 +11,7 @@
#define CRYINCLUDE_CRYCOMMON_CRYARRAY_H
#pragma once
-#include "CryLegacyAllocator.h"
+#include
#include
//---------------------------------------------------------------------------
@@ -664,7 +664,7 @@ namespace NArray
I capacity() const
{
- I aligned_bytes = Align(size() * sizeof(T), sizeof(I));
+ I aligned_bytes = static_cast(Align(size() * sizeof(T), sizeof(I)));
if (m_nSizeCap & nCAP_BIT)
{
// Capacity stored in word following data
@@ -682,7 +682,7 @@ namespace NArray
// Store size, and assert against overflow.
assert(s <= c);
m_nSizeCap = s;
- I aligned_bytes = Align(s * sizeof(T), sizeof(I));
+ I aligned_bytes = static_cast(Align(s * sizeof(T), sizeof(I)));
if (c * sizeof(T) >= aligned_bytes + sizeof(I))
{
// Has extra capacity, more than word-alignment
diff --git a/Code/Legacy/CryCommon/CryLegacyAllocator.h b/Code/Legacy/CryCommon/CryLegacyAllocator.h
index 81e3f90026..b0e1e29657 100644
--- a/Code/Legacy/CryCommon/CryLegacyAllocator.h
+++ b/Code/Legacy/CryCommon/CryLegacyAllocator.h
@@ -10,8 +10,6 @@
#include "LegacyAllocator.h"
-#include
-
//-----------------------------------------------------------------------------
// CryModule allocation API
//-----------------------------------------------------------------------------
@@ -95,128 +93,3 @@ inline void* CryModuleReallocAlignImpl(void* prev, size_t size, size_t alignment
return ptr;
}
-
-//-----------------------------------------------------------------------------
-// CryCrt alloc API
-//-----------------------------------------------------------------------------
-inline size_t CryCrtSize(void* p)
-{
- return AZ::AllocatorInstance::Get().AllocationSize(p);
-}
-
-inline void* CryCrtMalloc(size_t size)
-{
- return CryModuleMalloc(size);
-}
-
-inline size_t CryCrtFree(void* p)
-{
- size_t size = CryCrtSize(p);
- CryModuleFree(p);
- return size;
-};
-
-//-----------------------------------------------------------------------------
-// CrySystemCrt alloc API
-//-----------------------------------------------------------------------------
-inline size_t CrySystemCrtSize(void* p)
-{
- return AZ::AllocatorInstance::Get().AllocationSize(p);
-}
-
-inline void* CrySystemCrtMalloc(size_t size)
-{
- return AZ::AllocatorInstance::Get().Allocate(size, 0, 0, "AZ::LegacyAllocator");
-}
-
-inline void* CrySystemCrtRealloc(void* p, size_t size)
-{
- // Use LegacyAllocator's special ReAllocate
- return AZ::AllocatorInstance::Get().ReAllocate(p, size, 0);
-}
-
-inline size_t CrySystemCrtFree(void* p)
-{
- size_t size = CrySystemCrtSize(p);
- CryModuleFree(p);
- return size;
-}
-
-inline size_t CrySystemCrtGetUsedSpace()
-{
- return AZ::AllocatorInstance::Get().NumAllocatedBytes();
-}
-
-//-----------------------------------------------------------------------------
-// CryMalloc API
-//-----------------------------------------------------------------------------
-inline void* CryMalloc(size_t size, size_t& allocated, size_t alignment)
-{
- if (!size)
- {
- allocated = 0;
- return nullptr;
- }
-
- // The original implementation guaranteed 16 byte min alignment
- alignment = AZStd::GetMax(alignment, 16);
- void* ptr = AZ::AllocatorInstance::Get().Allocate(size, alignment, 0, "CryMalloc", __FILE__, __LINE__);
- allocated = AZ::AllocatorInstance::Get().AllocationSize(ptr);
- return ptr;
-}
-
-inline void* CryRealloc(void* memblock, size_t size, size_t& allocated, size_t& oldsize, size_t alignment)
-{
- oldsize = AZ::AllocatorInstance::Get().AllocationSize(memblock);
- void* ptr = AZ::AllocatorInstance::Get().ReAllocate(memblock, size, alignment);
- allocated = AZ::AllocatorInstance::Get().AllocationSize(ptr);
- return ptr;
-}
-
-inline size_t CryFree(void* p, size_t /*alignment*/)
-{
- size_t size = AZ::AllocatorInstance::Get().AllocationSize(p);
- AZ::AllocatorInstance::Get().DeAllocate(p, size);
- return size;
-}
-
-inline size_t CryGetMemSize(void* memblock, size_t /*sourceSize*/)
-{
- return AZ::AllocatorInstance::Get().AllocationSize(memblock);
-}
-
-inline int CryMemoryGetAllocatedSize()
-{
- return AZ::AllocatorInstance::Get().NumAllocatedBytes();
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline int CryMemoryGetPoolSize()
-{
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline int CryStats([[maybe_unused]] char* buf)
-{
- return 0;
-}
-
-inline int CryGetUsedHeapSize()
-{
- return AZ::AllocatorInstance::Get().NumAllocatedBytes();
-}
-
-inline int CryGetWastedHeapSize()
-{
- return 0;
-}
-
-inline void CryCleanup()
-{
- AZ::AllocatorInstance::Get().GarbageCollect();
-}
-
-inline void CryResetStats(void)
-{
-}
diff --git a/Code/Legacy/CryCommon/CryName.h b/Code/Legacy/CryCommon/CryName.h
index 552391419a..b9b3799dd7 100644
--- a/Code/Legacy/CryCommon/CryName.h
+++ b/Code/Legacy/CryCommon/CryName.h
@@ -45,7 +45,7 @@ struct INameTable
const char* GetStr() { return (char*)(this + 1); }
void AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/};
int Release() { return --nRefCount; };
- int GetMemoryUsage() { return sizeof(SNameEntry) + strlen(GetStr()); }
+ int GetMemoryUsage() { return static_cast(sizeof(SNameEntry) + strlen(GetStr())); }
int GetLength(){return nLength; }
};
@@ -102,14 +102,14 @@ public:
if (!pEntry)
{
// Create a new entry.
- unsigned int nLen = strlen(str);
- unsigned int allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
+ size_t nLen = strlen(str);
+ size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
pEntry = (SNameEntry*)CryModuleMalloc(allocLen);
assert(pEntry != NULL);
pEntry->nTag = SNameEntry::TAG;
pEntry->nRefCount = 0;
- pEntry->nLength = nLen;
- pEntry->nAllocSize = allocLen;
+ pEntry->nLength = static_cast(nLen);
+ pEntry->nAllocSize = static_cast(allocLen);
// Copy string to the end of name entry.
char* pEntryStr = const_cast(pEntry->GetStr());
memcpy(pEntryStr, str, nLen + 1);
@@ -134,7 +134,7 @@ public:
int n = 0;
for (it = m_nameMap.begin(); it != m_nameMap.end(); it++)
{
- nSize += strlen(it->first);
+ nSize += static_cast(strlen(it->first));
nSize += it->second->GetMemoryUsage();
n++;
}
@@ -149,7 +149,7 @@ public:
}
virtual int GetNumberOfEntries()
{
- return m_nameMap.size();
+ return static_cast(m_nameMap.size());
}
// Log all names inside CryName table.
diff --git a/Code/Legacy/CryCommon/CryPodArray.h b/Code/Legacy/CryCommon/CryPodArray.h
index ee36750f7f..20693b29ac 100644
--- a/Code/Legacy/CryCommon/CryPodArray.h
+++ b/Code/Legacy/CryCommon/CryPodArray.h
@@ -159,8 +159,8 @@ public:
return numElements != m_elements.size();
}
- ILINE int Count() const { return m_elements.size(); }
- ILINE unsigned int Size() const { return m_elements.size(); }
+ ILINE size_t Count() const { return m_elements.size(); }
+ ILINE size_t Size() const { return m_elements.size(); }
ILINE int IsEmpty() const { return m_elements.empty(); }
diff --git a/Code/Legacy/CryCommon/IIndexedMesh.h b/Code/Legacy/CryCommon/IIndexedMesh.h
index cb19656e35..87c3df98bd 100644
--- a/Code/Legacy/CryCommon/IIndexedMesh.h
+++ b/Code/Legacy/CryCommon/IIndexedMesh.h
@@ -2094,7 +2094,7 @@ public:
{
if (activeStreams & (1U << i))
{
- nMeshSize += ((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount();
+ nMeshSize += static_cast(((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount());
nMeshSize += TARGET_DEFAULT_ALIGN - (nMeshSize & (TARGET_DEFAULT_ALIGN - 1));
}
}
diff --git a/Code/Legacy/CryCommon/IShader.h b/Code/Legacy/CryCommon/IShader.h
index 978da1a77f..6ae3bd73df 100644
--- a/Code/Legacy/CryCommon/IShader.h
+++ b/Code/Legacy/CryCommon/IShader.h
@@ -1425,9 +1425,9 @@ struct STexSamplerFX
SAFE_RELEASE(m_pITarget);
}
- int Size()
+ size_t Size()
{
- int nSize = sizeof(*this);
+ size_t nSize = sizeof(*this);
nSize += m_szName.capacity();
nSize += m_szTexture.capacity();
#if SHADER_REFLECT_TEXTURE_SLOTS
@@ -1804,9 +1804,9 @@ struct SEfResTexture
return m_Ext.m_pTexModifier;
}
- int Size() const
+ size_t Size() const
{
- int nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt);
+ size_t nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt);
nSize += m_Name.size();
nSize += m_Sampler.Size();
nSize += m_Ext.Size();
@@ -1899,9 +1899,9 @@ struct SBaseShaderResources
uint8 m_VoxelCoverage;
- int Size() const
+ size_t Size() const
{
- int nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam);
+ size_t nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam);
return nSize;
}
@@ -2031,9 +2031,9 @@ struct SInputShaderResources
TexturesResourcesMap m_TexturesResourcesMap; // a map of all textures resources used by the shader by name
SDeformInfo m_DeformInfo;
- int Size() const
+ size_t Size() const
{
- int nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size();
+ size_t nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size();
nSize += m_TexturePath.size();
nSize += sizeof(SDeformInfo);
diff --git a/Code/Legacy/CryCommon/VectorMap.h b/Code/Legacy/CryCommon/VectorMap.h
index 0f2b7e57e4..1a42f0e48f 100644
--- a/Code/Legacy/CryCommon/VectorMap.h
+++ b/Code/Legacy/CryCommon/VectorMap.h
@@ -408,8 +408,7 @@ typename VectorMap::key_compare VectorMap::key_comp() co
template
typename VectorMap::iterator VectorMap::lower_bound(const key_type& key)
{
- int count = 0;
- count = m_entries.size();
+ int count = static_cast(m_entries.size());
iterator first = m_entries.begin();
iterator last = m_entries.end();
for (; 0 < count; )
@@ -432,8 +431,7 @@ typename VectorMap::iterator VectorMap::lower_bound(cons
template
typename VectorMap::const_iterator VectorMap::lower_bound(const key_type& key) const
{
- int count = 0;
- count = m_entries.size();
+ int count = static_cast(m_entries.size());
const_iterator first = m_entries.begin();
const_iterator last = m_entries.end();
for (; 0 < count; )
diff --git a/Code/Legacy/CryCommon/platform.h b/Code/Legacy/CryCommon/platform.h
index c040139b5a..12f732a729 100644
--- a/Code/Legacy/CryCommon/platform.h
+++ b/Code/Legacy/CryCommon/platform.h
@@ -475,8 +475,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
return conv_union.pDst;
}
-#include "CryLegacyAllocator.h"
-
//////////////////////////////////////////////////////////////////////////
#ifndef DEPRECATED
#define DEPRECATED
diff --git a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp
index 8b25773c45..3d46716873 100644
--- a/Code/Legacy/CrySystem/ConsoleBatchFile.cpp
+++ b/Code/Legacy/CrySystem/ConsoleBatchFile.cpp
@@ -112,7 +112,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
CryLog("%s \"%s\" found in %s ...", szLog, PathUtil::GetFile(filenameLog.c_str()), PathUtil::GetPath(filenameLog).c_str());
}
- int nLen = file.GetLength();
+ size_t nLen = file.GetLength();
char* sAllText = new char [nLen + 16];
file.ReadRaw(sAllText, nLen);
sAllText[nLen] = '\0';
diff --git a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp
index d21fff3dd3..d8ba36da3d 100644
--- a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp
+++ b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp
@@ -161,7 +161,7 @@ struct SLevelNameAutoComplete
: public IConsoleArgumentAutoComplete
{
AZStd::vector levels;
- virtual int GetCount() const { return levels.size(); };
+ virtual int GetCount() const { return static_cast(levels.size()); };
virtual const char* GetValue(int nIndex) const { return levels[nIndex].c_str(); };
};
// definition and declaration must be separated for devirtualization
diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp
index cffe1c38c6..6013b44f92 100644
--- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp
+++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp
@@ -479,7 +479,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader,
if (i == ELOCALIZED_COLUMN_SOUNDMOOD)
{
const char* pSoundMoodName = pFind + strlen(sLocalizedColumnNames[i]) + 1;
- int nSoundMoodNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1;
+ int nSoundMoodNameLength = static_cast(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1);
if (nSoundMoodNameLength > 0)
{
SoundMoodIndex[nCellIndex] = pSoundMoodName;
@@ -490,7 +490,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader,
if (i == ELOCALIZED_COLUMN_EVENTPARAMETER)
{
const char* pParameterName = pFind + strlen(sLocalizedColumnNames[i]) + 1;
- int nParameterNameLength = sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1;
+ int nParameterNameLength = static_cast(sCellContent.length() - strlen(sLocalizedColumnNames[i]) - 1);
if (nParameterNameLength > 0)
{
EventParameterIndex[nCellIndex] = pParameterName;
@@ -622,7 +622,7 @@ bool CLocalizedStringsManager::InitLocalizationData(
CRY_ASSERT(m_tagFileNames.size() < 255);
- uint8 curNumTags = m_tagFileNames.size();
+ uint8 curNumTags = static_cast(m_tagFileNames.size());
m_tagFileNames[sType].filenames = vEntries;
m_tagFileNames[sType].id = curNumTags + 1;
@@ -757,7 +757,7 @@ bool CLocalizedStringsManager::ReleaseLocalizationDataByTag(
bool bVecEntryErased = false;
//Then remove the entries in the storage vector
- const uint32 numEntries = m_pLanguage->m_vLocalizedStrings.size();
+ const int32 numEntries = static_cast(m_pLanguage->m_vLocalizedStrings.size());
for (int32 i = numEntries - 1; i >= 0; i--)
{
SLocalizedStringEntry* entry = m_pLanguage->m_vLocalizedStrings[i];
@@ -1436,7 +1436,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
// SoundMood Entries
{
- pEntry->SoundMoods.resize(SoundMoodValues.size());
+ pEntry->SoundMoods.resize(static_cast(SoundMoodValues.size()));
if (SoundMoodValues.size() > 0)
{
std::map::const_iterator itEnd = SoundMoodValues.end();
@@ -1452,7 +1452,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
// EventParameter Entries
{
- pEntry->EventParameters.resize(EventParameterValues.size());
+ pEntry->EventParameters.resize(static_cast(EventParameterValues.size()));
if (EventParameterValues.size() > 0)
{
std::map::const_iterator itEnd = EventParameterValues.end();
@@ -2226,7 +2226,7 @@ int CLocalizedStringsManager::GetLocalizedStringCount()
{
return 0;
}
- return m_pLanguage->m_vLocalizedStrings.size();
+ return static_cast(m_pLanguage->m_vLocalizedStrings.size());
}
//////////////////////////////////////////////////////////////////////////
@@ -2339,7 +2339,7 @@ void InternalFormatStringMessage(AZStd::string& outString, const AZStd::string&
int maxArgUsed = 0;
int lastPos = 0;
int curPos = 0;
- const int sourceLen = sString.length();
+ const int sourceLen = static_cast(sString.length());
while (true)
{
auto foundPos = sString.find(token, curPos);
diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp
index 0385ff8eb3..90c15588c3 100644
--- a/Code/Legacy/CrySystem/Log.cpp
+++ b/Code/Legacy/CrySystem/Log.cpp
@@ -483,7 +483,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
break;
}
- int bufferlen = sizeof(szBuffer) - prefixSize;
+ int bufferlen = static_cast(sizeof(szBuffer) - prefixSize);
if (bufferlen > 0)
{
#if defined(AZ_RESTRICTED_PLATFORM)
diff --git a/Code/Legacy/CrySystem/SimpleStringPool.h b/Code/Legacy/CrySystem/SimpleStringPool.h
index ddeca0f44c..d1a618425c 100644
--- a/Code/Legacy/CrySystem/SimpleStringPool.h
+++ b/Code/Legacy/CrySystem/SimpleStringPool.h
@@ -216,8 +216,8 @@ public:
CryFatalError("Can't replace strings in an xml node that reuses strings");
}
- int nStrLen1 = strlen(str1);
- int nStrLen2 = strlen(str2);
+ int nStrLen1 = static_cast(strlen(str1));
+ int nStrLen2 = static_cast(strlen(str2));
// undo ptr1 add.
if (m_ptr != m_start)
diff --git a/Code/Legacy/CrySystem/SystemCFG.cpp b/Code/Legacy/CrySystem/SystemCFG.cpp
index 4d193c72a5..57de0be909 100644
--- a/Code/Legacy/CrySystem/SystemCFG.cpp
+++ b/Code/Legacy/CrySystem/SystemCFG.cpp
@@ -287,7 +287,7 @@ public:
pos = 1;
for (;; )
{
- pos = szValue.find_first_of("\\", pos);
+ pos = static_cast(szValue.find_first_of("\\", pos));
if (pos == AZStd::string::npos)
{
@@ -302,7 +302,7 @@ public:
pos = 1;
for (;; )
{
- pos = szValue.find_first_of("\"", pos);
+ pos = static_cast(szValue.find_first_of("\"", pos));
if (pos == AZStd::string::npos)
{
@@ -416,7 +416,7 @@ bool CSystemConfiguration::ParseSystemConfig()
INDENT_LOG_DURING_SCOPE();
- int nLen = file.GetLength();
+ int nLen = static_cast(file.GetLength());
if (nLen == 0)
{
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Couldn't get length for Config file %s", filename.c_str());
diff --git a/Code/Legacy/CrySystem/ViewSystem/View.cpp b/Code/Legacy/CrySystem/ViewSystem/View.cpp
index ef9f2591c4..e6e9f7a984 100644
--- a/Code/Legacy/CrySystem/ViewSystem/View.cpp
+++ b/Code/Legacy/CrySystem/ViewSystem/View.cpp
@@ -173,7 +173,7 @@ void CView::SetViewShakeEx(const SShakeParams& params)
return;
}
- int shakes(m_shakes.size());
+ int shakes = static_cast(m_shakes.size());
SShake* pSetShake(NULL);
for (int i = 0; i < shakes; ++i)
@@ -250,7 +250,7 @@ void CView::ProcessShaking(float frameTime)
m_viewParams.shakingRatio = 0;
m_viewParams.groundOnly = false;
- int shakes(m_shakes.size());
+ int shakes = static_cast(m_shakes.size());
for (int i = 0; i < shakes; ++i)
{
ProcessShake(&m_shakes[i], frameTime);
@@ -556,7 +556,7 @@ void CView::ProcessShakeNormal_DoShaking(SShake* pShake, float frameTime)
//------------------------------------------------------------------------
void CView::StopShake(int shakeID)
{
- uint32 num = m_shakes.size();
+ uint32 num = static_cast(m_shakes.size());
for (uint32 i = 0; i < num; ++i)
{
if (m_shakes[i].ID == shakeID && m_shakes[i].updating)
diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp
index 0f98dd12d6..8e598c481d 100644
--- a/Code/Legacy/CrySystem/XConsole.cpp
+++ b/Code/Legacy/CrySystem/XConsole.cpp
@@ -1283,7 +1283,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel)
{
if (isCtrlModifierActive)
{
- m_nScrollLine = m_dqConsoleBuffer.size() - 1;
+ m_nScrollLine = static_cast(m_dqConsoleBuffer.size() - 1);
}
else
{
@@ -1396,7 +1396,7 @@ bool CXConsole::GetLineNo(const int indwLineNo, char* outszBuffer, const int ind
//////////////////////////////////////////////////////////////////////////
int CXConsole::GetLineCount() const
{
- return m_dqConsoleBuffer.size();
+ return static_cast(m_dqConsoleBuffer.size());
}
//////////////////////////////////////////////////////////////////////////
@@ -2614,7 +2614,7 @@ void CXConsole::RemoveOutputPrintSink(IOutputPrintSink* inpSink)
{
assert(inpSink);
- int nCount = m_OutputSinks.size();
+ int nCount = static_cast(m_OutputSinks.size());
for (int i = 0; i < nCount; i++)
{
@@ -2900,7 +2900,7 @@ bool CXConsole::IsHashCalculated()
//////////////////////////////////////////////////////////////////////////
int CXConsole::GetNumCheatVars()
{
- return m_randomCheckedVariables.size();
+ return static_cast(m_randomCheckedVariables.size());
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Legacy/CrySystem/XConsole.h b/Code/Legacy/CrySystem/XConsole.h
index 16d1870be6..67d9371e8d 100644
--- a/Code/Legacy/CrySystem/XConsole.h
+++ b/Code/Legacy/CrySystem/XConsole.h
@@ -70,7 +70,7 @@ struct CConsoleCommandArgs
CConsoleCommandArgs(AZStd::string& line, std::vector& args)
: m_line(line)
, m_args(args) {};
- virtual int GetArgCount() const { return m_args.size(); };
+ virtual int GetArgCount() const { return static_cast(m_args.size()); };
// Get argument by index, nIndex must be in 0 <= nIndex < GetArgCount()
virtual const char* GetArg(int nIndex) const
{
diff --git a/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp b/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp
index b0d7a6f1af..c5fa3839e0 100644
--- a/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp
+++ b/Code/Legacy/CrySystem/XML/WriteXMLSource.cpp
@@ -190,8 +190,9 @@ bool SaveArray(const IdTable& idTable, XmlNodeRef& definition, XmlNodeRef& data,
}
bool needIndex = false;
- for (size_t i = 1; i <= numElems; i++)
+ for (size_t sizei = 1; sizei <= numElems; sizei++)
{
+ const int i = static_cast(sizei);
if (!childSource->HaveElemAt(i))
{
needIndex = true;
diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp
index 7fd9df30c9..f55f792516 100644
--- a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp
+++ b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp
@@ -114,26 +114,26 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node,
nTheoreticalPosition += sizeof(header);
align(nTheoreticalPosition, nAlignment);
- header.nNodeTablePosition = nTheoreticalPosition;
+ header.nNodeTablePosition = static_cast(nTheoreticalPosition);
header.nNodeCount = int(m_nodes.size());
nTheoreticalPosition += header.nNodeCount * sizeof(Node);
align(nTheoreticalPosition, nAlignment);
- header.nChildTablePosition = nTheoreticalPosition;
+ header.nChildTablePosition = static_cast(nTheoreticalPosition);
header.nChildCount = int(m_childs.size());
nTheoreticalPosition += header.nChildCount * sizeof(NodeIndex);
align(nTheoreticalPosition, nAlignment);
- header.nAttributeTablePosition = nTheoreticalPosition;
+ header.nAttributeTablePosition = static_cast(nTheoreticalPosition);
header.nAttributeCount = int(m_attributes.size());
nTheoreticalPosition += header.nAttributeCount * sizeof(Attribute);
align(nTheoreticalPosition, nAlignment);
- header.nStringDataPosition = nTheoreticalPosition;
+ header.nStringDataPosition = static_cast(nTheoreticalPosition);
header.nStringDataSize = m_nStringDataSize;
nTheoreticalPosition += header.nStringDataSize;
- header.nXMLSize = nTheoreticalPosition;
+ header.nXMLSize = static_cast(nTheoreticalPosition);
// Swap endianness of the data structures
if (bNeedSwapEndian)
@@ -328,7 +328,7 @@ int XMLBinary::CXMLBinaryWriter::AddString(const XmlString& sString)
// We don't have such string yet, so we should add it to the tables.
m_strings.push_back(sString);
itStringEntry = m_stringMap.insert(StringMap::value_type(sString, m_nStringDataSize)).first;
- m_nStringDataSize += sString.length() + 1;
+ m_nStringDataSize += static_cast(sString.length() + 1);
}
// Return offset of the string in the string data buffer.
diff --git a/Code/Legacy/CrySystem/XML/XmlUtils.cpp b/Code/Legacy/CrySystem/XML/XmlUtils.cpp
index 5e31fff8d7..ecc10508f1 100644
--- a/Code/Legacy/CrySystem/XML/XmlUtils.cpp
+++ b/Code/Legacy/CrySystem/XML/XmlUtils.cpp
@@ -91,7 +91,7 @@ XmlNodeRef CXmlUtils::LoadXmlFromFile(const char* sFilename, bool bReuseStrings,
XmlNodeRef CXmlUtils::LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings, bool bSuppressWarnings)
{
XmlParser parser(bReuseStrings);
- XmlNodeRef node = parser.ParseBuffer(buffer, size, true, bSuppressWarnings);
+ XmlNodeRef node = parser.ParseBuffer(buffer, static_cast(size), true, bSuppressWarnings);
return node;
}
@@ -111,7 +111,7 @@ const char* CXmlUtils::HashXml(XmlNodeRef node)
static char temp[16];
static const char* hex = "0123456789abcdef";
XmlString str = node->getXML();
- GetMD5(str.data(), str.length(), temp);
+ GetMD5(str.data(), static_cast(str.length()), temp);
for (int i = 0; i < 16; i++)
{
signature[2 * i + 0] = hex[((uint8)temp[i]) >> 4];
diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp
index 728d9441f2..8eb13c5247 100644
--- a/Code/Legacy/CrySystem/XML/xml.cpp
+++ b/Code/Legacy/CrySystem/XML/xml.cpp
@@ -655,7 +655,7 @@ XmlNodeRef CXmlNode::findChild(const char* tag) const
if (m_pChilds)
{
XmlNodes& childs = *m_pChilds;
- for (int i = 0, num = childs.size(); i < num; ++i)
+ for (int i = 0, num = static_cast(childs.size()); i < num; ++i)
{
if (childs[i]->isTag(tag))
{
@@ -690,7 +690,7 @@ void CXmlNode::deleteChild(const char* tag)
if (m_pChilds)
{
XmlNodes& childs = *m_pChilds;
- for (int i = 0, num = childs.size(); i < num; ++i)
+ for (int i = 0, num = static_cast(childs.size()); i < num; ++i)
{
if (childs[i]->isTag(tag))
{
@@ -913,7 +913,7 @@ XmlNodeRef CXmlNode::clone()
node->m_pChilds = new XmlNodes;
node->m_pChilds->reserve(childs.size());
- for (int i = 0, num = childs.size(); i < num; ++i)
+ for (int i = 0, num = static_cast(childs.size()); i < num; ++i)
{
node->addChild(childs[i]->clone());
}
@@ -956,7 +956,7 @@ static void AddTabsToString(XmlString& xml, int level)
//////////////////////////////////////////////////////////////////////////
bool CXmlNode::IsValidXmlString(const char* str) const
{
- int len = strlen(str);
+ int len = static_cast(strlen(str));
{
// Prevents invalid characters not from standard ASCII set to propagate to xml.
@@ -1432,7 +1432,7 @@ protected:
void XmlParserImp::CleanStack()
{
m_nNodeStackTop = 0;
- for (int i = 0, num = m_nodeStack.size(); i < num; i++)
+ for (int i = 0, num = static_cast(m_nodeStack.size()); i < num; i++)
{
m_nodeStack[i].node = 0;
m_nodeStack[i].childs.resize(0);
diff --git a/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp b/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp
index 4f1e7a6337..e59bdfa8ac 100644
--- a/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp
+++ b/Code/Tools/AssetBundler/source/ui/PlatformSelectionWidget.cpp
@@ -34,7 +34,7 @@ namespace AssetBundler
for (const AZStd::string_view& platformString : m_platformHelper->GetPlatforms(PlatformFlags::AllNamedPlatforms))
{
// Create the CheckBox and store what platform it maps to
- QSharedPointer platformCheckBox(new QCheckBox(QString::fromUtf8(platformString.data(), platformString.size())));
+ QSharedPointer platformCheckBox(new QCheckBox(QString::fromUtf8(platformString.data(), static_cast(platformString.size()))));
m_platformCheckBoxes.push_back(platformCheckBox);
PlatformFlags currentPlatformFlag = m_platformHelper->GetPlatformFlag(platformString);
m_platformList.push_back(currentPlatformFlag);
diff --git a/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp b/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp
index eb0416f125..64e176ffe4 100644
--- a/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp
+++ b/Code/Tools/AssetProcessor/native/AssetManager/SourceFileRelocator.cpp
@@ -88,7 +88,7 @@ Please note that only those seed files will get updated that are active for your
{
scanFolderInfo = nullptr;
bool isRelative = AzFramework::StringFunc::Path::IsRelative(normalizedSource.c_str());
-
+
if (isRelative)
{
// Relative paths can match multiple files/folders, search each scan folder for a valid match
@@ -264,7 +264,7 @@ Please note that only those seed files will get updated that are active for your
metaDataFile.m_sourceFileIndex = sourceFileIndex.value();
metadataFiles.emplace_back(metaDataFile);
metaDataFileEntries.insert(metadaFileCorrectCase);
- }
+ }
}
}
}
@@ -601,7 +601,7 @@ Please note that only those seed files will get updated that are active for your
AZ::StringFunc::Path::ReplaceFullName(newDestinationPath, fullFileName.c_str());
}
-
+
if (!AzFramework::StringFunc::Path::IsRelative(newDestinationPath.c_str()))
{
@@ -1025,14 +1025,14 @@ Please note that only those seed files will get updated that are active for your
AZStd::binary_semaphore waitSignal;
int errorCount = 0;
- AzToolsFramework::SourceControlResponseCallbackBulk callback = AZStd::bind(&HandleSourceControlResult,
- AZStd::ref (relocationContainer),
- AZStd::ref(waitSignal),
- AZStd::ref(errorCount),
- static_cast(SCF_OpenByUser), // If a file is moved from A -> B and then again from B -> A, the result is just an "edit", so we're just going to assume success if the file is checked out, regardless of state
- true,
- AZStd::placeholders::_1,
- AZStd::placeholders::_2);
+ AzToolsFramework::SourceControlResponseCallbackBulk callback = [&](bool success, AZStd::vector info)
+ {
+ HandleSourceControlResult(
+ relocationContainer, waitSignal, errorCount,
+ SCF_OpenByUser, // If a file is moved from A -> B and then again from B -> A, the result is just an "edit", so we're just going
+ // to assume success if the file is checked out, regardless of state
+ true, success, info);
+ };
AzToolsFramework::SourceControlCommandBus::Broadcast(&AzToolsFramework::SourceControlCommandBus::Events::RequestRenameBulkExtended,
@@ -1049,7 +1049,7 @@ Please note that only those seed files will get updated that are active for your
{
if (relocationInfo.m_operationStatus == SourceFileRelocationStatus::Succeeded || relocationInfo.m_sourceFileIndex == AssetProcessor::SourceFileRelocationInvalidIndex)
{
- // we do not want to retry if the move operation already succeeded or if it is a source file
+ // we do not want to retry if the move operation already succeeded or if it is a source file
continue;
}
@@ -1108,7 +1108,7 @@ Please note that only those seed files will get updated that are active for your
{
if (entry.m_operationStatus == SourceFileRelocationStatus::Succeeded || entry.m_sourceFileIndex == AssetProcessor::SourceFileRelocationInvalidIndex)
{
- // we do not want to retry if the move operation already succeeded or if it is a source file
+ // we do not want to retry if the move operation already succeeded or if it is a source file
continue;
}
@@ -1224,7 +1224,7 @@ Please note that only those seed files will get updated that are active for your
m_stateData->QuerySourceByProductID(productDependency.m_productPK, [this, &sourceName, &scanPath](AzToolsFramework::AssetDatabase::SourceDatabaseEntry& entry)
{
sourceName = entry.m_sourceName;
-
+
m_stateData->QueryScanFolderByScanFolderID(entry.m_scanFolderPK, [&scanPath](AzToolsFramework::AssetDatabase::ScanFolderDatabaseEntry& entry)
{
scanPath = entry.m_scanFolder;
diff --git a/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp b/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp
index 08546365c5..27210685fc 100644
--- a/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp
+++ b/Code/Tools/AssetProcessor/native/resourcecompiler/RCBuilder.cpp
@@ -322,7 +322,7 @@ namespace AssetProcessor
executableDirectory /= ASSETPROCESSOR_TRAIT_LEGACY_RC_RELATIVE_PATH;
if (AZ::IO::SystemFile::Exists(executableDirectory.c_str()))
{
- rcAbsolutePathOut = QString::fromUtf8(executableDirectory.c_str(), executableDirectory.Native().size());
+ rcAbsolutePathOut = QString::fromUtf8(executableDirectory.c_str(), static_cast(executableDirectory.Native().size()));
return true;
}
diff --git a/Code/Tools/ProjectManager/Platform/Windows/ProjectBuilderWorker_windows.cpp b/Code/Tools/ProjectManager/Platform/Windows/ProjectBuilderWorker_windows.cpp
index a228f58e51..8856e2312a 100644
--- a/Code/Tools/ProjectManager/Platform/Windows/ProjectBuilderWorker_windows.cpp
+++ b/Code/Tools/ProjectManager/Platform/Windows/ProjectBuilderWorker_windows.cpp
@@ -118,7 +118,9 @@ namespace O3DE::ProjectManager
}
}
- if (m_configProjectProcess->exitCode() != 0 || !containsGeneratingDone)
+ if (m_configProjectProcess->exitStatus() != QProcess::ExitStatus::NormalExit
+ || m_configProjectProcess->exitCode() != 0
+ || !containsGeneratingDone)
{
QString error = tr("Configuring project failed. See log for details.");
QStringToAZTracePrint(error);
@@ -180,7 +182,8 @@ namespace O3DE::ProjectManager
}
}
- if (m_configProjectProcess->exitCode() != 0)
+ if (m_configProjectProcess->exitStatus() != QProcess::ExitStatus::NormalExit
+ || m_configProjectProcess->exitCode() != 0)
{
QString error = tr("Building project failed. See log for details.");
QStringToAZTracePrint(error);
diff --git a/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp
index 20d564d8b0..f098518fd3 100644
--- a/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp
+++ b/Code/Tools/ProjectManager/Source/CreateProjectCtrl.cpp
@@ -265,6 +265,6 @@ namespace O3DE::ProjectManager
void CreateProjectCtrl::ReinitGemCatalogForSelectedTemplate()
{
const QString projectTemplatePath = m_newProjectSettingsScreen->GetProjectTemplatePath();
- m_gemCatalogScreen->ReinitForProject(projectTemplatePath + "/Template", /*isNewProject=*/true);
+ m_gemCatalogScreen->ReinitForProject(projectTemplatePath + "/Template");
}
} // namespace O3DE::ProjectManager
diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp
index 53d772c217..863f611ec8 100644
--- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp
+++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp
@@ -62,10 +62,10 @@ namespace O3DE::ProjectManager
hLayout->addWidget(m_gemInspector);
}
- void GemCatalogScreen::ReinitForProject(const QString& projectPath, bool isNewProject)
+ void GemCatalogScreen::ReinitForProject(const QString& projectPath)
{
m_gemModel->clear();
- FillModel(projectPath, isNewProject);
+ FillModel(projectPath);
if (m_filterWidget)
{
@@ -88,18 +88,9 @@ namespace O3DE::ProjectManager
});
}
- void GemCatalogScreen::FillModel(const QString& projectPath, bool isNewProject)
+ void GemCatalogScreen::FillModel(const QString& projectPath)
{
- AZ::Outcome, AZStd::string> allGemInfosResult;
- if (isNewProject)
- {
- allGemInfosResult = PythonBindingsInterface::Get()->GetEngineGemInfos();
- }
- else
- {
- allGemInfosResult = PythonBindingsInterface::Get()->GetAllGemInfos(projectPath);
- }
-
+ AZ::Outcome, AZStd::string> allGemInfosResult = PythonBindingsInterface::Get()->GetAllGemInfos(projectPath);
if (allGemInfosResult.IsSuccess())
{
// Add all available gems to the model.
diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h
index 204ad0e5c5..5b48b2f90e 100644
--- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h
+++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h
@@ -28,13 +28,13 @@ namespace O3DE::ProjectManager
~GemCatalogScreen() = default;
ProjectManagerScreen GetScreenEnum() override;
- void ReinitForProject(const QString& projectPath, bool isNewProject);
+ void ReinitForProject(const QString& projectPath);
bool EnableDisableGemsForProject(const QString& projectPath);
GemModel* GetGemModel() const { return m_gemModel; }
private:
- void FillModel(const QString& projectPath, bool isNewProject);
+ void FillModel(const QString& projectPath);
GemListView* m_gemListView = nullptr;
GemInspector* m_gemInspector = nullptr;
diff --git a/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp b/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp
index e782f0b57f..0ff963e539 100644
--- a/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp
+++ b/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp
@@ -104,7 +104,7 @@ namespace O3DE::ProjectManager
QMessageBox::critical(m_parent, tr("Project Failed to Build!"), result);
m_projectInfo.m_buildFailed = true;
- m_projectInfo.m_logUrl = QUrl();
+ m_projectInfo.m_logUrl = QUrl("file:///" + m_worker->GetLogFilePath());
emit NotifyBuildProject(m_projectInfo);
}
diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp
index 981a9352f7..6aba261cd2 100644
--- a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp
+++ b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp
@@ -94,7 +94,7 @@ namespace O3DE::ProjectManager
Update();
// Gather the available gems that will be shown in the gem catalog.
- m_gemCatalogScreen->ReinitForProject(m_projectInfo.m_path, /*isNewProject=*/false);
+ m_gemCatalogScreen->ReinitForProject(m_projectInfo.m_path);
}
void UpdateProjectCtrl::HandleGemsButton()
diff --git a/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp b/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp
index aa439116a0..b6a7898ca2 100644
--- a/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp
+++ b/Code/Tools/RemoteConsole/Core/RemoteConsoleCore.cpp
@@ -323,7 +323,7 @@ bool SRemoteServer::ReadBuffer(const char* buffer, int data)
}
// Advance to the next null terminated string in the buffer
- const int currentSize = strnlen(curBuffer, bytesRemaining);
+ const int currentSize = static_cast(strnlen(curBuffer, bytesRemaining));
bytesRemaining -= currentSize + 1;
curBuffer += currentSize + 1;
}
@@ -466,7 +466,7 @@ void SRemoteClient::FillAutoCompleteList(AZStd::vector& list)
AZStd::string item = "map ";
const char* levelName = pLevel->GetName();
int start = 0;
- for (int k = 0, kend = strlen(levelName); k < kend; ++k)
+ for (int k = 0, kend = static_cast(strlen(levelName)); k < kend; ++k)
{
if ((levelName[k] == '\\' || levelName[k] == '/') && k + 1 < kend)
{
diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp
index 1b712cb134..aadb834aa9 100644
--- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp
+++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp
@@ -634,21 +634,21 @@ namespace AZ
AZStd::shared_ptr morphAnimNode =
AZStd::make_shared();
- const size_t numKeyFrames = GetNumKeyFrames(keys.size(), animation->mDuration, animation->mTicksPerSecond);
+ const size_t numKeyFrames = GetNumKeyFrames(static_cast(keys.size()), animation->mDuration, animation->mTicksPerSecond);
morphAnimNode->ReserveKeyFrames(numKeyFrames);
morphAnimNode->SetTimeStepBetweenFrames(s_defaultTimeStepBetweenFrames);
aiAnimMesh* aiAnimMesh = mesh->mAnimMeshes[meshIdx];
AZStd::string_view nodeName(aiAnimMesh->mName.C_Str());
- const AZ::u32 maxKeys = keys.size();
+ const AZ::u32 maxKeys = static_cast(keys.size());
AZ::u32 keyIdx = 0;
for (AZ::u32 frame = 0; frame < numKeyFrames; ++frame)
{
const double time = GetTimeForFrame(frame, animation->mTicksPerSecond);
float weight = 0;
- if (!SampleKeyFrame(weight, keys, keys.size(), time + keyOffset, keyIdx))
+ if (!SampleKeyFrame(weight, keys, static_cast(keys.size()), time + keyOffset, keyIdx))
{
return Events::ProcessingResult::Failure;
}
diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp
index 4de52e0f78..266791e05c 100644
--- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp
+++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactSourceCoveringTestsSerializer.cpp
@@ -50,8 +50,8 @@ namespace TestImpact
AZStd::vector coveringTests;
sourceCoveringTests.reserve(1U << 16); // Reserve for approx. 65k source files
const AZStd::string delim = "\n";
- auto start = 0U;
- auto end = sourceCoveringTestsListString.find(delim);
+ size_t start = 0U;
+ size_t end = sourceCoveringTestsListString.find(delim);
while (end != AZStd::string::npos)
{
diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h
index e9c30566cd..ad160303f7 100644
--- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h
+++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobUtil.h
@@ -43,8 +43,7 @@ namespace AWSCore
if (urlSections.size() > ExpectedUrlSections)
{
- int i;
- i = urlSections[ExpectedUrlSections - 1].find('.');
+ int i = static_cast(urlSections[ExpectedUrlSections - 1].find('.'));
if (i != -1)
{
// Handle APIGateway URLs with custom domains:
diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h
index 20b94d6e1a..cd0686c2d0 100644
--- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h
+++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJob.h
@@ -391,7 +391,7 @@ namespace AWSCore
int offset = 0;
while (offset < message.size())
{
- int count = (offset + MAX_MESSAGE_LENGTH < message.size()) ? MAX_MESSAGE_LENGTH : message.size() - offset;
+ int count = static_cast((offset + MAX_MESSAGE_LENGTH < message.size()) ? MAX_MESSAGE_LENGTH : message.size() - offset);
AZ_Warning(ServiceClientJobType::COMPONENT_DISPLAY_NAME, false, message.substr(offset, count).c_str());
offset += MAX_MESSAGE_LENGTH;
}
diff --git a/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp b/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp
index 71fe0fc221..d041a97428 100644
--- a/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp
+++ b/Gems/AWSCore/Code/Source/Framework/JsonObjectHandler.cpp
@@ -443,7 +443,7 @@ namespace AWSCore
msg += AZStd::string::format(" at character %zu: ", result.Offset());
const int snippet_size = 40;
- int start = result.Offset() - snippet_size / 2;
+ int start = static_cast(result.Offset() - snippet_size / 2);
int length = snippet_size;
int offset = snippet_size / 2;
if (start < 0) {
diff --git a/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp b/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp
index 5c80813590..caba8b5ae7 100644
--- a/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp
+++ b/Gems/AWSCore/Code/Tests/ScriptCanvas/AWSScriptBehaviorsComponentTest.cpp
@@ -51,7 +51,7 @@ protected:
TEST_F(AWSScriptBehaviorsComponentTest, Reflect)
{
- int oldEBusNum = m_behaviorContext->m_ebuses.size();
+ int oldEBusNum = static_cast(m_behaviorContext->m_ebuses.size());
m_componentDescriptor.reset(AWSScriptBehaviorsComponent::CreateDescriptor());
m_componentDescriptor->Reflect(m_serializeContext.get());
m_componentDescriptor->Reflect(m_behaviorContext.get());
diff --git a/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp b/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp
index d787cf0bfb..e23c97a5fe 100644
--- a/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp
+++ b/Gems/AWSMetrics/Code/Source/MetricsEvent.cpp
@@ -58,7 +58,7 @@ namespace AWSMetrics
int MetricsEvent::GetNumAttributes() const
{
- return m_attributes.size();
+ return static_cast(m_attributes.size());
}
size_t MetricsEvent::GetSizeInBytes() const
diff --git a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp
index 680c946b37..5c4d910658 100644
--- a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp
+++ b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp
@@ -256,7 +256,7 @@ namespace AWSMetrics
}
m_globalStats.m_numSuccesses++;
- m_globalStats.m_sendSizeInBytes += metricsEvent.GetSizeInBytes();
+ m_globalStats.m_sendSizeInBytes += static_cast(metricsEvent.GetSizeInBytes());
}
else
{
diff --git a/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp b/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp
index cd22bce5e0..ab54fb9e3e 100644
--- a/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp
+++ b/Gems/AWSMetrics/Code/Source/MetricsQueue.cpp
@@ -134,7 +134,7 @@ namespace AWSMetrics
int MetricsQueue::GetNumMetrics() const
{
- return m_metrics.size();
+ return static_cast(m_metrics.size());
}
size_t MetricsQueue::GetSizeInBytes() const
@@ -175,7 +175,7 @@ namespace AWSMetrics
MetricsEvent& curEvent = m_metrics.front();
curNum += 1;
- curSizeInBytes += curEvent.GetSizeInBytes();
+ curSizeInBytes += static_cast(curEvent.GetSizeInBytes());
if (curNum <= maxBatchedRecordsCount && curSizeInBytes <= maxPayloadSizeInBytes)
{
m_sizeSerializedToJson -= curEvent.GetSizeInBytes();
diff --git a/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp b/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp
index 149f23ccf2..2d9990ad1e 100644
--- a/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp
+++ b/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp
@@ -452,7 +452,7 @@ namespace AWSMetrics
EXPECT_EQ(stats.m_numErrors, MaxNumMetricsEvents / 2);
EXPECT_EQ(stats.m_numDropped, 0);
- int metricsEventSize = sizeof(AwsMetricsAttributeKeyEventName) - 1 + strlen(AttrValue);
+ int metricsEventSize = static_cast(sizeof(AwsMetricsAttributeKeyEventName) - 1 + strlen(AttrValue));
EXPECT_EQ(stats.m_sendSizeInBytes, metricsEventSize * MaxNumMetricsEvents / 2);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MaxNumMetricsEvents / 2);
diff --git a/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp b/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp
index cc05a60798..85a9d8a4a7 100644
--- a/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp
+++ b/Gems/AWSMetrics/Code/Tests/MetricsQueueTest.cpp
@@ -124,7 +124,7 @@ namespace AWSMetrics
queue.AddMetrics(metrics);
}
- int maxCapacity = queue[0].GetSizeInBytes() * NumTestMetrics / 2;
+ int maxCapacity = static_cast(queue[0].GetSizeInBytes() * NumTestMetrics / 2);
ASSERT_EQ(queue.FilterMetricsByPriority(maxCapacity), NumTestMetrics / 2);
ASSERT_EQ(queue.GetNumMetrics(), NumTestMetrics / 2);
@@ -230,7 +230,7 @@ namespace AWSMetrics
{
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
- int sizeOfEachMetrics = metrics.GetSizeInBytes();
+ int sizeOfEachMetrics = static_cast(metrics.GetSizeInBytes());
MetricsQueue queue;
queue.AddMetrics(metrics);
diff --git a/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp b/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp
index 6e9fe1855c..aecac5fa34 100644
--- a/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp
+++ b/Gems/AssetMemoryAnalyzer/Code/Source/DebugImGUI.cpp
@@ -201,13 +201,13 @@ namespace AssetMemoryAnalyzer
{
case AllocationCategories::HEAP:
ImGui::Text(FormatUtils::FormatCodePoint(*ap->m_codePoint));
- heapSummary.m_allocationCount = ap->m_allocations.size();
+ heapSummary.m_allocationCount = static_cast(ap->m_allocations.size());
heapSummary.m_allocatedMemory = ap->m_totalAllocatedMemory;
break;
case AllocationCategories::VRAM:
ImGui::Text("%s", ap->m_codePoint->m_file);
- vramSummary.m_allocationCount = ap->m_allocations.size();
+ vramSummary.m_allocationCount = static_cast(ap->m_allocations.size());
vramSummary.m_allocatedMemory = ap->m_totalAllocatedMemory;
break;
}
diff --git a/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp b/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp
index 20a6089323..9f75e62454 100644
--- a/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp
+++ b/Gems/AssetMemoryAnalyzer/Code/Source/ExportJSON.cpp
@@ -78,7 +78,7 @@ namespace AssetMemoryAnalyzer
writer.StartObject();
writer.Key("id");
- writer.Int(idCounter++);
+ writer.Int(static_cast(idCounter++));
writer.Key("label");
writer.String(asset.m_id ? asset.m_id : "Root");
@@ -98,7 +98,7 @@ namespace AssetMemoryAnalyzer
{
writer.StartObject();
writer.Key("id");
- writer.Int(idCounter++);
+ writer.Int(static_cast(idCounter++));
writer.Key("label");
writer.String("");
@@ -119,7 +119,7 @@ namespace AssetMemoryAnalyzer
writer.StartObject();
writer.Key("id");
- writer.Int(idCounter++);
+ writer.Int(static_cast(idCounter++));
writer.Key("label");
@@ -127,13 +127,13 @@ namespace AssetMemoryAnalyzer
{
case AllocationCategories::HEAP:
writer.String(FormatUtils::FormatCodePoint(*ap.m_codePoint));
- heapSummary.m_allocationCount = ap.m_allocations.size();
+ heapSummary.m_allocationCount = static_cast(ap.m_allocations.size());
heapSummary.m_allocatedMemory = ap.m_totalAllocatedMemory;
break;
case AllocationCategories::VRAM:
writer.String(ap.m_codePoint->m_file);
- vramSummary.m_allocationCount = ap.m_allocations.size();
+ vramSummary.m_allocationCount = static_cast(ap.m_allocations.size());
vramSummary.m_allocatedMemory = ap.m_totalAllocatedMemory;
break;
}
diff --git a/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp b/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp
index 9a6f7c83ab..330b6571f3 100644
--- a/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp
+++ b/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp
@@ -235,7 +235,7 @@ namespace AZ
UpdateViewToClipMatrix();
}
- void CameraComponent::SetOrthographic(bool orthographic)
+ void CameraComponent::SetOrthographic([[maybe_unused]] bool orthographic)
{
AZ_Assert(!orthographic, "DebugCamera does not support orthographic projection");
}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/UI.pass b/Gems/Atom/Feature/Common/Assets/Passes/UI.pass
index ac43f17c11..fd59df5336 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/UI.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/UI.pass
@@ -13,13 +13,7 @@
"ScopeAttachmentUsage": "DepthStencil",
"LoadStoreAction": {
"ClearValue": {
- "Type": "DepthStencil",
- "Value": [
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ]
+ "Type": "DepthStencil"
},
"LoadActionStencil": "Clear"
}
diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp
index 08b3821b41..ea726dd914 100644
--- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp
+++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp
@@ -196,13 +196,13 @@ namespace AZ
{
const size_t sourceByteSize = source.size() * sizeof(AuxGeomIndex);
- RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(sourceByteSize);
+ RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(static_cast(sourceByteSize));
if (!dynamicBuffer)
{
AZ_WarningOnce("AuxGeom", false, "Failed to allocate dynamic buffer of size %d.", sourceByteSize);
return false;
- }
- dynamicBuffer->Write(source.data(), sourceByteSize);
+ }
+ dynamicBuffer->Write(source.data(), static_cast(sourceByteSize));
group.m_indexBufferView = dynamicBuffer->GetIndexBufferView(RHI::IndexFormat::Uint32);
return true;
}
@@ -211,13 +211,13 @@ namespace AZ
{
const size_t sourceByteSize = source.size() * sizeof(AuxGeomDynamicVertex);
- RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(sourceByteSize);
+ RHI::Ptr dynamicBuffer = RPI::DynamicDrawInterface::Get()->GetDynamicBuffer(static_cast(sourceByteSize));
if (!dynamicBuffer)
{
AZ_WarningOnce("AuxGeom", false, "Failed to allocate dynamic buffer of size %d.", sourceByteSize);
return false;
- }
- dynamicBuffer->Write(source.data(), sourceByteSize);
+ }
+ dynamicBuffer->Write(source.data(), static_cast(sourceByteSize));
group.m_streamBufferViews[0] = dynamicBuffer->GetStreamBufferView(sizeof(AuxGeomDynamicVertex));
return true;
}
diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp
index b1456f82fe..089adf4621 100644
--- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp
+++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PolygonLightFeatureProcessor.cpp
@@ -145,7 +145,7 @@ namespace AZ::Render
// individual point as its own element instead of each array being its own element. Since all
// the arrays are stored in a contiguous vector, we can treat it as one giant array.
const LightPosition* firstPosition = m_polygonLightData.GetDataVector<1>().at(0).data();
- m_lightPolygonPointBufferHandler.UpdateBuffer(firstPosition, m_polygonLightData.GetDataCount() * MaxPolygonPoints);
+ m_lightPolygonPointBufferHandler.UpdateBuffer(firstPosition, static_cast(m_polygonLightData.GetDataCount() * MaxPolygonPoints));
}
m_deviceBufferNeedsUpdate = false;
}
diff --git a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp
index 96041dc89d..4b1a6ec7f6 100644
--- a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp
+++ b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp
@@ -65,7 +65,7 @@ namespace AZ
AZ::JobCompletion jobCompletion;
const int numThreads = 8;
- const int numPixelsPerThread = buffer->size() / numChannels / numThreads;
+ const int numPixelsPerThread = static_cast(buffer->size() / numChannels / numThreads);
for (int i = 0; i < numThreads; ++i)
{
int startPixel = i * numPixelsPerThread;
diff --git a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp
index 71f17b3361..0f8a30d8aa 100644
--- a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp
+++ b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp
@@ -162,7 +162,7 @@ namespace AZ
m_rootConstantData.SetConstant(colorOffsetIndex, m_morphInstanceMetaData.m_accumulatedColorDeltaOffsetInBytes / 4);
}
- m_dispatchItem.m_rootConstantSize = m_rootConstantData.GetConstantData().size();
+ m_dispatchItem.m_rootConstantSize = static_cast(m_rootConstantData.GetConstantData().size());
m_dispatchItem.m_rootConstants = m_rootConstantData.GetConstantData().data();
}
diff --git a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp
index 03ee176fd0..5a25951163 100644
--- a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp
+++ b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp
@@ -497,7 +497,7 @@ namespace AZ::Render
const ShadowmapAtlas& atlas = m_projectedShadowmapsPasses.front()->GetShadowmapAtlas();
const Data::Instance indexTableBuffer = atlas.CreateShadowmapIndexTableBuffer(indexTableBufferName);
- m_filterParamBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), m_shadowData.GetSize());
+ m_filterParamBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), static_cast(m_shadowData.GetSize()));
// Set index table buffer and ESM parameter buffer to ESM pass.
for (EsmShadowmapsPass* esmPass : m_esmShadowmapsPasses)
@@ -564,7 +564,7 @@ namespace AZ::Render
if (m_deviceBufferNeedsUpdate)
{
- m_shadowBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), m_shadowData.GetSize());
+ m_shadowBufferHandler.UpdateBuffer(m_shadowData.GetRawData(), static_cast(m_shadowData.GetSize()));
m_deviceBufferNeedsUpdate = false;
}
}
diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp
index de2c52d1c8..af427eb554 100644
--- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp
+++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp
@@ -446,7 +446,7 @@ namespace AZ
// Positions start at the beginning of the allocation
instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes = allocation->GetVirtualAddress().m_ptr;
- uint32_t deltaStreamSizeInBytes = vertexCount * MorphTargetConstants::s_unpackedMorphTargetDeltaSizeInBytes;
+ uint32_t deltaStreamSizeInBytes = static_cast(vertexCount * MorphTargetConstants::s_unpackedMorphTargetDeltaSizeInBytes);
// Followed by normals, tangents, and bitangents
instanceMetaData.m_accumulatedNormalDeltaOffsetInBytes = instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes + deltaStreamSizeInBytes;
diff --git a/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp b/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp
index 0a31fe4c9e..e3f3ea906b 100644
--- a/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp
+++ b/Gems/Atom/Feature/Common/Code/Tests/SparseVectorTests.cpp
@@ -81,7 +81,7 @@ namespace UnitTest
EXPECT_EQ(data.c, TestData::DefaultValueC);
// Assign new unique values
- data.a = TestData::DefaultValueA * i;
+ data.a = TestData::DefaultValueA * static_cast(i);
data.b = TestData::DefaultValueB * float(i);
data.c = i % 2 == 0;
}
@@ -190,12 +190,12 @@ namespace UnitTest
EXPECT_EQ(data.b, TestData::DefaultValueB);
EXPECT_EQ(data.c, TestData::DefaultValueC);
- data.a = TestData::DefaultValueA * i;
+ data.a = TestData::DefaultValueA * static_cast(i);
data.b = TestData::DefaultValueB * float(i);
data.c = i % 2 == 0;
// Assign some values to the uninitialized primitive types
- container.GetElement<1>(indices[i]) = i * 10;
+ container.GetElement<1>(indices[i]) = static_cast(i * 10);
container.GetElement<2>(indices[i]) = i * 20.0f;
}
@@ -254,7 +254,7 @@ namespace UnitTest
{
indices[i] = container.Reserve();
- container.GetElement<1>(i) = i * 10;
+ container.GetElement<1>(i) = static_cast(i * 10);
container.GetElement<2>(i) = i * 20.0f;
}
diff --git a/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp b/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp
index 7461a7c3e8..a9e08249c4 100644
--- a/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp
+++ b/Gems/Atom/RHI/Code/Source/RHI/ShaderResourceGroupData.cpp
@@ -139,7 +139,7 @@ namespace AZ
bool isValidAll = true;
for (size_t i = 0; i < imageViews.size(); ++i)
{
- const bool isValid = ValidateImageViewAccess(inputIndex, imageViews[i], i);
+ const bool isValid = ValidateImageViewAccess(inputIndex, imageViews[i], static_cast(i));
if (isValid)
{
m_imageViewsUnboundedArray.push_back(imageViews[i]);
@@ -185,7 +185,7 @@ namespace AZ
bool isValidAll = true;
for (size_t i = 0; i < bufferViews.size(); ++i)
{
- const bool isValid = ValidateBufferViewAccess(inputIndex, bufferViews[i], i);
+ const bool isValid = ValidateBufferViewAccess(inputIndex, bufferViews[i], static_cast(i));
if (isValid)
{
m_bufferViewsUnboundedArray.push_back(bufferViews[i]);
diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp
index 7437c3b339..d51fdd3495 100644
--- a/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp
+++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/ShaderResourceGroupPool.cpp
@@ -356,7 +356,7 @@ namespace AZ
if (!bufferViews.empty())
{
- group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, bufferViews.size());
+ group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, static_cast(bufferViews.size()));
AZ_Assert(group.m_unboundedDescriptorTables[tableIndex].IsValid(), "Descriptor context failed to allocate unbounded array descriptor table, most likely out of memory.");
ShaderResourceGroupCompiledData& compiledData = group.m_compiledData[group.m_compiledDataIndex];
@@ -415,7 +415,7 @@ namespace AZ
if (!imageViews.empty())
{
- group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, imageViews.size());
+ group.m_unboundedDescriptorTables[tableIndex] = m_descriptorContext->CreateDescriptorTable(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, static_cast(imageViews.size()));
AZ_Assert(group.m_unboundedDescriptorTables[tableIndex].IsValid(), "Descriptor context failed to allocate unbounded array descriptor table, most likely out of memory.");
ShaderResourceGroupCompiledData& compiledData = group.m_compiledData[group.m_compiledDataIndex];
diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp
index b4c153a38c..33623f93e4 100644
--- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp
+++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RayTracingPipelineState.cpp
@@ -163,9 +163,9 @@ namespace AZ
createInfo.sType = VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0;
- createInfo.stageCount = stages.size();
+ createInfo.stageCount = static_cast(stages.size());
createInfo.pStages = stages.data();
- createInfo.groupCount = groups.size();
+ createInfo.groupCount = static_cast(groups.size());
createInfo.pGroups = groups.data();
createInfo.maxPipelineRayRecursionDepth = descriptor->GetConfiguration().m_maxRecursionDepth;
createInfo.layout = m_pipelineLayout;
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp
index 7100b2cd48..fb8708fb88 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp
@@ -109,7 +109,7 @@ namespace AZ
if (auto* serialize = azrtti_cast(context))
{
serialize->Class()
- ->Version(29); // (updated to separate material slot ID from default material asset)
+ ->Version(30); // (updated to separate material slot ID from default material asset)
}
}
@@ -882,7 +882,7 @@ namespace AZ
processedMorphTargets = true;
}
- totalVertexCount += vertexCount;
+ totalVertexCount += static_cast(vertexCount);
productMeshList.emplace_back(productMesh);
}
}
@@ -960,7 +960,7 @@ namespace AZ
for (const auto& skinData : sourceMesh.m_skinData)
{
const size_t numJoints = skinData->GetBoneCount();
- const AZ::u32 controlPointIndex = sourceMeshData->GetControlPointIndex(vertexIndex);
+ const AZ::u32 controlPointIndex = sourceMeshData->GetControlPointIndex(static_cast(vertexIndex));
const size_t numSkinInfluences = skinData->GetLinkCount(controlPointIndex);
size_t numInfluencesExcess = 0;
@@ -1195,15 +1195,15 @@ namespace AZ
mesh.m_skinWeights.size(), m_numSkinJointInfluencesPerVertex, m_numSkinJointInfluencesPerVertex);
const size_t numSkinInfluences = mesh.m_skinWeights.size();
- uint32_t jointIndicesSizeInBytes = numSkinInfluences * sizeof(uint16_t);
+ uint32_t jointIndicesSizeInBytes = static_cast(numSkinInfluences * sizeof(uint16_t));
meshView.m_skinJointIndicesView = RHI::BufferViewDescriptor::CreateRaw(0, jointIndicesSizeInBytes);
- meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(0, numSkinInfluences, SkinWeightFormat);
+ meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(0, static_cast(numSkinInfluences), SkinWeightFormat);
}
if (!mesh.m_morphTargetVertexData.empty())
{
const size_t numTotalVertices = mesh.m_morphTargetVertexData.size();
- meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(0, numTotalVertices, sizeof(PackedCompressedMorphTargetDelta));
+ meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(0, static_cast(numTotalVertices), sizeof(PackedCompressedMorphTargetDelta));
}
if (!mesh.m_clothData.empty())
@@ -1358,8 +1358,8 @@ namespace AZ
const size_t numPrevSkinInfluences = lodBufferInfo.m_skinInfluencesCount;
const size_t numNewSkinInfluences = mesh.m_skinWeights.size();
- meshView.m_skinJointIndicesView = RHI::BufferViewDescriptor::CreateRaw(/*byteOffset=*/numPrevSkinInfluences * sizeof(uint16_t), numNewSkinInfluences * sizeof(uint16_t));
- meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(/*elementOffset=*/numPrevSkinInfluences, numNewSkinInfluences, SkinWeightFormat);
+ meshView.m_skinJointIndicesView = RHI::BufferViewDescriptor::CreateRaw(/*byteOffset=*/ static_cast(numPrevSkinInfluences * sizeof(uint16_t)), static_cast(numNewSkinInfluences * sizeof(uint16_t)));
+ meshView.m_skinWeightsView = RHI::BufferViewDescriptor::CreateTyped(/*elementOffset=*/ static_cast(numPrevSkinInfluences), static_cast(numNewSkinInfluences), SkinWeightFormat);
lodBufferInfo.m_skinInfluencesCount += numNewSkinInfluences;
}
@@ -1369,7 +1369,7 @@ namespace AZ
const size_t numPrevVertexDeltas = lodBufferInfo.m_morphTargetVertexDeltaCount;
const size_t numNewVertexDeltas = mesh.m_morphTargetVertexData.size();
- meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(/*elementOffset=*/numPrevVertexDeltas, numNewVertexDeltas, sizeof(PackedCompressedMorphTargetDelta));
+ meshView.m_morphTargetVertexDataView = RHI::BufferViewDescriptor::CreateStructured(/*elementOffset=*/ static_cast(numPrevVertexDeltas), static_cast(numNewVertexDeltas), sizeof(PackedCompressedMorphTargetDelta));
lodBufferInfo.m_morphTargetVertexDeltaCount += numNewVertexDeltas;
}
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp
index fefe835ee9..0a1fb49ab5 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp
@@ -110,8 +110,8 @@ namespace AZ::RPI
{
AZ::Aabb meshAabb = AZ::Aabb::CreateNull();
- const size_t numVertices = mesh.m_meshData->GetVertexCount();
- for (size_t i = 0; i < numVertices; ++i)
+ const unsigned int numVertices = static_cast(mesh.m_meshData->GetVertexCount());
+ for (unsigned int i = 0; i < numVertices; ++i)
{
meshAabb.AddPoint(mesh.m_meshData->GetPosition(i));
}
@@ -164,7 +164,7 @@ namespace AZ::RPI
blendShapeName.c_str(), numVertices, sourceMesh.m_meshData->GetVertexCount());
// The start index is after any previously added deltas
- metaData.m_startIndex = aznumeric_caster(packedCompressedMorphTargetVertexData.size());
+ metaData.m_startIndex = aznumeric_cast(packedCompressedMorphTargetVertexData.size());
// Multiply normal by inverse transpose to avoid incorrect values produced by non-uniformly scaled transforms.
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/PipelineState.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/PipelineState.cpp
index ba9e6b20ed..8e0aa62554 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Public/PipelineState.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Public/PipelineState.cpp
@@ -172,7 +172,7 @@ namespace AZ
}
m_pipelineState = m_shader->AcquirePipelineState(descriptor);
- }
+ }
m_dirty = false;
}
return m_pipelineState;
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp
index 071a07ecda..02a03ee853 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp
@@ -782,7 +782,7 @@ namespace AZ
pipelineStateList.push_back();
pipelineStateList[size].m_multisampleState = rasterPass->GetMultisampleState();
pipelineStateList[size].m_renderAttachmentConfiguration = rasterPass->GetRenderAttachmentConfiguration();
- rasterPass->SetPipelineStateDataIndex(size);
+ rasterPass->SetPipelineStateDataIndex(static_cast(size));
}
}
}
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp
index 1436e62d7f..f2d82918ea 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp
@@ -516,7 +516,7 @@ namespace AZ
SupervariantIndex ShaderAsset::GetSupervariantIndexInternal(AZ::Name supervariantName) const
{
const auto& supervariants = GetCurrentShaderApiData().m_supervariants;
- const uint32_t supervariantCount = supervariants.size();
+ const uint32_t supervariantCount = static_cast(supervariants.size());
for (uint32_t index = 0; index < supervariantCount; ++index)
{
if (supervariants[index].m_name == supervariantName)
diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp
index 368fb2c3c6..21f3239698 100644
--- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp
+++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp
@@ -1045,23 +1045,23 @@ namespace UnitTest
lodCreator.SetMeshMaterialSlot(AZ::Sfmt::GetInstance().Rand32());
{
- AZ::Data::Asset indexBuffer = BuildTestBuffer(indicesCount, sizeof(uint32_t));
+ AZ::Data::Asset indexBuffer = BuildTestBuffer(static_cast(indicesCount), sizeof(uint32_t));
AZStd::copy(indices, indices + indicesCount, reinterpret_cast(const_cast(indexBuffer->GetBuffer().data())));
lodCreator.SetMeshIndexBuffer({
indexBuffer,
- AZ::RHI::BufferViewDescriptor::CreateStructured(0, indicesCount, sizeof(uint32_t))
+ AZ::RHI::BufferViewDescriptor::CreateStructured(0, static_cast(indicesCount), sizeof(uint32_t))
});
}
{
- AZ::Data::Asset positionBuffer = BuildTestBuffer(positionCount / 3, sizeof(float) * 3);
+ AZ::Data::Asset positionBuffer = BuildTestBuffer(static_cast(positionCount / 3), sizeof(float) * 3);
AZStd::copy(positions, positions + positionCount, reinterpret_cast(const_cast(positionBuffer->GetBuffer().data())));
lodCreator.AddMeshStreamBuffer(
AZ::RHI::ShaderSemantic(AZ::Name("POSITION")),
AZ::Name(),
{
positionBuffer,
- AZ::RHI::BufferViewDescriptor::CreateStructured(0, positionCount / 3, sizeof(float) * 3)
+ AZ::RHI::BufferViewDescriptor::CreateStructured(0, static_cast(positionCount / 3), sizeof(float) * 3)
}
);
}
diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h
index 1d2ccc07e1..e6a666c640 100644
--- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h
+++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h
@@ -16,37 +16,62 @@
namespace AtomToolsFramework
{
- class ModernViewportCameraControllerInstance;
+ class ModularViewportCameraControllerInstance;
+
+ //! A function object to represent returning a camera controller priority.
+ using CameraControllerPriorityFn =
+ AZStd::function;
+
+ //! The default behavior for what priority the camera controller should respond to events at.
+ //! @note This can change based on the state of the camera controller/system.
+ AzFramework::ViewportControllerPriority DefaultCameraControllerPriority(const AzFramework::CameraSystem& cameraSystem);
+
+ //! Builder class to create and configure a ModularViewportCameraControllerInstance.
class ModularViewportCameraController
: public AzFramework::MultiViewportController<
- ModernViewportCameraControllerInstance, AzFramework::ViewportControllerPriority::DispatchToAllPriorities>
+ ModularViewportCameraControllerInstance,
+ AzFramework::ViewportControllerPriority::DispatchToAllPriorities>
{
public:
+ friend ModularViewportCameraControllerInstance;
+
using CameraListBuilder = AZStd::function;
using CameraPropsBuilder = AZStd::function;
+ using CameraPriorityBuilder = AZStd::function;
- //! Sets the camera list builder callback used to populate new ModernViewportCameraControllerInstances
+ //! Sets the camera list builder callback used to populate new ModularViewportCameraControllerInstances.
void SetCameraListBuilderCallback(const CameraListBuilder& builder);
- //! Sets the camera props builder callback used to populate new ModernViewportCameraControllerInstances
+ //! Sets the camera props builder callback used to populate new ModularViewportCameraControllerInstances.
void SetCameraPropsBuilderCallback(const CameraPropsBuilder& builder);
- //! Sets up a camera list based on this controller's CameraListBuilderCallback
- void SetupCameras(AzFramework::Cameras& cameras);
- //! Sets up properties shared across all cameras
- void SetupCameraProperies(AzFramework::CameraProps& cameraProps);
+ //! Sets the camera controller priority builder callback used to populate new ModularViewportCameraControllerInstances.
+ void SetCameraPriorityBuilderCallback(const CameraPriorityBuilder& builder);
private:
+ //! Sets up a camera list based on this controller's CameraListBuilderCallback.
+ void SetupCameras(AzFramework::Cameras& cameras);
+ //! Sets up properties shared across all cameras.
+ void SetupCameraProperties(AzFramework::CameraProps& cameraProps);
+ //! Sets up how the camera controller should decide at what priority level to respond to.
+ void SetupCameraControllerPriority(CameraControllerPriorityFn& cameraPriorityFn);
+
+ //! Builder to generate a list of CameraInputs to run in the ModularViewportCameraControllerInstance.
CameraListBuilder m_cameraListBuilder;
+ //! Builder to define custom camera properties to use for things such as rotate and translate interpolation.
CameraPropsBuilder m_cameraPropsBuilder;
+ //! Builder to define what priority level the camera controller should respond to events at.
+ CameraPriorityBuilder m_cameraControllerPriorityBuilder;
};
- class ModernViewportCameraControllerInstance final
- : public AzFramework::MultiViewportControllerInstanceInterface,
- public ModularViewportCameraControllerRequestBus::Handler,
- private AzFramework::ViewportDebugDisplayEventBus::Handler
+ //! A customizable camera controller that can be configured to run a varying set of CameraInput instances.
+ //! The controller can also be animated from its current transform to a new translation and orientation.
+ class ModularViewportCameraControllerInstance final
+ : public AzFramework::MultiViewportControllerInstanceInterface
+ , public ModularViewportCameraControllerRequestBus::Handler
+ , private AzFramework::ViewportDebugDisplayEventBus::Handler
{
public:
- explicit ModernViewportCameraControllerInstance(AzFramework::ViewportId viewportId, ModularViewportCameraController* controller);
- ~ModernViewportCameraControllerInstance() override;
+ explicit ModularViewportCameraControllerInstance(AzFramework::ViewportId viewportId, ModularViewportCameraController* controller);
+ ~ModularViewportCameraControllerInstance() override;
// MultiViewportControllerInstanceInterface overrides ...
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
@@ -60,25 +85,35 @@ namespace AtomToolsFramework
// AzFramework::ViewportDebugDisplayEventBus overrides ...
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
+ //! The current mode the camera controller is in.
enum class CameraMode
{
- Control,
- Animation
+ Control, //!< The camera is being driven by user input.
+ Animation //!< The camera is being animated (interpolated) from one transform to another.
};
- AzFramework::Camera m_camera;
- AzFramework::Camera m_targetCamera;
- AzFramework::CameraSystem m_cameraSystem;
- AzFramework::CameraProps m_cameraProps;
+ //! Encapsulates an animation (interpolation) between two transforms.
+ struct CameraAnimation
+ {
+ //! The transform of the camera at the start of the animation.
+ AZ::Transform m_transformStart = AZ::Transform::CreateIdentity();
+ AZ::Transform m_transformEnd = AZ::Transform::CreateIdentity(); //!< The transform of the camera at the end of the animation.
+ float m_time = 0.0f; //!< The interpolation amount between the start and end transforms (in the range 0.0 - 1.0).
+ };
- AZ::Transform m_transformStart = AZ::Transform::CreateIdentity();
- AZ::Transform m_transformEnd = AZ::Transform::CreateIdentity();
- float m_animationT = 0.0f;
- CameraMode m_cameraMode = CameraMode::Control;
+ AzFramework::Camera m_camera; //!< The current camera state (pitch/yaw/position/look-distance).
+ AzFramework::Camera m_targetCamera; //!< The target (next) camera state that m_camera is catching up to.
+ AzFramework::CameraSystem m_cameraSystem; //!< The camera system responsible for managing all CameraInputs.
+ AzFramework::CameraProps m_cameraProps; //!< Camera properties to control rotate and translate smoothness.
+ CameraControllerPriorityFn m_priorityFn; //!< Controls at what priority the camera controller should respond to events.
+
+ CameraAnimation m_cameraAnimation; //!< Camera animation state (used during CameraMode::Animation).
+ CameraMode m_cameraMode = CameraMode::Control; //!< The current mode the camera is operating in.
AZStd::optional m_lookAtAfterInterpolation; //!< The look at point after an interpolation has finished.
//!< Will be cleared when the view changes (camera looks away).
- bool m_updatingTransform = false;
-
+ //! Flag to prevent circular updates of the camera transform (while the viewport transform is being updated internally).
+ bool m_updatingTransformInternally = false;
+ //! Listen for camera view changes outside of the camera controller.
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
};
} // namespace AtomToolsFramework
diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp
index 3a542db1a4..3d9219edc5 100644
--- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp
+++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp
@@ -87,14 +87,12 @@ namespace AtomToolsFramework
if (auto behaviorContext = azrtti_cast(context))
{
- auto targetName = GetBuildTargetName();
-
// this will put these methods into the 'azlmbr.AtomTools.general' module
- auto addGeneral = [targetName](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
+ auto addGeneral = [](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
{
methodBuilder->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
->Attribute(AZ::Script::Attributes::Category, "Editor")
- ->Attribute(AZ::Script::Attributes::Module, targetName);
+ ->Attribute(AZ::Script::Attributes::Module, "atomtools.general");
};
// The reflection here is based on patterns in CryEditPythonHandler::Reflect
addGeneral(behaviorContext->Method(
diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp
index 10cfa059aa..e98df83930 100644
--- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp
+++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp
@@ -68,6 +68,11 @@ namespace AtomToolsFramework
m_cameraPropsBuilder = builder;
}
+ void ModularViewportCameraController::SetCameraPriorityBuilderCallback(const CameraPriorityBuilder& builder)
+ {
+ m_cameraControllerPriorityBuilder = builder;
+ }
+
void ModularViewportCameraController::SetupCameras(AzFramework::Cameras& cameras)
{
if (m_cameraListBuilder)
@@ -76,7 +81,7 @@ namespace AtomToolsFramework
}
}
- void ModularViewportCameraController::SetupCameraProperies(AzFramework::CameraProps& cameraProps)
+ void ModularViewportCameraController::SetupCameraProperties(AzFramework::CameraProps& cameraProps)
{
if (m_cameraPropsBuilder)
{
@@ -84,18 +89,43 @@ namespace AtomToolsFramework
}
}
- ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(
+ void ModularViewportCameraController::SetupCameraControllerPriority(CameraControllerPriorityFn& cameraPriorityFn)
+ {
+ if (m_cameraControllerPriorityBuilder)
+ {
+ m_cameraControllerPriorityBuilder(cameraPriorityFn);
+ }
+ }
+
+ // what priority should the camera system respond to
+ AzFramework::ViewportControllerPriority DefaultCameraControllerPriority(const AzFramework::CameraSystem& cameraSystem)
+ {
+ // ModernViewportCameraControllerInstance receives events at all priorities, when it is in 'exclusive' mode
+ // or it is actively handling events (essentially when the camera system is 'active' and responding to inputs)
+ // it should only respond to the highest priority
+ if (cameraSystem.m_cameras.Exclusive() || cameraSystem.HandlingEvents())
+ {
+ return AzFramework::ViewportControllerPriority::Highest;
+ }
+
+ // otherwise it should only respond to normal priority events
+ return AzFramework::ViewportControllerPriority::Normal;
+ }
+
+ ModularViewportCameraControllerInstance::ModularViewportCameraControllerInstance(
const AzFramework::ViewportId viewportId, ModularViewportCameraController* controller)
: MultiViewportControllerInstanceInterface(viewportId, controller)
{
controller->SetupCameras(m_cameraSystem.m_cameras);
- controller->SetupCameraProperies(m_cameraProps);
+ controller->SetupCameraProperties(m_cameraProps);
+ controller->SetupCameraControllerPriority(m_priorityFn);
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
{
auto handleCameraChange = [this, viewportContext](const AZ::Matrix4x4&)
{
- if (!m_updatingTransform)
+ // ignore these updates if the camera is being updated internally
+ if (!m_updatingTransformInternally)
{
UpdateCameraFromTransform(m_targetCamera, viewportContext->GetCameraTransform());
m_camera = m_targetCamera;
@@ -111,30 +141,15 @@ namespace AtomToolsFramework
ModularViewportCameraControllerRequestBus::Handler::BusConnect(viewportId);
}
- ModernViewportCameraControllerInstance::~ModernViewportCameraControllerInstance()
+ ModularViewportCameraControllerInstance::~ModularViewportCameraControllerInstance()
{
ModularViewportCameraControllerRequestBus::Handler::BusDisconnect();
AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
}
- // what priority should the camera system respond to
- static AzFramework::ViewportControllerPriority GetPriority(const AzFramework::CameraSystem& cameraSystem)
+ bool ModularViewportCameraControllerInstance::HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event)
{
- // ModernViewportCameraControllerInstance receives events at all priorities, when it is in 'exclusive' mode
- // or it is actively handling events (essentially when the camera system is 'active' and responding to inputs)
- // it should only respond to the highest priority
- if (cameraSystem.m_cameras.Exclusive() || cameraSystem.HandlingEvents())
- {
- return AzFramework::ViewportControllerPriority::Highest;
- }
-
- // otherwise it should only respond to normal priority events
- return AzFramework::ViewportControllerPriority::Normal;
- }
-
- bool ModernViewportCameraControllerInstance::HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event)
- {
- if (event.m_priority == GetPriority(m_cameraSystem))
+ if (event.m_priority == m_priorityFn(m_cameraSystem))
{
return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel));
}
@@ -142,7 +157,7 @@ namespace AtomToolsFramework
return false;
}
- void ModernViewportCameraControllerInstance::UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event)
+ void ModularViewportCameraControllerInstance::UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event)
{
// only update for a single priority (normal is the default)
if (event.m_priority != AzFramework::ViewportControllerPriority::Normal)
@@ -152,7 +167,7 @@ namespace AtomToolsFramework
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
{
- m_updatingTransform = true;
+ m_updatingTransformInternally = true;
if (m_cameraMode == CameraMode::Control)
{
@@ -180,10 +195,12 @@ namespace AtomToolsFramework
return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f);
};
- const float transitionT = smootherStepFn(m_animationT);
+ const auto& [transformStart, transformEnd, animationTime] = m_cameraAnimation;
+
+ const float transitionTime = smootherStepFn(animationTime);
const AZ::Transform current = AZ::Transform::CreateFromQuaternionAndTranslation(
- m_transformStart.GetRotation().Slerp(m_transformEnd.GetRotation(), transitionT),
- m_transformStart.GetTranslation().Lerp(m_transformEnd.GetTranslation(), transitionT));
+ transformStart.GetRotation().Slerp(transformEnd.GetRotation(), transitionTime),
+ transformStart.GetTranslation().Lerp(transformEnd.GetTranslation(), transitionTime));
const AZ::Vector3 eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromTransform(current));
m_camera.m_pitch = eulerAngles.GetX();
@@ -191,21 +208,21 @@ namespace AtomToolsFramework
m_camera.m_lookAt = current.GetTranslation();
m_targetCamera = m_camera;
- if (m_animationT >= 1.0f)
+ if (animationTime >= 1.0f)
{
m_cameraMode = CameraMode::Control;
}
- m_animationT = AZ::GetClamp(m_animationT + event.m_deltaTime.count(), 0.0f, 1.0f);
+ m_cameraAnimation.m_time = AZ::GetClamp(animationTime + event.m_deltaTime.count(), 0.0f, 1.0f);
viewportContext->SetCameraTransform(current);
}
- m_updatingTransform = false;
+ m_updatingTransformInternally = false;
}
}
- void ModernViewportCameraControllerInstance::DisplayViewport(
+ void ModularViewportCameraControllerInstance::DisplayViewport(
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
{
if (const float alpha = AZStd::min(-m_camera.m_lookDist / 5.0f, 1.0f); alpha > AZ::Constants::FloatEpsilon)
@@ -216,16 +233,14 @@ namespace AtomToolsFramework
}
}
- void ModernViewportCameraControllerInstance::InterpolateToTransform(const AZ::Transform& worldFromLocal, const float lookAtDistance)
+ void ModularViewportCameraControllerInstance::InterpolateToTransform(const AZ::Transform& worldFromLocal, const float lookAtDistance)
{
- m_animationT = 0.0f;
m_cameraMode = CameraMode::Animation;
- m_transformStart = m_camera.Transform();
- m_transformEnd = worldFromLocal;
- m_lookAtAfterInterpolation = m_transformEnd.GetTranslation() + m_transformEnd.GetBasisY() * lookAtDistance;
+ m_cameraAnimation = CameraAnimation{ m_camera.Transform(), worldFromLocal, 0.0f };
+ m_lookAtAfterInterpolation = worldFromLocal.GetTranslation() + worldFromLocal.GetBasisY() * lookAtDistance;
}
- AZStd::optional ModernViewportCameraControllerInstance::LookAtAfterInterpolation() const
+ AZStd::optional ModularViewportCameraControllerInstance::LookAtAfterInterpolation() const
{
return m_lookAtAfterInterpolation;
}
diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp
index 0977694b90..6f1bdfb083 100644
--- a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp
+++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp
@@ -9,7 +9,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -28,11 +27,11 @@
#include
-#include
#include
#include
#include
+#include