Merge branch 'main' into sc_automation_del_searchtext
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icons / Toolbar / Non Uniform Scaling</title>
|
||||
<defs>
|
||||
<rect id="path-1" x="3" y="3" width="18" height="18"></rect>
|
||||
<mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="18" height="18" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
</defs>
|
||||
<g id="Icons-/-Toolbar-/-Non-Uniform-Scaling" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group">
|
||||
<rect id="Icon-Background" x="0" y="0" width="24" height="24"></rect>
|
||||
<g id="Group-3" transform="translate(4.644661, 5.000000)" fill="#65C98C">
|
||||
<rect id="Rectangle" x="3.16582489" y="1.21320344" width="1.95262146" height="5"></rect>
|
||||
<polygon id="Rectangle" points="4.14213562 -1.71418435e-13 8.28427125 4.14213562 -1.11910481e-13 4.14213562"></polygon>
|
||||
</g>
|
||||
<g id="Group-4" transform="translate(13.073593, 10.857864)" fill="#65C98C">
|
||||
<g id="Group-2" transform="translate(0.000000, 0.000000)">
|
||||
<rect id="Rectangle" x="0" y="3.16582489" width="4" height="1.95262146"></rect>
|
||||
<polygon id="Rectangle" points="5.71320344 4.14213562 1.57106781 8.28427125 1.57106781 1.14575016e-13"></polygon>
|
||||
</g>
|
||||
</g>
|
||||
<rect id="Rectangle" stroke="#65C98C" fill="#65C98C" x="3.5" y="12.5" width="8" height="8"></rect>
|
||||
<use id="Rectangle" stroke="#65C98C" mask="url(#mask-2)" stroke-width="2" stroke-dasharray="1" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -53,5 +53,6 @@ set(GEM_DEPENDENCIES
|
||||
Gem::ImguiAtom
|
||||
Gem::Atom_AtomBridge
|
||||
Gem::AtomFont
|
||||
Gem::NvCloth
|
||||
Gem::Blast
|
||||
)
|
||||
|
||||
@@ -68,5 +68,6 @@ set(GEM_DEPENDENCIES
|
||||
Gem::ImguiAtom
|
||||
Gem::AtomFont
|
||||
Gem::AtomToolsFramework.Editor
|
||||
Gem::NvCloth.Editor
|
||||
Gem::Blast.Editor
|
||||
)
|
||||
|
||||
@@ -107,20 +107,21 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
endif()
|
||||
|
||||
## NvCloth ##
|
||||
# [TODO LYN-1928] Enable when AutomatedTesting runs with Atom
|
||||
#if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
# ly_add_pytest(
|
||||
# NAME AutomatedTesting::NvClothTests
|
||||
# TEST_SUITE main
|
||||
# TEST_SERIAL
|
||||
# PATH ${CMAKE_CURRENT_LIST_DIR}/NvCloth/TestSuite_Active.py
|
||||
# TIMEOUT 1500
|
||||
# RUNTIME_DEPENDENCIES
|
||||
# Legacy::Editor
|
||||
# AZ::AssetProcessor
|
||||
# AutomatedTesting.Assets
|
||||
# )
|
||||
#endif()
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::NvClothTests_Main
|
||||
TEST_SUITE main
|
||||
TEST_SERIAL
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/NvCloth/TestSuite_Active.py
|
||||
TIMEOUT 1500
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::Editor
|
||||
AZ::AssetProcessor
|
||||
AutomatedTesting.Assets
|
||||
COMPONENT
|
||||
NvCloth
|
||||
)
|
||||
endif()
|
||||
|
||||
## Editor Python Bindings ##
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
|
||||
+5
-2
@@ -20,7 +20,7 @@ class Tests:
|
||||
exit_game_mode = ("Exited game mode", "Failed to exit game mode")
|
||||
# fmt: on
|
||||
|
||||
def run():
|
||||
def C18977329_NvCloth_AddClothSimulationToMesh():
|
||||
"""
|
||||
Summary:
|
||||
Load level with Entity having Mesh and Cloth components already setup. Verify that editor remains stable in Game mode.
|
||||
@@ -89,4 +89,7 @@ def run():
|
||||
helper.close_editor()
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
import ImportPathHelper as imports
|
||||
imports.init()
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(C18977329_NvCloth_AddClothSimulationToMesh)
|
||||
|
||||
+5
-2
@@ -20,7 +20,7 @@ class Tests:
|
||||
exit_game_mode = ("Exited game mode", "Failed to exit game mode")
|
||||
# fmt: on
|
||||
|
||||
def run():
|
||||
def C18977330_NvCloth_AddClothSimulationToActor():
|
||||
"""
|
||||
Summary:
|
||||
Load level with Entity having Actor and Cloth components already setup. Verify that editor remains stable in Game mode.
|
||||
@@ -89,4 +89,7 @@ def run():
|
||||
helper.close_editor()
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
import ImportPathHelper as imports
|
||||
imports.init()
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(C18977330_NvCloth_AddClothSimulationToActor)
|
||||
|
||||
@@ -21,14 +21,15 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesti
|
||||
|
||||
from base import TestAutomationBase
|
||||
|
||||
@pytest.mark.SUITE_main
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(TestAutomationBase):
|
||||
@pytest.mark.xfail(reason="Running with atom null renderer is causing this test to fail")
|
||||
def test_C18977329_NvCloth_AddClothSimulationToMesh(self, request, workspace, editor, launcher_platform):
|
||||
from . import C18977329_NvCloth_AddClothSimulationToMesh as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.xfail(reason="Running with atom null renderer is causing this test to fail")
|
||||
def test_C18977330_NvCloth_AddClothSimulationToActor(self, request, workspace, editor, launcher_platform):
|
||||
from . import C18977330_NvCloth_AddClothSimulationToActor as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@@ -27,6 +27,155 @@ TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
|
||||
@pytest.mark.parametrize("level", ["auto_test"])
|
||||
class TestAtomEditorComponentsMain(object):
|
||||
|
||||
# It requires at least one test
|
||||
def test_Dummy(self, request, editor, level, workspace, project, launcher_platform):
|
||||
pass
|
||||
@pytest.mark.test_case_id(
|
||||
"C32078130", # Display Mapper
|
||||
"C32078129", # Light
|
||||
"C32078131", # Radius Weight Modifier
|
||||
"C32078127", # PostFX Layer
|
||||
"C32078125", # Physical Sky
|
||||
"C32078115", # Global Skylight (IBL)
|
||||
"C32078121", # Exposure Control
|
||||
"C32078120", # Directional Light
|
||||
"C32078119", # DepthOfField
|
||||
"C32078118") # Decal (Atom)
|
||||
def test_AtomEditorComponents_AddedToEntity(self, request, editor, level, workspace, project, launcher_platform):
|
||||
cfg_args = [level]
|
||||
|
||||
expected_lines = [
|
||||
# Decal (Atom) Component
|
||||
"Decal (Atom) Entity successfully created",
|
||||
"Decal (Atom)_test: Component added to the entity: True",
|
||||
"Decal (Atom)_test: Component removed after UNDO: True",
|
||||
"Decal (Atom)_test: Component added after REDO: True",
|
||||
"Decal (Atom)_test: Entered game mode: True",
|
||||
"Decal (Atom)_test: Exit game mode: True",
|
||||
"Decal (Atom) Controller|Configuration|Material: SUCCESS",
|
||||
"Decal (Atom)_test: Entity is hidden: True",
|
||||
"Decal (Atom)_test: Entity is shown: True",
|
||||
"Decal (Atom)_test: Entity deleted: True",
|
||||
"Decal (Atom)_test: UNDO entity deletion works: True",
|
||||
"Decal (Atom)_test: REDO entity deletion works: True",
|
||||
# DepthOfField Component
|
||||
"DepthOfField Entity successfully created",
|
||||
"DepthOfField_test: Component added to the entity: True",
|
||||
"DepthOfField_test: Component removed after UNDO: True",
|
||||
"DepthOfField_test: Component added after REDO: True",
|
||||
"DepthOfField_test: Entered game mode: True",
|
||||
"DepthOfField_test: Exit game mode: True",
|
||||
"DepthOfField_test: Entity disabled initially: True",
|
||||
"DepthOfField_test: Entity enabled after adding required components: True",
|
||||
"DepthOfField Controller|Configuration|Camera Entity: SUCCESS",
|
||||
"DepthOfField_test: Entity is hidden: True",
|
||||
"DepthOfField_test: Entity is shown: True",
|
||||
"DepthOfField_test: Entity deleted: True",
|
||||
"DepthOfField_test: UNDO entity deletion works: True",
|
||||
"DepthOfField_test: REDO entity deletion works: True",
|
||||
# Exposure Control Component
|
||||
"Exposure Control Entity successfully created",
|
||||
"Exposure Control_test: Component added to the entity: True",
|
||||
"Exposure Control_test: Component removed after UNDO: True",
|
||||
"Exposure Control_test: Component added after REDO: True",
|
||||
"Exposure Control_test: Entered game mode: True",
|
||||
"Exposure Control_test: Exit game mode: True",
|
||||
"Exposure Control_test: Entity disabled initially: True",
|
||||
"Exposure Control_test: Entity enabled after adding required components: True",
|
||||
"Exposure Control_test: Entity is hidden: True",
|
||||
"Exposure Control_test: Entity is shown: True",
|
||||
"Exposure Control_test: Entity deleted: True",
|
||||
"Exposure Control_test: UNDO entity deletion works: True",
|
||||
"Exposure Control_test: REDO entity deletion works: True",
|
||||
# Global Skylight (IBL) Component
|
||||
"Global Skylight (IBL) Entity successfully created",
|
||||
"Global Skylight (IBL)_test: Component added to the entity: True",
|
||||
"Global Skylight (IBL)_test: Component removed after UNDO: True",
|
||||
"Global Skylight (IBL)_test: Component added after REDO: True",
|
||||
"Global Skylight (IBL)_test: Entered game mode: True",
|
||||
"Global Skylight (IBL)_test: Exit game mode: True",
|
||||
"Global Skylight (IBL) Controller|Configuration|Diffuse Image: SUCCESS",
|
||||
"Global Skylight (IBL) Controller|Configuration|Specular Image: SUCCESS",
|
||||
"Global Skylight (IBL)_test: Entity is hidden: True",
|
||||
"Global Skylight (IBL)_test: Entity is shown: True",
|
||||
"Global Skylight (IBL)_test: Entity deleted: True",
|
||||
"Global Skylight (IBL)_test: UNDO entity deletion works: True",
|
||||
"Global Skylight (IBL)_test: REDO entity deletion works: True",
|
||||
# Physical Sky Component
|
||||
"Physical Sky Entity successfully created",
|
||||
"Physical Sky component was added to entity",
|
||||
"Entity has a Physical Sky component",
|
||||
"Physical Sky_test: Component added to the entity: True",
|
||||
"Physical Sky_test: Component removed after UNDO: True",
|
||||
"Physical Sky_test: Component added after REDO: True",
|
||||
"Physical Sky_test: Entered game mode: True",
|
||||
"Physical Sky_test: Exit game mode: True",
|
||||
"Physical Sky_test: Entity is hidden: True",
|
||||
"Physical Sky_test: Entity is shown: True",
|
||||
"Physical Sky_test: Entity deleted: True",
|
||||
"Physical Sky_test: UNDO entity deletion works: True",
|
||||
"Physical Sky_test: REDO entity deletion works: True",
|
||||
# PostFX Layer Component
|
||||
"PostFX Layer Entity successfully created",
|
||||
"PostFX Layer_test: Component added to the entity: True",
|
||||
"PostFX Layer_test: Component removed after UNDO: True",
|
||||
"PostFX Layer_test: Component added after REDO: True",
|
||||
"PostFX Layer_test: Entered game mode: True",
|
||||
"PostFX Layer_test: Exit game mode: True",
|
||||
"PostFX Layer_test: Entity is hidden: True",
|
||||
"PostFX Layer_test: Entity is shown: True",
|
||||
"PostFX Layer_test: Entity deleted: True",
|
||||
"PostFX Layer_test: UNDO entity deletion works: True",
|
||||
"PostFX Layer_test: REDO entity deletion works: True",
|
||||
# Radius Weight Modifier Component
|
||||
"Radius Weight Modifier Entity successfully created",
|
||||
"Radius Weight Modifier_test: Component added to the entity: True",
|
||||
"Radius Weight Modifier_test: Component removed after UNDO: True",
|
||||
"Radius Weight Modifier_test: Component added after REDO: True",
|
||||
"Radius Weight Modifier_test: Entered game mode: True",
|
||||
"Radius Weight Modifier_test: Exit game mode: True",
|
||||
"Radius Weight Modifier_test: Entity is hidden: True",
|
||||
"Radius Weight Modifier_test: Entity is shown: True",
|
||||
"Radius Weight Modifier_test: Entity deleted: True",
|
||||
"Radius Weight Modifier_test: UNDO entity deletion works: True",
|
||||
"Radius Weight Modifier_test: REDO entity deletion works: True",
|
||||
# Light Component
|
||||
"Light Entity successfully created",
|
||||
"Light_test: Component added to the entity: True",
|
||||
"Light_test: Component removed after UNDO: True",
|
||||
"Light_test: Component added after REDO: True",
|
||||
"Light_test: Entered game mode: True",
|
||||
"Light_test: Exit game mode: True",
|
||||
"Light_test: Entity is hidden: True",
|
||||
"Light_test: Entity is shown: True",
|
||||
"Light_test: Entity deleted: True",
|
||||
"Light_test: UNDO entity deletion works: True",
|
||||
"Light_test: REDO entity deletion works: True",
|
||||
# Display Mapper Component
|
||||
"Display Mapper Entity successfully created",
|
||||
"Display Mapper_test: Component added to the entity: True",
|
||||
"Display Mapper_test: Component removed after UNDO: True",
|
||||
"Display Mapper_test: Component added after REDO: True",
|
||||
"Display Mapper_test: Entered game mode: True",
|
||||
"Display Mapper_test: Exit game mode: True",
|
||||
"Display Mapper_test: Entity is hidden: True",
|
||||
"Display Mapper_test: Entity is shown: True",
|
||||
"Display Mapper_test: Entity deleted: True",
|
||||
"Display Mapper_test: UNDO entity deletion works: True",
|
||||
"Display Mapper_test: REDO entity deletion works: True",
|
||||
]
|
||||
|
||||
unexpected_lines = [
|
||||
"failed to open",
|
||||
"Traceback (most recent call last):",
|
||||
]
|
||||
|
||||
hydra.launch_and_validate_results(
|
||||
request,
|
||||
TEST_DIRECTORY,
|
||||
editor,
|
||||
"hydra_AtomEditorComponents_AddedToEntity.py",
|
||||
timeout=EDITOR_TIMEOUT,
|
||||
expected_lines=expected_lines,
|
||||
unexpected_lines=unexpected_lines,
|
||||
halt_on_unexpected=True,
|
||||
null_renderer=True,
|
||||
cfg_args=cfg_args,
|
||||
)
|
||||
|
||||
@@ -19,170 +19,6 @@ import pytest
|
||||
@pytest.mark.parametrize("level", ["auto_test"])
|
||||
class TestAtomEditorComponentsSandbox(object):
|
||||
|
||||
@pytest.mark.test_case_id(
|
||||
"C32078117", # Area Light
|
||||
"C32078130", # Display Mapper
|
||||
"C32078129", # Light
|
||||
"C32078131", # Radius Weight Modifier
|
||||
"C32078127", # PostFX Layer
|
||||
"C32078126", # Point Light
|
||||
"C32078125", # Physical Sky
|
||||
"C32078115", # Global Skylight (IBL)
|
||||
"C32078121", # Exposure Control
|
||||
"C32078120", # Directional Light
|
||||
"C32078119", # DepthOfField
|
||||
"C32078118") # Decal
|
||||
def test_AtomEditorComponents_AddedToEntity(self, request, editor, level, workspace, project, launcher_platform):
|
||||
cfg_args = [level]
|
||||
|
||||
expected_lines = [
|
||||
# Decal Component
|
||||
"Decal (Atom) Entity successfully created",
|
||||
"Decal (Atom)_test: Component added to the entity: True",
|
||||
"Decal (Atom)_test: Component removed after UNDO: True",
|
||||
"Decal (Atom)_test: Component added after REDO: True",
|
||||
"Decal (Atom)_test: Entered game mode: True",
|
||||
"Decal (Atom)_test: Exit game mode: True",
|
||||
"Decal (Atom) Controller|Configuration|Material: SUCCESS",
|
||||
"Decal (Atom)_test: Entity is hidden: True",
|
||||
"Decal (Atom)_test: Entity is shown: True",
|
||||
"Decal (Atom)_test: Entity deleted: True",
|
||||
"Decal (Atom)_test: UNDO entity deletion works: True",
|
||||
"Decal (Atom)_test: REDO entity deletion works: True",
|
||||
# DepthOfField Component
|
||||
"DepthOfField Entity successfully created",
|
||||
"DepthOfField_test: Component added to the entity: True",
|
||||
"DepthOfField_test: Component removed after UNDO: True",
|
||||
"DepthOfField_test: Component added after REDO: True",
|
||||
"DepthOfField_test: Entered game mode: True",
|
||||
"DepthOfField_test: Exit game mode: True",
|
||||
"DepthOfField_test: Entity disabled initially: True",
|
||||
"DepthOfField_test: Entity enabled after adding required components: True",
|
||||
"DepthOfField Controller|Configuration|Camera Entity: SUCCESS",
|
||||
"DepthOfField_test: Entity is hidden: True",
|
||||
"DepthOfField_test: Entity is shown: True",
|
||||
"DepthOfField_test: Entity deleted: True",
|
||||
"DepthOfField_test: UNDO entity deletion works: True",
|
||||
"DepthOfField_test: REDO entity deletion works: True",
|
||||
# Directional Light Component
|
||||
"Directional Light Entity successfully created",
|
||||
"Directional Light_test: Component added to the entity: True",
|
||||
"Directional Light_test: Component removed after UNDO: True",
|
||||
"Directional Light_test: Component added after REDO: True",
|
||||
"Directional Light_test: Entered game mode: True",
|
||||
"Directional Light_test: Exit game mode: True",
|
||||
"Directional Light Controller|Configuration|Shadow|Camera: SUCCESS",
|
||||
"Directional Light_test: Entity is hidden: True",
|
||||
"Directional Light_test: Entity is shown: True",
|
||||
"Directional Light_test: Entity deleted: True",
|
||||
"Directional Light_test: UNDO entity deletion works: True",
|
||||
"Directional Light_test: REDO entity deletion works: True",
|
||||
# Exposure Control Component
|
||||
"Exposure Control Entity successfully created",
|
||||
"Exposure Control_test: Component added to the entity: True",
|
||||
"Exposure Control_test: Component removed after UNDO: True",
|
||||
"Exposure Control_test: Component added after REDO: True",
|
||||
"Exposure Control_test: Entered game mode: True",
|
||||
"Exposure Control_test: Exit game mode: True",
|
||||
"Exposure Control_test: Entity disabled initially: True",
|
||||
"Exposure Control_test: Entity enabled after adding required components: True",
|
||||
"Exposure Control_test: Entity is hidden: True",
|
||||
"Exposure Control_test: Entity is shown: True",
|
||||
"Exposure Control_test: Entity deleted: True",
|
||||
"Exposure Control_test: UNDO entity deletion works: True",
|
||||
"Exposure Control_test: REDO entity deletion works: True",
|
||||
# Global Skylight (IBL) Component
|
||||
"Global Skylight (IBL) Entity successfully created",
|
||||
"Global Skylight (IBL)_test: Component added to the entity: True",
|
||||
"Global Skylight (IBL)_test: Component removed after UNDO: True",
|
||||
"Global Skylight (IBL)_test: Component added after REDO: True",
|
||||
"Global Skylight (IBL)_test: Entered game mode: True",
|
||||
"Global Skylight (IBL)_test: Exit game mode: True",
|
||||
"Global Skylight (IBL) Controller|Configuration|Diffuse Image: SUCCESS",
|
||||
"Global Skylight (IBL) Controller|Configuration|Specular Image: SUCCESS",
|
||||
"Global Skylight (IBL)_test: Entity is hidden: True",
|
||||
"Global Skylight (IBL)_test: Entity is shown: True",
|
||||
"Global Skylight (IBL)_test: Entity deleted: True",
|
||||
"Global Skylight (IBL)_test: UNDO entity deletion works: True",
|
||||
"Global Skylight (IBL)_test: REDO entity deletion works: True",
|
||||
# Physical Sky Component
|
||||
"Physical Sky Entity successfully created",
|
||||
"Physical Sky component was added to entity",
|
||||
"Entity has a Physical Sky component",
|
||||
"Physical Sky_test: Component added to the entity: True",
|
||||
"Physical Sky_test: Component removed after UNDO: True",
|
||||
"Physical Sky_test: Component added after REDO: True",
|
||||
"Physical Sky_test: Entered game mode: True",
|
||||
"Physical Sky_test: Exit game mode: True",
|
||||
"Physical Sky_test: Entity is hidden: True",
|
||||
"Physical Sky_test: Entity is shown: True",
|
||||
"Physical Sky_test: Entity deleted: True",
|
||||
"Physical Sky_test: UNDO entity deletion works: True",
|
||||
"Physical Sky_test: REDO entity deletion works: True",
|
||||
# PostFX Layer Component
|
||||
"PostFX Layer Entity successfully created",
|
||||
"PostFX Layer_test: Component added to the entity: True",
|
||||
"PostFX Layer_test: Component removed after UNDO: True",
|
||||
"PostFX Layer_test: Component added after REDO: True",
|
||||
"PostFX Layer_test: Entered game mode: True",
|
||||
"PostFX Layer_test: Exit game mode: True",
|
||||
"PostFX Layer_test: Entity is hidden: True",
|
||||
"PostFX Layer_test: Entity is shown: True",
|
||||
"PostFX Layer_test: Entity deleted: True",
|
||||
"PostFX Layer_test: UNDO entity deletion works: True",
|
||||
"PostFX Layer_test: REDO entity deletion works: True",
|
||||
# Radius Weight Modifier Component
|
||||
"Radius Weight Modifier Entity successfully created",
|
||||
"Radius Weight Modifier_test: Component added to the entity: True",
|
||||
"Radius Weight Modifier_test: Component removed after UNDO: True",
|
||||
"Radius Weight Modifier_test: Component added after REDO: True",
|
||||
"Radius Weight Modifier_test: Entered game mode: True",
|
||||
"Radius Weight Modifier_test: Exit game mode: True",
|
||||
"Radius Weight Modifier_test: Entity is hidden: True",
|
||||
"Radius Weight Modifier_test: Entity is shown: True",
|
||||
"Radius Weight Modifier_test: Entity deleted: True",
|
||||
"Radius Weight Modifier_test: UNDO entity deletion works: True",
|
||||
"Radius Weight Modifier_test: REDO entity deletion works: True",
|
||||
# Light Component
|
||||
"Light Entity successfully created",
|
||||
"Light_test: Component added to the entity: True",
|
||||
"Light_test: Component removed after UNDO: True",
|
||||
"Light_test: Component added after REDO: True",
|
||||
"Light_test: Entered game mode: True",
|
||||
"Light_test: Exit game mode: True",
|
||||
"Light_test: Entity is hidden: True",
|
||||
"Light_test: Entity is shown: True",
|
||||
"Light_test: Entity deleted: True",
|
||||
"Light_test: UNDO entity deletion works: True",
|
||||
"Light_test: REDO entity deletion works: True",
|
||||
# Display Mapper Component
|
||||
"Display Mapper Entity successfully created",
|
||||
"Display Mapper_test: Component added to the entity: True",
|
||||
"Display Mapper_test: Component removed after UNDO: True",
|
||||
"Display Mapper_test: Component added after REDO: True",
|
||||
"Display Mapper_test: Entered game mode: True",
|
||||
"Display Mapper_test: Exit game mode: True",
|
||||
"Display Mapper_test: Entity is hidden: True",
|
||||
"Display Mapper_test: Entity is shown: True",
|
||||
"Display Mapper_test: Entity deleted: True",
|
||||
"Display Mapper_test: UNDO entity deletion works: True",
|
||||
"Display Mapper_test: REDO entity deletion works: True",
|
||||
]
|
||||
|
||||
unexpected_lines = [
|
||||
"failed to open",
|
||||
"Traceback (most recent call last):",
|
||||
]
|
||||
|
||||
hydra.launch_and_validate_results(
|
||||
request,
|
||||
TEST_DIRECTORY,
|
||||
editor,
|
||||
"hydra_AtomEditorComponents_AddedToEntity.py",
|
||||
timeout=EDITOR_TIMEOUT,
|
||||
expected_lines=expected_lines,
|
||||
unexpected_lines=unexpected_lines,
|
||||
halt_on_unexpected=True,
|
||||
null_renderer=True,
|
||||
cfg_args=cfg_args,
|
||||
)
|
||||
# It requires at least one test
|
||||
def test_Dummy(self, request, editor, level, workspace, project, launcher_platform):
|
||||
pass
|
||||
|
||||
+1
-1
@@ -98,5 +98,5 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(C14861501_PhysXCollider_RenderMeshAutoAssigned)
|
||||
|
||||
+1
-1
@@ -114,5 +114,5 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(C4044695_PhysXCollider_AddMultipleSurfaceFbx)
|
||||
|
||||
@@ -429,6 +429,8 @@ class TestAutomation(TestAutomationBase):
|
||||
from . import C4976236_AddPhysxColliderComponent as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.xfail(
|
||||
reason="This will fail due to this issue ATOM-15487.")
|
||||
def test_C14861502_PhysXCollider_AssetAutoAssigned(self, request, workspace, editor, launcher_platform):
|
||||
from . import C14861502_PhysXCollider_AssetAutoAssigned as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a2a3360287a4711882c4254d64ca2ba70cd743012a7d38ca29aa2a57f151efaa
|
||||
size 6661
|
||||
oid sha256:e15d484113e8151072b410924747a8ad304f6f12457fad577308c0491693ab34
|
||||
size 5472
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<download name="C18977329_NvCloth_AddClothSimulationToMesh" type="Map">
|
||||
<index src="filelist.xml" dest="filelist.xml"/>
|
||||
<files>
|
||||
<file src="level.pak" dest="level.pak" size="9946" md5="7368d6ce15bfc09a92f694efe73a00ec"/>
|
||||
<file src="level.pak" dest="level.pak" size="97C8" md5="64e64e1e3345dacace01dde152c72250"/>
|
||||
</files>
|
||||
</download>
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cd8105f020151e65093988dfb09ab42ff8d33ef5b97c61fbe0011384870aadf8
|
||||
size 39238
|
||||
oid sha256:64de37c805b0be77cdb7a85b5406af58b7f845e7d97fec1721ac5d789bb641db
|
||||
size 38856
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f53fb5e096ff562e9f0f12856ce387891596776d086f49c7ed3a59dcd0a0c11a
|
||||
size 6535
|
||||
oid sha256:7b595323d4d51211463dea0338abb6ce2a4a0a8d41efb12ac3c9dccd1f972171
|
||||
size 5504
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<download name="C18977330_NvCloth_AddClothSimulationToActor" type="Map">
|
||||
<index src="filelist.xml" dest="filelist.xml"/>
|
||||
<files>
|
||||
<file src="level.pak" dest="level.pak" size="990B" md5="7c17ac9bc5bd3e14e196b731a7e8eed7"/>
|
||||
<file src="level.pak" dest="level.pak" size="9941" md5="297730934d657d7ca57a7357ee9cd566"/>
|
||||
</files>
|
||||
</download>
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:87fbd9fda267daa505f11276b64f47c26115bee9e6d14f2a6f5a1cf1e1234218
|
||||
size 39179
|
||||
oid sha256:617c455668fc41cb7fd69de690e4aa3c80f2cb36deaa371902b79de18fcd1cb2
|
||||
size 39233
|
||||
|
||||
@@ -77,7 +77,7 @@ unsigned int g_EnableMultipleAssert = 0;//set to something else than 0 if to ena
|
||||
#endif
|
||||
|
||||
#if defined(APPLE)
|
||||
#include "../CrySystem/SystemUtilsApple.h"
|
||||
#include <AzFramework/Utils/SystemUtilsApple.h>
|
||||
#endif
|
||||
|
||||
#include "StringUtils.h"
|
||||
|
||||
@@ -108,10 +108,11 @@ bool CLevelInfo::ReadInfo()
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
|
||||
// Set up a default game type for legacy code.
|
||||
m_defaultGameTypeName = "Mission0";
|
||||
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
// Set up a default game type for legacy code.
|
||||
m_defaultGameTypeName = "Mission0";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#define LOG_BACKUP_PATH "@log@/LogBackups"
|
||||
|
||||
#if defined(IOS)
|
||||
#include "SystemUtilsApple.h"
|
||||
#include <AzFramework/Utils/SystemUtilsApple.h>
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
#include "MobileDetectSpec.h"
|
||||
#include "SystemUtilsApple.h"
|
||||
#include <AzFramework/Utils/SystemUtilsApple.h>
|
||||
|
||||
namespace MobileSysInspect
|
||||
{
|
||||
|
||||
@@ -8,8 +8,3 @@
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../SystemUtilsApple.h
|
||||
../../SystemUtilsApple.mm
|
||||
)
|
||||
|
||||
@@ -13,8 +13,6 @@ set(FILES
|
||||
../../MobileDetectSpec_Ios.cpp
|
||||
../../MobileDetectSpec.cpp
|
||||
../../MobileDetectSpec.h
|
||||
../../SystemUtilsApple.h
|
||||
../../SystemUtilsApple.mm
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ __pragma(comment(lib, "Winmm.lib"))
|
||||
#endif
|
||||
|
||||
#if defined(APPLE)
|
||||
#include "SystemUtilsApple.h"
|
||||
#include <AzFramework/Utils/SystemUtilsApple.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,3 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
SystemUtilsApple.h
|
||||
SystemUtilsApple.mm
|
||||
)
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Math/MathMatrixSerializer.h>
|
||||
#include <AzCore/Math/Matrix3x3.h>
|
||||
#include <AzCore/Math/Matrix3x4.h>
|
||||
#include <AzCore/Math/Matrix4x4.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/Serialization/Json/RegistrationContext.h>
|
||||
#include <AzCore/Serialization/Json/StackedString.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/string/osstring.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ::JsonMathMatrixSerializerInternal
|
||||
{
|
||||
template<typename MatrixType, size_t RowCount, size_t ColumnCount>
|
||||
JsonSerializationResult::Result LoadArray(MatrixType& output, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
|
||||
constexpr size_t ElementCount = RowCount * ColumnCount;
|
||||
static_assert(ElementCount == 9 || ElementCount == 12 || ElementCount == 16,
|
||||
"MathMatrixSerializer only support Matrix3x3, Matrix3x4 and Matrix4x4.");
|
||||
|
||||
rapidjson::SizeType arraySize = inputValue.Size();
|
||||
if (arraySize < ElementCount)
|
||||
{
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Unsupported,
|
||||
"Not enough numbers in JSON array to load math matrix from.");
|
||||
}
|
||||
|
||||
AZ::BaseJsonSerializer* floatSerializer = context.GetRegistrationContext()->GetSerializerForType(azrtti_typeid<float>());
|
||||
if (!floatSerializer)
|
||||
{
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Catastrophic, "Failed to find the JSON float serializer.");
|
||||
}
|
||||
|
||||
constexpr const char* names[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
|
||||
float values[ElementCount];
|
||||
for (int i = 0; i < ElementCount; ++i)
|
||||
{
|
||||
ScopedContextPath subPath(context, names[i]);
|
||||
JSR::Result intermediate = floatSerializer->Load(values + i, azrtti_typeid<float>(), inputValue[i], context);
|
||||
if (intermediate.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediate;
|
||||
}
|
||||
}
|
||||
|
||||
size_t valueIndex = 0;
|
||||
for (size_t r = 0; r < RowCount; ++r)
|
||||
{
|
||||
for (size_t c = 0; c < ColumnCount; ++c)
|
||||
{
|
||||
output.SetElement(aznumeric_caster(r), aznumeric_caster(c), values[valueIndex++]);
|
||||
}
|
||||
}
|
||||
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Success, "Successfully read math matrix.");
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result LoadFloatFromObject(
|
||||
float& output,
|
||||
const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context,
|
||||
const char* name,
|
||||
const char* altName)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
|
||||
AZ::BaseJsonSerializer* floatSerializer = context.GetRegistrationContext()->GetSerializerForType(azrtti_typeid<float>());
|
||||
if (!floatSerializer)
|
||||
{
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Catastrophic, "Failed to find the json float serializer.");
|
||||
}
|
||||
|
||||
const char* nameUsed = name;
|
||||
JSR::ResultCode result(JSR::Tasks::ReadField);
|
||||
auto iterator = inputValue.FindMember(rapidjson::StringRef(name));
|
||||
if (iterator == inputValue.MemberEnd())
|
||||
{
|
||||
nameUsed = altName;
|
||||
iterator = inputValue.FindMember(rapidjson::StringRef(altName));
|
||||
if (iterator == inputValue.MemberEnd())
|
||||
{
|
||||
// field not found so leave default value
|
||||
result.Combine(JSR::ResultCode(JSR::Tasks::ReadField, JSR::Outcomes::DefaultsUsed));
|
||||
nameUsed = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (nameUsed)
|
||||
{
|
||||
ScopedContextPath subPath(context, nameUsed);
|
||||
JSR::Result intermediate = floatSerializer->Load(&output, azrtti_typeid<float>(), iterator->value, context);
|
||||
if (intermediate.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediate;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Combine(JSR::ResultCode(JSR::Tasks::ReadField, JSR::Outcomes::Success));
|
||||
}
|
||||
}
|
||||
|
||||
return context.Report(result, "Successfully read float.");
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result LoadVector3FromObject(
|
||||
Vector3& output,
|
||||
const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context,
|
||||
AZStd::fixed_vector<AZStd::string_view, 6> names)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
constexpr size_t ElementCount = 3; // Vector3
|
||||
|
||||
JSR::ResultCode result(JSR::Tasks::ReadField);
|
||||
float values[ElementCount];
|
||||
for (int i = 0; i < ElementCount; ++i)
|
||||
{
|
||||
values[i] = output.GetElement(i);
|
||||
auto name = names[i * 2];
|
||||
auto altName = names[(i * 2) + 1];
|
||||
|
||||
JSR::Result intermediate = LoadFloatFromObject(values[i], inputValue, context, name.data(), altName.data());
|
||||
if (intermediate.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediate;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Combine(JSR::ResultCode(JSR::Tasks::ReadField, JSR::Outcomes::Success));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < ElementCount; ++i)
|
||||
{
|
||||
output.SetElement(i, values[i]);
|
||||
}
|
||||
|
||||
return context.Report(result, "Successfully read math matrix.");
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result LoadQuaternionAndScale(
|
||||
AZ::Quaternion& quaternion,
|
||||
float& scale,
|
||||
const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
|
||||
JSR::ResultCode result(JSR::Tasks::ReadField);
|
||||
scale = 1.0f;
|
||||
JSR::Result intermediateScale = LoadFloatFromObject(scale, inputValue, context, "scale", "Scale");
|
||||
if (intermediateScale.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediateScale;
|
||||
}
|
||||
result.Combine(intermediateScale);
|
||||
|
||||
if (AZ::IsClose(scale, 0.0f))
|
||||
{
|
||||
result.Combine({ JSR::Tasks::ReadField, JSR::Outcomes::Unsupported });
|
||||
return context.Report(result, "Scale can not be zero.");
|
||||
}
|
||||
|
||||
AZ::Vector3 degreesRollPitchYaw = AZ::Vector3::CreateZero();
|
||||
JSR::Result intermediateDegrees = LoadVector3FromObject(degreesRollPitchYaw, inputValue, context, { "roll", "Roll", "pitch", "Pitch", "yaw", "Yaw" });
|
||||
if (intermediateDegrees.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediateDegrees;
|
||||
}
|
||||
result.Combine(intermediateDegrees);
|
||||
|
||||
// the quaternion should be equivalent to a series of rotations in the order z, then y, then x
|
||||
const AZ::Vector3 eulerRadians = AZ::Vector3DegToRad(degreesRollPitchYaw);
|
||||
quaternion = AZ::Quaternion::CreateRotationX(eulerRadians.GetX()) *
|
||||
AZ::Quaternion::CreateRotationY(eulerRadians.GetY()) *
|
||||
AZ::Quaternion::CreateRotationZ(eulerRadians.GetZ());
|
||||
|
||||
return context.Report(result, "Successfully read math yaw, pitch, roll, and scale.");
|
||||
}
|
||||
|
||||
template<typename MatrixType>
|
||||
JsonSerializationResult::Result LoadObject(MatrixType& output, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
output = MatrixType::CreateIdentity();
|
||||
|
||||
JSR::ResultCode result(JSR::Tasks::ReadField);
|
||||
float scale;
|
||||
AZ::Quaternion rotation;
|
||||
|
||||
JSR::Result intermediate = LoadQuaternionAndScale(rotation, scale, inputValue, context);
|
||||
if (intermediate.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediate;
|
||||
}
|
||||
result.Combine(intermediate);
|
||||
|
||||
AZ::Vector3 translation = AZ::Vector3::CreateZero();
|
||||
JSR::Result intermediateTranslation = LoadVector3FromObject(translation, inputValue, context, { "x", "X", "y", "Y", "z", "Z" });
|
||||
if (intermediateTranslation.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediateTranslation;
|
||||
}
|
||||
result.Combine(intermediateTranslation);
|
||||
|
||||
// composed a matrix by rotation, then scale, then translation
|
||||
auto matrix = MatrixType::CreateFromQuaternion(rotation);
|
||||
matrix.MultiplyByScale(Vector3{ scale });
|
||||
matrix.SetTranslation(translation);
|
||||
|
||||
if (matrix == MatrixType::CreateIdentity())
|
||||
{
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::DefaultsUsed, "Using identity matrix for empty object.");
|
||||
}
|
||||
|
||||
output = matrix;
|
||||
return context.Report(result, "Successfully read math matrix.");
|
||||
}
|
||||
|
||||
template<>
|
||||
JsonSerializationResult::Result LoadObject<Matrix3x3>(Matrix3x3& output, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
output = Matrix3x3::CreateIdentity();
|
||||
|
||||
JSR::ResultCode result(JSR::Tasks::ReadField);
|
||||
float scale;
|
||||
AZ::Quaternion rotation;
|
||||
|
||||
JSR::Result intermediate = LoadQuaternionAndScale(rotation, scale, inputValue, context);
|
||||
if (intermediate.GetResultCode().GetProcessing() != JSR::Processing::Completed)
|
||||
{
|
||||
return intermediate;
|
||||
}
|
||||
result.Combine(intermediate);
|
||||
|
||||
// composed a matrix by rotation then scale
|
||||
auto matrix = Matrix3x3::CreateFromQuaternion(rotation);
|
||||
matrix.MultiplyByScale(Vector3{ scale });
|
||||
|
||||
if (matrix == Matrix3x3::CreateIdentity())
|
||||
{
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::DefaultsUsed, "Using identity matrix for empty object.");
|
||||
}
|
||||
|
||||
output = matrix;
|
||||
return context.Report(result, "Successfully read math matrix.");
|
||||
}
|
||||
|
||||
template<typename MatrixType, size_t RowCount, size_t ColumnCount>
|
||||
JsonSerializationResult::Result Load(void* outputValue, const Uuid& outputValueTypeId,
|
||||
const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
|
||||
constexpr size_t ElementCount = RowCount * ColumnCount;
|
||||
static_assert(ElementCount == 9 || ElementCount == 12 || ElementCount == 16,
|
||||
"MathMatrixSerializer only support Matrix3x3, Matrix3x4 and Matrix4x4.");
|
||||
|
||||
AZ_Assert(azrtti_typeid<MatrixType>() == outputValueTypeId,
|
||||
"Unable to deserialize Matrix%zux%zu to json because the provided type is %s",
|
||||
RowCount, ColumnCount, outputValueTypeId.ToString<OSString>().c_str());
|
||||
AZ_UNUSED(outputValueTypeId);
|
||||
|
||||
MatrixType* matrix = reinterpret_cast<MatrixType*>(outputValue);
|
||||
AZ_Assert(matrix, "Output value for JsonMatrix%zux%zuSerializer can't be null.", RowCount, ColumnCount);
|
||||
|
||||
switch (inputValue.GetType())
|
||||
{
|
||||
case rapidjson::kArrayType:
|
||||
return LoadArray<MatrixType, RowCount, ColumnCount>(*matrix, inputValue, context);
|
||||
case rapidjson::kObjectType:
|
||||
return LoadObject<MatrixType>(*matrix, inputValue, context);
|
||||
|
||||
case rapidjson::kStringType:
|
||||
[[fallthrough]];
|
||||
case rapidjson::kNumberType:
|
||||
[[fallthrough]];
|
||||
case rapidjson::kNullType:
|
||||
[[fallthrough]];
|
||||
case rapidjson::kFalseType:
|
||||
[[fallthrough]];
|
||||
case rapidjson::kTrueType:
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Unsupported,
|
||||
"Unsupported type. Math matrix can only be read from arrays or objects.");
|
||||
|
||||
default:
|
||||
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Unknown,
|
||||
"Unknown json type encountered in math matrix.");
|
||||
}
|
||||
}
|
||||
|
||||
template<typename MatrixType>
|
||||
AZ::Quaternion CreateQuaternion(const MatrixType& matrix);
|
||||
|
||||
template<>
|
||||
AZ::Quaternion CreateQuaternion<AZ::Matrix3x3>(const AZ::Matrix3x3& matrix)
|
||||
{
|
||||
return Quaternion::CreateFromMatrix3x3(matrix);
|
||||
}
|
||||
|
||||
template<>
|
||||
AZ::Quaternion CreateQuaternion<AZ::Matrix3x4>(const AZ::Matrix3x4& matrix)
|
||||
{
|
||||
return Quaternion::CreateFromMatrix3x4(matrix);
|
||||
}
|
||||
|
||||
template<>
|
||||
AZ::Quaternion CreateQuaternion<AZ::Matrix4x4>(const AZ::Matrix4x4& matrix)
|
||||
{
|
||||
return Quaternion::CreateFromMatrix4x4(matrix);
|
||||
}
|
||||
|
||||
template<typename MatrixType>
|
||||
JsonSerializationResult::Result StoreRotationAndScale(rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue,
|
||||
const Uuid& valueTypeId, JsonSerializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
AZ_UNUSED(valueTypeId);
|
||||
|
||||
const MatrixType* matrix = reinterpret_cast<const MatrixType*>(inputValue);
|
||||
AZ_Assert(matrix, "Input value for JsonMatrixSerializer can't be null.");
|
||||
const MatrixType* defaultMatrix = reinterpret_cast<const MatrixType*>(defaultValue);
|
||||
|
||||
if (!context.ShouldKeepDefaults() && defaultMatrix && *matrix == *defaultMatrix)
|
||||
{
|
||||
return context.Report(JSR::Tasks::WriteValue, JSR::Outcomes::DefaultsUsed, "Default math Matrix used.");
|
||||
}
|
||||
|
||||
MatrixType matrixToExport = *matrix;
|
||||
AZ::Vector3 scale = matrixToExport.ExtractScale();
|
||||
|
||||
AZ::Quaternion rotation = CreateQuaternion(matrixToExport);
|
||||
auto degrees = rotation.GetEulerDegrees();
|
||||
outputValue.AddMember(rapidjson::StringRef("roll"), degrees.GetX(), context.GetJsonAllocator());
|
||||
outputValue.AddMember(rapidjson::StringRef("pitch"), degrees.GetY(), context.GetJsonAllocator());
|
||||
outputValue.AddMember(rapidjson::StringRef("yaw"), degrees.GetZ(), context.GetJsonAllocator());
|
||||
outputValue.AddMember(rapidjson::StringRef("scale"), scale.GetX(), context.GetJsonAllocator());
|
||||
|
||||
return context.Report(JSR::Tasks::WriteValue, JSR::Outcomes::Success, "Math Matrix successfully stored.");
|
||||
}
|
||||
|
||||
template<typename MatrixType>
|
||||
JsonSerializationResult::Result StoreTranslation(rapidjson::Value& outputValue, const void* inputValue,
|
||||
const void* defaultValue, const Uuid& valueTypeId, JsonSerializerContext& context)
|
||||
{
|
||||
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
|
||||
AZ_UNUSED(valueTypeId);
|
||||
|
||||
const MatrixType* matrix = reinterpret_cast<const MatrixType*>(inputValue);
|
||||
AZ_Assert(matrix, "Input value for JsonMatrixSerializer can't be null.");
|
||||
const MatrixType* defaultMatrix = reinterpret_cast<const MatrixType*>(defaultValue);
|
||||
|
||||
if (!context.ShouldKeepDefaults() && defaultMatrix && *matrix == *defaultMatrix)
|
||||
{
|
||||
return context.Report(JSR::Tasks::WriteValue, JSR::Outcomes::DefaultsUsed, "Default math Matrix used.");
|
||||
}
|
||||
|
||||
auto translation = matrix->GetTranslation();
|
||||
outputValue.AddMember(rapidjson::StringRef("x"), translation.GetX(), context.GetJsonAllocator());
|
||||
outputValue.AddMember(rapidjson::StringRef("y"), translation.GetY(), context.GetJsonAllocator());
|
||||
outputValue.AddMember(rapidjson::StringRef("z"), translation.GetZ(), context.GetJsonAllocator());
|
||||
|
||||
return context.Report(JSR::Tasks::WriteValue, JSR::Outcomes::Success, "Math Matrix successfully stored.");
|
||||
}
|
||||
}
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
// Matrix3x3
|
||||
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonMatrix3x3Serializer, SystemAllocator, 0);
|
||||
|
||||
JsonSerializationResult::Result JsonMatrix3x3Serializer::Load(void* outputValue, const Uuid& outputValueTypeId,
|
||||
const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
return JsonMathMatrixSerializerInternal::Load<Matrix3x3, 3, 3>(
|
||||
outputValue,
|
||||
outputValueTypeId,
|
||||
inputValue,
|
||||
context);
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result JsonMatrix3x3Serializer::Store(rapidjson::Value& outputValue, const void* inputValue,
|
||||
const void* defaultValue, const Uuid& valueTypeId, JsonSerializerContext& context)
|
||||
{
|
||||
outputValue.SetObject();
|
||||
|
||||
return JsonMathMatrixSerializerInternal::StoreRotationAndScale<Matrix3x3>(
|
||||
outputValue,
|
||||
inputValue,
|
||||
defaultValue,
|
||||
valueTypeId,
|
||||
context);
|
||||
}
|
||||
|
||||
|
||||
// Matrix3x4
|
||||
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonMatrix3x4Serializer, SystemAllocator, 0);
|
||||
|
||||
JsonSerializationResult::Result JsonMatrix3x4Serializer::Load(void* outputValue, const Uuid& outputValueTypeId,
|
||||
const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
return JsonMathMatrixSerializerInternal::Load<Matrix3x4, 3, 4>(
|
||||
outputValue,
|
||||
outputValueTypeId,
|
||||
inputValue,
|
||||
context);
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result JsonMatrix3x4Serializer::Store(rapidjson::Value& outputValue, const void* inputValue,
|
||||
const void* defaultValue, const Uuid& valueTypeId, JsonSerializerContext& context)
|
||||
{
|
||||
outputValue.SetObject();
|
||||
|
||||
auto result = JsonMathMatrixSerializerInternal::StoreRotationAndScale<Matrix3x4>(
|
||||
outputValue,
|
||||
inputValue,
|
||||
defaultValue,
|
||||
valueTypeId,
|
||||
context);
|
||||
|
||||
auto resultTranslation = JsonMathMatrixSerializerInternal::StoreTranslation<Matrix3x4>(
|
||||
outputValue,
|
||||
inputValue,
|
||||
defaultValue,
|
||||
valueTypeId,
|
||||
context);
|
||||
|
||||
result.GetResultCode().Combine(resultTranslation);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Matrix4x4
|
||||
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonMatrix4x4Serializer, SystemAllocator, 0);
|
||||
|
||||
JsonSerializationResult::Result JsonMatrix4x4Serializer::Load(void* outputValue, const Uuid& outputValueTypeId,
|
||||
const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
return JsonMathMatrixSerializerInternal::Load<Matrix4x4, 4, 4>(
|
||||
outputValue,
|
||||
outputValueTypeId,
|
||||
inputValue,
|
||||
context);
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result JsonMatrix4x4Serializer::Store(rapidjson::Value& outputValue, const void* inputValue,
|
||||
const void* defaultValue, const Uuid& valueTypeId, JsonSerializerContext& context)
|
||||
{
|
||||
outputValue.SetObject();
|
||||
|
||||
auto result = JsonMathMatrixSerializerInternal::StoreRotationAndScale<Matrix4x4>(
|
||||
outputValue,
|
||||
inputValue,
|
||||
defaultValue,
|
||||
valueTypeId,
|
||||
context);
|
||||
|
||||
auto resultTranslation = JsonMathMatrixSerializerInternal::StoreTranslation<Matrix4x4>(
|
||||
outputValue,
|
||||
inputValue,
|
||||
defaultValue,
|
||||
valueTypeId,
|
||||
context);
|
||||
|
||||
result.GetResultCode().Combine(resultTranslation);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class JsonMatrix3x3Serializer
|
||||
: public BaseJsonSerializer
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(JsonMatrix3x3Serializer, "{8C76CD6A-8576-4604-A746-CF7A7F20F366}", BaseJsonSerializer);
|
||||
AZ_CLASS_ALLOCATOR_DECL;
|
||||
JsonSerializationResult::Result Load(void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context) override;
|
||||
JsonSerializationResult::Result Store(rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue,
|
||||
const Uuid& valueTypeId, JsonSerializerContext& context) override;
|
||||
};
|
||||
|
||||
class JsonMatrix3x4Serializer
|
||||
: public BaseJsonSerializer
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(JsonMatrix3x4Serializer, "{E801333B-4AF1-4F43-976C-579670B02DC5}", BaseJsonSerializer);
|
||||
AZ_CLASS_ALLOCATOR_DECL;
|
||||
JsonSerializationResult::Result Load(void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context) override;
|
||||
JsonSerializationResult::Result Store(rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue,
|
||||
const Uuid& valueTypeId, JsonSerializerContext& context) override;
|
||||
};
|
||||
|
||||
class JsonMatrix4x4Serializer
|
||||
: public BaseJsonSerializer
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(JsonMatrix4x4Serializer, "{46E888FC-248A-4910-9221-4E101A10AEA1}", BaseJsonSerializer);
|
||||
AZ_CLASS_ALLOCATOR_DECL;
|
||||
JsonSerializationResult::Result Load(void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context) override;
|
||||
JsonSerializationResult::Result Store(rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue,
|
||||
const Uuid& valueTypeId, JsonSerializerContext& context) override;
|
||||
};
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Vector4.h>
|
||||
#include <AzCore/Math/MathMatrixSerializer.h>
|
||||
#include <AzCore/Math/MathVectorSerializer.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <AzCore/Math/ColorSerializer.h>
|
||||
@@ -366,6 +367,9 @@ namespace AZ
|
||||
{
|
||||
context.Serializer<JsonColorSerializer>()->HandlesType<Color>();
|
||||
context.Serializer<JsonUuidSerializer>()->HandlesType<Uuid>();
|
||||
context.Serializer<JsonMatrix3x3Serializer>()->HandlesType<Matrix3x3>();
|
||||
context.Serializer<JsonMatrix3x4Serializer>()->HandlesType<Matrix3x4>();
|
||||
context.Serializer<JsonMatrix4x4Serializer>()->HandlesType<Matrix4x4>();
|
||||
context.Serializer<JsonVector2Serializer>()->HandlesType<Vector2>();
|
||||
context.Serializer<JsonVector3Serializer>()->HandlesType<Vector3>();
|
||||
context.Serializer<JsonVector4Serializer>()->HandlesType<Vector4>();
|
||||
|
||||
@@ -53,6 +53,10 @@ namespace AZ
|
||||
//! RemoveableByUser : A bool which determines if the component can be removed by the user.
|
||||
//! Setting this to false prevents the user from removing this component. Default behavior is removeable by user.
|
||||
const static AZ::Crc32 RemoveableByUser = AZ_CRC("RemoveableByUser", 0x32c7fd50);
|
||||
//! An int which, if specified, causes a component to be forced to a particular position in the sorted list of
|
||||
//! components on an entity, and prevents dragging or moving operations which would affect that position.
|
||||
const static AZ::Crc32 FixedComponentListIndex = AZ_CRC_CE("FixedComponentListIndex");
|
||||
|
||||
const static AZ::Crc32 AppearsInAddComponentMenu = AZ_CRC("AppearsInAddComponentMenu", 0x53790e31);
|
||||
const static AZ::Crc32 ForceAutoExpand = AZ_CRC("ForceAutoExpand", 0x1a5c79d2); // Ignores expansion state set by user, enforces expansion.
|
||||
const static AZ::Crc32 AutoExpand = AZ_CRC("AutoExpand", 0x306ff5c0); // Expands automatically unless user changes expansion state.
|
||||
|
||||
@@ -290,6 +290,8 @@ set(FILES
|
||||
Math/MathScriptHelpers.h
|
||||
Math/MathUtils.cpp
|
||||
Math/MathUtils.h
|
||||
Math/MathMatrixSerializer.h
|
||||
Math/MathMatrixSerializer.cpp
|
||||
Math/MathVectorSerializer.h
|
||||
Math/MathVectorSerializer.cpp
|
||||
Math/Matrix3x3.cpp
|
||||
|
||||
@@ -0,0 +1,562 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/Math/MathMatrixSerializer.h>
|
||||
#include <AzCore/Math/Matrix3x3.h>
|
||||
#include <AzCore/Math/Matrix3x4.h>
|
||||
#include <AzCore/Math/Matrix4x4.h>
|
||||
#include <AzCore/Math/Random.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/Serialization/Json/DoubleSerializer.h>
|
||||
#include <AzCore/Serialization/Json/RegistrationContext.h>
|
||||
#include <Tests/Serialization/Json/BaseJsonSerializerFixture.h>
|
||||
#include <Tests/Serialization/Json/JsonSerializerConformityTests.h>
|
||||
|
||||
namespace JsonSerializationTests
|
||||
{
|
||||
namespace DataHelper
|
||||
{
|
||||
// Build Matrix
|
||||
|
||||
template <typename MatrixType>
|
||||
MatrixType BuildMatrixRotationWithSale(const AZ::Vector3& angles, float scale)
|
||||
{
|
||||
// start a matrix with angle degrees
|
||||
const AZ::Vector3 eulerRadians = AZ::Vector3DegToRad(angles);
|
||||
const auto rotX = MatrixType::CreateRotationX(eulerRadians.GetX());
|
||||
const auto rotY = MatrixType::CreateRotationY(eulerRadians.GetY());
|
||||
const auto rotZ = MatrixType::CreateRotationZ(eulerRadians.GetZ());
|
||||
auto matrix = rotX * rotY * rotZ;
|
||||
|
||||
// apply a scale
|
||||
matrix.MultiplyByScale(AZ::Vector3{ scale });
|
||||
return matrix;
|
||||
}
|
||||
|
||||
template <typename MatrixType>
|
||||
MatrixType BuildMatrix(const AZ::Vector3& angles, float scale, const AZ::Vector3& translation)
|
||||
{
|
||||
auto matrix = BuildMatrixRotationWithSale<MatrixType>(angles, scale);
|
||||
matrix.SetTranslation(translation);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
template <>
|
||||
AZ::Matrix3x3 BuildMatrix(const AZ::Vector3& angles, float scale, const AZ::Vector3&)
|
||||
{
|
||||
return BuildMatrixRotationWithSale<AZ::Matrix3x3>(angles, scale);
|
||||
}
|
||||
|
||||
// Arbitrary Matrix
|
||||
|
||||
template <typename MatrixType>
|
||||
MatrixType CreateArbitraryMatrixRotationAndSale(AZ::SimpleLcgRandom& random)
|
||||
{
|
||||
// start a matrix with arbitrary degrees
|
||||
float roll = random.GetRandomFloat() * 360.0f;
|
||||
float pitch = random.GetRandomFloat() * 360.0f;
|
||||
float yaw = random.GetRandomFloat() * 360.0f;
|
||||
const AZ::Vector3 eulerRadians = AZ::Vector3DegToRad(AZ::Vector3{ roll, pitch, yaw });
|
||||
const auto rotX = MatrixType::CreateRotationX(eulerRadians.GetX());
|
||||
const auto rotY = MatrixType::CreateRotationY(eulerRadians.GetY());
|
||||
const auto rotZ = MatrixType::CreateRotationZ(eulerRadians.GetZ());
|
||||
auto matrix = rotX * rotY * rotZ;
|
||||
|
||||
// apply a scale
|
||||
matrix.MultiplyByScale(AZ::Vector3{ random.GetRandomFloat() });
|
||||
return matrix;
|
||||
}
|
||||
|
||||
template <typename MatrixType>
|
||||
void AssignArbitrarySetTranslation(MatrixType& matrix, AZ::SimpleLcgRandom& random)
|
||||
{
|
||||
float x = random.GetRandomFloat() * 10000.0f;
|
||||
float y = random.GetRandomFloat() * 10000.0f;
|
||||
float z = random.GetRandomFloat() * 10000.0f;
|
||||
matrix.SetTranslation(AZ::Vector3{ x, y, z });
|
||||
}
|
||||
|
||||
template <typename MatrixType>
|
||||
MatrixType CreateArbitraryMatrix(size_t seed);
|
||||
|
||||
template <>
|
||||
AZ::Matrix3x3 CreateArbitraryMatrix(size_t seed)
|
||||
{
|
||||
AZ::SimpleLcgRandom random(seed);
|
||||
return CreateArbitraryMatrixRotationAndSale<AZ::Matrix3x3>(random);
|
||||
}
|
||||
|
||||
template <>
|
||||
AZ::Matrix3x4 CreateArbitraryMatrix(size_t seed)
|
||||
{
|
||||
AZ::SimpleLcgRandom random(seed);
|
||||
auto matrix = CreateArbitraryMatrixRotationAndSale<AZ::Matrix3x4>(random);
|
||||
AssignArbitrarySetTranslation<AZ::Matrix3x4>(matrix, random);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
template <>
|
||||
AZ::Matrix4x4 CreateArbitraryMatrix(size_t seed)
|
||||
{
|
||||
AZ::SimpleLcgRandom random(seed);
|
||||
auto matrix = CreateArbitraryMatrixRotationAndSale<AZ::Matrix4x4>(random);
|
||||
AssignArbitrarySetTranslation<AZ::Matrix4x4>(matrix, random);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
// CreateQuaternion
|
||||
|
||||
template<typename MatrixType>
|
||||
AZ::Quaternion CreateQuaternion(const MatrixType& matrix);
|
||||
|
||||
template<>
|
||||
AZ::Quaternion CreateQuaternion<AZ::Matrix3x3>(const AZ::Matrix3x3& matrix)
|
||||
{
|
||||
return AZ::Quaternion::CreateFromMatrix3x3(matrix);
|
||||
}
|
||||
|
||||
template<>
|
||||
AZ::Quaternion CreateQuaternion<AZ::Matrix3x4>(const AZ::Matrix3x4& matrix)
|
||||
{
|
||||
return AZ::Quaternion::CreateFromMatrix3x4(matrix);
|
||||
}
|
||||
|
||||
template<>
|
||||
AZ::Quaternion CreateQuaternion<AZ::Matrix4x4>(const AZ::Matrix4x4& matrix)
|
||||
{
|
||||
return AZ::Quaternion::CreateFromMatrix4x4(matrix);
|
||||
}
|
||||
|
||||
template<typename MatrixType>
|
||||
void AddRotation(rapidjson::Value& value, const MatrixType& matrix, rapidjson::Document::AllocatorType& allocator)
|
||||
{
|
||||
AZ::Quaternion rotation = CreateQuaternion<MatrixType>(matrix);
|
||||
const auto degrees = rotation.GetEulerDegrees();
|
||||
value.AddMember("yaw", degrees.GetX(), allocator);
|
||||
value.AddMember("pitch", degrees.GetY(), allocator);
|
||||
value.AddMember("roll", degrees.GetZ(), allocator);
|
||||
}
|
||||
|
||||
void AddScale(rapidjson::Value& value, float scale, rapidjson::Document::AllocatorType& allocator)
|
||||
{
|
||||
value.AddMember("scale", scale, allocator);
|
||||
}
|
||||
|
||||
void AddTranslation(rapidjson::Value& value, const AZ::Vector3& translation, rapidjson::Document::AllocatorType& allocator)
|
||||
{
|
||||
value.AddMember("x", translation.GetX(), allocator);
|
||||
value.AddMember("y", translation.GetY(), allocator);
|
||||
value.AddMember("z", translation.GetZ(), allocator);
|
||||
}
|
||||
|
||||
template <typename MatrixType>
|
||||
void AddData(rapidjson::Value& value, const MatrixType& matrix, rapidjson::Document::AllocatorType& allocator);
|
||||
|
||||
template <>
|
||||
void AddData(rapidjson::Value& value, const AZ::Matrix3x3& matrix, rapidjson::Document::AllocatorType& allocator)
|
||||
{
|
||||
AddScale(value, matrix.RetrieveScale().GetX(), allocator);
|
||||
AddRotation(value, matrix, allocator);
|
||||
}
|
||||
|
||||
template <>
|
||||
void AddData(rapidjson::Value& value, const AZ::Matrix3x4& matrix, rapidjson::Document::AllocatorType& allocator)
|
||||
{
|
||||
AddScale(value, matrix.RetrieveScale().GetX(), allocator);
|
||||
AddTranslation(value, matrix.GetTranslation(), allocator);
|
||||
AddRotation(value, matrix, allocator);
|
||||
}
|
||||
|
||||
template <>
|
||||
void AddData(rapidjson::Value& value, const AZ::Matrix4x4& matrix, rapidjson::Document::AllocatorType& allocator)
|
||||
{
|
||||
AddScale(value, matrix.RetrieveScale().GetX(), allocator);
|
||||
AddTranslation(value, matrix.GetTranslation(), allocator);
|
||||
AddRotation(value, matrix, allocator);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename MatrixType, size_t RowCount, size_t ColumnCount, typename Serializer>
|
||||
class MathMatrixSerializerTestDescription :
|
||||
public JsonSerializerConformityTestDescriptor<MatrixType>
|
||||
{
|
||||
public:
|
||||
AZStd::shared_ptr<AZ::BaseJsonSerializer> CreateSerializer() override
|
||||
{
|
||||
return AZStd::make_shared<Serializer>();
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<MatrixType> CreateDefaultInstance() override
|
||||
{
|
||||
return AZStd::make_shared<MatrixType>(MatrixType::CreateIdentity());
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<MatrixType> CreateFullySetInstance() override
|
||||
{
|
||||
auto angles = AZ::Vector3 { 0.0f, 0.0f, 0.0f };
|
||||
auto scale = 10.0f;
|
||||
auto translation = AZ::Vector3{ 10.0f, 20.0f, 30.0f };
|
||||
auto matrix = DataHelper::BuildMatrix<MatrixType>(angles, scale, translation);
|
||||
return AZStd::make_shared<MatrixType>(matrix);
|
||||
}
|
||||
|
||||
AZStd::string_view GetJsonForFullySetInstance() override
|
||||
{
|
||||
if constexpr (RowCount * ColumnCount == 9)
|
||||
{
|
||||
return "{\"roll\":0.0,\"pitch\":0.0,\"yaw\":0.0,\"scale\":10.0}";
|
||||
}
|
||||
else if constexpr (RowCount * ColumnCount == 12)
|
||||
{
|
||||
return "{\"roll\":0.0,\"pitch\":0.0,\"yaw\":0.0,\"scale\":10.0,\"x\":10.0,\"y\":20.0,\"z\":30.0}";
|
||||
}
|
||||
else if constexpr (RowCount * ColumnCount == 16)
|
||||
{
|
||||
return "{\"roll\":0.0,\"pitch\":0.0,\"yaw\":0.0,\"scale\":10.0,\"x\":10.0,\"y\":20.0,\"z\":30.0}";
|
||||
}
|
||||
else
|
||||
{
|
||||
static_assert((RowCount >= 3 && RowCount <= 4) && (ColumnCount >= 3 && ColumnCount <= 4),
|
||||
"Only matrix 3x3, 3x4 or 4x4 are supported by this test.");
|
||||
}
|
||||
return "{}";
|
||||
}
|
||||
|
||||
void ConfigureFeatures(JsonSerializerConformityTestDescriptorFeatures& features) override
|
||||
{
|
||||
features.EnableJsonType(rapidjson::kArrayType);
|
||||
features.EnableJsonType(rapidjson::kObjectType);
|
||||
features.m_fixedSizeArray = true;
|
||||
features.m_supportsPartialInitialization = false;
|
||||
features.m_supportsInjection = false;
|
||||
}
|
||||
|
||||
bool AreEqual(const MatrixType& lhs, const MatrixType& rhs) override
|
||||
{
|
||||
for (int r = 0; r < RowCount; ++r)
|
||||
{
|
||||
for (int c = 0; c < ColumnCount; ++c)
|
||||
{
|
||||
if (!AZ::IsClose(lhs.GetElement(r, c), rhs.GetElement(r, c), AZ::Constants::Tolerance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
using MathMatrixSerializerConformityTestTypes = ::testing::Types<
|
||||
MathMatrixSerializerTestDescription<AZ::Matrix3x3, 3, 3, AZ::JsonMatrix3x3Serializer>,
|
||||
MathMatrixSerializerTestDescription<AZ::Matrix3x4, 3, 4, AZ::JsonMatrix3x4Serializer>,
|
||||
MathMatrixSerializerTestDescription<AZ::Matrix4x4, 4, 4, AZ::JsonMatrix4x4Serializer>
|
||||
>;
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(JsonMathMatrixSerializer, JsonSerializerConformityTests, MathMatrixSerializerConformityTestTypes);
|
||||
|
||||
template<typename T>
|
||||
class JsonMathMatrixSerializerTests
|
||||
: public BaseJsonSerializerFixture
|
||||
{
|
||||
public:
|
||||
using Descriptor = T;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
BaseJsonSerializerFixture::SetUp();
|
||||
m_serializer = AZStd::make_unique<typename T::Serializer>();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
m_serializer.reset();
|
||||
BaseJsonSerializerFixture::TearDown();
|
||||
}
|
||||
|
||||
protected:
|
||||
AZStd::unique_ptr<typename T::Serializer> m_serializer;
|
||||
};
|
||||
|
||||
struct Matrix3x3Descriptor
|
||||
{
|
||||
using MatrixType = AZ::Matrix3x3;
|
||||
using Serializer = AZ::JsonMatrix3x3Serializer;
|
||||
constexpr static size_t RowCount = 3;
|
||||
constexpr static size_t ColumnCount = 3;
|
||||
constexpr static size_t ElementCount = RowCount * ColumnCount;
|
||||
constexpr static bool HasTranslation = false;
|
||||
};
|
||||
|
||||
struct Matrix3x4Descriptor
|
||||
{
|
||||
using MatrixType = AZ::Matrix3x4;
|
||||
using Serializer = AZ::JsonMatrix3x4Serializer;
|
||||
constexpr static size_t RowCount = 3;
|
||||
constexpr static size_t ColumnCount = 4;
|
||||
constexpr static size_t ElementCount = RowCount * ColumnCount;
|
||||
constexpr static bool HasTranslation = true;
|
||||
};
|
||||
|
||||
struct Matrix4x4Descriptor
|
||||
{
|
||||
using MatrixType = AZ::Matrix4x4;
|
||||
using Serializer = AZ::JsonMatrix4x4Serializer;
|
||||
constexpr static size_t RowCount = 4;
|
||||
constexpr static size_t ColumnCount = 4;
|
||||
constexpr static size_t ElementCount = RowCount * ColumnCount;
|
||||
constexpr static bool HasTranslation = true;
|
||||
};
|
||||
|
||||
using JsonMathMatrixSerializerTypes = ::testing::Types <
|
||||
Matrix3x3Descriptor, Matrix3x4Descriptor, Matrix4x4Descriptor>;
|
||||
TYPED_TEST_CASE(JsonMathMatrixSerializerTests, JsonMathMatrixSerializerTypes);
|
||||
|
||||
// Load array tests
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, Load_Array_ReturnsConvertAndLoadsMatrix)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
rapidjson::Value& arrayValue = this->m_jsonDocument->SetArray();
|
||||
for (size_t i = 0; i < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::ElementCount; ++i)
|
||||
{
|
||||
arrayValue.PushBack(static_cast<float>(i + 1), this->m_jsonDocument->GetAllocator());
|
||||
}
|
||||
|
||||
auto output = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateZero();
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
ASSERT_EQ(Outcomes::Success, result.GetOutcome());
|
||||
|
||||
for (int r = 0; r < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::RowCount; ++r)
|
||||
{
|
||||
for (int c = 0; c < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::ColumnCount; ++c)
|
||||
{
|
||||
auto testValue = static_cast<float>((r * JsonMathMatrixSerializerTests<TypeParam>::Descriptor::ColumnCount) + c + 1);
|
||||
EXPECT_FLOAT_EQ(testValue, output.GetElement(r, c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, Load_InvalidEntries_ReturnsUnsupportedAndLeavesMatrixUntouched)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
rapidjson::Value& arrayValue = this->m_jsonDocument->SetArray();
|
||||
for (size_t i = 0; i < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::ElementCount; ++i)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
arrayValue.PushBack(rapidjson::StringRef("Invalid"), this->m_jsonDocument->GetAllocator());
|
||||
}
|
||||
else
|
||||
{
|
||||
arrayValue.PushBack(static_cast<float>(i + 1), this->m_jsonDocument->GetAllocator());
|
||||
}
|
||||
}
|
||||
|
||||
auto output = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateZero();
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
EXPECT_EQ(Outcomes::Unsupported, result.GetOutcome());
|
||||
|
||||
for (int r = 0; r < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::RowCount; ++r)
|
||||
{
|
||||
for (int c = 0; c < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::ColumnCount; ++c)
|
||||
{
|
||||
EXPECT_FLOAT_EQ(0.0f, output.GetElement(r, c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, Load_FloatSerializerMissingForArray_ReturnsCatastrophic)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
this->m_jsonRegistrationContext->EnableRemoveReflection();
|
||||
this->m_jsonRegistrationContext->template Serializer<AZ::JsonFloatSerializer>()->template HandlesType<float>();
|
||||
this->m_jsonRegistrationContext->DisableRemoveReflection();
|
||||
|
||||
rapidjson::Value& arrayValue = this->m_jsonDocument->SetArray();
|
||||
for (size_t i = 0; i < JsonMathMatrixSerializerTests<TypeParam>::Descriptor::ElementCount + 1; ++i)
|
||||
{
|
||||
arrayValue.PushBack(static_cast<float>(i + 1), this->m_jsonDocument->GetAllocator());
|
||||
}
|
||||
|
||||
typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType output;
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
EXPECT_EQ(Outcomes::Catastrophic, result.GetOutcome());
|
||||
|
||||
this->m_jsonRegistrationContext->template Serializer<AZ::JsonFloatSerializer>()->template HandlesType<float>();
|
||||
}
|
||||
|
||||
// Load object tests
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, Load_ValidObjectLowerCase_ReturnsSuccessAndLoadsMatrix)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
rapidjson::Value& objectValue = this->m_jsonDocument->SetObject();
|
||||
auto input = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateIdentity();
|
||||
DataHelper::AddData(objectValue, input, this->m_jsonDocument->GetAllocator());
|
||||
|
||||
auto output = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateZero();
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
ASSERT_EQ(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
EXPECT_TRUE(input == output);
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, Load_ValidObjectWithExtraFields_ReturnsPartialConvertAndLoadsMatrix)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
rapidjson::Value& objectValue = this->m_jsonDocument->SetObject();
|
||||
auto input = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateIdentity();
|
||||
DataHelper::AddScale(objectValue, input.RetrieveScale().GetX(), this->m_jsonDocument->GetAllocator());
|
||||
DataHelper::AddRotation(objectValue, input, this->m_jsonDocument->GetAllocator());
|
||||
objectValue.AddMember(rapidjson::StringRef("extra"), "no value", this->m_jsonDocument->GetAllocator());
|
||||
|
||||
auto output = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateZero();
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
ASSERT_EQ(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
EXPECT_TRUE(input == output);
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, SaveLoad_Identity_LoadsDefaultMatrixWithIdentity)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
auto defaultValue = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateIdentity();
|
||||
|
||||
rapidjson::Value& objectInput = this->m_jsonDocument->SetObject();
|
||||
this->m_serializer->Store(
|
||||
objectInput,
|
||||
&defaultValue,
|
||||
&defaultValue,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonSerializationContext);
|
||||
|
||||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||
objectInput.Accept(writer);
|
||||
|
||||
auto output = defaultValue;
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
|
||||
EXPECT_TRUE(defaultValue == output);
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, LoadSave_Zero_SavesAndLoadsIdentityMatrix)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
auto defaultValue = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateIdentity();
|
||||
auto input = JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType::CreateZero();
|
||||
|
||||
rapidjson::Value& objectInput = this->m_jsonDocument->SetObject();
|
||||
this->m_serializer->Store(
|
||||
objectInput,
|
||||
&input,
|
||||
&defaultValue,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonSerializationContext);
|
||||
|
||||
auto output = defaultValue;
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
|
||||
ASSERT_EQ(Outcomes::Unsupported, result.GetOutcome());
|
||||
EXPECT_TRUE(defaultValue == output);
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, Load_InvalidFields_ReturnsUnsupportedAndLeavesMatrixUntouched)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
using Descriptor = typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor;
|
||||
|
||||
const auto defaultValue = Descriptor::MatrixType::CreateIdentity();
|
||||
rapidjson::Value& objectValue = this->m_jsonDocument->SetObject();
|
||||
auto input = Descriptor::MatrixType::CreateIdentity();
|
||||
DataHelper::AddData(objectValue, input, this->m_jsonDocument->GetAllocator());
|
||||
objectValue["yaw"] = "Invalid";
|
||||
|
||||
auto output = Descriptor::MatrixType::CreateZero();
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
ASSERT_EQ(Outcomes::Unsupported, result.GetOutcome());
|
||||
EXPECT_TRUE(input == output);
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonMathMatrixSerializerTests, LoadSave_Arbitrary_SavesAndLoadsArbitraryMatrix)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
using Descriptor = typename JsonMathMatrixSerializerTests<TypeParam>::Descriptor;
|
||||
|
||||
auto defaultValue = Descriptor::MatrixType::CreateIdentity();
|
||||
size_t elementCount = Descriptor::RowCount * Descriptor::ColumnCount;
|
||||
auto input = DataHelper::CreateArbitraryMatrix<typename Descriptor::MatrixType>(elementCount);
|
||||
|
||||
rapidjson::Value& objectInput = this->m_jsonDocument->SetObject();
|
||||
this->m_serializer->Store(
|
||||
objectInput,
|
||||
&input,
|
||||
&defaultValue,
|
||||
azrtti_typeid<typename Descriptor::MatrixType>(),
|
||||
*this->m_jsonSerializationContext);
|
||||
|
||||
auto output = defaultValue;
|
||||
ResultCode result = this->m_serializer->Load(
|
||||
&output,
|
||||
azrtti_typeid<typename Descriptor::MatrixType>(),
|
||||
*this->m_jsonDocument,
|
||||
*this->m_jsonDeserializationContext);
|
||||
|
||||
EXPECT_EQ(Processing::Completed, result.GetProcessing());
|
||||
|
||||
for (int r = 0; r < Descriptor::RowCount; ++r)
|
||||
{
|
||||
for (int c = 0; c < Descriptor::ColumnCount; ++c)
|
||||
{
|
||||
EXPECT_NEAR(input.GetElement(r, c), output.GetElement(r, c), AZ::Constants::Tolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace JsonSerializationTests
|
||||
@@ -111,6 +111,7 @@ set(FILES
|
||||
Serialization/Json/JsonSerializerMock.h
|
||||
Serialization/Json/MapSerializerTests.cpp
|
||||
Serialization/Json/MathVectorSerializerTests.cpp
|
||||
Serialization/Json/MathMatrixSerializerTests.cpp
|
||||
Serialization/Json/SmartPointerSerializerTests.cpp
|
||||
Serialization/Json/StringSerializerTests.cpp
|
||||
Serialization/Json/TestCases.h
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace AzFramework
|
||||
|
||||
void NonUniformScaleComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("NonUniformScaleService"));
|
||||
|
||||
incompatible.push_back(AZ_CRC_CE("DebugDrawObbService"));
|
||||
incompatible.push_back(AZ_CRC_CE("DebugDrawService"));
|
||||
incompatible.push_back(AZ_CRC_CE("EMotionFXActorService"));
|
||||
|
||||
+13
-28
@@ -19,44 +19,29 @@
|
||||
|
||||
namespace AzPhysics
|
||||
{
|
||||
struct SimulatedBody;
|
||||
}
|
||||
|
||||
namespace Physics
|
||||
{
|
||||
//! Requests for generic physical world bodies
|
||||
class WorldBodyRequests
|
||||
//! Requests for physics simulated body components.
|
||||
class SimulatedBodyComponentRequests
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
|
||||
//! Enable physics for this body
|
||||
//! Enable physics for this body.
|
||||
virtual void EnablePhysics() = 0;
|
||||
//! Disable physics for this body
|
||||
//! Disable physics for this body.
|
||||
virtual void DisablePhysics() = 0;
|
||||
//! Retrieve whether physics is enabled for this body
|
||||
//! Retrieve whether physics is enabled for this body.
|
||||
virtual bool IsPhysicsEnabled() const = 0;
|
||||
|
||||
//! Retrieves the AABB(aligned-axis bounding box) for this body
|
||||
//! Retrieves the AABB(aligned-axis bounding box) for this body.
|
||||
virtual AZ::Aabb GetAabb() const = 0;
|
||||
//! Retrieves current WorldBody* for this body. Note: Do not hold a reference to AzPhysics::SimulatedBody* as could be deleted
|
||||
virtual AzPhysics::SimulatedBody* GetWorldBody() = 0;
|
||||
|
||||
//! Perform a single-object raycast against this body
|
||||
//! Get the Simulated Body Handle for this body.
|
||||
virtual AzPhysics::SimulatedBodyHandle GetSimulatedBodyHandle() const = 0;
|
||||
//! Retrieves current WorldBody* for this body.
|
||||
//! @note Do not hold a reference to AzPhysics::SimulatedBody* as it could be deleted or moved.
|
||||
virtual AzPhysics::SimulatedBody* GetSimulatedBody() = 0;
|
||||
//! Perform a single-object raycast against this body.
|
||||
virtual AzPhysics::SceneQueryHit RayCast(const AzPhysics::RayCastRequest& request) = 0;
|
||||
};
|
||||
using WorldBodyRequestBus = AZ::EBus<WorldBodyRequests>;
|
||||
|
||||
//! Notifications for generic physical world bodies
|
||||
class WorldBodyNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
//! Notification for physics enabled
|
||||
virtual void OnPhysicsEnabled() = 0;
|
||||
//! Notification for physics disabled
|
||||
virtual void OnPhysicsDisabled() = 0;
|
||||
};
|
||||
using WorldBodyNotificationBus = AZ::EBus<WorldBodyNotifications>;
|
||||
using SimulatedBodyComponentRequestsBus = AZ::EBus<SimulatedBodyComponentRequests>;
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <AzFramework/Physics/ShapeConfiguration.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzFramework/Physics/CollisionBus.h>
|
||||
#include <AzFramework/Physics/WorldBodyBus.h>
|
||||
#include <AzFramework/Physics/Components/SimulatedBodyComponentBus.h>
|
||||
#include <AzFramework/Physics/WindBus.h>
|
||||
#include <AzFramework/Physics/PhysicsSystem.h>
|
||||
#include <AzFramework/Physics/Collision/CollisionEvents.h>
|
||||
@@ -39,19 +39,19 @@ namespace Physics
|
||||
{
|
||||
namespace ReflectionUtils
|
||||
{
|
||||
void ReflectWorldBodyBus(AZ::ReflectContext* context)
|
||||
void ReflectSimulatedBodyComponentRequestsBus(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<Physics::WorldBodyRequestBus>("WorldBodyRequestBus")
|
||||
behaviorContext->EBus<AzPhysics::SimulatedBodyComponentRequestsBus>("SimulatedBodyComponentRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Module, "physics")
|
||||
->Attribute(AZ::Script::Attributes::Category, "PhysX")
|
||||
->Event("EnablePhysics", &WorldBodyRequests::EnablePhysics)
|
||||
->Event("DisablePhysics", &WorldBodyRequests::DisablePhysics)
|
||||
->Event("IsPhysicsEnabled", &WorldBodyRequests::IsPhysicsEnabled)
|
||||
->Event("GetAabb", &WorldBodyRequests::GetAabb)
|
||||
->Event("RayCast", &WorldBodyRequests::RayCast)
|
||||
->Event("EnablePhysics", &AzPhysics::SimulatedBodyComponentRequests::EnablePhysics)
|
||||
->Event("DisablePhysics", &AzPhysics::SimulatedBodyComponentRequests::DisablePhysics)
|
||||
->Event("IsPhysicsEnabled", &AzPhysics::SimulatedBodyComponentRequests::IsPhysicsEnabled)
|
||||
->Event("GetAabb", &AzPhysics::SimulatedBodyComponentRequests::GetAabb)
|
||||
->Event("RayCast", &AzPhysics::SimulatedBodyComponentRequests::RayCast)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace Physics
|
||||
AnimationConfiguration::Reflect(context);
|
||||
CharacterConfiguration::Reflect(context);
|
||||
AzPhysics::SimulatedBody::Reflect(context);
|
||||
ReflectWorldBodyBus(context);
|
||||
ReflectSimulatedBodyComponentRequestsBus(context);
|
||||
CollisionFilteringRequests::Reflect(context);
|
||||
AzPhysics::SceneQuery::ReflectSceneQueryObjects(context);
|
||||
ReflectWindBus(context);
|
||||
|
||||
@@ -48,15 +48,21 @@ namespace AzFramework
|
||||
};
|
||||
|
||||
//! The interface used by MultiViewportController to manage individual instances.
|
||||
template <class TController>
|
||||
class MultiViewportControllerInstanceInterface
|
||||
{
|
||||
public:
|
||||
explicit MultiViewportControllerInstanceInterface(ViewportId viewport)
|
||||
using ControllerType = TController;
|
||||
|
||||
MultiViewportControllerInstanceInterface(ViewportId viewport, ControllerType* controller)
|
||||
: m_viewportId(viewport)
|
||||
, m_controller(controller)
|
||||
{
|
||||
}
|
||||
|
||||
ViewportId GetViewportId() const { return m_viewportId; }
|
||||
ControllerType* GetController() { return m_controller; }
|
||||
const ControllerType* GetController() const { return m_controller; }
|
||||
|
||||
virtual bool HandleInputChannelEvent([[maybe_unused]]const ViewportControllerInputEvent& event) { return false; }
|
||||
virtual void ResetInputChannels() {}
|
||||
@@ -64,6 +70,7 @@ namespace AzFramework
|
||||
|
||||
private:
|
||||
ViewportId m_viewportId;
|
||||
ControllerType* m_controller;
|
||||
};
|
||||
} //namespace AzFramework
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace AzFramework
|
||||
MultiViewportController<TViewportControllerInstance, Priority>::~MultiViewportController()
|
||||
{
|
||||
static_assert(
|
||||
AZStd::is_constructible<TViewportControllerInstance, ViewportId>::value,
|
||||
"TViewportControllerInstance must implement a TViewportControllerInstance(ViewportId) constructor"
|
||||
AZStd::is_same<TViewportControllerInstance, decltype(TViewportControllerInstance(0, nullptr))>::value,
|
||||
"TViewportControllerInstance must implement a TViewportControllerInstance(ViewportId, ViewportController) constructor"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace AzFramework
|
||||
template <class TViewportControllerInstance, ViewportControllerPriority Priority>
|
||||
void MultiViewportController<TViewportControllerInstance, Priority>::RegisterViewportContext(ViewportId viewport)
|
||||
{
|
||||
m_instances[viewport] = AZStd::make_unique<TViewportControllerInstance>(viewport);
|
||||
m_instances[viewport] = AZStd::make_unique<TViewportControllerInstance>(viewport, static_cast<typename TViewportControllerInstance::ControllerType*>(this));
|
||||
}
|
||||
|
||||
template <class TViewportControllerInstance, ViewportControllerPriority Priority>
|
||||
|
||||
@@ -213,6 +213,12 @@ set(FILES
|
||||
StreamingInstall/StreamingInstall.cpp
|
||||
StreamingInstall/StreamingInstallRequests.h
|
||||
StreamingInstall/StreamingInstallNotifications.h
|
||||
Physics/Collision/CollisionEvents.h
|
||||
Physics/Collision/CollisionEvents.cpp
|
||||
Physics/Collision/CollisionLayers.h
|
||||
Physics/Collision/CollisionLayers.cpp
|
||||
Physics/Collision/CollisionGroups.h
|
||||
Physics/Collision/CollisionGroups.cpp
|
||||
Physics/Common/PhysicsSceneQueries.h
|
||||
Physics/Common/PhysicsSceneQueries.cpp
|
||||
Physics/Common/PhysicsEvents.h
|
||||
@@ -223,12 +229,7 @@ set(FILES
|
||||
Physics/Common/PhysicsSimulatedBodyEvents.h
|
||||
Physics/Common/PhysicsSimulatedBodyEvents.cpp
|
||||
Physics/Common/PhysicsTypes.h
|
||||
Physics/Collision/CollisionEvents.h
|
||||
Physics/Collision/CollisionEvents.cpp
|
||||
Physics/Collision/CollisionLayers.h
|
||||
Physics/Collision/CollisionLayers.cpp
|
||||
Physics/Collision/CollisionGroups.h
|
||||
Physics/Collision/CollisionGroups.cpp
|
||||
Physics/Components/SimulatedBodyComponentBus.h
|
||||
Physics/Configuration/CollisionConfiguration.h
|
||||
Physics/Configuration/CollisionConfiguration.cpp
|
||||
Physics/Configuration/RigidBodyConfiguration.h
|
||||
@@ -265,7 +266,6 @@ set(FILES
|
||||
Physics/ShapeConfiguration.h
|
||||
Physics/ShapeConfiguration.cpp
|
||||
Physics/SystemBus.h
|
||||
Physics/WorldBodyBus.h
|
||||
Physics/ColliderComponentBus.h
|
||||
Physics/RagdollPhysicsBus.h
|
||||
Physics/CharacterPhysicsDataBus.h
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../Common/Apple/AzFramework/Utils/SystemUtilsApple.h"
|
||||
@@ -36,4 +36,6 @@ set(FILES
|
||||
../Common/Unimplemented/AzFramework/Input/Devices/VirtualKeyboard/InputDeviceVirtualKeyboard_Unimplemented.cpp
|
||||
AzFramework/Archive/ArchiveVars_Platform.h
|
||||
AzFramework/Archive/ArchiveVars_Mac.h
|
||||
../Common/Apple/AzFramework/Utils/SystemUtilsApple.h
|
||||
../Common/Apple/AzFramework/Utils/SystemUtilsApple.mm
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../Common/Apple/AzFramework/Utils/SystemUtilsApple.h"
|
||||
@@ -36,5 +36,7 @@ set(FILES
|
||||
AzFramework/Process/ProcessCommon.h
|
||||
AzFramework/Process/ProcessWatcher_iOS.cpp
|
||||
AzFramework/Process/ProcessCommunicator_iOS.cpp
|
||||
../Common/Apple/AzFramework/Utils/SystemUtilsApple.h
|
||||
../Common/Apple/AzFramework/Utils/SystemUtilsApple.mm
|
||||
)
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ namespace AzToolsFramework
|
||||
//! Allows a component to get the list of selected entities
|
||||
//! \param selectedEntityIds the return vector holding the entities required
|
||||
virtual void GetSelectedEntities(EntityIdList& selectedEntityIds) = 0;
|
||||
|
||||
//! Explicitly sets a component as having been the most recently added.
|
||||
//! This means that the next time the UI refreshes, that component will be ensured to be visible.
|
||||
virtual void SetNewComponentId(AZ::ComponentId componentId) = 0;
|
||||
};
|
||||
|
||||
using EntityPropertyEditorRequestBus = AZ::EBus<EntityPropertyEditorRequests>;
|
||||
|
||||
@@ -182,6 +182,22 @@ namespace AzToolsFramework
|
||||
instanceToParentUnder = prefabEditorEntityOwnershipInterface->GetRootPrefabInstance();
|
||||
parent = instanceToParentUnder->get().GetContainerEntityId();
|
||||
}
|
||||
|
||||
//Detect whether this instantiation would produce a cyclical dependency
|
||||
auto relativePath = m_prefabLoaderInterface->GetRelativePathToProject(filePath);
|
||||
Prefab::TemplateId templateId = m_prefabSystemComponentInterface->GetTemplateIdFromFilePath(relativePath);
|
||||
|
||||
// If the template isn't currently loaded, there's no way for it to be in the hierarchy so we just skip the check.
|
||||
if (templateId != Prefab::InvalidTemplateId && IsPrefabInInstanceAncestorHierarchy(templateId, instanceToParentUnder->get()))
|
||||
{
|
||||
return AZ::Failure(
|
||||
AZStd::string::format(
|
||||
"Instantiate Prefab operation aborted - Cyclical dependency detected\n(%s depends on %s).",
|
||||
relativePath.Native().c_str(),
|
||||
instanceToParentUnder->get().GetTemplateSourcePath().Native().c_str()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
// Initialize Undo Batch object
|
||||
@@ -192,7 +208,7 @@ namespace AzToolsFramework
|
||||
instanceToParentUnderDomBeforeCreate, instanceToParentUnder->get());
|
||||
|
||||
// Instantiate the Prefab
|
||||
auto instanceToCreate = prefabEditorEntityOwnershipInterface->InstantiatePrefab(filePath, instanceToParentUnder);
|
||||
auto instanceToCreate = prefabEditorEntityOwnershipInterface->InstantiatePrefab(relativePath, instanceToParentUnder);
|
||||
|
||||
if (!instanceToCreate)
|
||||
{
|
||||
@@ -242,6 +258,23 @@ namespace AzToolsFramework
|
||||
return AZ::Success();
|
||||
}
|
||||
|
||||
bool PrefabPublicHandler::IsPrefabInInstanceAncestorHierarchy(TemplateId prefabTemplateId, InstanceOptionalConstReference instance)
|
||||
{
|
||||
InstanceOptionalConstReference currentInstance = instance;
|
||||
|
||||
while (currentInstance.has_value())
|
||||
{
|
||||
if (currentInstance->get().GetTemplateId() == prefabTemplateId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
currentInstance = currentInstance->get().GetParentInstance();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void PrefabPublicHandler::CreateLink(
|
||||
const EntityList& topLevelEntities, Instance& sourceInstance, TemplateId targetTemplateId,
|
||||
UndoSystem::URSequencePoint* undoBatch, AZ::EntityId commonRootEntityId)
|
||||
|
||||
@@ -106,6 +106,14 @@ namespace AzToolsFramework
|
||||
const AZStd::vector<AZ::EntityId>& entityIds, EntityList& inputEntityList, EntityList& topLevelEntities,
|
||||
AZ::EntityId& commonRootEntityId, InstanceOptionalReference& commonRootEntityOwningInstance);
|
||||
|
||||
/* Detects whether an instance of prefabTemplateId is present in the hierarchy of ancestors of instance.
|
||||
*
|
||||
* \param prefabTemplateId The template id to test for
|
||||
* \param instance The instance whose ancestor hierarchy prefabTemplateId will be tested against.
|
||||
* \return true if an instance of the template of id prefabTemplateId could be found in the ancestor hierarchy of instance, false otherwise.
|
||||
*/
|
||||
bool IsPrefabInInstanceAncestorHierarchy(TemplateId prefabTemplateId, InstanceOptionalConstReference instance);
|
||||
|
||||
static Instance* GetParentInstance(Instance* instance);
|
||||
static Instance* GetAncestorOfInstanceThatIsChildOfRoot(const Instance* ancestor, Instance* descendant);
|
||||
static void GenerateContainerEntityTransform(const EntityList& topLevelEntities, AZ::Vector3& translation, AZ::Quaternion& rotation);
|
||||
|
||||
@@ -721,6 +721,8 @@ namespace AzToolsFramework
|
||||
|
||||
TemplateId PrefabSystemComponent::GetTemplateIdFromFilePath(AZ::IO::PathView filePath) const
|
||||
{
|
||||
AZ_Assert(!filePath.IsAbsolute(), "Prefab - GetTemplateIdFromFilePath was passed an absolute path. Prefabs use paths relative to the project folder.");
|
||||
|
||||
auto found = m_templateFilePathToIdMap.find(filePath);
|
||||
if (found != m_templateFilePathToIdMap.end())
|
||||
{
|
||||
|
||||
+6
-3
@@ -39,9 +39,10 @@ namespace AzToolsFramework
|
||||
editContext->Class<EditorNonUniformScaleComponent>("Non-uniform Scale",
|
||||
"Non-uniform scale for this entity only (does not propagate through hierarchy)")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Non-uniform Scale")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::FixedComponentListIndex, 1)
|
||||
->Attribute(AZ::Edit::Attributes::RemoveableByUser, true)
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/NonUniformScale.svg")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/NonUniformScale.svg")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &EditorNonUniformScaleComponent::m_scale, "Non-uniform Scale",
|
||||
"Non-uniform scale for this entity only (does not propagate through hierarchy)")
|
||||
@@ -61,6 +62,8 @@ namespace AzToolsFramework
|
||||
|
||||
void EditorNonUniformScaleComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("NonUniformScaleService"));
|
||||
|
||||
incompatible.push_back(AZ_CRC_CE("DebugDrawObbService"));
|
||||
incompatible.push_back(AZ_CRC_CE("DebugDrawService"));
|
||||
incompatible.push_back(AZ_CRC_CE("EMotionFXActorService"));
|
||||
|
||||
+70
@@ -25,11 +25,15 @@
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/API/EntityPropertyEditorRequestsBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponentBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorInspectorComponentBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorPendingCompositionBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
@@ -1196,6 +1200,66 @@ namespace AzToolsFramework
|
||||
destinationComponent->SetWorldTM(const_cast<TransformComponent*>(sourceComponent)->GetWorldTM());
|
||||
}
|
||||
|
||||
AZ::Component* TransformComponent::FindPresentOrPendingComponent(AZ::Uuid componentUuid)
|
||||
{
|
||||
// first check if the component is present and valid
|
||||
if (AZ::Component* foundComponent = GetEntity()->FindComponent(componentUuid))
|
||||
{
|
||||
return foundComponent;
|
||||
}
|
||||
|
||||
// then check to see if there's a component pending because it's in an invalid state
|
||||
AZStd::vector<AZ::Component*> pendingComponents;
|
||||
AzToolsFramework::EditorPendingCompositionRequestBus::Event(GetEntityId(),
|
||||
&AzToolsFramework::EditorPendingCompositionRequests::GetPendingComponents, pendingComponents);
|
||||
|
||||
for (const auto pendingComponent : pendingComponents)
|
||||
{
|
||||
if (pendingComponent->RTTI_IsTypeOf(componentUuid))
|
||||
{
|
||||
return pendingComponent;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool TransformComponent::IsAddNonUniformScaleButtonReadOnly()
|
||||
{
|
||||
return FindPresentOrPendingComponent(EditorNonUniformScaleComponent::TYPEINFO_Uuid()) != nullptr;
|
||||
}
|
||||
|
||||
AZ::Crc32 TransformComponent::OnAddNonUniformScaleButtonPressed()
|
||||
{
|
||||
// if there is already a non-uniform scale component, do nothing
|
||||
if (FindPresentOrPendingComponent(EditorNonUniformScaleComponent::TYPEINFO_Uuid()))
|
||||
{
|
||||
return AZ::Edit::PropertyRefreshLevels::None;
|
||||
}
|
||||
|
||||
const AZStd::vector<AZ::EntityId> entityList = { GetEntityId() };
|
||||
const AZ::ComponentTypeList componentsToAdd = { EditorNonUniformScaleComponent::TYPEINFO_Uuid() };
|
||||
|
||||
AzToolsFramework::EntityCompositionRequests::AddComponentsOutcome addComponentsOutcome;
|
||||
AzToolsFramework::EntityCompositionRequestBus::BroadcastResult(addComponentsOutcome,
|
||||
&AzToolsFramework::EntityCompositionRequests::AddComponentsToEntities, entityList, componentsToAdd);
|
||||
|
||||
const auto nonUniformScaleComponent = FindPresentOrPendingComponent(EditorNonUniformScaleComponent::RTTI_Type());
|
||||
AZ::ComponentId nonUniformScaleComponentId =
|
||||
nonUniformScaleComponent ? nonUniformScaleComponent->GetId() : AZ::InvalidComponentId;
|
||||
|
||||
if (!addComponentsOutcome.IsSuccess() || !nonUniformScaleComponent)
|
||||
{
|
||||
AZ_Warning("Transform component", false, "Failed to add non-uniform scale component.");
|
||||
return AZ::Edit::PropertyRefreshLevels::None;
|
||||
}
|
||||
|
||||
AzToolsFramework::EntityPropertyEditorRequestBus::Broadcast(
|
||||
&AzToolsFramework::EntityPropertyEditorRequests::SetNewComponentId, nonUniformScaleComponentId);
|
||||
|
||||
return AZ::Edit::PropertyRefreshLevels::EntireTree;
|
||||
}
|
||||
|
||||
void TransformComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
// reflect data for script, serialization, editing..
|
||||
@@ -1211,6 +1275,7 @@ namespace AzToolsFramework
|
||||
serializeContext->Class<Components::TransformComponent, EditorComponentBase>()->
|
||||
Field("Parent Entity", &TransformComponent::m_parentEntityId)->
|
||||
Field("Transform Data", &TransformComponent::m_editorTransform)->
|
||||
Field("AddNonUniformScaleButton", &TransformComponent::m_addNonUniformScaleButton)->
|
||||
Field("Cached World Transform", &TransformComponent::m_cachedWorldTransform)->
|
||||
Field("Cached World Transform Parent", &TransformComponent::m_cachedWorldTransformParent)->
|
||||
Field("Parent Activation Transform Mode", &TransformComponent::m_parentActivationTransformMode)->
|
||||
@@ -1224,6 +1289,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
ptrEdit->Class<TransformComponent>("Transform", "Controls the placement of the entity in the world in 3d")->
|
||||
ClassElement(AZ::Edit::ClassElements::EditorData, "")->
|
||||
Attribute(AZ::Edit::Attributes::FixedComponentListIndex, 0)->
|
||||
Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Transform.svg")->
|
||||
Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Transform.png")->
|
||||
Attribute(AZ::Edit::Attributes::AutoExpand, true)->
|
||||
@@ -1234,6 +1300,10 @@ namespace AzToolsFramework
|
||||
DataElement(AZ::Edit::UIHandlers::Default, &TransformComponent::m_editorTransform, "Values", "")->
|
||||
Attribute(AZ::Edit::Attributes::ChangeNotify, &TransformComponent::TransformChanged)->
|
||||
Attribute(AZ::Edit::Attributes::AutoExpand, true)->
|
||||
DataElement(AZ::Edit::UIHandlers::Button, &TransformComponent::m_addNonUniformScaleButton, "", "")->
|
||||
Attribute(AZ::Edit::Attributes::ButtonText, "Add non-uniform scale")->
|
||||
Attribute(AZ::Edit::Attributes::ReadOnly, &TransformComponent::IsAddNonUniformScaleButtonReadOnly)->
|
||||
Attribute(AZ::Edit::Attributes::ChangeNotify, &TransformComponent::OnAddNonUniformScaleButtonPressed)->
|
||||
DataElement(AZ::Edit::UIHandlers::ComboBox, &TransformComponent::m_parentActivationTransformMode,
|
||||
"Parent activation", "Configures relative transform behavior when parent activates.")->
|
||||
EnumAttribute(AZ::TransformConfig::ParentActivationTransformMode::MaintainOriginalRelativeTransform, "Original relative transform")->
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Commands/SelectionCommand.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.h>
|
||||
|
||||
#include "EditorComponentBase.h"
|
||||
#include "TransformComponentBus.h"
|
||||
@@ -228,6 +229,10 @@ namespace AzToolsFramework
|
||||
|
||||
void CheckApplyCachedWorldTransform(const AZ::Transform& parentWorld);
|
||||
|
||||
AZ::Component* FindPresentOrPendingComponent(AZ::Uuid componentUuid);
|
||||
bool IsAddNonUniformScaleButtonReadOnly();
|
||||
AZ::Crc32 OnAddNonUniformScaleButtonPressed();
|
||||
|
||||
// Drives transform behavior when parent activates. See AZ::TransformConfig::ParentActivationTransformMode for details.
|
||||
AZ::TransformConfig::ParentActivationTransformMode m_parentActivationTransformMode;
|
||||
|
||||
@@ -260,6 +265,10 @@ namespace AzToolsFramework
|
||||
bool m_worldTransformDirty = true;
|
||||
bool m_isStatic = false;
|
||||
|
||||
// This is a workaround for a bug which causes the button to appear with incorrect placement if a UI
|
||||
// element is used rather than a data element.
|
||||
bool m_addNonUniformScaleButton = false;
|
||||
|
||||
// Deprecated
|
||||
AZ::InterpolationMode m_interpolatePosition;
|
||||
AZ::InterpolationMode m_interpolateRotation;
|
||||
|
||||
+82
-13
@@ -63,6 +63,7 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzToolsFramework/ToolsComponents/EditorOnlyEntityComponentBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorOnlyEntityComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorLayerComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.h>
|
||||
#include <AzToolsFramework/ToolsMessaging/EntityHighlightBus.h>
|
||||
#include <AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.hxx>
|
||||
#include <AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.hxx>
|
||||
@@ -494,6 +495,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void EntityPropertyEditor::SetNewComponentId(AZ::ComponentId componentId)
|
||||
{
|
||||
m_newComponentId = componentId;
|
||||
}
|
||||
|
||||
void EntityPropertyEditor::SetOverrideEntityIds(const AzToolsFramework::EntityIdSet& entities)
|
||||
{
|
||||
m_overrideSelectedEntityIds = entities;
|
||||
@@ -1039,15 +1045,23 @@ namespace AzToolsFramework
|
||||
sortedComponents.end(),
|
||||
[=](const OrderedSortComponentEntry& component1, const OrderedSortComponentEntry& component2)
|
||||
{
|
||||
// Transform component must be first, always
|
||||
// If component 1 is a transform component, it is sorted earlier
|
||||
if (component1.m_component->RTTI_IsTypeOf(AZ::EditorTransformComponentTypeId))
|
||||
AZStd::optional<int> fixedComponentListIndex1 = GetFixedComponentListIndex(component1.m_component);
|
||||
AZStd::optional<int> fixedComponentListIndex2 = GetFixedComponentListIndex(component2.m_component);
|
||||
|
||||
// If both components have fixed list indices, sort based on those indices
|
||||
if (fixedComponentListIndex1.has_value() && fixedComponentListIndex2.has_value())
|
||||
{
|
||||
return fixedComponentListIndex1.value() < fixedComponentListIndex2.value();
|
||||
}
|
||||
|
||||
// If component 1 has a fixed list index, sort it first
|
||||
if (fixedComponentListIndex1.has_value())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// If component 2 is a transform component, component 1 is never sorted earlier
|
||||
if (component2.m_component->RTTI_IsTypeOf(AZ::EditorTransformComponentTypeId))
|
||||
// If component 2 has a fixed list index, component 1 should not be sorted before it
|
||||
if (fixedComponentListIndex2.has_value())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1128,10 +1142,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (auto attributeData = azdynamic_cast<AZ::Edit::AttributeData<bool>*>(attribute))
|
||||
{
|
||||
if (!attributeData->Get(nullptr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return attributeData->Get(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1166,6 +1177,36 @@ namespace AzToolsFramework
|
||||
return true;
|
||||
}
|
||||
|
||||
AZStd::optional<int> EntityPropertyEditor::GetFixedComponentListIndex(const AZ::Component* component)
|
||||
{
|
||||
auto componentClassData = component ? GetComponentClassData(component) : nullptr;
|
||||
if (componentClassData && componentClassData->m_editData)
|
||||
{
|
||||
if (auto editorDataElement = componentClassData->m_editData->FindElementData(AZ::Edit::ClassElements::EditorData))
|
||||
{
|
||||
if (auto attribute = editorDataElement->FindAttribute(AZ::Edit::Attributes::FixedComponentListIndex))
|
||||
{
|
||||
if (auto attributeData = azdynamic_cast<AZ::Edit::AttributeData<int>*>(attribute))
|
||||
{
|
||||
return { attributeData->Get(nullptr) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool EntityPropertyEditor::IsComponentDraggable(const AZ::Component* component)
|
||||
{
|
||||
return !GetFixedComponentListIndex(component).has_value();
|
||||
}
|
||||
|
||||
bool EntityPropertyEditor::AreComponentsDraggable(const AZ::Entity::ComponentArrayType& components) const
|
||||
{
|
||||
return AZStd::all_of(
|
||||
components.begin(), components.end(), [](AZ::Component* component) { return IsComponentDraggable(component); });
|
||||
}
|
||||
|
||||
bool EntityPropertyEditor::AreComponentsCopyable(const AZ::Entity::ComponentArrayType& components) const
|
||||
{
|
||||
return AreComponentsCopyable(components, m_componentFilter);
|
||||
@@ -3367,7 +3408,9 @@ namespace AzToolsFramework
|
||||
sourceComponents.size() == m_selectedEntityIds.size() &&
|
||||
targetComponents.size() == m_selectedEntityIds.size() &&
|
||||
AreComponentsRemovable(sourceComponents) &&
|
||||
AreComponentsRemovable(targetComponents);
|
||||
AreComponentsRemovable(targetComponents) &&
|
||||
AreComponentsDraggable(sourceComponents) &&
|
||||
AreComponentsDraggable(targetComponents);
|
||||
}
|
||||
|
||||
bool EntityPropertyEditor::IsMoveComponentsUpAllowed() const
|
||||
@@ -3681,14 +3724,38 @@ namespace AzToolsFramework
|
||||
|
||||
void EntityPropertyEditor::ScrollToNewComponent()
|
||||
{
|
||||
//force new components to be visible, assuming they are added to the end of the list and layout
|
||||
auto componentEditor = GetComponentEditorsFromIndex(m_componentEditorsUsed - 1);
|
||||
// force new components to be visible
|
||||
// if no component has been explicitly set at the most recently added,
|
||||
// assume new components are added to the end of the list and layout
|
||||
AZ::s32 newComponentIndex = m_componentEditorsUsed - 1;
|
||||
|
||||
// if there is a component id explicitly set as the most recently added, try to find it and make sure it is visible
|
||||
if (m_newComponentId.has_value() && m_newComponentId.value() != AZ::InvalidComponentId)
|
||||
{
|
||||
AZ::ComponentId newComponentId = m_newComponentId.value();
|
||||
for (AZ::s32 componentIndex = 0; componentIndex < m_componentEditorsUsed; ++componentIndex)
|
||||
{
|
||||
if (m_componentEditors[componentIndex])
|
||||
{
|
||||
for (const auto component : m_componentEditors[componentIndex]->GetComponents())
|
||||
{
|
||||
if (component->GetId() == newComponentId)
|
||||
{
|
||||
newComponentIndex = componentIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto componentEditor = GetComponentEditorsFromIndex(newComponentIndex);
|
||||
if (componentEditor)
|
||||
{
|
||||
m_gui->m_componentList->ensureWidgetVisible(componentEditor);
|
||||
}
|
||||
m_shouldScrollToNewComponents = false;
|
||||
m_shouldScrollToNewComponentsQueued = false;
|
||||
m_newComponentId.reset();
|
||||
}
|
||||
|
||||
void EntityPropertyEditor::QueueScrollToNewComponent()
|
||||
@@ -4073,7 +4140,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (!componentEditor ||
|
||||
!componentEditor->isVisible() ||
|
||||
!AreComponentsRemovable(componentEditor->GetComponents()))
|
||||
!AreComponentsRemovable(componentEditor->GetComponents()) ||
|
||||
!AreComponentsDraggable(componentEditor->GetComponents()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -4223,6 +4291,7 @@ namespace AzToolsFramework
|
||||
while (targetComponentEditor
|
||||
&& (targetComponentEditor->IsDragged()
|
||||
|| !AreComponentsRemovable(targetComponentEditor->GetComponents())
|
||||
|| !AreComponentsDraggable(targetComponentEditor->GetComponents())
|
||||
|| (globalRect.center().y() > GetWidgetGlobalRect(targetComponentEditor).center().y())))
|
||||
{
|
||||
if (targetItr == m_componentEditors.end() || targetComponentEditor == m_componentEditors.back() || !targetComponentEditor->isVisible())
|
||||
|
||||
+7
@@ -211,6 +211,7 @@ namespace AzToolsFramework
|
||||
// EntityPropertEditorRequestBus
|
||||
void GetSelectedAndPinnedEntities(EntityIdList& selectedEntityIds) override;
|
||||
void GetSelectedEntities(EntityIdList& selectedEntityIds) override;
|
||||
void SetNewComponentId(AZ::ComponentId componentId) override;
|
||||
|
||||
bool IsEntitySelected(const AZ::EntityId& id) const;
|
||||
bool IsSingleEntitySelected(const AZ::EntityId& id) const;
|
||||
@@ -237,6 +238,9 @@ namespace AzToolsFramework
|
||||
static bool DoesComponentPassFilter(const AZ::Component* component, const ComponentFilter& filter);
|
||||
static bool IsComponentRemovable(const AZ::Component* component);
|
||||
bool AreComponentsRemovable(const AZ::Entity::ComponentArrayType& components) const;
|
||||
static AZStd::optional<int> GetFixedComponentListIndex(const AZ::Component* component);
|
||||
static bool IsComponentDraggable(const AZ::Component* component);
|
||||
bool AreComponentsDraggable(const AZ::Entity::ComponentArrayType& components) const;
|
||||
bool AreComponentsCopyable(const AZ::Entity::ComponentArrayType& components) const;
|
||||
|
||||
void AddMenuOptionsForComponents(QMenu& menu, const QPoint& position);
|
||||
@@ -568,6 +572,9 @@ namespace AzToolsFramework
|
||||
void ConnectToEntityBuses(const AZ::EntityId& entityId);
|
||||
void DisconnectFromEntityBuses(const AZ::EntityId& entityId);
|
||||
|
||||
//! Stores a component id to be focused on next time the UI updates.
|
||||
AZStd::optional<AZ::ComponentId> m_newComponentId;
|
||||
|
||||
private slots:
|
||||
void OnPropertyRefreshRequired(); // refresh is needed for a property.
|
||||
void UpdateContents();
|
||||
|
||||
@@ -178,6 +178,24 @@ namespace AzToolsFramework
|
||||
~ViewportInteractionRequests() = default;
|
||||
};
|
||||
|
||||
/// Interface to return only viewport specific settings (e.g. snapping).
|
||||
class ViewportSettings
|
||||
{
|
||||
public:
|
||||
virtual ~ViewportSettings() = default;
|
||||
|
||||
/// Return if grid snapping is enabled.
|
||||
virtual bool GridSnappingEnabled() const = 0;
|
||||
/// Return the grid snapping size.
|
||||
virtual float GridSize() const = 0;
|
||||
/// Does the grid currently want to be displayed.
|
||||
virtual bool ShowGrid() const = 0;
|
||||
/// Return if angle snapping is enabled.
|
||||
virtual bool AngleSnappingEnabled() const = 0;
|
||||
/// Return the angle snapping/step size.
|
||||
virtual float AngleStep() const = 0;
|
||||
};
|
||||
|
||||
/// Type to inherit to implement ViewportInteractionRequests.
|
||||
using ViewportInteractionRequestBus = AZ::EBus<ViewportInteractionRequests, ViewportEBusTraits>;
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/ScriptEditorComponent.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx>
|
||||
#include <AzToolsFramework/API/EntityPropertyEditorRequestsBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorLockComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityComponent.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorDefaultSelection.h>
|
||||
|
||||
#include <AzCore/IO/Streamer/StreamerComponent.h>
|
||||
#include <AzCore/Asset/AssetManagerComponent.h>
|
||||
#include <AzCore/std/sort.h>
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace UnitTest
|
||||
|
||||
TEST(EntityPropertyEditorTests, PrioritySort_NonTransformAsFirstItem_TransformMovesToTopRemainderUnchanged)
|
||||
{
|
||||
ComponentApplication app;
|
||||
ToolsApplication app;
|
||||
|
||||
AZ::Entity::ComponentArrayType unorderedComponents;
|
||||
AZ::Entity::ComponentArrayType orderedComponents;
|
||||
@@ -68,12 +68,18 @@ namespace UnitTest
|
||||
|
||||
Entity* systemEntity = app.Create(desc, startupParams);
|
||||
|
||||
// Need to reflect the components so that edit attribute used for sorting, such as FixedComponentListIndex, get set.
|
||||
app.RegisterComponentDescriptor(AzToolsFramework::Components::TransformComponent::CreateDescriptor());
|
||||
app.RegisterComponentDescriptor(AzToolsFramework::Components::ScriptEditorComponent::CreateDescriptor());
|
||||
app.RegisterComponentDescriptor(AZ::AssetManagerComponent::CreateDescriptor());
|
||||
|
||||
// Add more than 31 components, as we are testing the case where the sort fails when there are 32 or more items.
|
||||
const int numFillerItems = 32;
|
||||
|
||||
for (int commentIndex = 0; commentIndex < numFillerItems; commentIndex++)
|
||||
{
|
||||
unorderedComponents.insert(unorderedComponents.begin(), systemEntity->CreateComponent(AZ::StreamerComponent::RTTI_Type()));
|
||||
unorderedComponents.insert(unorderedComponents.begin(), systemEntity->CreateComponent(
|
||||
AzToolsFramework::Components::ScriptEditorComponent::RTTI_Type()));
|
||||
}
|
||||
|
||||
// Add a TransformComponent at the end which should be sorted to the beginning by the priority sort.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <AzCore/IO/SystemFile.h> // for AZ_MAX_PATH_LEN
|
||||
|
||||
#include <CrySystem/SystemUtilsApple.h>
|
||||
#include <AzFramework/Utils/SystemUtilsApple.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
@@ -106,6 +106,15 @@ AZ_CVAR(
|
||||
|
||||
EditorViewportWidget* EditorViewportWidget::m_pPrimaryViewport = nullptr;
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
extern InputChannelId CameraFreeLookButton;
|
||||
extern InputChannelId CameraFreePanButton;
|
||||
extern InputChannelId CameraOrbitLookButton;
|
||||
extern InputChannelId CameraOrbitDollyButton;
|
||||
extern InputChannelId CameraOrbitPanButton;
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
void StopFixedCursorMode();
|
||||
void StartFixedCursorMode(QObject *viewport);
|
||||
@@ -161,6 +170,7 @@ EditorViewportWidget::EditorViewportWidget(const QString& name, QWidget* parent)
|
||||
, m_camFOV(gSettings.viewports.fDefaultFov)
|
||||
, m_defaultViewName(name)
|
||||
, m_renderViewport(nullptr) //m_renderViewport is initialized later, in SetViewportId
|
||||
, m_editorViewportSettings(this)
|
||||
{
|
||||
// need this to be set in order to allow for language switching on Windows
|
||||
setAttribute(Qt::WA_InputMethodEnabled);
|
||||
@@ -1098,32 +1108,6 @@ AzFramework::CameraState EditorViewportWidget::GetCameraState()
|
||||
return m_renderViewport->GetCameraState();
|
||||
}
|
||||
|
||||
bool EditorViewportWidget::GridSnappingEnabled()
|
||||
{
|
||||
return GetViewManager()->GetGrid()->IsEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportWidget::GridSize()
|
||||
{
|
||||
const CGrid* grid = GetViewManager()->GetGrid();
|
||||
return grid->scale * grid->size;
|
||||
}
|
||||
|
||||
bool EditorViewportWidget::ShowGrid()
|
||||
{
|
||||
return gSettings.viewports.bShowGridGuide;
|
||||
}
|
||||
|
||||
bool EditorViewportWidget::AngleSnappingEnabled()
|
||||
{
|
||||
return GetViewManager()->GetGrid()->IsAngleSnapEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportWidget::AngleStep()
|
||||
{
|
||||
return GetViewManager()->GetGrid()->GetAngleSnap();
|
||||
}
|
||||
|
||||
AZ::Vector3 EditorViewportWidget::PickTerrain(const AzFramework::ScreenPoint& point)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
@@ -1227,13 +1211,47 @@ void EditorViewportWidget::SetViewportId(int id)
|
||||
if (ed_useNewCameraSystem)
|
||||
{
|
||||
AzFramework::ReloadCameraKeyBindings();
|
||||
m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::ModernViewportCameraController>());
|
||||
|
||||
auto controller = AZStd::make_shared<SandboxEditor::ModernViewportCameraController>();
|
||||
controller->SetCameraListBuilderCallback([](AzFramework::Cameras& cameras)
|
||||
{
|
||||
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraFreeLookButton);
|
||||
auto firstPersonPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraFreePanButton, AzFramework::LookPan);
|
||||
auto firstPersonTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation);
|
||||
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
|
||||
|
||||
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>();
|
||||
auto orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraOrbitLookButton);
|
||||
auto orbitTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation);
|
||||
auto orbitDollyWheelCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
|
||||
auto orbitDollyMoveCamera =
|
||||
AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>(AzFramework::CameraOrbitDollyButton);
|
||||
auto orbitPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraOrbitPanButton, AzFramework::OrbitPan);
|
||||
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyWheelCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyMoveCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitPanCamera);
|
||||
|
||||
cameras.AddCamera(firstPersonRotateCamera);
|
||||
cameras.AddCamera(firstPersonPanCamera);
|
||||
cameras.AddCamera(firstPersonTranslateCamera);
|
||||
cameras.AddCamera(firstPersonWheelCamera);
|
||||
cameras.AddCamera(orbitCamera);
|
||||
});
|
||||
|
||||
m_renderViewport->GetControllerList()->Add(controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::LegacyViewportCameraController>());
|
||||
}
|
||||
|
||||
m_renderViewport->SetViewportSettings(&m_editorViewportSettings);
|
||||
|
||||
UpdateScene();
|
||||
|
||||
if (m_pPrimaryViewport == this)
|
||||
@@ -2853,4 +2871,35 @@ void EditorViewportWidget::SetAsActiveViewport()
|
||||
}
|
||||
}
|
||||
|
||||
EditorViewportSettings::EditorViewportSettings(const EditorViewportWidget* editorViewportWidget)
|
||||
: m_editorViewportWidget(editorViewportWidget)
|
||||
{
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::GridSnappingEnabled() const
|
||||
{
|
||||
return m_editorViewportWidget->GetViewManager()->GetGrid()->IsEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportSettings::GridSize() const
|
||||
{
|
||||
const CGrid* grid = m_editorViewportWidget->GetViewManager()->GetGrid();
|
||||
return grid->scale * grid->size;
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::ShowGrid() const
|
||||
{
|
||||
return gSettings.viewports.bShowGridGuide;
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::AngleSnappingEnabled() const
|
||||
{
|
||||
return m_editorViewportWidget->GetViewManager()->GetGrid()->IsAngleSnapEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportSettings::AngleStep() const
|
||||
{
|
||||
return m_editorViewportWidget->GetViewManager()->GetGrid()->GetAngleSnap();
|
||||
}
|
||||
|
||||
#include <moc_EditorViewportWidget.cpp>
|
||||
|
||||
@@ -65,6 +65,23 @@ namespace AzToolsFramework
|
||||
class ManipulatorManager;
|
||||
}
|
||||
|
||||
class EditorViewportWidget;
|
||||
|
||||
//! Viewport settings for the EditorViewportWidget
|
||||
struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::ViewportSettings
|
||||
{
|
||||
explicit EditorViewportSettings(const EditorViewportWidget* editorViewportWidget);
|
||||
|
||||
bool GridSnappingEnabled() const override;
|
||||
float GridSize() const override;
|
||||
bool ShowGrid() const override;
|
||||
bool AngleSnappingEnabled() const override;
|
||||
float AngleStep() const override;
|
||||
|
||||
private:
|
||||
const EditorViewportWidget* m_editorViewportWidget = nullptr;
|
||||
};
|
||||
|
||||
// EditorViewportWidget window
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
@@ -189,13 +206,7 @@ public:
|
||||
virtual void OnStartPlayInEditor();
|
||||
virtual void OnStopPlayInEditor();
|
||||
|
||||
// AzToolsFramework::ViewportInteractionRequestBus
|
||||
AzFramework::CameraState GetCameraState();
|
||||
bool GridSnappingEnabled();
|
||||
float GridSize();
|
||||
bool ShowGrid();
|
||||
bool AngleSnappingEnabled();
|
||||
float AngleStep();
|
||||
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
|
||||
|
||||
// AzToolsFramework::ViewportFreezeRequestBus
|
||||
@@ -596,5 +607,7 @@ private:
|
||||
|
||||
AZ::Name m_defaultViewportContextName;
|
||||
|
||||
EditorViewportSettings m_editorViewportSettings;
|
||||
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
namespace SandboxEditor
|
||||
{
|
||||
|
||||
LegacyViewportCameraControllerInstance::LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewportId)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface(viewportId)
|
||||
LegacyViewportCameraControllerInstance::LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewportId, LegacyViewportCameraController* controller)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface<LegacyViewportCameraController>(viewportId, controller)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,14 @@ namespace AzFramework
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class LegacyViewportCameraControllerInstance;
|
||||
using LegacyViewportCameraController = AzFramework::MultiViewportController<LegacyViewportCameraControllerInstance>;
|
||||
|
||||
class LegacyViewportCameraControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<LegacyViewportCameraController>
|
||||
{
|
||||
public:
|
||||
explicit LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewport);
|
||||
LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewport, LegacyViewportCameraController* controller);
|
||||
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
void ResetInputChannels() override;
|
||||
@@ -69,5 +72,4 @@ namespace SandboxEditor
|
||||
bool m_capturingCursor = false;
|
||||
};
|
||||
|
||||
using LegacyViewportCameraController = AzFramework::MultiViewportController<LegacyViewportCameraControllerInstance>;
|
||||
} //namespace SandboxEditor
|
||||
|
||||
@@ -22,15 +22,6 @@
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
extern InputChannelId CameraFreeLookButton;
|
||||
extern InputChannelId CameraFreePanButton;
|
||||
extern InputChannelId CameraOrbitLookButton;
|
||||
extern InputChannelId CameraOrbitDollyButton;
|
||||
extern InputChannelId CameraOrbitPanButton;
|
||||
}
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
static void DrawPreviewAxis(AzFramework::DebugDisplayRequests& display, const AZ::Transform& transform, const float axisLength)
|
||||
@@ -60,36 +51,23 @@ namespace SandboxEditor
|
||||
return viewportContext;
|
||||
}
|
||||
|
||||
ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(const AzFramework::ViewportId viewportId)
|
||||
: MultiViewportControllerInstanceInterface(viewportId)
|
||||
void ModernViewportCameraController::SetCameraListBuilderCallback(const CameraListBuilder& builder)
|
||||
{
|
||||
// LYN-2315 TODO - move setup out of constructor, pass cameras in
|
||||
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraFreeLookButton);
|
||||
auto firstPersonPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraFreePanButton, AzFramework::LookPan);
|
||||
auto firstPersonTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation);
|
||||
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
|
||||
m_cameraListBuilder = builder;
|
||||
}
|
||||
|
||||
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>();
|
||||
auto orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraOrbitLookButton);
|
||||
auto orbitTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation);
|
||||
auto orbitDollyWheelCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
|
||||
auto orbitDollyMoveCamera =
|
||||
AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>(AzFramework::CameraOrbitDollyButton);
|
||||
auto orbitPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraOrbitPanButton, AzFramework::OrbitPan);
|
||||
void ModernViewportCameraController::SetupCameras(AzFramework::Cameras& cameras)
|
||||
{
|
||||
if (m_cameraListBuilder)
|
||||
{
|
||||
m_cameraListBuilder(cameras);
|
||||
}
|
||||
}
|
||||
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyWheelCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyMoveCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitPanCamera);
|
||||
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonRotateCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonPanCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonTranslateCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonWheelCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(orbitCamera);
|
||||
ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(const AzFramework::ViewportId viewportId, ModernViewportCameraController* controller)
|
||||
: MultiViewportControllerInstanceInterface<ModernViewportCameraController>(viewportId, controller)
|
||||
{
|
||||
controller->SetupCameras(m_cameraSystem.m_cameras);
|
||||
|
||||
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
|
||||
{
|
||||
|
||||
@@ -19,12 +19,29 @@
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class ModernViewportCameraControllerInstance final : public AzFramework::MultiViewportControllerInstanceInterface,
|
||||
private AzFramework::ViewportDebugDisplayEventBus::Handler
|
||||
class ModernViewportCameraControllerInstance;
|
||||
class ModernViewportCameraController
|
||||
: public AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>
|
||||
{
|
||||
public:
|
||||
explicit ModernViewportCameraControllerInstance(AzFramework::ViewportId viewportId);
|
||||
~ModernViewportCameraControllerInstance();
|
||||
using CameraListBuilder = AZStd::function<void(AzFramework::Cameras&)>;
|
||||
//! Sets the camera list builder callback used to populate new ModernViewportCameraControllerInstances
|
||||
void SetCameraListBuilderCallback(const CameraListBuilder& builder);
|
||||
|
||||
//! Sets up a camera list based on this controller's CameraListBuilderCallback
|
||||
void SetupCameras(AzFramework::Cameras& cameras);
|
||||
|
||||
private:
|
||||
CameraListBuilder m_cameraListBuilder;
|
||||
};
|
||||
|
||||
class ModernViewportCameraControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<ModernViewportCameraController>
|
||||
, private AzFramework::ViewportDebugDisplayEventBus::Handler
|
||||
{
|
||||
public:
|
||||
explicit ModernViewportCameraControllerInstance(AzFramework::ViewportId viewportId, ModernViewportCameraController* controller);
|
||||
~ModernViewportCameraControllerInstance() override;
|
||||
|
||||
// MultiViewportControllerInstanceInterface overrides ...
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
@@ -51,6 +68,4 @@ namespace SandboxEditor
|
||||
|
||||
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
|
||||
};
|
||||
|
||||
using ModernViewportCameraController = AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>;
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -27,8 +27,8 @@ static const auto InteractionPriority = AzFramework::ViewportControllerPriority:
|
||||
namespace SandboxEditor
|
||||
{
|
||||
|
||||
ViewportManipulatorControllerInstance::ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface(viewport)
|
||||
ViewportManipulatorControllerInstance::ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport, ViewportManipulatorController* controller)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface<ViewportManipulatorController>(viewport, controller)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,14 @@
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class ViewportManipulatorControllerInstance;
|
||||
using ViewportManipulatorController = AzFramework::MultiViewportController<ViewportManipulatorControllerInstance, AzFramework::ViewportControllerPriority::DispatchToAllPriorities>;
|
||||
|
||||
class ViewportManipulatorControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<ViewportManipulatorController>
|
||||
{
|
||||
public:
|
||||
explicit ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport);
|
||||
explicit ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport, ViewportManipulatorController* controller);
|
||||
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
void ResetInputChannels() override;
|
||||
@@ -40,6 +43,4 @@ namespace SandboxEditor
|
||||
AZStd::unordered_map<AzToolsFramework::ViewportInteraction::MouseButton, AZ::ScriptTimePoint> m_pendingDoubleClicks;
|
||||
AZ::ScriptTimePoint m_curTime;
|
||||
};
|
||||
|
||||
using ViewportManipulatorController = AzFramework::MultiViewportController<ViewportManipulatorControllerInstance, AzFramework::ViewportControllerPriority::DispatchToAllPriorities>;
|
||||
} //namespace SandboxEditor
|
||||
|
||||
@@ -124,131 +124,29 @@ namespace AssetProcessor
|
||||
|
||||
NativeLegacyRCCompiler::NativeLegacyRCCompiler()
|
||||
: m_resourceCompilerInitialized(false)
|
||||
, m_systemRoot()
|
||||
, m_rcExecutableFullPath()
|
||||
, m_requestedQuit(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool NativeLegacyRCCompiler::Initialize(const QString& systemRoot, const QString& rcExecutableFullPath)
|
||||
|
||||
bool NativeLegacyRCCompiler::Initialize()
|
||||
{
|
||||
// QFile::exists(normalizedPath)
|
||||
if (!QDir(systemRoot).exists())
|
||||
{
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, QString("Cannot locate system root dir %1").arg(systemRoot).toUtf8().data());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AZ::IO::SystemFile::Exists(rcExecutableFullPath.toUtf8().data()))
|
||||
{
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, QString("Invalid executable path '%1'").arg(rcExecutableFullPath).toUtf8().data());
|
||||
return false;
|
||||
}
|
||||
this->m_systemRoot.setPath(systemRoot);
|
||||
this->m_rcExecutableFullPath = rcExecutableFullPath;
|
||||
this->m_resourceCompilerInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NativeLegacyRCCompiler::Execute(const QString& inputFile, const QString& watchFolder, const QString& platformIdentifier,
|
||||
const QString& params, const QString& dest, const AssetBuilderSDK::JobCancelListener* jobCancelListener, Result& result) const
|
||||
bool NativeLegacyRCCompiler::Execute(
|
||||
[[maybe_unused]] const QString& inputFile,
|
||||
[[maybe_unused]] const QString& watchFolder,
|
||||
[[maybe_unused]] const QString& platformIdentifier,
|
||||
[[maybe_unused]] const QString& params,
|
||||
[[maybe_unused]] const QString& dest,
|
||||
[[maybe_unused]] const AssetBuilderSDK::JobCancelListener* jobCancelListener,
|
||||
[[maybe_unused]] Result& result) const
|
||||
{
|
||||
if (!this->m_resourceCompilerInitialized)
|
||||
{
|
||||
result.m_exitCode = JobExitCode_RCCouldNotBeLaunched;
|
||||
result.m_crashed = false;
|
||||
AZ_Warning("RC Builder", false, "RC Compiler has not been initialized before use.");
|
||||
return false;
|
||||
}
|
||||
// running RC.EXE is deprecated.
|
||||
AZ_Error("RC Builder", false, "running RC.EXE is deprecated");
|
||||
|
||||
// build the command line:
|
||||
QString commandString = NativeLegacyRCCompiler::BuildCommand(inputFile, watchFolder, platformIdentifier, params, dest);
|
||||
|
||||
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
||||
|
||||
// while it might be tempting to set the executable in processLaunchInfo.m_processExecutableString, it turns out that RC.EXE
|
||||
// won't work if you do that because it assumes the first command line param is the exe name, which is not the case if you do it that way...
|
||||
|
||||
QString formatter("\"%1\" %2");
|
||||
processLaunchInfo.m_commandlineParameters = QString(formatter).arg(m_rcExecutableFullPath).arg(commandString).toUtf8().data();
|
||||
processLaunchInfo.m_showWindow = false;
|
||||
processLaunchInfo.m_workingDirectory = m_systemRoot.absolutePath().toUtf8().data();
|
||||
processLaunchInfo.m_processPriority = AzFramework::ProcessPriority::PROCESSPRIORITY_IDLE;
|
||||
|
||||
AZ_TracePrintf("RC Builder", "Executing RC.EXE: '%s' ...\n", processLaunchInfo.m_commandlineParameters.c_str());
|
||||
AZ_TracePrintf("Rc Builder", "Executing RC.EXE with working directory: '%s' ...\n", processLaunchInfo.m_workingDirectory.c_str());
|
||||
|
||||
AzFramework::ProcessWatcher* watcher = AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_STDINOUT);
|
||||
|
||||
if (!watcher)
|
||||
{
|
||||
result.m_exitCode = JobExitCode_RCCouldNotBeLaunched;
|
||||
result.m_crashed = false;
|
||||
AZ_Error("RC Builder", false, "RC failed to execute\n");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QElapsedTimer ticker;
|
||||
ticker.start();
|
||||
|
||||
// it created the process, wait for it to exit:
|
||||
bool finishedOK = false;
|
||||
{
|
||||
CommunicatorTracePrinter tracer(watcher->GetCommunicator(), "RC Builder"); // allow this to go out of scope...
|
||||
while ((!m_requestedQuit) && (!finishedOK))
|
||||
{
|
||||
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(NativeLegacyRCCompiler::s_maxSleepTime));
|
||||
|
||||
tracer.Pump();
|
||||
|
||||
if (ticker.elapsed() > s_jobMaximumWaitTime || (jobCancelListener && jobCancelListener->IsCancelled()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
AZ::u32 exitCode = 0;
|
||||
if (!watcher->IsProcessRunning(&exitCode))
|
||||
{
|
||||
finishedOK = true; // we either cant wait for it, or it finished.
|
||||
result.m_exitCode = exitCode;
|
||||
result.m_crashed = (exitCode == 100) || (exitCode == 101); // these indicate fatal errors.
|
||||
break;
|
||||
}
|
||||
}
|
||||
tracer.Pump(); // empty whats left if possible.
|
||||
}
|
||||
if (!finishedOK)
|
||||
{
|
||||
if (watcher->IsProcessRunning())
|
||||
{
|
||||
watcher->TerminateProcess(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
if (!this->m_requestedQuit)
|
||||
{
|
||||
if (jobCancelListener == nullptr || !jobCancelListener->IsCancelled())
|
||||
{
|
||||
AZ_Error("RC Builder", false, "RC failed to complete within the maximum allowed time and was terminated. please see %s/rc_log.log for details", result.m_outputDir.toUtf8().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_TracePrintf("RC Builder", "RC was terminated. There was a request to cancel the job.\n");
|
||||
result.m_exitCode = JobExitCode_JobCancelled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning("RC Builder", false, "RC terminated because the application is shutting down.\n");
|
||||
result.m_exitCode = JobExitCode_JobCancelled;
|
||||
}
|
||||
result.m_crashed = false;
|
||||
}
|
||||
AZ_TracePrintf("RC Builder", "RC.EXE execution has ended\n");
|
||||
|
||||
delete watcher;
|
||||
|
||||
return finishedOK;
|
||||
return false;
|
||||
}
|
||||
|
||||
QString NativeLegacyRCCompiler::BuildCommand(const QString& inputFile, const QString& watchFolder, const QString& platformIdentifier, const QString& params, const QString& dest)
|
||||
@@ -438,22 +336,7 @@ namespace AssetProcessor
|
||||
bool InternalRecognizerBasedBuilder::Initialize(const RecognizerConfiguration& recognizerConfig)
|
||||
{
|
||||
InitializeAssetRecognizers(recognizerConfig.GetAssetRecognizerContainer());
|
||||
|
||||
// Get the engine root since rc.exe will exist there and not in any external project folder
|
||||
QString systemRoot;
|
||||
QString rcFullPath;
|
||||
|
||||
// Validate that the engine root contains the necessary rc.exe
|
||||
if (!FindRC(rcFullPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!m_rcCompiler->Initialize(systemRoot, rcFullPath))
|
||||
{
|
||||
AssetBuilderSDK::BuilderLog(m_internalRecognizerBuilderUuid, "Unable to find rc.exe from the engine root (%1).", rcFullPath.toUtf8().data());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return m_rcCompiler->Initialize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace AssetProcessor
|
||||
};
|
||||
|
||||
virtual ~RCCompiler() = default;
|
||||
virtual bool Initialize(const QString& systemRoot, const QString& rcExecutableFullPath) = 0;
|
||||
virtual bool Initialize() = 0;
|
||||
virtual bool Execute(const QString& inputFile, const QString& watchFolder, const QString& platformIdentifier, const QString& params,
|
||||
const QString& dest, const AssetBuilderSDK::JobCancelListener* jobCancelListener, Result& result) const = 0;
|
||||
virtual void RequestQuit() = 0;
|
||||
@@ -44,7 +44,7 @@ namespace AssetProcessor
|
||||
public:
|
||||
NativeLegacyRCCompiler();
|
||||
|
||||
bool Initialize(const QString& systemRoot, const QString& rcExecutableFullPath) override;
|
||||
bool Initialize() override;
|
||||
bool Execute(const QString& inputFile, const QString& watchFolder, const QString& platformIdentifier, const QString& params, const QString& dest,
|
||||
const AssetBuilderSDK::JobCancelListener* jobCancelListener, Result& result) const override;
|
||||
static QString BuildCommand(const QString& inputFile, const QString& watchFolder, const QString& platformIdentifier, const QString& params, const QString& dest);
|
||||
@@ -53,8 +53,6 @@ namespace AssetProcessor
|
||||
static const int s_maxSleepTime;
|
||||
static const unsigned int s_jobMaximumWaitTime;
|
||||
bool m_resourceCompilerInitialized;
|
||||
QDir m_systemRoot;
|
||||
QString m_rcExecutableFullPath;
|
||||
volatile bool m_requestedQuit;
|
||||
};
|
||||
|
||||
|
||||
@@ -43,19 +43,6 @@ TEST_F(RCBuilderTest, Shutdown_NormalShutdown_Requested)
|
||||
}
|
||||
|
||||
|
||||
TEST_F(RCBuilderTest, Initialize_StandardInitialization_Fail)
|
||||
{
|
||||
MockRCCompiler* mockRC = new MockRCCompiler();
|
||||
TestInternalRecognizerBasedBuilder test(mockRC);
|
||||
|
||||
MockRecognizerConfiguration configuration;
|
||||
|
||||
mockRC->SetResultInitialize(false);
|
||||
bool initialization_result = test.Initialize(configuration);
|
||||
ASSERT_FALSE(initialization_result);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(RCBuilderTest, Initialize_StandardInitializationWithDuplicateAndInvalidRecognizers_Valid)
|
||||
{
|
||||
MockRCCompiler* mockRC = new MockRCCompiler();
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool Initialize([[maybe_unused]] const QString& systemRoot, [[maybe_unused]] const QString& rcExecutableFullPath) override
|
||||
bool Initialize() override
|
||||
{
|
||||
m_initialize++;
|
||||
return m_initializeResult;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace AssetProcessor
|
||||
{
|
||||
}
|
||||
|
||||
bool Initialize([[maybe_unused]] const QString& systemRoot, [[maybe_unused]] const QString& rcExecutableFullPath) override
|
||||
bool Initialize() override
|
||||
{
|
||||
m_initialize++;
|
||||
return m_initializeResult;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <GemCatalog.h>
|
||||
|
||||
#include <Source/ui_GemCatalog.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemCatalog::GemCatalog(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
, m_ui(new Ui::GemCatalogClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
ConnectSlotsAndSignals();
|
||||
}
|
||||
|
||||
GemCatalog::~GemCatalog()
|
||||
{
|
||||
}
|
||||
|
||||
void GemCatalog::ConnectSlotsAndSignals()
|
||||
{
|
||||
QObject::connect(m_ui->backButton, &QPushButton::pressed, this, &GemCatalog::HandleBackButton);
|
||||
QObject::connect(m_ui->confirmButton, &QPushButton::pressed, this, &GemCatalog::HandleConfirmButton);
|
||||
}
|
||||
|
||||
void GemCatalog::HandleBackButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
|
||||
}
|
||||
void GemCatalog::HandleConfirmButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -1,231 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GemCatalogClass</class>
|
||||
<widget class="QWidget" name="GemCatalogClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>806</width>
|
||||
<height>566</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Gem Catalog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>Cart</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_2">
|
||||
<property name="text">
|
||||
<string>Hamburger Menu</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_2">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_3">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_3">
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Atom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Camera</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PhysX</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="backButton">
|
||||
<property name="text">
|
||||
<string>Back</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="confirmButton">
|
||||
<property name="text">
|
||||
<string>Create Project</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <GemCatalog/GemCatalog.h>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemCatalog::GemCatalog(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
{
|
||||
ConnectSlotsAndSignals();
|
||||
|
||||
m_gemModel = new GemModel(this);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
vLayout->addLayout(hLayout);
|
||||
|
||||
QWidget* filterPlaceholderWidget = new QWidget();
|
||||
filterPlaceholderWidget->setFixedWidth(250);
|
||||
hLayout->addWidget(filterPlaceholderWidget);
|
||||
|
||||
m_gemListView = new GemListView(m_gemModel, this);
|
||||
hLayout->addWidget(m_gemListView);
|
||||
|
||||
QWidget* inspectorPlaceholderWidget = new QWidget();
|
||||
inspectorPlaceholderWidget->setFixedWidth(250);
|
||||
hLayout->addWidget(inspectorPlaceholderWidget);
|
||||
|
||||
// Temporary back and next buttons until they are centralized and shared.
|
||||
QDialogButtonBox* backNextButtons = new QDialogButtonBox();
|
||||
vLayout->addWidget(backNextButtons);
|
||||
|
||||
QPushButton* tempBackButton = backNextButtons->addButton("Back", QDialogButtonBox::RejectRole);
|
||||
QPushButton* tempNextButton = backNextButtons->addButton("Next", QDialogButtonBox::AcceptRole);
|
||||
connect(tempBackButton, &QPushButton::pressed, this, &GemCatalog::HandleBackButton);
|
||||
connect(tempNextButton, &QPushButton::pressed, this, &GemCatalog::HandleConfirmButton);
|
||||
|
||||
// Start: Temporary gem test data
|
||||
{
|
||||
m_gemModel->AddGem(GemInfo("EMotion FX",
|
||||
"O3DE Foundation",
|
||||
"EMFX is a real-time character animation system. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
(GemInfo::Android | GemInfo::iOS | GemInfo::Windows | GemInfo::Linux),
|
||||
true));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Atom",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
true));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("PhysX",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Android | GemInfo::Linux,
|
||||
false));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Certificate Manager",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Windows,
|
||||
false));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Cloud Gem Framework",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::iOS | GemInfo::Linux,
|
||||
false));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Achievements",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
false));
|
||||
}
|
||||
// End: Temporary gem test data
|
||||
}
|
||||
|
||||
void GemCatalog::HandleBackButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
|
||||
}
|
||||
void GemCatalog::HandleConfirmButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
+5
-12
@@ -13,32 +13,25 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ScreenWidget.h>
|
||||
#include <GemCatalog/GemListView.h>
|
||||
#include <GemCatalog/GemModel.h>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class GemCatalogClass;
|
||||
}
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemCatalog
|
||||
: public ScreenWidget
|
||||
{
|
||||
|
||||
public:
|
||||
explicit GemCatalog(ProjectManagerWindow* window);
|
||||
~GemCatalog();
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals() override;
|
||||
~GemCatalog() = default;
|
||||
|
||||
protected slots:
|
||||
void HandleBackButton();
|
||||
void HandleConfirmButton();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::GemCatalogClass> m_ui;
|
||||
GemListView* m_gemListView = nullptr;
|
||||
GemModel* m_gemModel = nullptr;
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "GemItemDelegate.h"
|
||||
#include "GemModel.h"
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemItemDelegate::GemItemDelegate(GemModel* gemModel, QObject* parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
, m_gemModel(gemModel)
|
||||
{
|
||||
}
|
||||
|
||||
void GemItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const
|
||||
{
|
||||
if (!modelIndex.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QStyleOptionViewItem options(option);
|
||||
initStyleOption(&options, modelIndex);
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QRect fullRect, itemRect, contentRect;
|
||||
CalcRects(options, modelIndex, fullRect, itemRect, contentRect);
|
||||
|
||||
QFont standardFont(options.font);
|
||||
standardFont.setPixelSize(s_fontSize);
|
||||
|
||||
painter->save();
|
||||
painter->setClipping(true);
|
||||
painter->setClipRect(fullRect);
|
||||
painter->setFont(options.font);
|
||||
|
||||
// Draw background
|
||||
painter->fillRect(fullRect, m_backgroundColor);
|
||||
|
||||
// Draw item background
|
||||
const QColor itemBackgroundColor = options.state & QStyle::State_MouseOver ? m_itemBackgroundColor.lighter(120) : m_itemBackgroundColor;
|
||||
painter->fillRect(itemRect, itemBackgroundColor);
|
||||
|
||||
// Draw border
|
||||
if (options.state & QStyle::State_Selected)
|
||||
{
|
||||
painter->save();
|
||||
QPen borderPen(m_borderColor);
|
||||
borderPen.setWidth(s_borderWidth);
|
||||
painter->setPen(borderPen);
|
||||
painter->drawRect(itemRect);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
// Gem name
|
||||
const QString gemName = m_gemModel->GetName(modelIndex);
|
||||
QFont gemNameFont(options.font);
|
||||
gemNameFont.setPixelSize(s_gemNameFontSize);
|
||||
gemNameFont.setBold(true);
|
||||
QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize);
|
||||
gemNameRect.moveTo(contentRect.left(), contentRect.top());
|
||||
|
||||
painter->setFont(gemNameFont);
|
||||
painter->setPen(m_textColor);
|
||||
painter->drawText(gemNameRect, Qt::TextSingleLine, gemName);
|
||||
|
||||
// Gem creator
|
||||
const QString gemCreator = m_gemModel->GetCreator(modelIndex);
|
||||
QRect gemCreatorRect = GetTextRect(standardFont, gemCreator, s_fontSize);
|
||||
gemCreatorRect.moveTo(contentRect.left(), contentRect.top() + gemNameRect.height());
|
||||
|
||||
painter->setFont(standardFont);
|
||||
painter->setPen(m_linkColor);
|
||||
painter->drawText(gemCreatorRect, Qt::TextSingleLine, gemCreator);
|
||||
|
||||
// Gem summary
|
||||
const QSize summarySize = QSize(contentRect.width() - s_summaryStartX - s_itemMargins.right() * 4, contentRect.height());
|
||||
const QRect summaryRect = QRect(/*topLeft=*/QPoint(contentRect.left() + s_summaryStartX, contentRect.top()), summarySize);
|
||||
|
||||
painter->setFont(standardFont);
|
||||
painter->setPen(m_textColor);
|
||||
|
||||
const QString summary = m_gemModel->GetSummary(modelIndex);
|
||||
painter->drawText(summaryRect, Qt::AlignLeft | Qt::TextWordWrap, summary);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QSize GemItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const
|
||||
{
|
||||
QStyleOptionViewItem options(option);
|
||||
initStyleOption(&options, modelIndex);
|
||||
|
||||
int marginsHorizontal = s_itemMargins.left() + s_itemMargins.right() + s_contentMargins.left() + s_contentMargins.right();
|
||||
return QSize(marginsHorizontal + s_summaryStartX, s_height);
|
||||
}
|
||||
|
||||
bool GemItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& modelIndex)
|
||||
{
|
||||
if (!modelIndex.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return QStyledItemDelegate::editorEvent(event, model, option, modelIndex);
|
||||
}
|
||||
|
||||
void GemItemDelegate::CalcRects(const QStyleOptionViewItem& option, const QModelIndex& modelIndex, QRect& outFullRect, QRect& outItemRect, QRect& outContentRect) const
|
||||
{
|
||||
const bool isFirst = modelIndex.row() == 0;
|
||||
|
||||
outFullRect = QRect(option.rect);
|
||||
outItemRect = QRect(outFullRect.adjusted(s_itemMargins.left(), isFirst ? s_itemMargins.top() * 2 : s_itemMargins.top(), -s_itemMargins.right(), -s_itemMargins.bottom()));
|
||||
outContentRect = QRect(outItemRect.adjusted(s_contentMargins.left(), s_contentMargins.top(), -s_contentMargins.right(), -s_contentMargins.bottom()));
|
||||
}
|
||||
|
||||
QRect GemItemDelegate::GetTextRect(QFont& font, const QString& text, qreal fontSize) const
|
||||
{
|
||||
font.setPixelSize(fontSize);
|
||||
return QFontMetrics(font).boundingRect(text);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QStyledItemDelegate>
|
||||
#include "GemInfo.h"
|
||||
#include "GemModel.h"
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QEvent)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemItemDelegate
|
||||
: public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
|
||||
public:
|
||||
explicit GemItemDelegate(GemModel* gemModel, QObject* parent = nullptr);
|
||||
~GemItemDelegate() = default;
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
|
||||
bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) override;
|
||||
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
|
||||
|
||||
private:
|
||||
void CalcRects(const QStyleOptionViewItem& option, const QModelIndex& modelIndex, QRect& outFullRect, QRect& outItemRect, QRect& outContentRect) const;
|
||||
QRect GetTextRect(QFont& font, const QString& text, qreal fontSize) const;
|
||||
|
||||
GemModel* m_gemModel = nullptr;
|
||||
|
||||
// Colors
|
||||
const QColor m_textColor = QColor("#FFFFFF");
|
||||
const QColor m_linkColor = QColor("#94D2FF");
|
||||
const QColor m_backgroundColor = QColor("#333333"); // Outside of the actual gem item
|
||||
const QColor m_itemBackgroundColor = QColor("#404040"); // Background color of the gem item
|
||||
const QColor m_borderColor = QColor("#1E70EB");
|
||||
|
||||
// Item
|
||||
inline constexpr static int s_height = 140; // Gem item total height
|
||||
inline constexpr static qreal s_gemNameFontSize = 16.0;
|
||||
inline constexpr static qreal s_fontSize = 15.0;
|
||||
inline constexpr static int s_summaryStartX = 200;
|
||||
|
||||
// Margin and borders
|
||||
inline constexpr static QMargins s_itemMargins = QMargins(/*left=*/20, /*top=*/10, /*right=*/20, /*bottom=*/10); // Item border distances
|
||||
inline constexpr static QMargins s_contentMargins = QMargins(/*left=*/15, /*top=*/12, /*right=*/12, /*bottom=*/12); // Distances of the elements within an item to the item borders
|
||||
inline constexpr static int s_borderWidth = 4;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "GemListView.h"
|
||||
#include "GemItemDelegate.h"
|
||||
#include <QStandardItemModel>
|
||||
#include <QDateTime>
|
||||
#include <QPalette>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemListView::GemListView(GemModel* model, QWidget *parent) :
|
||||
QListView(parent)
|
||||
{
|
||||
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Window, QColor("#333333"));
|
||||
setPalette(palette);
|
||||
|
||||
setModel(model);
|
||||
setSelectionModel(model->GetSelectionModel());
|
||||
setItemDelegate(new GemItemDelegate(model, this));
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "GemInfo.h"
|
||||
#include "GemModel.h"
|
||||
#include <QListView>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemListView
|
||||
: public QListView
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
public:
|
||||
explicit GemListView(GemModel* model, QWidget *parent = nullptr);
|
||||
~GemListView() = default;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "GemModel.h"
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemModel::GemModel(QObject* parent)
|
||||
: QStandardItemModel(parent)
|
||||
{
|
||||
m_selectionModel = new QItemSelectionModel(this, parent);
|
||||
}
|
||||
|
||||
QItemSelectionModel* GemModel::GetSelectionModel() const
|
||||
{
|
||||
return m_selectionModel;
|
||||
}
|
||||
|
||||
void GemModel::AddGem(const GemInfo& gemInfo)
|
||||
{
|
||||
QStandardItem* item = new QStandardItem();
|
||||
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
|
||||
item->setData(gemInfo.m_name, RoleName);
|
||||
item->setData(gemInfo.m_creator, RoleCreator);
|
||||
item->setData(static_cast<int>(gemInfo.m_platforms), RolePlatforms);
|
||||
item->setData(gemInfo.m_summary, RoleSummary);
|
||||
item->setData(gemInfo.m_isAdded, RoleIsAdded);
|
||||
|
||||
appendRow(item);
|
||||
}
|
||||
|
||||
void GemModel::Clear()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
QString GemModel::GetName(const QModelIndex& modelIndex) const
|
||||
{
|
||||
return modelIndex.data(RoleName).toString();
|
||||
}
|
||||
|
||||
QString GemModel::GetCreator(const QModelIndex& modelIndex) const
|
||||
{
|
||||
return modelIndex.data(RoleCreator).toString();
|
||||
}
|
||||
|
||||
int GemModel::GetPlatforms(const QModelIndex& modelIndex) const
|
||||
{
|
||||
return static_cast<GemInfo::Platforms>(modelIndex.data(RolePlatforms).toInt());
|
||||
}
|
||||
|
||||
QString GemModel::GetSummary(const QModelIndex& modelIndex) const
|
||||
{
|
||||
return modelIndex.data(RoleSummary).toString();
|
||||
}
|
||||
|
||||
bool GemModel::IsAdded(const QModelIndex& modelIndex) const
|
||||
{
|
||||
return modelIndex.data(RoleIsAdded).toBool();
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "GemInfo.h"
|
||||
#include <QStandardItemModel>
|
||||
#include <QItemSelectionModel>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemModel
|
||||
: public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
|
||||
public:
|
||||
explicit GemModel(QObject* parent = nullptr);
|
||||
QItemSelectionModel* GetSelectionModel() const;
|
||||
|
||||
void AddGem(const GemInfo& gemInfo);
|
||||
void Clear();
|
||||
|
||||
QString GetName(const QModelIndex& modelIndex) const;
|
||||
QString GetCreator(const QModelIndex& modelIndex) const;
|
||||
int GetPlatforms(const QModelIndex& modelIndex) const;
|
||||
QString GetSummary(const QModelIndex& modelIndex) const;
|
||||
bool IsAdded(const QModelIndex& modelIndex) const;
|
||||
|
||||
private:
|
||||
enum UserRole
|
||||
{
|
||||
RoleName = Qt::UserRole,
|
||||
RoleCreator,
|
||||
RolePlatforms,
|
||||
RoleSummary,
|
||||
RoleIsAdded
|
||||
};
|
||||
|
||||
QItemSelectionModel* m_selectionModel = nullptr;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <FirstTimeUse.h>
|
||||
#include <NewProjectSettings.h>
|
||||
#include <GemCatalog.h>
|
||||
#include <GemCatalog/GemCatalog.h>
|
||||
#include <ProjectsHome.h>
|
||||
#include <ProjectSettings.h>
|
||||
#include <EngineSettings.h>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void ConnectSlotsAndSignals() = 0;
|
||||
virtual void ConnectSlotsAndSignals() {}
|
||||
|
||||
ProjectManagerWindow* m_projectManagerWindow;
|
||||
};
|
||||
|
||||
@@ -25,9 +25,6 @@ set(FILES
|
||||
Source/NewProjectSettings.h
|
||||
Source/NewProjectSettings.cpp
|
||||
Source/NewProjectSettings.ui
|
||||
Source/GemCatalog.h
|
||||
Source/GemCatalog.cpp
|
||||
Source/GemCatalog.ui
|
||||
Source/ProjectsHome.h
|
||||
Source/ProjectsHome.cpp
|
||||
Source/ProjectsHome.ui
|
||||
@@ -37,6 +34,14 @@ set(FILES
|
||||
Source/EngineSettings.h
|
||||
Source/EngineSettings.cpp
|
||||
Source/EngineSettings.ui
|
||||
Source/GemCatalog/GemCatalog.h
|
||||
Source/GemCatalog/GemCatalog.cpp
|
||||
Source/GemCatalog/GemInfo.h
|
||||
Source/GemCatalog/GemInfo.cpp
|
||||
Source/GemCatalog/GemItemDelegate.h
|
||||
Source/GemCatalog/GemItemDelegate.cpp
|
||||
Source/GemCatalog/GemListView.h
|
||||
Source/GemCatalog/GemListView.cpp
|
||||
Source/GemCatalog/GemModel.h
|
||||
Source/GemCatalog/GemModel.cpp
|
||||
)
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace AZ
|
||||
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
|
||||
if (serializeContext)
|
||||
{
|
||||
serializeContext->Class<AssImpAnimationImporter, SceneCore::LoadingComponent>()->Version(2); // [LYN-2281] Skinned mesh loading fixes
|
||||
serializeContext->Class<AssImpAnimationImporter, SceneCore::LoadingComponent>()->Version(3); // [LYN-3349] Rolling back rotation change
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -306,7 +306,7 @@ namespace AZ
|
||||
for (const RPI::ViewPtr& view : packet.m_views)
|
||||
{
|
||||
if (m_renderPipelineIdsForPersistentView.find(view.get()) != m_renderPipelineIdsForPersistentView.end() &&
|
||||
(view->GetUsageFlags() & RPI::View::UsageCamera))
|
||||
(RHI::CheckBitsAny(view->GetUsageFlags(), RPI::View::UsageCamera | RPI::View::UsageReflectiveCubeMap)))
|
||||
{
|
||||
RPI::ShaderResourceGroup* viewSrg = view->GetShaderResourceGroup().get();
|
||||
|
||||
|
||||
+10
-6
@@ -69,9 +69,8 @@ namespace AZ
|
||||
|
||||
if (m_shouldUpdatePassParameters)
|
||||
{
|
||||
auto* passSystem = AZ::RPI::PassSystemInterface::Get();
|
||||
UpdateEyeAdaptationPass(passSystem);
|
||||
UpdateLuminanceHeatmap(passSystem);
|
||||
UpdateEyeAdaptationPass();
|
||||
UpdateLuminanceHeatmap();
|
||||
|
||||
m_shouldUpdatePassParameters = false;
|
||||
}
|
||||
@@ -140,7 +139,8 @@ namespace AZ
|
||||
if (m_heatmapEnabled != value)
|
||||
{
|
||||
m_heatmapEnabled = value;
|
||||
m_shouldUpdatePassParameters = true;
|
||||
// Update immediately so that the ExposureControlSettings can just be turned off and killed without having to wait for another Simulate() call
|
||||
UpdateLuminanceHeatmap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,8 +198,10 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void ExposureControlSettings::UpdateEyeAdaptationPass(RPI::PassSystemInterface* passSystem)
|
||||
void ExposureControlSettings::UpdateEyeAdaptationPass()
|
||||
{
|
||||
auto* passSystem = AZ::RPI::PassSystemInterface::Get();
|
||||
|
||||
// [GFX-TODO][ATOM-13224] Remove UpdateLuminanceHeatmap and UpdateEyeAdaptationPass
|
||||
auto passTemplateName = m_eyeAdaptationPassTemplateNameId;
|
||||
|
||||
@@ -220,8 +222,10 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void ExposureControlSettings::UpdateLuminanceHeatmap(RPI::PassSystemInterface* passSystem)
|
||||
void ExposureControlSettings::UpdateLuminanceHeatmap()
|
||||
{
|
||||
auto* passSystem = AZ::RPI::PassSystemInterface::Get();
|
||||
|
||||
// [GFX-TODO][ATOM-13194] Support multiple views for the luminance heatmap
|
||||
// [GFX-TODO][ATOM-13224] Remove UpdateLuminanceHeatmap and UpdateEyeAdaptationPass
|
||||
const RPI::Ptr<RPI::Pass> luminanceHeatmap = passSystem->GetRootPass()->FindPassByNameRecursive(m_luminanceHeatmapNameId);
|
||||
|
||||
+2
-2
@@ -84,8 +84,8 @@ namespace AZ
|
||||
|
||||
void UpdateExposureControlRelatedPassParameters();
|
||||
|
||||
void UpdateLuminanceHeatmap(RPI::PassSystemInterface* passSystem);
|
||||
void UpdateEyeAdaptationPass(RPI::PassSystemInterface* passSystem);
|
||||
void UpdateLuminanceHeatmap();
|
||||
void UpdateEyeAdaptationPass();
|
||||
|
||||
PostProcessSettings* m_parentSettings = nullptr;
|
||||
bool m_shouldUpdatePassParameters = true;
|
||||
|
||||
+5
@@ -99,6 +99,9 @@ namespace AtomToolsFramework
|
||||
AZStd::optional<AzToolsFramework::ViewportInteraction::ProjectedViewportRay> ViewportScreenToWorldRay(
|
||||
const AzFramework::ScreenPoint& screenPosition) override;
|
||||
|
||||
//! Set interface for providing viewport specific settings (e.g. snapping properties).
|
||||
void SetViewportSettings(AzToolsFramework::ViewportInteraction::ViewportSettings* viewportSettings);
|
||||
|
||||
// AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Handler ...
|
||||
void BeginCursorCapture() override;
|
||||
void EndCursorCapture() override;
|
||||
@@ -156,5 +159,7 @@ namespace AtomToolsFramework
|
||||
bool m_capturingCursor = false;
|
||||
// The last known position of the mouse cursor, if one is available.
|
||||
AZStd::optional<QPoint> m_lastCursorPosition;
|
||||
// The viewport settings (e.g. grid snapping, grid size) for this viewport.
|
||||
const AzToolsFramework::ViewportInteraction::ViewportSettings* m_viewportSettings = nullptr;
|
||||
};
|
||||
} //namespace AtomToolsFramework
|
||||
|
||||
@@ -384,27 +384,32 @@ namespace AtomToolsFramework
|
||||
|
||||
bool RenderViewportWidget::GridSnappingEnabled()
|
||||
{
|
||||
return false;
|
||||
return m_viewportSettings ? m_viewportSettings->GridSnappingEnabled() : false;
|
||||
}
|
||||
|
||||
float RenderViewportWidget::GridSize()
|
||||
{
|
||||
return 0.0f;
|
||||
return m_viewportSettings ? m_viewportSettings->GridSize() : 0.0f;
|
||||
}
|
||||
|
||||
bool RenderViewportWidget::ShowGrid()
|
||||
{
|
||||
return false;
|
||||
return m_viewportSettings ? m_viewportSettings->ShowGrid() : false;
|
||||
}
|
||||
|
||||
bool RenderViewportWidget::AngleSnappingEnabled()
|
||||
{
|
||||
return false;
|
||||
return m_viewportSettings ? m_viewportSettings->AngleSnappingEnabled() : false;
|
||||
}
|
||||
|
||||
float RenderViewportWidget::AngleStep()
|
||||
{
|
||||
return 0.0f;
|
||||
return m_viewportSettings ? m_viewportSettings->AngleStep() : 0.0f;
|
||||
}
|
||||
|
||||
void RenderViewportWidget::SetViewportSettings(AzToolsFramework::ViewportInteraction::ViewportSettings* viewportSettings)
|
||||
{
|
||||
m_viewportSettings = viewportSettings;
|
||||
}
|
||||
|
||||
AzFramework::ScreenPoint RenderViewportWidget::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
|
||||
|
||||
+19
@@ -31,6 +31,7 @@
|
||||
#include <Atom/Document/MaterialDocumentSystemRequestBus.h>
|
||||
|
||||
#include <WIndow/MaterialEditorBrowserInteractions.h>
|
||||
#include <Window/CreateMaterialDialog/CreateMaterialDialog.h>
|
||||
|
||||
#include <Atom/RPI.Reflect/Material/MaterialAsset.h>
|
||||
#include <Atom/RPI.Edit/Material/MaterialSourceData.h>
|
||||
@@ -248,6 +249,24 @@ namespace MaterialEditor
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
QAction* createMaterialAction = menu->addAction(QObject::tr("Create Material..."));
|
||||
QObject::connect(createMaterialAction, &QAction::triggered, caller, [caller, entry]()
|
||||
{
|
||||
CreateMaterialDialog createDialog(entry->GetFullPath().c_str(), caller);
|
||||
createDialog.adjustSize();
|
||||
|
||||
if (createDialog.exec() == QDialog::Accepted &&
|
||||
!createDialog.m_materialFileInfo.absoluteFilePath().isEmpty() &&
|
||||
!createDialog.m_materialTypeFileInfo.absoluteFilePath().isEmpty())
|
||||
{
|
||||
MaterialDocumentSystemRequestBus::Broadcast(&MaterialDocumentSystemRequestBus::Events::CreateDocumentFromFile,
|
||||
createDialog.m_materialTypeFileInfo.absoluteFilePath().toUtf8().constData(),
|
||||
createDialog.m_materialFileInfo.absoluteFilePath().toUtf8().constData());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MaterialEditorBrowserInteractions::AddPerforceMenuActions([[maybe_unused]] QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry)
|
||||
|
||||
+3
@@ -88,6 +88,9 @@ namespace AZ
|
||||
{
|
||||
ExposureControlRequestBus::Handler::BusDisconnect(m_entityId);
|
||||
|
||||
m_configuration.SetHeatmapEnabled(false);
|
||||
OnConfigChanged();
|
||||
|
||||
if (m_postProcessInterface)
|
||||
{
|
||||
m_postProcessInterface->RemoveExposureControlSettingsInterface();
|
||||
|
||||
@@ -486,10 +486,14 @@ namespace AZ
|
||||
AZ_Assert(jointIndicesBufferAsset->GetBufferDescriptor().m_byteCount == remappedJointIndexBufferSizeInBytes, "Joint indices data from EMotionFX is not the same size as the buffer from the model in '%s', lod '%d'", fullFileName.c_str(), lodIndex);
|
||||
AZ_Assert(skinWeightsBufferAsset->GetBufferDescriptor().m_byteCount == remappedSkinWeightsBufferSizeInBytes, "Skin weights data from EMotionFX is not the same size as the buffer from the model in '%s', lod '%d'", fullFileName.c_str(), lodIndex);
|
||||
|
||||
Data::Instance<RPI::Buffer> jointIndicesBuffer = RPI::Buffer::FindOrCreate(jointIndicesBufferAsset);
|
||||
jointIndicesBuffer->UpdateData(blendIndexBufferData.data(), remappedJointIndexBufferSizeInBytes);
|
||||
Data::Instance<RPI::Buffer> skinWeightsBuffer = RPI::Buffer::FindOrCreate(skinWeightsBufferAsset);
|
||||
skinWeightsBuffer->UpdateData(blendWeightBufferData.data(), remappedSkinWeightsBufferSizeInBytes);
|
||||
if (Data::Instance<RPI::Buffer> jointIndicesBuffer = RPI::Buffer::FindOrCreate(jointIndicesBufferAsset))
|
||||
{
|
||||
jointIndicesBuffer->UpdateData(blendIndexBufferData.data(), remappedJointIndexBufferSizeInBytes);
|
||||
}
|
||||
if (Data::Instance<RPI::Buffer> skinWeightsBuffer = RPI::Buffer::FindOrCreate(skinWeightsBufferAsset))
|
||||
{
|
||||
skinWeightsBuffer->UpdateData(blendWeightBufferData.data(), remappedSkinWeightsBufferSizeInBytes);
|
||||
}
|
||||
}
|
||||
|
||||
// Create read-only input assembly buffers that are not modified during skinning and shared across all instances
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace Blast
|
||||
virtual AZ::Transform GetTransform() const = 0;
|
||||
virtual const BlastFamily& GetFamily() const = 0;
|
||||
virtual Nv::Blast::TkActor& GetTkActor() const = 0;
|
||||
virtual AzPhysics::SimulatedBody* GetWorldBody() = 0;
|
||||
virtual const AzPhysics::SimulatedBody* GetWorldBody() const = 0;
|
||||
virtual AzPhysics::SimulatedBody* GetSimulatedBody() = 0;
|
||||
virtual const AzPhysics::SimulatedBody* GetSimulatedBody() const = 0;
|
||||
virtual const AZ::Entity* GetEntity() const = 0;
|
||||
virtual const AZStd::vector<uint32_t>& GetChunkIndices() const = 0;
|
||||
virtual bool IsStatic() const = 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <AzFramework/Physics/Shape.h>
|
||||
#include <AzFramework/Physics/SystemBus.h>
|
||||
#include <AzFramework/Physics/Utils.h>
|
||||
#include <AzFramework/Physics/WorldBodyBus.h>
|
||||
#include <AzFramework/Physics/Components/SimulatedBodyComponentBus.h>
|
||||
#include <Blast/BlastActor.h>
|
||||
#include <Family/BlastFamily.h>
|
||||
#include <NvBlastExtPxAsset.h>
|
||||
@@ -164,7 +164,7 @@ namespace Blast
|
||||
|
||||
AZ::Transform BlastActorImpl::GetTransform() const
|
||||
{
|
||||
return GetWorldBody()->GetTransform();
|
||||
return GetSimulatedBody()->GetTransform();
|
||||
}
|
||||
|
||||
const BlastFamily& BlastActorImpl::GetFamily() const
|
||||
@@ -177,19 +177,19 @@ namespace Blast
|
||||
return m_tkActor;
|
||||
}
|
||||
|
||||
AzPhysics::SimulatedBody* BlastActorImpl::GetWorldBody()
|
||||
AzPhysics::SimulatedBody* BlastActorImpl::GetSimulatedBody()
|
||||
{
|
||||
AzPhysics::SimulatedBody* worldBody = nullptr;
|
||||
Physics::WorldBodyRequestBus::EventResult(
|
||||
worldBody, m_entity->GetId(), &Physics::WorldBodyRequests::GetWorldBody);
|
||||
AzPhysics::SimulatedBodyComponentRequestsBus::EventResult(
|
||||
worldBody, m_entity->GetId(), &AzPhysics::SimulatedBodyComponentRequests::GetSimulatedBody);
|
||||
return worldBody;
|
||||
}
|
||||
|
||||
const AzPhysics::SimulatedBody* BlastActorImpl::GetWorldBody() const
|
||||
const AzPhysics::SimulatedBody* BlastActorImpl::GetSimulatedBody() const
|
||||
{
|
||||
AzPhysics::SimulatedBody* worldBody = nullptr;
|
||||
Physics::WorldBodyRequestBus::EventResult(
|
||||
worldBody, m_entity->GetId(), &Physics::WorldBodyRequests::GetWorldBody);
|
||||
AzPhysics::SimulatedBodyComponentRequestsBus::EventResult(
|
||||
worldBody, m_entity->GetId(), &AzPhysics::SimulatedBodyComponentRequests::GetSimulatedBody);
|
||||
return worldBody;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <Actor/ShapesProvider.h>
|
||||
#include <AzFramework/Physics/WorldBodyBus.h>
|
||||
#include <Blast/BlastActor.h>
|
||||
#include <Actor/BlastActorDesc.h>
|
||||
#include <PhysX/ColliderComponentBus.h>
|
||||
@@ -45,8 +44,8 @@ namespace Blast
|
||||
const AZStd::vector<uint32_t>& GetChunkIndices() const override;
|
||||
bool IsStatic() const override;
|
||||
|
||||
AzPhysics::SimulatedBody* GetWorldBody() override;
|
||||
const AzPhysics::SimulatedBody* GetWorldBody() const override;
|
||||
AzPhysics::SimulatedBody* GetSimulatedBody() override;
|
||||
const AzPhysics::SimulatedBody* GetSimulatedBody() const override;
|
||||
|
||||
protected:
|
||||
//! We want to be able to override this function for testing purposes, because
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Physics/WorldBodyBus.h>
|
||||
#include <AzFramework/Physics/Configuration/RigidBodyConfiguration.h>
|
||||
#include <PhysX/ColliderComponentBus.h>
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace Blast
|
||||
}
|
||||
|
||||
// transform all added lines from local to global
|
||||
const AZ::Transform& localToGlobal = blastActor->GetWorldBody()->GetTransform();
|
||||
const AZ::Transform& localToGlobal = blastActor->GetSimulatedBody()->GetTransform();
|
||||
for (uint32_t i = lineStartIndex; i < debugRenderBuffer.m_lines.size(); i++)
|
||||
{
|
||||
DebugLine& line = debugRenderBuffer.m_lines[i];
|
||||
@@ -485,7 +485,7 @@ namespace Blast
|
||||
{
|
||||
for (auto actor : m_family->GetActorTracker().GetActors())
|
||||
{
|
||||
auto worldBody = actor->GetWorldBody();
|
||||
auto worldBody = actor->GetSimulatedBody();
|
||||
if (actor->IsStatic())
|
||||
{
|
||||
AZ::Vector3 gravity = AzPhysics::DefaultGravity;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Blast
|
||||
{
|
||||
if (m_chunkActors[chunkId])
|
||||
{
|
||||
m_meshFeatureProcessor->SetTransform(m_chunkMeshHandles[chunkId], m_chunkActors[chunkId]->GetWorldBody()->GetTransform(), m_scale);
|
||||
m_meshFeatureProcessor->SetTransform(m_chunkMeshHandles[chunkId], m_chunkActors[chunkId]->GetSimulatedBody()->GetTransform(), m_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace Blast
|
||||
{
|
||||
m_actors.emplace(actor);
|
||||
m_entityIdToActor.emplace(actor->GetEntity()->GetId(), actor);
|
||||
m_bodyToActor.emplace(actor->GetWorldBody(), actor);
|
||||
m_bodyToActor.emplace(actor->GetSimulatedBody(), actor);
|
||||
}
|
||||
|
||||
void ActorTracker::RemoveActor(BlastActor* actor)
|
||||
{
|
||||
m_bodyToActor.erase(actor->GetWorldBody());
|
||||
m_bodyToActor.erase(actor->GetSimulatedBody());
|
||||
m_entityIdToActor.erase(actor->GetEntity()->GetId());
|
||||
m_actors.erase(actor);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Blast
|
||||
{
|
||||
return;
|
||||
}
|
||||
parentBody = parentActor->GetWorldBody();
|
||||
parentBody = parentActor->GetSimulatedBody();
|
||||
|
||||
const bool parentStatic = parentActor->IsStatic();
|
||||
|
||||
@@ -493,7 +493,7 @@ namespace Blast
|
||||
}
|
||||
|
||||
// transform all added lines from local to global
|
||||
AZ::Transform localToGlobal = blastActor->GetWorldBody()->GetTransform();
|
||||
AZ::Transform localToGlobal = blastActor->GetSimulatedBody()->GetTransform();
|
||||
for (uint32_t i = lineStartIndex; i < debugRenderBuffer.m_lines.size(); i++)
|
||||
{
|
||||
DebugLine& line = debugRenderBuffer.m_lines[i];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user