Merge branch 'development' into Atom/guthadam/thumbnail_and_preview_refactor

This commit is contained in:
Guthrie Adams
2021-10-12 13:21:11 -05:00
399 changed files with 2648 additions and 3761 deletions
+17 -7
View File
@@ -7,20 +7,30 @@ labels: 'needs-triage,needs-sig,kind/bug'
---
**Describe the bug**
A clear and concise description of what the bug is.
A clear and concise description of what the bug is. Try to isolate the issue to help the community to reproduce it easily and increase chances for a fast fix.
**To Reproduce**
**Steps to reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
2. Click on '...'
3. Select attached asset '...'
4. Scroll down to '...'
5. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Actual behavior**
A clear and concise description of what actually happened.
**Assets required**
Provide sample assets needed to reproduce the issue.
**Screenshots/Video**
If applicable, add screenshots and/or a video to help explain your problem.
**Found in Branch**
Name of or link to the branch where the issue occurs.
**Desktop/Device (please complete the following information):**
- Device: [e.g. PC, Mac, iPhone, Samsung]
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Diffuse_lowQ
@@ -1 +0,0 @@
/autooptimizefile=0 /mipmaps=0 /preset=AlbedoWithGenericAlpha /reduce=-1
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /dns=1 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /dns=1 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /dns=1 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /dns=1 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /dns=1 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /dns=1 /preset=Uncompressed
@@ -1 +0,0 @@
/autooptimizefile=0 /mipmaps=0 /preset=Albedo /reduce=-1 /ser=1
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=AlbedoWithGenericAlpha /reduce="android:2,ios:2,mac:0,pc:0,provo:0"
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Albedo /reduce="android:3,ios:3,mac:0,pc:0,provo:0"
@@ -3,8 +3,6 @@ Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
Main suite tests for the Atom renderer.
"""
import logging
import os
@@ -25,7 +23,6 @@ TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests")
class TestAtomEditorComponentsMain(object):
"""Holds tests for Atom components."""
@pytest.mark.xfail(reason="This test is being marked xfail as it failed during an unrelated development run. See LYN-7530 for more details.")
def test_AtomEditorComponents_AddedToEntity(self, request, editor, level, workspace, project, launcher_platform):
"""
Please review the hydra script run by this test for more specific test info.
@@ -162,21 +159,6 @@ class TestAtomEditorComponentsMain(object):
"Display Mapper_test: Entity deleted: True",
"Display Mapper_test: UNDO entity deletion works: True",
"Display Mapper_test: REDO entity deletion works: True",
# Reflection Probe Component
"Reflection Probe Entity successfully created",
"Reflection Probe_test: Component added to the entity: True",
"Reflection Probe_test: Component removed after UNDO: True",
"Reflection Probe_test: Component added after REDO: True",
"Reflection Probe_test: Entered game mode: True",
"Reflection Probe_test: Exit game mode: True",
"Reflection Probe_test: Entity disabled initially: True",
"Reflection Probe_test: Entity enabled after adding required components: True",
"Reflection Probe_test: Cubemap is generated: True",
"Reflection Probe_test: Entity is hidden: True",
"Reflection Probe_test: Entity is shown: True",
"Reflection Probe_test: Entity deleted: True",
"Reflection Probe_test: UNDO entity deletion works: True",
"Reflection Probe_test: REDO entity deletion works: True",
]
unexpected_lines = [
@@ -59,5 +59,9 @@ class TestAutomation(EditorTestSuite):
class AtomEditorComponents_MeshAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_MeshAdded as test_module
@pytest.mark.test_case_id("C32078123")
class AtomEditorComponents_MaterialAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_MaterialAdded as test_module
class ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges(EditorSharedTest):
from Atom.tests import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module
@@ -3,12 +3,17 @@ Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
Sandbox suite tests for the Atom renderer.
"""
import logging
import os
import pytest
import editor_python_test_tools.hydra_test_utils as hydra
logger = logging.getLogger(__name__)
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests")
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@@ -18,3 +23,49 @@ class TestAtomEditorComponentsSandbox(object):
# It requires at least one test
def test_Dummy(self, request, editor, level, workspace, project, launcher_platform):
pass
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("level", ["auto_test"])
class TestAtomEditorComponentsMain(object):
"""Holds tests for Atom components."""
def test_AtomEditorComponents_ReflectionProbeAddedToEntity(
self, request, editor, level, workspace, project, launcher_platform):
"""
Please review the hydra script run by this test for more specific test info.
Tests the following Atom components and verifies all "expected_lines" appear in Editor.log:
1. Reflection Probe
"""
cfg_args = [level]
expected_lines = [
# Reflection Probe Component
"Reflection Probe Entity successfully created",
"Reflection Probe_test: Component added to the entity: True",
"Reflection Probe_test: Component removed after UNDO: True",
"Reflection Probe_test: Component added after REDO: True",
"Reflection Probe_test: Entered game mode: True",
"Reflection Probe_test: Exit game mode: True",
"Reflection Probe_test: Entity disabled initially: True",
"Reflection Probe_test: Entity enabled after adding required components: True",
"Reflection Probe_test: Cubemap is generated: True",
"Reflection Probe_test: Entity is hidden: True",
"Reflection Probe_test: Entity is shown: True",
"Reflection Probe_test: Entity deleted: True",
"Reflection Probe_test: UNDO entity deletion works: True",
"Reflection Probe_test: REDO entity deletion works: True",
]
hydra.launch_and_validate_results(
request,
TEST_DIRECTORY,
editor,
"hydra_AtomEditorComponents_AddedToEntity.py",
timeout=120,
expected_lines=expected_lines,
unexpected_lines=[],
halt_on_unexpected=True,
null_renderer=True,
cfg_args=cfg_args,
)
@@ -0,0 +1,205 @@
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
class Tests:
creation_undo = (
"UNDO Entity creation success",
"UNDO Entity creation failed")
creation_redo = (
"REDO Entity creation success",
"REDO Entity creation failed")
material_creation = (
"Material Entity successfully created",
"Material Entity failed to be created")
material_component = (
"Entity has a Material component",
"Entity failed to find Material component")
material_disabled = (
"Material component disabled",
"Material component was not disabled.")
actor_component = (
"Entity has an Actor component",
"Entity did not have an Actor component")
actor_undo = (
"Entity Actor component gone",
"Entity Actor component add failed to undo")
mesh_component = (
"Entity has a Mesh component",
"Entity did not have a Mesh component")
material_enabled = (
"Material component enabled",
"Material component was not enabled.")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
exit_game_mode = (
"Exited game mode",
"Couldn't exit game mode")
is_visible = (
"Entity is visible",
"Entity was not visible")
is_hidden = (
"Entity is hidden",
"Entity was not hidden")
entity_deleted = (
"Entity deleted",
"Entity was not deleted")
deletion_undo = (
"UNDO deletion success",
"UNDO deletion failed")
deletion_redo = (
"REDO deletion success",
"REDO deletion failed")
def AtomEditorComponents_Material_AddedToEntity():
"""
Summary:
Tests the Material component can be added to an entity and has the expected functionality.
Test setup:
- Wait for Editor idle loop.
- Open the "Base" level.
Expected Behavior:
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
Creation and deletion undo/redo should also work.
Test Steps:
1) Create a Material entity with no components.
2) Add a Material component to Material entity.
3) UNDO the entity creation and component addition.
4) REDO the entity creation and component addition.
5) Verify Material component not enabled.
6) Add Actor component since it is required by the Material component.
7) Verify Material component is enabled.
8) UNDO add Actor component
9) Verify Material component not enabled.
10) Add Mesh component since it is required by the Material component.
11) Verify Material component is enabled.
12) Enter/Exit game mode.
13) Test IsHidden.
14) Test IsVisible.
15) Delete Material entity.
16) UNDO deletion.
17) REDO deletion.
18) Look for errors.
:return: None
"""
import azlmbr.legacy.general as general
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper
with Tracer() as error_tracer:
# Test setup begins.
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
TestHelper.init_idle()
TestHelper.open_level("", "Base")
# Test steps begin.
# 1. Create a Material entity with no components.
material_name = "Material"
material_entity = EditorEntity.create_editor_entity(material_name)
Report.critical_result(Tests.material_creation, material_entity.exists())
# 2. Add a Material component to Material entity.
material_component = material_entity.add_component(material_name)
Report.critical_result(
Tests.material_component,
material_entity.has_component(material_name))
# 3. UNDO the entity creation and component addition.
# -> UNDO component addition.
general.undo()
# -> UNDO naming entity.
general.undo()
# -> UNDO selecting entity.
general.undo()
# -> UNDO entity creation.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.creation_undo, not material_entity.exists())
# 4. REDO the entity creation and component addition.
# -> REDO entity creation.
general.redo()
# -> REDO selecting entity.
general.redo()
# -> REDO naming entity.
general.redo()
# -> REDO component addition.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, material_entity.exists())
# 5. Verify Material component not enabled.
Report.result(Tests.material_disabled, not material_component.is_enabled())
# 6. Add Actor component since it is required by the Material component.
actor_name = "Actor"
material_entity.add_component(actor_name)
Report.result(Tests.actor_component, material_entity.has_component(actor_name))
# 7. Verify Material component is enabled.
Report.result(Tests.material_enabled, material_component.is_enabled())
# 8. UNDO component addition.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.actor_undo, not material_entity.has_component(actor_name))
# 9. Verify Material component not enabled.
Report.result(Tests.material_disabled, not material_component.is_enabled())
# 10. Add Mesh component since it is required by the Material component.
mesh_name = "Mesh"
material_entity.add_component(mesh_name)
Report.result(Tests.mesh_component, material_entity.has_component(mesh_name))
# 11. Verify Material component is enabled.
Report.result(Tests.material_enabled, material_component.is_enabled())
# 12. Enter/Exit game mode.
TestHelper.enter_game_mode(Tests.enter_game_mode)
general.idle_wait_frames(1)
TestHelper.exit_game_mode(Tests.exit_game_mode)
# 13. Test IsHidden.
material_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, material_entity.is_hidden() is True)
# 14. Test IsVisible.
material_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, material_entity.is_visible() is True)
# 15. Delete Material entity.
material_entity.delete()
Report.result(Tests.entity_deleted, not material_entity.exists())
# 16. UNDO deletion.
general.undo()
Report.result(Tests.deletion_undo, material_entity.exists())
# 17. REDO deletion.
general.redo()
Report.result(Tests.deletion_redo, not material_entity.exists())
# 18. Look for errors or asserts.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in error_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(AtomEditorComponents_Material_AddedToEntity)
@@ -525,10 +525,6 @@ class TestAutomation(TestAutomationBase):
from .tests.joints import Joints_BallNoLimitsConstrained as test_module
self._run_test(request, workspace, editor, test_module)
def test_Joints_FixedLeadFollowerCollide(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_FixedLeadFollowerCollide as test_module
self._run_test(request, workspace, editor, test_module)
def test_Joints_GlobalFrameConstrained(self, request, workspace, editor, launcher_platform):
from .tests.joints import Joints_GlobalFrameConstrained as test_module
self._run_test(request, workspace, editor, test_module)
@@ -82,7 +82,7 @@ def ForceRegion_SplineRegionWithModifiedTransform():
import azlmbr.bus as bus
# region Constants
TIMEOUT = 5.0
TIMEOUT = 10.0
MIN_TRIGGER_DISTANCE = 2.0
# endregion
@@ -77,7 +77,7 @@ def ForceRegion_ZeroPointForceDoesNothing():
helper.init_idle()
TIMEOUT_SECONDS = 3.0
TIMEOUT_SECONDS = 5.0
X_Y_Z_TOLERANCE = 1.5
REGION_HEIGHT = 3.0
TERRAIN_HEIGHT = 32.0
@@ -45,8 +45,13 @@ class JointEntity:
# Entity class that sets a flag when an instance receives collision events.
class JointEntityCollisionAware(JointEntity):
def on_collision_begin(self, args):
if not self.collided:
self.collided = True
self.collided = True
def on_collision_persist(self, args):
self.collided = True
def on_collision_end(self, args):
self.collided = True
def __init__(self, name):
self.id = general.find_game_entity(name)
@@ -58,3 +63,5 @@ class JointEntityCollisionAware(JointEntity):
self.handler = azlmbr.physics.CollisionNotificationBusHandler()
self.handler.connect(self.id)
self.handler.add_callback("OnCollisionBegin", self.on_collision_begin)
self.handler.add_callback("OnCollisionPresist", self.on_collision_persist)
self.handler.add_callback("OnCollisionEnd", self.on_collision_end)
@@ -1,92 +0,0 @@
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C18243582
# Test Case Title : Check that fixed joint allows lead-follower collision
# fmt: off
class Tests:
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
lead_found = ("Found lead", "Did not find lead")
follower_found = ("Found follower", "Did not find follower")
check_collision_happened = ("Lead and follower collided", "Lead and follower did not collide")
# fmt: on
def Joints_FixedLeadFollowerCollide():
"""
Summary: Check that fixed joint allows lead-follower collision
Level Description:
lead - Starts above follower entity
follower - Starts below lead entity. Constrained to lead entity with fixed joint. Starts with initial velocity of (5, 0, 0) in positive X direction.
Expected Behavior:
The follower entity moves in the positive X direction and the lead entity is dragged along towards the positive X direction.
The x position of the lead entity is incremented from its original.
The lead and follower entities are kept apart at a distance of approximately 1.0 due to collision.
Test Steps:
1) Open Level
2) Enter Game Mode
3) Create and Validate Entities
4) Wait for several seconds
5) Check to see if lead and follower behaved as expected.
6) Exit Game Mode
7) Close Editor
Note:
- This test file must be called from the Open 3D Engine Editor command terminal
- Any passed and failed tests are written to the Editor.log file.
Parsing the file or running a log_monitor are required to observe the test results.
:return: None
"""
import os
import sys
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
import azlmbr.legacy.general as general
import azlmbr.bus
from JointsHelper import JointEntityCollisionAware
# Helper Entity class - self.collided flag is set when instance receives collision event.
class Entity(JointEntityCollisionAware):
def criticalEntityFound(self): # Override function to use local Test dictionary
Report.critical_result(Tests.__dict__[self.name + "_found"], self.id.isValid())
# Main Script
helper.init_idle()
# 1) Open Level
helper.open_level("Physics", "Joints_FixedLeadFollowerCollide")
# 2) Enter Game Mode
helper.enter_game_mode(Tests.enter_game_mode)
# 3) Create and Validate Entities
lead = Entity("lead")
follower = Entity("follower")
# 4) Wait for several seconds
general.idle_wait(2.0) # wait for lead and follower to move
# 5) Check to see if lead entity and follower collided
Report.critical_result(Tests.check_collision_happened, lead.collided and follower.collided)
# 6) Exit Game Mode
helper.exit_game_mode(Tests.exit_game_mode)
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Joints_FixedLeadFollowerCollide)
@@ -80,6 +80,20 @@ def RigidBody_KinematicModeWorks():
ramp_id = general.find_game_entity("Ramp")
Report.result(Tests.find_ramp, ramp_id.IsValid())
# 2.1) setup collision handler
class RampTouched:
value = False
def on_collision_begin(args):
other_id = args[0]
if other_id.Equal(ramp_id):
Report.info("Box touched ramp")
RampTouched.value = True
handler = azlmbr.physics.CollisionNotificationBusHandler()
handler.connect(box_id)
handler.add_callback("OnCollisionBegin", on_collision_begin)
# 3) Check for kinematic ramp and not kinematic box
box_kinematic = azlmbr.physics.RigidBodyRequestBus(azlmbr.bus.Event, "IsKinematic", box_id)
Report.result(Tests.box_is_not_kinematic, not box_kinematic)
@@ -98,21 +112,7 @@ def RigidBody_KinematicModeWorks():
ramp_pos_start = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", ramp_id)
Report.info("Ramp's initial position: {}".format(ramp_pos_start))
# 6) Check to see that the box hits the ramp
class RampTouched:
value = False
def on_collision_begin(args):
other_id = args[0]
if other_id.Equal(ramp_id):
Report.info("Box touched ramp")
RampTouched.value = True
handler = azlmbr.physics.CollisionNotificationBusHandler()
handler.connect(box_id)
handler.add_callback("OnCollisionBegin", on_collision_begin)
# 6.5) Wait for the box to touch the ramp or timeout
# 6) Wait for the box to touch the ramp or timeout
helper.wait_for_condition(lambda: RampTouched.value, TIME_OUT)
Report.result(Tests.box_touched_ramp, RampTouched.value)
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Terrain_Albedo_HighPassed /reduce=0
@@ -55,32 +55,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
## LandscapeCanvas ##
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Main
TEST_SERIAL
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/TestSuite_Main.py
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Periodic
TEST_SERIAL
TEST_SUITE periodic
PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/TestSuite_Periodic.py
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
Legacy::Editor
AutomatedTesting.Assets
COMPONENT
LargeWorlds
)
ly_add_pytest(
NAME AutomatedTesting::LandscapeCanvasTests_Main_Optimized
TEST_SERIAL
@@ -12,7 +12,6 @@ import ly_test_tools.environment.file_system as file_system
from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite
@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.")
@pytest.mark.SUITE_periodic
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3093fee5317ba6fb353a435c09f43f13c5e722421aae62a297f699c202d6129e
size 6699
@@ -1,6 +0,0 @@
<download name="Joints_Fixed2BodiesConstrained" type="Map">
<index src="filelist.xml" dest="filelist.xml"/>
<files>
<file src="level.pak" dest="level.pak" size="7959" md5="f315f559517fa8d28c600ea74c3ea555"/>
</files>
</download>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b1daa050e732ff0594601bbfca8ac9ed05972c2f9fa3e43dbc8645e802ed2730
size 7959
@@ -1,14 +0,0 @@
<Environment>
<Fog ViewDistance="8000" ViewDistanceLowSpec="1000"/>
<Terrain DetailLayersViewDistRatio="1.0" HeightMapAO="0"/>
<EnvState WindVector="1,0,0" BreezeGeneration="0" BreezeStrength="1.f" BreezeMovementSpeed="8.f" BreezeVariation="1.f" BreezeLifeTime="15.f" BreezeCount="4" BreezeSpawnRadius="25.f" BreezeSpread="0.f" BreezeRadius="5.f" ConsoleMergedMeshesPool="2750" ShowTerrainSurface="1" SunShadowsMinSpec="1" SunShadowsAdditionalCascadeMinSpec="0" SunShadowsClipPlaneRange="256.0f" SunShadowsClipPlaneRangeShift="0.0f" UseLayersActivation="0" SunLinkedToTOD="1"/>
<VolFogShadows Enable="0" EnableForClouds="0"/>
<CloudShadows CloudShadowTexture="" CloudShadowSpeed="0,0,0" CloudShadowTiling="1.0" CloudShadowBrightness="1.0" CloudShadowInvert="0"/>
<ParticleLighting AmbientMul="1.0" LightsMul="1.0"/>
<SkyBox Material="EngineAssets/Materials/Sky/Sky" MaterialLowSpec="EngineAssets/Materials/Sky/Sky" Angle="0" Stretching="0.5"/>
<Ocean Material="EngineAssets/Materials/Water/Ocean_default" CausticsDistanceAtten="100.0" CausticDepth="8.0" CausticIntensity="1.0" CausticsTilling="1.0"/>
<OceanAnimation WindDirection="1.0" WindSpeed="4.0" WavesAmount="1.5" WavesSize="0.4" WavesSpeed="1.0"/>
<Moon Latitude="240.0" Longitude="45.0" Size="0.5" Texture="Textures/Skys/Night/half_moon.dds"/>
<DynTexSource Width="256" Height="256"/>
<Total_Illumination_v2 Active="0" IntegrationMode="0" NumberOfBounces="1" DiffuseConeWidth="24" ConeMaxLength="12.0" UseLightProbes="0" InjectionMultiplier="1.0" AmbientOffsetRed="1.0" AmbientOffsetGreen="1.0" AmbientOffsetBlue="1.0" AmbientOffsetBias="0.1" Saturation="0.8" SSAOAmount="0.7"/>
</Environment>
@@ -1,7 +0,0 @@
<TerrainTexture TileCountX="1" TileCountY="1" TileResolution="512">
<RGBLayer>
<Tiles>
<tile X="0" Y="0" Size="512"/>
</Tiles>
</RGBLayer>
</TerrainTexture>
@@ -1,356 +0,0 @@
<TimeOfDay Time="13.5" TimeStart="13.5" TimeEnd="13.5" TimeAnimSpeed="0">
<Variable Name="Sun color" Color="0.99989021,0.99946922,0.9991194">
<Spline Keys="-0.000628322:(0.783538:0.89627:0.930341):36,0:(0.783538:0.887923:0.921582):36,0.229167:(0.783538:0.879623:0.921582):36,0.25:(0.947307:0.745404:0.577581):36,0.458333:(1:1:1):36,0.5625:(1:1:1):36,0.75:(0.947307:0.745404:0.577581):36,0.770833:(0.783538:0.879623:0.921582):36,1:(0.783538:0.89627:0.930556):36,"/>
</Variable>
<Variable Name="Sun intensity" Value="92366.68">
<Spline Keys="0:1000:36,0.229167:1000:36,0.5:120000:36,0.770833:1000:65572,0.999306:1000:36,"/>
</Variable>
<Variable Name="Sun specular multiplier" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:36,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Fog color" Color="0.27049801,0.47353199,0.83076996">
<Spline Keys="0:(0.00651209:0.00972122:0.0137021):36,0.229167:(0.00604883:0.00972122:0.0137021):36,0.25:(0.270498:0.473532:0.83077):36,0.5:(0.270498:0.473532:0.83077):458788,0.75:(0.270498:0.473532:0.83077):36,0.770833:(0.00604883:0.00972122:0.0137021):36,1:(0.00651209:0.00972122:0.0137021):36,"/>
</Variable>
<Variable Name="Fog color multiplier" Value="1">
<Spline Keys="0:0.5:36,0.229167:0.5:36,0.25:1:36,0.5:1:36,0.75:1:36,0.770833:0.5:36,1:0.5:65572,"/>
</Variable>
<Variable Name="Fog height (bottom)" Value="0">
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
</Variable>
<Variable Name="Fog layer density (bottom)" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:36,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Fog color (top)" Color="0.597202,0.72305501,0.91309899">
<Spline Keys="0:(0.00699541:0.00972122:0.0122865):36,0.229167:(0.00699541:0.00972122:0.0122865):36,0.25:(0.597202:0.723055:0.913099):36,0.5:(0.597202:0.723055:0.913099):458788,0.75:(0.597202:0.723055:0.913099):36,0.770833:(0.00699541:0.00972122:0.0122865):36,1:(0.00699541:0.00972122:0.0122865):36,"/>
</Variable>
<Variable Name="Fog color (top) multiplier" Value="0.88389361">
<Spline Keys="-4.40702e-06:0.5:36,0.0297507:0.499195:36,0.229167:0.5:36,0.5:1:36,0.770833:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Fog height (top)" Value="100.00001">
<Spline Keys="0:100:36,0.25:100:36,0.5:100:36,0.75:100:65572,1:100:36,"/>
</Variable>
<Variable Name="Fog layer density (top)" Value="9.9999997e-05">
<Spline Keys="0:0.0001:36,0.25:0.0001:36,0.5:0.0001:65572,0.75:0.0001:36,1:0.0001:36,"/>
</Variable>
<Variable Name="Fog color height offset" Value="0">
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:65572,"/>
</Variable>
<Variable Name="Fog color (radial)" Color="0.78592348,0.52744436,0.17234583">
<Spline Keys="0:(0:0:0):36,0.229167:(0.00439144:0.00367651:0.00334654):36,0.25:(0.838799:0.564712:0.184475):36,0.5:(0.768151:0.514918:0.168269):458788,0.75:(0.838799:0.564712:0.184475):36,0.770833:(0.00402472:0.00334654:0.00303527):36,1:(0:0:0):36,"/>
</Variable>
<Variable Name="Fog color (radial) multiplier" Value="6">
<Spline Keys="0:0:36,0.25:6:36,0.5:6:36,0.75:6:36,1:0:36,"/>
</Variable>
<Variable Name="Fog radial size" Value="0.85000002">
<Spline Keys="0:0:36,0.25:0.85:65572,0.5:0.85:36,0.75:0.85:36,1:0:36,"/>
</Variable>
<Variable Name="Fog radial lobe" Value="0.75">
<Spline Keys="0:0:36,0.25:0.75:36,0.5:0.75:36,0.75:0.75:65572,1:0:36,"/>
</Variable>
<Variable Name="Volumetric fog: Final density clamp" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Volumetric fog: Global density" Value="1.5">
<Spline Keys="0:1.5:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:1.5:36,"/>
</Variable>
<Variable Name="Volumetric fog: Ramp start" Value="25.000002">
<Spline Keys="0:25:36,0.25:25:36,0.5:25:65572,0.75:25:36,1:25:36,"/>
</Variable>
<Variable Name="Volumetric fog: Ramp end" Value="1000.0001">
<Spline Keys="0:1000:36,0.25:1000:36,0.5:1000:65572,0.75:1000:36,1:1000:36,"/>
</Variable>
<Variable Name="Volumetric fog: Ramp influence" Value="0.69999993">
<Spline Keys="0:0.7:36,0.25:0.7:36,0.5:0.7:65572,0.75:0.7:36,1:0.7:36,"/>
</Variable>
<Variable Name="Volumetric fog: Shadow darkening" Value="0.20000002">
<Spline Keys="0:0.2:36,0.25:0.2:36,0.5:0.2:65572,0.75:0.2:36,1:0.2:36,"/>
</Variable>
<Variable Name="Volumetric fog: Shadow darkening sun" Value="0.5">
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Volumetric fog: Shadow darkening ambient" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Volumetric fog: Shadow range" Value="0.10000001">
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog height (bottom)" Value="0">
<Spline Keys="0:0:0,1:0:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog layer density (bottom)" Value="1">
<Spline Keys="0:1:0,1:1:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog height (top)" Value="4000">
<Spline Keys="0:4000:0,1:4000:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog layer density (top)" Value="9.9999997e-05">
<Spline Keys="0:0.0001:0,1:0.0001:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Global fog density" Value="0.1">
<Spline Keys="0:0.1:0,1:0.1:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Ramp start" Value="0">
<Spline Keys="0:0:0,1:0:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Ramp end" Value="0">
<Spline Keys="0:0:0,1:0:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog albedo color (atmosphere)" Color="1,1,1">
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Anisotropy factor (atmosphere)" Value="0.60000002">
<Spline Keys="0:0.6:0,1:0.6:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog albedo color (sun radial)" Color="1,1,1">
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Anisotropy factor (sun radial)" Value="0.94999999">
<Spline Keys="0:0.95:0,1:0.95:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Blend factor for sun scattering" Value="1">
<Spline Keys="0:1:0,1:1:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Blend mode for sun scattering" Value="0">
<Spline Keys="0:0:0,1:0:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Fog albedo color (entities)" Color="1,1,1">
<Spline Keys="0:(1:1:1):0,1:(1:1:1):0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Anisotropy factor (entities)" Value="0.60000002">
<Spline Keys="0:0.6:0,1:0.6:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Maximum range of ray-marching" Value="64">
<Spline Keys="0:64:0,1:64:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: In-scattering factor" Value="1">
<Spline Keys="0:1:0,1:1:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Extinction factor" Value="0.30000001">
<Spline Keys="0:0.3:0,1:0.3:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Analytical volumetric fog visibility" Value="0.5">
<Spline Keys="0:0.5:0,1:0.5:0,"/>
</Variable>
<Variable Name="Volumetric fog 2: Final density clamp" Value="1">
<Spline Keys="0:1:0,0.5:1:36,1:1:0,"/>
</Variable>
<Variable Name="Sky light: Sun intensity" Color="1,1,1">
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.494381:(1:1:1):65572,0.5:(1:1:1):36,0.75:(1:1:1):36,1:(1:1:1):36,"/>
</Variable>
<Variable Name="Sky light: Sun intensity multiplier" Value="200.00002">
<Spline Keys="0:200:36,0.25:200:36,0.5:200:36,0.75:200:36,1:200:36,"/>
</Variable>
<Variable Name="Sky light: Mie scattering" Value="6.779707">
<Spline Keys="0:40:36,0.5:2:36,1:40:36,"/>
</Variable>
<Variable Name="Sky light: Rayleigh scattering" Value="0.20000002">
<Spline Keys="0:0.2:36,0.229167:0.2:36,0.25:1:36,0.291667:0.2:36,0.5:0.2:36,0.729167:0.2:36,0.75:1:36,0.770833:0.2:36,1:0.2:36,"/>
</Variable>
<Variable Name="Sky light: Sun anisotropy factor" Value="-0.99989998">
<Spline Keys="0:-0.9999:36,0.25:-0.9999:36,0.5:-0.9999:65572,0.75:-0.9999:36,1:-0.9999:36,"/>
</Variable>
<Variable Name="Sky light: Wavelength (R)" Value="694">
<Spline Keys="0:694:36,0.25:694:36,0.5:694:65572,0.75:694:36,1:694:36,"/>
</Variable>
<Variable Name="Sky light: Wavelength (G)" Value="596.99994">
<Spline Keys="0:597:36,0.25:597:36,0.5:597:36,0.75:597:36,1:597:36,"/>
</Variable>
<Variable Name="Sky light: Wavelength (B)" Value="488">
<Spline Keys="0:488:36,0.25:488:36,0.5:488:65572,0.75:488:36,1:488:36,"/>
</Variable>
<Variable Name="Night sky: Horizon color" Color="0.27049801,0.39157301,0.52711499">
<Spline Keys="0:(0.270498:0.391573:0.520996):36,0.25:(0.270498:0.391573:0.527115):36,0.5:(0.270498:0.391573:0.527115):262180,0.75:(0.270498:0.391573:0.527115):36,1:(0.270498:0.391573:0.520996):36,"/>
</Variable>
<Variable Name="Night sky: Horizon color multiplier" Value="0">
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
</Variable>
<Variable Name="Night sky: Zenith color" Color="0.36130697,0.434154,0.46778399">
<Spline Keys="0:(0.361307:0.434154:0.467784):36,0.25:(0.361307:0.434154:0.467784):36,0.5:(0.361307:0.434154:0.467784):262180,0.75:(0.361307:0.434154:0.467784):36,1:(0.361307:0.434154:0.467784):36,"/>
</Variable>
<Variable Name="Night sky: Zenith color multiplier" Value="0">
<Spline Keys="0:0.02:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.02:36,"/>
</Variable>
<Variable Name="Night sky: Zenith shift" Value="0.5">
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Night sky: Star intensity" Value="0">
<Spline Keys="0:3:36,0.25:0:36,0.5:0:65572,0.75:0:36,0.836647:1.03977:36,1:3:36,"/>
</Variable>
<Variable Name="Night sky: Moon color" Color="1,1,1">
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.5:(1:1:1):458788,0.75:(1:1:1):36,1:(1:1:1):36,"/>
</Variable>
<Variable Name="Night sky: Moon color multiplier" Value="0">
<Spline Keys="0:0.4:36,0.25:0:36,0.5:0:36,0.75:0:65572,1:0.4:36,"/>
</Variable>
<Variable Name="Night sky: Moon inner corona color" Color="0.904661,1,1">
<Spline Keys="0:(0.89627:1:1):36,0.25:(0.904661:1:1):36,0.5:(0.904661:1:1):393252,0.75:(0.904661:1:1):36,0.836647:(0.89627:1:1):36,1:(0.89627:1:1):36,"/>
</Variable>
<Variable Name="Night sky: Moon inner corona color multiplier" Value="0">
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
</Variable>
<Variable Name="Night sky: Moon inner corona scale" Value="0">
<Spline Keys="0:2:36,0.25:0:36,0.5:0:65572,0.75:0:36,0.836647:0.693178:36,1:2:36,"/>
</Variable>
<Variable Name="Night sky: Moon outer corona color" Color="0.201556,0.22696599,0.25415203">
<Spline Keys="0:(0.198069:0.226966:0.250158):36,0.25:(0.201556:0.226966:0.254152):36,0.5:(0.201556:0.226966:0.254152):36,0.75:(0.201556:0.226966:0.254152):36,1:(0.198069:0.226966:0.250158):36,"/>
</Variable>
<Variable Name="Night sky: Moon outer corona color multiplier" Value="0">
<Spline Keys="0:0.1:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.1:36,"/>
</Variable>
<Variable Name="Night sky: Moon outer corona scale" Value="0">
<Spline Keys="0:0.01:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.01:36,"/>
</Variable>
<Variable Name="Cloud shading: Sun light multiplier" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Cloud shading: Sun custom color" Color="0.83076996,0.76815104,0.65837508">
<Spline Keys="0:(0.737911:0.737911:0.737911):36,0.25:(0.83077:0.768151:0.658375):36,0.5:(0.83077:0.768151:0.658375):458788,0.75:(0.83077:0.768151:0.658375):36,1:(0.737911:0.737911:0.737911):36,"/>
</Variable>
<Variable Name="Cloud shading: Sun custom color multiplier" Value="1">
<Spline Keys="0:0.1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cloud shading: Sun custom color influence" Value="0">
<Spline Keys="0:0.5:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0.5:36,"/>
</Variable>
<Variable Name="Sun shafts visibility" Value="0">
<Spline Keys="0:0:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0:36,"/>
</Variable>
<Variable Name="Sun rays visibility" Value="1.5">
<Spline Keys="0:1:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:1:36,"/>
</Variable>
<Variable Name="Sun rays attenuation" Value="1.5">
<Spline Keys="0:0.1:36,0.25:1.5:36,0.5:1.5:65572,0.75:1.5:36,1:0.1:36,"/>
</Variable>
<Variable Name="Sun rays suncolor influence" Value="0.5">
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Sun rays custom color" Color="0.66538697,0.83879906,0.94730699">
<Spline Keys="0:(0.665387:0.838799:0.947307):36,0.25:(0.665387:0.838799:0.947307):36,0.5:(0.665387:0.838799:0.947307):458788,0.75:(0.665387:0.838799:0.947307):36,1:(0.665387:0.838799:0.947307):36,"/>
</Variable>
<Variable Name="Ocean fog color" Color="0.0012141101,0.0091340598,0.017642001">
<Spline Keys="0:(0.00121411:0.00913406:0.017642):36,0.25:(0.00121411:0.00913406:0.017642):36,0.5:(0.00121411:0.00913406:0.017642):458788,0.75:(0.00121411:0.00913406:0.017642):36,1:(0.00121411:0.00913406:0.017642):36,"/>
</Variable>
<Variable Name="Ocean fog color multiplier" Value="0.5">
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Ocean fog density" Value="0.5">
<Spline Keys="0:0.5:36,0.25:0.5:36,0.5:0.5:65572,0.75:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Static skybox multiplier" Value="1">
<Spline Keys="0:1:0,1:1:0,"/>
</Variable>
<Variable Name="Film curve shoulder scale" Value="2.232213">
<Spline Keys="0:3:36,0.229167:3:36,0.5:2:36,0.770833:3:36,1:3:36,"/>
</Variable>
<Variable Name="Film curve midtones scale" Value="0.88389361">
<Spline Keys="0:0.5:36,0.229167:0.5:36,0.5:1:36,0.770833:0.5:36,1:0.5:36,"/>
</Variable>
<Variable Name="Film curve toe scale" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Film curve whitepoint" Value="4">
<Spline Keys="0:4:36,0.25:4:36,0.5:4:65572,0.75:4:36,1:4:36,"/>
</Variable>
<Variable Name="Saturation" Value="1">
<Spline Keys="0:0.8:36,0.229167:0.8:36,0.5:1:36,0.751391:1:65572,0.770833:0.8:36,1:0.8:36,"/>
</Variable>
<Variable Name="Color balance" Color="1,1,1">
<Spline Keys="0:(1:1:1):36,0.25:(1:1:1):36,0.5:(1:1:1):36,0.75:(1:1:1):36,1:(1:1:1):36,"/>
</Variable>
<Variable Name="Scene key" Value="0.18000002">
<Spline Keys="0:0.18:36,0.25:0.18:36,0.5:0.18:65572,0.75:0.18:36,1:0.18:36,"/>
</Variable>
<Variable Name="Min exposure" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Max exposure" Value="2.6142297">
<Spline Keys="0:2:36,0.229167:2:36,0.5:2.8:36,0.770833:2:36,1:2:36,"/>
</Variable>
<Variable Name="EV Min" Value="4.5">
<Spline Keys="0:4.5:0,1:4.5:0,"/>
</Variable>
<Variable Name="EV Max" Value="17">
<Spline Keys="0:17:0,1:17:0,"/>
</Variable>
<Variable Name="EV Auto compensation" Value="1.5">
<Spline Keys="0:1.5:0,1:1.5:0,"/>
</Variable>
<Variable Name="Bloom amount" Value="0.30899152">
<Spline Keys="0:1:36,0.229167:1:36,0.5:0.1:36,0.770833:1:36,1:1:36,"/>
</Variable>
<Variable Name="Filters: grain" Value="0">
<Spline Keys="0:0.3:65572,0.229167:0.3:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0.3:36,"/>
</Variable>
<Variable Name="Filters: photofilter color" Color="0,0,0">
<Spline Keys="0:(0:0:0):36,0.25:(0:0:0):36,0.5:(0:0:0):458788,0.75:(0:0:0):36,1:(0:0:0):36,"/>
</Variable>
<Variable Name="Filters: photofilter density" Value="0">
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
</Variable>
<Variable Name="Dof: focus range" Value="500.00003">
<Spline Keys="0:500:36,0.25:500:36,0.5:500:65572,0.75:500:36,1:500:36,"/>
</Variable>
<Variable Name="Dof: blur amount" Value="0.10000001">
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 0: Bias" Value="0.10000001">
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 0: Slope Bias" Value="64">
<Spline Keys="0:64:36,0.25:64:36,0.5:64:65572,0.75:64:36,1:64:36,"/>
</Variable>
<Variable Name="Cascade 1: Bias" Value="0.10000001">
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 1: Slope Bias" Value="23">
<Spline Keys="0:23:36,0.25:23:36,0.5:23:65572,0.75:23:36,1:23:36,"/>
</Variable>
<Variable Name="Cascade 2: Bias" Value="0.10000001">
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 2: Slope Bias" Value="4">
<Spline Keys="0:4:36,0.25:4:36,0.5:4:65572,0.75:4:36,1:4:36,"/>
</Variable>
<Variable Name="Cascade 3: Bias" Value="0.10000001">
<Spline Keys="0:0.1:36,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 3: Slope Bias" Value="1">
<Spline Keys="0:1:36,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Cascade 4: Bias" Value="0.10000001">
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:65572,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 4: Slope Bias" Value="1">
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Cascade 5: Bias" Value="0.0099999998">
<Spline Keys="0:0.01:0,0.25:0.01:36,0.5:0.01:65572,0.75:0.01:36,1:0.01:36,"/>
</Variable>
<Variable Name="Cascade 5: Slope Bias" Value="1">
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Cascade 6: Bias" Value="0.10000001">
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 6: Slope Bias" Value="1">
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Cascade 7: Bias" Value="0.10000001">
<Spline Keys="0:0.1:0,0.25:0.1:36,0.5:0.1:36,0.75:0.1:36,1:0.1:36,"/>
</Variable>
<Variable Name="Cascade 7: Slope Bias" Value="1">
<Spline Keys="0:1:0,0.25:1:36,0.5:1:65572,0.75:1:36,1:1:36,"/>
</Variable>
<Variable Name="Shadow jittering" Value="2.4999998">
<Spline Keys="0:5:36,0.25:2.5:36,0.5:2.5:65572,0.75:2.5:36,1:5:0,"/>
</Variable>
<Variable Name="HDR dynamic power factor" Value="0">
<Spline Keys="0:0:36,0.25:0:36,0.5:0:65572,0.75:0:36,1:0:36,"/>
</Variable>
<Variable Name="Sky brightening (terrain occlusion)" Value="0">
<Spline Keys="0:0:36,0.25:0:36,0.5:0:36,0.75:0:36,1:0:36,"/>
</Variable>
<Variable Name="Sun color multiplier" Value="9.999999">
<Spline Keys="0:0.1:36,0.25:10:36,0.5:10:36,0.75:10:36,1:0.1:36,"/>
</Variable>
</TimeOfDay>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e6a5435c928079b27796f6b202bbc2623e7e454244ddc099a3cadf33b7cb9e9
size 63
@@ -1,12 +0,0 @@
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85
size 22
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:012caffa9354f6253d2e626ba183b44eb02a74eba286fde0430227ef024411e2
size 8961
oid sha256:817bd8dd22e185136418b60fba5b3552993687515d3d5ae96791f2c3be907b92
size 7233
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:619bcf0c2a2b08f4ffe05e60858c479828fe39d5530f4e488b9c0ec8a585ccb7
size 7735
oid sha256:cb97ada674d123c67d7a32eb65e81fa66472cf51f748054c4a4297649f2a0f40
size 5568
@@ -1 +0,0 @@
/autooptimizefile=0 /M=50,50,0,50,50,50 /preset=NormalsWithSmoothness /reduce="android:1,ios:1,mac:0,pc:0,provo:0"
@@ -10,13 +10,6 @@
"Gems/DevTextures"
]
},
"PBSreferenceMaterials":
{
"SourcePaths":
[
"Gems/PBSreferenceMaterials"
]
},
"PhysicsEntities":
{
"SourcePaths":
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=LensOptics /reduce=-1
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Albedo /reduce=0
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Terrain_Albedo_HighPassed /reduce=0
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=Terrain_Albedo_HighPassed /reduce=0
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=AlbedoWithOpacity /reduce=0
@@ -1 +0,0 @@
/autooptimizefile=0 /preset=AlbedoWithOpacity /reduce=0
+32 -24
View File
@@ -32,6 +32,7 @@
#include <AzFramework/API/ApplicationAPI.h>
// AzToolsFramework
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
// AzQtComponents
@@ -166,15 +167,14 @@ LevelEditorMenuHandler::LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPan
m_mainWindow->menuBar()->setNativeMenuBar(true);
#endif
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
AzToolsFramework::GetEntityContextId());
ViewportEditorModeNotificationsBus::Handler::BusConnect(GetEntityContextId());
EditorMenuRequestBus::Handler::BusConnect();
}
LevelEditorMenuHandler::~LevelEditorMenuHandler()
{
EditorMenuRequestBus::Handler::BusDisconnect();
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
}
void LevelEditorMenuHandler::Initialize()
@@ -1184,36 +1184,44 @@ void LevelEditorMenuHandler::AddDisableActionInSimModeListener(QAction* action)
}));
}
void LevelEditorMenuHandler::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
void LevelEditorMenuHandler::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
if (!menuWrapper.isNull())
if (mode == ViewportEditorMode::Component)
{
// copy of menu actions
auto actions = menuWrapper.Get()->actions();
// remove all non-reserved edit menu options
actions.erase(
std::remove_if(actions.begin(), actions.end(), [](QAction* action)
{
return !action->property("Reserved").toBool();
}),
actions.end());
if (auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
!menuWrapper.isNull())
{
// copy of menu actions
auto actions = menuWrapper.Get()->actions();
// remove all non-reserved edit menu options
actions.erase(
std::remove_if(actions.begin(), actions.end(), [](QAction* action)
{
return !action->property("Reserved").toBool();
}),
actions.end());
// clear and update the menu with new actions
menuWrapper.Get()->clear();
menuWrapper.Get()->addActions(actions);
// clear and update the menu with new actions
menuWrapper.Get()->clear();
menuWrapper.Get()->addActions(actions);
}
}
}
void LevelEditorMenuHandler::LeftComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
void LevelEditorMenuHandler::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
RestoreEditMenuToDefault();
if (mode == ViewportEditorMode::Component)
{
RestoreEditMenuToDefault();
}
}
void LevelEditorMenuHandler::AddEditMenuAction(QAction* action)
{
auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
if (!menuWrapper.isNull())
if (auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
!menuWrapper.isNull())
{
menuWrapper.Get()->addAction(action);
}
@@ -1237,8 +1245,8 @@ void LevelEditorMenuHandler::AddMenuAction(AZStd::string_view categoryId, QActio
void LevelEditorMenuHandler::RestoreEditMenuToDefault()
{
auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
if (!menuWrapper.isNull())
if (auto menuWrapper = m_actionManager->FindMenu(s_editMenuId);
!menuWrapper.isNull())
{
menuWrapper.Get()->clear();
PopulateEditMenu(menuWrapper);
+7 -5
View File
@@ -18,7 +18,7 @@
#include <QPointer>
#include "ActionManager.h"
#include "QtViewPaneManager.h"
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#endif
class MainWindow;
@@ -28,7 +28,7 @@ struct QtViewPane;
class LevelEditorMenuHandler
: public QObject
, private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
, private AzToolsFramework::EditorMenuRequestBus::Handler
{
Q_OBJECT
@@ -88,9 +88,11 @@ private:
void AddDisableActionInSimModeListener(QAction* action);
// EditorComponentModeNotificationBus
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
// EditorMenuRequestBus
void AddEditMenuAction(QAction* action) override;
+1
View File
@@ -28,6 +28,7 @@
#include "Objects/EntityObject.h"
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
//////////////////////////////////////////////////////////////////////////
#define MUSIC_LEVEL_LIBRARY_FILE "Music.xml"
@@ -69,6 +69,7 @@ namespace UnitTest
m_rootWidget = AZStd::make_unique<QWidget>();
m_rootWidget->setFixedSize(WidgetSize);
m_rootWidget->move(0, 0); // explicitly set the widget to be in the upper left corner
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
m_controllerList->RegisterViewportContext(TestViewportId);
@@ -344,4 +345,51 @@ namespace UnitTest
// Clean-up
HaltCollaborators();
}
// test to verify deltas and cursor positions are handled correctly when the widget is moved
TEST_F(ModularViewportCameraControllerFixture, CameraDoesNotStutterAfterWidgetIsMoved)
{
// Given
PrepareCollaborators();
SandboxEditor::SetCameraCaptureCursorForLook(true);
const float deltaTime = 1.0f / 60.0f;
// When
// move cursor to the center of the screen
auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2);
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// move camera right
const auto mouseDelta = QPoint(200, 0);
MousePressAndMove(m_rootWidget.get(), start, mouseDelta, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::NoModifier, start + mouseDelta);
// update the position of the widget
const auto offset = QPoint(500, 500);
m_rootWidget->move(offset);
// move cursor back to widget center
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// move camera left
MousePressAndMove(m_rootWidget.get(), start, -mouseDelta, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// Then
// ensure the camera rotation has returned to the identity
const AZ::Quaternion cameraRotation = m_cameraViewportContextView->GetCameraTransform().GetRotation();
const auto eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromQuaternion(cameraRotation));
using ::testing::FloatNear;
EXPECT_THAT(eulerAngles.GetX(), FloatNear(0.0f, 0.001f));
EXPECT_THAT(eulerAngles.GetZ(), FloatNear(0.0f, 0.001f));
// Clean-up
HaltCollaborators();
}
} // namespace UnitTest
+1
View File
@@ -98,6 +98,7 @@ AZ_POP_DISABLE_WARNING
#include "ActionManager.h"
#include <ImGuiBus.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
using namespace AZ;
+23 -14
View File
@@ -30,6 +30,8 @@
#include "Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h"
#include <AzCore/Console/Console.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
AZ_CVAR_EXTERNED(bool, ed_visibility_logTiming);
@@ -107,14 +109,13 @@ CObjectManager::CObjectManager()
m_objectsByName.reserve(1024);
LoadRegistry();
AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
AzToolsFramework::GetEntityContextId());
AzToolsFramework::ViewportEditorModeNotificationsBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
}
//////////////////////////////////////////////////////////////////////////
CObjectManager::~CObjectManager()
{
AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
AzToolsFramework::ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
m_bExiting = true;
SaveRegistry();
@@ -2306,25 +2307,33 @@ void CObjectManager::SelectObjectInRect(CBaseObject* pObj, CViewport* view, HitC
}
}
void CObjectManager::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
void CObjectManager::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
// hide current gizmo for entity (translate/rotate/scale)
IGizmoManager* gizmoManager = GetGizmoManager();
const size_t gizmoCount = static_cast<size_t>(gizmoManager->GetGizmoCount());
for (size_t i = 0; i < gizmoCount; ++i)
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast<int>(i)));
// hide current gizmo for entity (translate/rotate/scale)
IGizmoManager* gizmoManager = GetGizmoManager();
const size_t gizmoCount = static_cast<size_t>(gizmoManager->GetGizmoCount());
for (size_t i = 0; i < gizmoCount; ++i)
{
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast<int>(i)));
}
}
}
void CObjectManager::LeftComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
void CObjectManager::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
// show translate/rotate/scale gizmo again
if (IGizmoManager* gizmoManager = GetGizmoManager())
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
if (CBaseObject* selectedObject = GetIEditor()->GetSelectedObject())
// show translate/rotate/scale gizmo again
if (IGizmoManager* gizmoManager = GetGizmoManager())
{
gizmoManager->AddGizmo(new CAxisGizmo(selectedObject));
if (CBaseObject* selectedObject = GetIEditor()->GetSelectedObject())
{
gizmoManager->AddGizmo(new CAxisGizmo(selectedObject));
}
}
}
}
+8 -5
View File
@@ -20,8 +20,9 @@
#include "ObjectManagerEventBus.h"
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/Component/Component.h>
#include <Include/SandboxAPI.h>
// forward declarations.
@@ -58,7 +59,7 @@ public:
*/
class CObjectManager
: public IObjectManager
, private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
{
public:
//! Selection functor callback.
@@ -329,9 +330,11 @@ private:
void FindDisplayableObjects(DisplayContext& dc, bool bDisplay);
// EditorComponentModeNotificationBus
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
private:
typedef std::map<GUID, CBaseObjectPtr, guid_less_predicate> Objects;
@@ -36,6 +36,7 @@
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.hxx>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <QGraphicsOpacityEffect>
#include <QLabel>
@@ -267,8 +268,7 @@ OutlinerWidget::OutlinerWidget(QWidget* pParent, Qt::WindowFlags flags)
ToolsApplicationEvents::Bus::Handler::BusConnect();
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
AzToolsFramework::GetEntityContextId());
AzToolsFramework::ViewportEditorModeNotificationsBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusConnect();
AzToolsFramework::EditorWindowUIRequestBus::Handler::BusConnect();
}
@@ -276,7 +276,7 @@ OutlinerWidget::OutlinerWidget(QWidget* pParent, Qt::WindowFlags flags)
OutlinerWidget::~OutlinerWidget()
{
AzToolsFramework::EditorWindowUIRequestBus::Handler::BusDisconnect();
AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
AzToolsFramework::ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusDisconnect();
AzToolsFramework::EditorPickModeNotificationBus::Handler::BusDisconnect();
EntityHighlightMessages::Bus::Handler::BusDisconnect();
@@ -1335,14 +1335,22 @@ void OutlinerWidget::SetEditorUiEnabled(bool enable)
EnableUi(enable);
}
void OutlinerWidget::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
void OutlinerWidget::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
EnableUi(false);
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
EnableUi(false);
}
}
void OutlinerWidget::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
void OutlinerWidget::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
EnableUi(true);
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
EnableUi(true);
}
}
void OutlinerWidget::OnSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/)
@@ -16,7 +16,7 @@
#include <AzCore/base.h>
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Entity/SliceEditorEntityOwnershipServiceBus.h>
@@ -58,7 +58,7 @@ class OutlinerWidget
, private AzToolsFramework::EditorEntityContextNotificationBus::Handler
, private AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
, private AzToolsFramework::EditorEntityInfoNotificationBus::Handler
, private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
, private AzToolsFramework::EditorWindowUIRequestBus::Handler
{
Q_OBJECT;
@@ -105,9 +105,11 @@ private:
void OnEntityInfoUpdatedAddChildEnd(AZ::EntityId /*parentId*/, AZ::EntityId /*childId*/) override;
void OnEntityInfoUpdatedName(AZ::EntityId entityId, const AZStd::string& /*name*/) override;
// EditorComponentModeNotificationBus
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
// EditorWindowUIRequestBus overrides
void SetEditorUiEnabled(bool enable) override;
+52 -7
View File
@@ -37,6 +37,7 @@
#include <AzAssetBrowser/AzAssetBrowserWindow.h>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <AzQtComponents/Utilities/AutoSettingsGroup.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzToolsFramework/UI/Docking/DockWidgetUtils.h>
#include <AzToolsFramework/UI/PropertyEditor/ComponentEditor.hxx>
#include <AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx>
@@ -44,11 +45,54 @@
#include <AzQtComponents/Buses/ShortcutDispatch.h>
#include <AzQtComponents/Utilities/QtViewPaneEffects.h>
#include <AzQtComponents/Components/StyleManager.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
#include "ShortcutDispatcher.h"
// Helper for EditorComponentModeNotifications to be used
// as a member instead of inheriting from EBus directly.
class ViewportEditorModeNotificationsBusImpl
: public AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
{
public:
// Set the function to be called when entering ComponentMode.
void SetEnteredComponentModeFunc(
const AZStd::function<void(const AzToolsFramework::ViewportEditorModesInterface&)>& enteredComponentModeFunc)
{
m_enteredComponentModeFunc = enteredComponentModeFunc;
}
// Set the function to be called when leaving ComponentMode.
void SetLeftComponentModeFunc(
const AZStd::function<void(const AzToolsFramework::ViewportEditorModesInterface&)>& leftComponentModeFunc)
{
m_leftComponentModeFunc = leftComponentModeFunc;
}
private:
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override
{
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
m_enteredComponentModeFunc(editorModeState);
}
}
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override
{
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
m_leftComponentModeFunc(editorModeState);
}
}
AZStd::function<void(const AzToolsFramework::ViewportEditorModesInterface&)> m_enteredComponentModeFunc; ///< Function to call when entering ComponentMode.
AZStd::function<void(const AzToolsFramework::ViewportEditorModesInterface&)> m_leftComponentModeFunc; ///< Function to call when leaving ComponentMode.
};
struct ViewLayoutState
{
QVector<QString> viewPanes;
@@ -519,16 +563,17 @@ QtViewPaneManager::QtViewPaneManager(QObject* parent)
, m_settings(nullptr)
, m_restoreInProgress(false)
, m_advancedDockManager(nullptr)
, m_componentModeNotifications(AZStd::make_unique<ViewportEditorModeNotificationsBusImpl>())
{
qRegisterMetaTypeStreamOperators<ViewLayoutState>("ViewLayoutState");
qRegisterMetaTypeStreamOperators<QVector<QString> >("QVector<QString>");
// view pane manager is interested when we enter/exit ComponentMode
m_componentModeNotifications.BusConnect(AzToolsFramework::GetEntityContextId());
m_componentModeNotifications->BusConnect(AzToolsFramework::GetEntityContextId());
m_windowRequest.BusConnect();
m_componentModeNotifications.SetEnteredComponentModeFunc(
[this](const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
m_componentModeNotifications->SetEnteredComponentModeFunc(
[this](const AzToolsFramework::ViewportEditorModesInterface&)
{
// gray out panels when entering ComponentMode
SetDefaultActionsEnabled(false, m_registeredPanes, [](QWidget* widget, bool on)
@@ -537,8 +582,8 @@ QtViewPaneManager::QtViewPaneManager(QObject* parent)
});
});
m_componentModeNotifications.SetLeftComponentModeFunc(
[this](const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
m_componentModeNotifications->SetLeftComponentModeFunc(
[this](const AzToolsFramework::ViewportEditorModesInterface&)
{
// enable panels again when leaving ComponentMode
SetDefaultActionsEnabled(true, m_registeredPanes, [](QWidget* widget, bool on)
@@ -563,7 +608,7 @@ QtViewPaneManager::QtViewPaneManager(QObject* parent)
QtViewPaneManager::~QtViewPaneManager()
{
m_windowRequest.BusDisconnect();
m_componentModeNotifications.BusDisconnect();
m_componentModeNotifications->BusDisconnect();
}
static bool lessThan(const QtViewPane& v1, const QtViewPane& v2)
+4 -4
View File
@@ -17,7 +17,6 @@
#include <AzQtComponents/Components/DockTabWidget.h>
#include <AzQtComponents/Components/StyledDockWidget.h>
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
#include <QObject>
@@ -34,6 +33,7 @@
#endif
class QMainWindow;
class ViewportEditorModeNotificationsBusImpl;
struct ViewLayoutState;
namespace AzQtComponents
@@ -245,9 +245,9 @@ private:
QPointer<AzQtComponents::FancyDocking> m_advancedDockManager;
using EditorComponentModeNotificationBusImpl = AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBusImpl;
EditorComponentModeNotificationBusImpl m_componentModeNotifications; //!< Helper for EditorComponentModeNotificationBus so
//!< QtViewPaneManager does not need to inherit directly from it. */
AZStd::unique_ptr<ViewportEditorModeNotificationsBusImpl>
m_componentModeNotifications; //!< Helper for EditorComponentModeNotificationBus so
//!< QtViewPaneManager does not need to inherit directly from it. */
using EditorWindowRequestBusImpl = AzToolsFramework::EditorWindowRequestBusImpl;
EditorWindowRequestBusImpl m_windowRequest; //!< Helper for EditorWindowRequestBus so
+1
View File
@@ -19,6 +19,7 @@
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
// Editor
#include "ViewManager.h"
@@ -46,5 +46,23 @@ namespace AZ
private:
AZStd::sys_time_t m_timeStamp;
};
//! Utility type that updates the given variable with the lifetime of the object in cycles.
//! Useful for quick scope based timing.
struct ScopedTimer
{
explicit ScopedTimer(AZStd::sys_time_t& variable)
: m_variable(variable)
{
m_timer.Stamp();
}
~ScopedTimer()
{
m_variable = m_timer.GetDeltaTimeInTicks();
}
AZStd::sys_time_t& m_variable;
Timer m_timer;
};
}
}
+45
View File
@@ -30,4 +30,49 @@ namespace AZStd
using std::sqrt;
using std::tan;
using std::trunc;
} // namespace AZStd
// from c++20 standard
namespace AZStd::Internal
{
template<typename T>
constexpr T lerp(T a, T b, T t) noexcept
{
if ((a <= 0 && b >= 0) || (a >= 0 && b <= 0))
{
return t * b + (1 - t) * a;
}
if (t == 1)
{
return b;
}
const T x = a + t * (b - a);
if ((t > 1) == (b > a))
{
return b < x ? x : b;
}
else
{
return x < b ? x : b;
}
}
} // namespace AZStd::Internal
namespace AZStd
{
constexpr float lerp(float a, float b, float t) noexcept
{
return Internal::lerp(a, b, t);
}
constexpr double lerp(double a, double b, double t) noexcept
{
return Internal::lerp(a, b, t);
}
constexpr long double lerp(long double a, long double b, long double t) noexcept
{
return Internal::lerp(a, b, t);
}
} // namespace AZStd
@@ -0,0 +1,46 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/std/math.h>
namespace UnitTest
{
template<typename T>
class StdMathTest : public ::testing::Test
{
};
using MathTestConfigs = ::testing::Types<float, double, long double>;
TYPED_TEST_CASE(StdMathTest, MathTestConfigs);
TYPED_TEST(StdMathTest, LerpOperations)
{
using AZStd::lerp;
using ::testing::Eq;
using T = TypeParam;
constexpr T maxNumber = AZStd::numeric_limits<T>::max();
constexpr T eps = AZStd::numeric_limits<T>::epsilon();
constexpr T a{ 42 };
// exactness: lerp(a,b,0)==a && lerp(a,b,1)==b
EXPECT_THAT(lerp(eps, maxNumber, T(0)), Eq(eps));
EXPECT_THAT(lerp(eps, maxNumber, T(1)), Eq(maxNumber));
// consistency: lerp(a,a,t)==a
EXPECT_THAT(lerp(a, a, T(0.5)), Eq(a));
EXPECT_THAT(lerp(eps, eps, T(0.5)), Eq(eps));
// a few generic tests taken from MathUtilTests.cpp
EXPECT_EQ(T(2.5), lerp(T(2), T(4), T(0.25)));
EXPECT_EQ(T(6.0), lerp(T(2), T(4), T(2.0)));
EXPECT_EQ(T(3.5), lerp(T(2), T(4), T(0.75)));
EXPECT_EQ(T(0.0), lerp(T(2), T(4), T(-1.0)));
}
} // namespace UnitTest
@@ -64,6 +64,91 @@ namespace JsonSerializationTests
};
class TestSerializedAssetTracker
: public BaseJsonSerializerFixture
{
public:
void SetUp() override
{
BaseJsonSerializerFixture::SetUp();
AZ::AllocatorInstance<AZ::PoolAllocator>::Create();
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Create();
// Set up the Job Manager with 1 thread so that the Asset Manager is able to load assets.
AZ::JobManagerDesc jobDesc;
AZ::JobManagerThreadDesc threadDesc;
jobDesc.m_workerThreads.push_back(threadDesc);
m_jobManager = aznew AZ::JobManager(jobDesc);
m_jobContext = aznew AZ::JobContext(*m_jobManager);
AZ::JobContext::SetGlobalContext(m_jobContext);
AZ::Data::AssetManager::Descriptor descriptor;
AZ::Data::AssetManager::Create(descriptor);
AZ::Data::AssetManager::Instance().RegisterHandler(&m_assetHandler, azrtti_typeid<TestAssetData>());
m_serializeContext->RegisterGenericType<AZ::Data::Asset<TestAssetData>>();
m_jsonRegistrationContext->Serializer<AZ::Data::AssetJsonSerializer>()->HandlesType<AZ::Data::Asset>();
}
void TearDown() override
{
m_jsonRegistrationContext->EnableRemoveReflection();
m_jsonRegistrationContext->Serializer<AZ::Data::AssetJsonSerializer>()->HandlesType<AZ::Data::Asset>();
m_jsonRegistrationContext->DisableRemoveReflection();
AZ::Data::AssetManager::Instance().UnregisterHandler(&m_assetHandler);
AZ::Data::AssetManager::Destroy();
AZ::JobContext::SetGlobalContext(nullptr);
delete m_jobContext;
delete m_jobManager;
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Destroy();
AZ::AllocatorInstance<AZ::PoolAllocator>::Destroy();
BaseJsonSerializerFixture::TearDown();
}
private:
TestAssetHandler m_assetHandler;
AZ::JobManager* m_jobManager{ nullptr };
AZ::JobContext* m_jobContext{ nullptr };
};
TEST_F(TestSerializedAssetTracker, AssetTracker_Callback_Works)
{
auto assetCallback = [](AZ::Data::Asset<AZ::Data::AssetData>& asset)
{
if (!asset.GetId().IsValid() && !asset.GetHint().empty())
{
if (asset.GetHint() == "test/path/foo.asset")
{
asset.SetHint("passed");
}
}
};
auto tracker = AZ::Data::SerializedAssetTracker{};
tracker.SetAssetFixUp(assetCallback);
AZ::JsonDeserializerSettings settings;
settings.m_metadata.Add(tracker);
settings.m_registrationContext = this->m_jsonRegistrationContext.get();
settings.m_serializeContext = this->m_serializeContext.get();
AZStd::string_view assetHintOnlyTestAsset = R"(
{
"assetHint" : "test/path/foo.asset"
})";
rapidjson::Document jsonDom;
jsonDom.Parse(assetHintOnlyTestAsset.data());
AZ::Data::Asset<TestAssetData> instance;
auto result = AZ::JsonSerialization::Load(instance, jsonDom, settings);
EXPECT_NE(result.GetProcessing(), AZ::JsonSerializationResult::Processing::Halted);
EXPECT_STREQ(instance.GetHint().c_str(), "passed");
}
class AssetSerializerTestDescription final
: public JsonSerializerConformityTestDescriptor<AZ::Data::Asset<TestAssetData>>
{
@@ -195,6 +195,7 @@ set(FILES
AZStd/LockFreeQueues.cpp
AZStd/LockFreeStacks.cpp
AZStd/LockTests.cpp
AZStd/Math.cpp
AZStd/Numeric.cpp
AZStd/Ordered.cpp
AZStd/Optional.cpp
@@ -9,6 +9,7 @@
#pragma once
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/string.h>
namespace AZ
@@ -112,9 +112,10 @@ namespace AzFramework
void ApplicationIos::PumpSystemEventLoopUntilEmpty()
{
SInt32 result;
const CFTimeInterval MaxSecondsInRunLoop = 0.001; // One millisecond
do
{
result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, DBL_EPSILON, TRUE);
result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, MaxSecondsInRunLoop, TRUE);
}
while (result == kCFRunLoopRunHandledSource);
}
@@ -12,6 +12,7 @@
#include <xcb/xcb.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
#include <AzFramework/XcbApplication.h>
#include <AzFramework/XcbInputDeviceKeyboard.h>
#include <AzFramework/Input/Buses/Notifications/InputTextNotificationBus.h>
@@ -196,6 +197,7 @@ namespace AzFramework
Application application;
application.Start({}, {});
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
const InputChannel* inputChannel = InputChannelRequests::FindInputChannel(InputDeviceKeyboard::Key::AlphanumericA);
ASSERT_TRUE(inputChannel);
@@ -420,6 +422,7 @@ namespace AzFramework
Application application;
application.Start({}, {});
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
for (int i = 0; i < 4; ++i)
{
@@ -33,6 +33,9 @@ namespace AzQtComponents
titleLabel->setObjectName("Title");
titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
titleLabel->setWordWrap(true);
titleLabel->setTextFormat(Qt::RichText);
titleLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
titleLabel->setOpenExternalLinks(true);
QHBoxLayout* headerLayout = new QHBoxLayout(headerFrame);
headerLayout->setSizeConstraint(QLayout::SetMinimumSize);
@@ -0,0 +1,29 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Interface/Interface.h>
#include <AzCore/Outcome/Outcome.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
namespace AzToolsFramework
{
//! The AZ::Interface for component mode collection queries.
class ComponentModeCollectionInterface
{
public:
AZ_RTTI(ComponentModeCollectionInterface, "{DFAA4450-BBCD-47C0-9B91-FEA2DBD9B152}");
virtual ~ComponentModeCollectionInterface() = default;
//! Retrieves the list of all Component types (usually one).
//! @note If called outside of component mode, an empty vector will be returned.
virtual AZStd::vector<AZ::Uuid> GetComponentTypes() const = 0;
};
} // namespace AzToolsFramework
@@ -0,0 +1,27 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
namespace AzToolsFramework
{
void ViewportEditorModeNotifications::Reflect(AZ::ReflectContext* context)
{
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<ViewportEditorModeNotificationsBus>("ViewportEditorModeNotificationsBus")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
->Attribute(AZ::Script::Attributes::Category, "Editor")
->Attribute(AZ::Script::Attributes::Module, "editor")
->Event("OnEditorModeActivated", &ViewportEditorModeNotifications::OnEditorModeActivated)
->Event("OnEditorModeDeactivated", &ViewportEditorModeNotifications::OnEditorModeDeactivated)
;
}
}
} // namespace AzToolsFramework
@@ -34,6 +34,8 @@ namespace AzToolsFramework
class ViewportEditorModesInterface
{
public:
AZ_RTTI(ViewportEditorModesInterface, "{2421496C-4A46-41C9-8AEF-AE2B6E43E6CF}");
virtual ~ViewportEditorModesInterface() = default;
//! Returns true if the specified editor mode is active, otherwise false.
@@ -52,6 +54,9 @@ namespace AzToolsFramework
using BusIdType = ViewportEditorModeTrackerInfo::IdType;
//////////////////////////////////////////////////////////////////////////
AZ_RTTI(ViewportEditorModeNotifications, "{9469DE39-6C21-423C-94FA-EF3A9616B14F}", AZ::EBusTraits);
static void Reflect(AZ::ReflectContext* context);
//! Notifies subscribers of the a given viewport to the activation of the specified editor mode.
virtual void OnEditorModeActivated([[maybe_unused]] const ViewportEditorModesInterface& editorModeState, [[maybe_unused]] ViewportEditorMode mode)
{
@@ -203,6 +203,12 @@ namespace AzToolsFramework
}
}
AZStd::vector<AZ::Uuid> ComponentModeCollection::GetComponentTypes() const
{
// If in component mode, return the active component types, otherwise return an empty vector
return InComponentMode() ? m_activeComponentTypes : AZStd::vector<AZ::Uuid>{};
}
void ComponentModeCollection::BeginComponentMode()
{
m_selectedComponentModeIndex = 0;
@@ -211,13 +217,6 @@ namespace AzToolsFramework
// notify listeners the editor has entered ComponentMode - listeners may
// wish to modify state to indicate this (e.g. appearance, functionality etc.)
EditorComponentModeNotificationBus::Event(
GetEntityContextId(), &EditorComponentModeNotifications::EnteredComponentMode,
m_activeComponentTypes);
// this call to activate the component mode editor state should eventually replace the bus call in
// ComponentModeCollection::BeginComponentMode() to EditorComponentModeNotifications::EnteredComponentMode
// such that all of the notifications for activating/deactivating the different editor modes are in a central location
m_viewportEditorModeTracker->ActivateMode({ GetEntityContextId() }, ViewportEditorMode::Component);
// enable actions for the first/primary ComponentMode
@@ -288,14 +287,6 @@ namespace AzToolsFramework
// notify listeners the editor has left ComponentMode - listeners may
// wish to modify state to indicate this (e.g. appearance, functionality etc.)
EditorComponentModeNotificationBus::Event(
GetEntityContextId(),
&EditorComponentModeNotifications::LeftComponentMode,
m_activeComponentTypes);
// this call to deactivate the component mode editor state should eventually replace the bus call in
// ComponentModeCollection::EndComponentMode() to EditorComponentModeNotifications::LeftComponentMode
// such that all of the notifications for activating/deactivating the different editor modes are in a central location
m_viewportEditorModeTracker->DeactivateMode({ GetEntityContextId() }, ViewportEditorMode::Component);
// clear stored modes and builders for this ComponentMode
@@ -9,6 +9,7 @@
#pragma once
#include <AzCore/std/containers/vector.h>
#include <AzToolsFramework/API/ComponentModeCollectionInterface.h>
#include <AzToolsFramework/ComponentMode/ComponentModeViewportUi.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
@@ -21,6 +22,7 @@ namespace AzToolsFramework
{
/// Manages all individual ComponentModes for a single instance of Editor wide ComponentMode.
class ComponentModeCollection
: public ComponentModeCollectionInterface
{
public:
AZ_CLASS_ALLOCATOR_DECL
@@ -89,6 +91,9 @@ namespace AzToolsFramework
/// Called once each time a ComponentMode is added.
void PopulateViewportUi();
// ComponentModeCollectionInterface overrides ...
AZStd::vector<AZ::Uuid> GetComponentTypes() const override;
private:
// Internal helper used by Select[|Prev|Next]ActiveComponentMode
bool ActiveComponentModeChanged(const AZ::Uuid& previousComponentType);
@@ -24,18 +24,8 @@ namespace AzToolsFramework
: public EditorComponentModeNotificationBus::Handler
, public AZ::BehaviorEBusHandler
{
AZ_EBUS_BEHAVIOR_BINDER(EditorComponentModeNotificationBusHandler, "{AD2F4204-0913-4FC9-9A10-492538F60C70}", AZ::SystemAllocator,
EnteredComponentMode, LeftComponentMode, ActiveComponentModeChanged);
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentTypes) override
{
Call(FN_EnteredComponentMode, componentTypes);
}
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentTypes) override
{
Call(FN_LeftComponentMode, componentTypes);
}
AZ_EBUS_BEHAVIOR_BINDER(
EditorComponentModeNotificationBusHandler, "{AD2F4204-0913-4FC9-9A10-492538F60C70}", AZ::SystemAllocator, ActiveComponentModeChanged);
void ActiveComponentModeChanged(const AZ::Uuid& componentType) override
{
@@ -171,8 +161,6 @@ namespace AzToolsFramework
->Attribute(AZ::Script::Attributes::Category, "Editor")
->Attribute(AZ::Script::Attributes::Module, "editor")
->Handler<Internal::EditorComponentModeNotificationBusHandler>()
->Event("EnteredComponentMode", &EditorComponentModeNotifications::EnteredComponentMode)
->Event("LeftComponentMode", &EditorComponentModeNotifications::LeftComponentMode)
->Event("ActiveComponentModeChanged", &EditorComponentModeNotifications::ActiveComponentModeChanged)
;
}
@@ -238,12 +238,6 @@ namespace AzToolsFramework
using BusIdType = AzFramework::EntityContextId;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
/// Called when Editor enters ComponentMode - pass the list of all Component types (usually one).
virtual void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentTypes) = 0;
/// Called when Editor leaves ComponentMode - pass the list of all Component types (usually one).
virtual void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentTypes) = 0;
/// Called when Tab is pressed to cycle the 'selected' ComponentMode (which shortcuts/actions are active).
/// Also called when directly selecting a Component in the EntityOutliner.
virtual void ActiveComponentModeChanged(const AZ::Uuid& /*componentType*/) {}
@@ -255,42 +249,6 @@ namespace AzToolsFramework
/// Type to inherit to implement EditorComponentModeNotifications.
using EditorComponentModeNotificationBus = AZ::EBus<EditorComponentModeNotifications>;
/// Helper for EditorComponentModeNotifications to be used
/// as a member instead of inheriting from EBus directly.
class EditorComponentModeNotificationBusImpl
: public EditorComponentModeNotificationBus::Handler
{
public:
/// Set the function to be called when entering ComponentMode.
void SetEnteredComponentModeFunc(
const AZStd::function<void(const AZStd::vector<AZ::Uuid>&)>& enteredComponentModeFunc)
{
m_enteredComponentModeFunc = enteredComponentModeFunc;
}
/// Set the function to be called when leaving ComponentMode.
void SetLeftComponentModeFunc(
const AZStd::function<void(const AZStd::vector<AZ::Uuid>&)>& leftComponentModeFunc)
{
m_leftComponentModeFunc = leftComponentModeFunc;
}
private:
// EditorComponentModeNotificationBus
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override
{
m_enteredComponentModeFunc(componentModeTypes);
}
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override
{
m_leftComponentModeFunc(componentModeTypes);
}
AZStd::function<void(const AZStd::vector<AZ::Uuid>&)> m_enteredComponentModeFunc; ///< Function to call when entering ComponentMode.
AZStd::function<void(const AZStd::vector<AZ::Uuid>&)> m_leftComponentModeFunc; ///< Function to call when leaving ComponentMode.
};
/// Helper to answer if the Editor is in ComponentMode or not.
inline bool InComponentMode()
{
@@ -261,10 +261,10 @@ namespace AzToolsFramework
// ensures cursor positions are refreshed correctly with context menu focus changes)
if (eventType == QEvent::FocusIn)
{
const auto widgetCursorPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
if (m_sourceWidget->geometry().contains(widgetCursorPosition))
const auto globalCursorPosition = QCursor::pos();
if (m_sourceWidget->geometry().contains(globalCursorPosition))
{
HandleMouseMoveEvent(widgetCursorPosition);
HandleMouseMoveEvent(globalCursorPosition);
}
}
}
@@ -290,7 +290,7 @@ namespace AzToolsFramework
else if (eventType == QEvent::Type::MouseMove)
{
auto mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseMoveEvent(mouseEvent->pos());
HandleMouseMoveEvent(mouseEvent->globalPos());
}
// Map wheel events to the mouse Z movement channel.
else if (eventType == QEvent::Type::Wheel)
@@ -370,11 +370,12 @@ namespace AzToolsFramework
return QPoint{ denormalizedX, denormalizedY };
}
void QtEventToAzInputMapper::HandleMouseMoveEvent(const QPoint& cursorPosition)
void QtEventToAzInputMapper::HandleMouseMoveEvent(const QPoint& globalCursorPosition)
{
const QPoint cursorDelta = cursorPosition - m_previousCursorPosition;
const QPoint cursorDelta = globalCursorPosition - m_previousGlobalCursorPosition;
m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(cursorPosition);
m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition =
WidgetPositionToNormalizedPosition(m_sourceWidget->mapFromGlobal(globalCursorPosition));
m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta = WidgetPositionToNormalizedPosition(cursorDelta);
ProcessPendingMouseEvents(cursorDelta);
@@ -382,12 +383,11 @@ namespace AzToolsFramework
if (m_capturingCursor)
{
// Reset our cursor position to the previous point
const QPoint screenCursorPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition);
AzQtComponents::SetCursorPos(screenCursorPosition);
AzQtComponents::SetCursorPos(m_previousGlobalCursorPosition);
}
else
{
m_previousCursorPosition = cursorPosition;
m_previousGlobalCursorPosition = globalCursorPosition;
}
}
@@ -129,7 +129,7 @@ namespace AzToolsFramework
// Handle mouse click events.
void HandleMouseButtonEvent(QMouseEvent* mouseEvent);
// Handle mouse move events.
void HandleMouseMoveEvent(const QPoint& cursorPosition);
void HandleMouseMoveEvent(const QPoint& globalCursorPosition);
// Handles key press / release events (or ShortcutOverride events for keys listed in m_highPriorityKeys).
void HandleKeyEvent(QKeyEvent* keyEvent);
// Handles mouse wheel events.
@@ -156,8 +156,8 @@ namespace AzToolsFramework
AZStd::unordered_set<Qt::Key> m_highPriorityKeys;
// A lookup table for AZ input channel ID -> physical input channel on our mouse or keyboard device.
AZStd::unordered_map<AzFramework::InputChannelId, AzFramework::InputChannel*> m_channels;
// Where the position of the mouse cursor was at the last cursor event.
QPoint m_previousCursorPosition;
// Where the mouse cursor was at the last cursor event.
QPoint m_previousGlobalCursorPosition;
// The source widget to map events from, used to calculate the relative mouse position within the widget bounds.
QWidget* m_sourceWidget;
// Flags whether or not Qt events should currently be processed.
@@ -26,6 +26,7 @@
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.hxx>
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerDisplayOptionsMenu.h>
@@ -292,8 +293,7 @@ namespace AzToolsFramework
EntityOutlinerModelNotificationBus::Handler::BusConnect();
ToolsApplicationEvents::Bus::Handler::BusConnect();
EditorEntityContextNotificationBus::Handler::BusConnect();
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
GetEntityContextId());
ViewportEditorModeNotificationsBus::Handler::BusConnect(GetEntityContextId());
EditorEntityInfoNotificationBus::Handler::BusConnect();
Prefab::PrefabPublicNotificationBus::Handler::BusConnect();
EditorWindowUIRequestBus::Handler::BusConnect();
@@ -303,7 +303,7 @@ namespace AzToolsFramework
{
EditorWindowUIRequestBus::Handler::BusDisconnect();
Prefab::PrefabPublicNotificationBus::Handler::BusDisconnect();
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
EditorEntityInfoNotificationBus::Handler::BusDisconnect();
EditorPickModeNotificationBus::Handler::BusDisconnect();
EntityHighlightMessages::Bus::Handler::BusDisconnect();
@@ -1128,14 +1128,22 @@ namespace AzToolsFramework
EnableUi(enable);
}
void EntityOutlinerWidget::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
void EntityOutlinerWidget::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
EnableUi(false);
if (mode == ViewportEditorMode::Component)
{
EnableUi(false);
}
}
void EntityOutlinerWidget::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
void EntityOutlinerWidget::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
EnableUi(true);
if (mode == ViewportEditorMode::Component)
{
EnableUi(true);
}
}
void EntityOutlinerWidget::OnPrefabInstancePropagationBegin()
@@ -14,7 +14,7 @@
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
@@ -59,7 +59,7 @@ namespace AzToolsFramework
, private ToolsApplicationEvents::Bus::Handler
, private EditorEntityContextNotificationBus::Handler
, private EditorEntityInfoNotificationBus::Handler
, private ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private ViewportEditorModeNotificationsBus::Handler
, private Prefab::PrefabPublicNotificationBus::Handler
, private EditorWindowUIRequestBus::Handler
{
@@ -101,9 +101,11 @@ namespace AzToolsFramework
void OnEntityInfoUpdatedAddChildEnd(AZ::EntityId /*parentId*/, AZ::EntityId /*childId*/) override;
void OnEntityInfoUpdatedName(AZ::EntityId entityId, const AZStd::string& /*name*/) override;
// EditorComponentModeNotificationBus
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
// PrefabPublicNotificationBus
void OnPrefabInstancePropagationBegin() override;
@@ -90,7 +90,6 @@ namespace AzToolsFramework
void SetComponentOverridden(const bool overridden);
// Calls match EditorComponentModeNotificationBus - called from EntityPropertyEditor
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes);
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes);
void ActiveComponentModeChanged(const AZ::Uuid& componentType);
@@ -33,6 +33,7 @@ AZ_POP_DISABLE_WARNING
#include <AzQtComponents/Components/Style.h>
#include <AzQtComponents/Components/Widgets/DragAndDrop.h>
#include <AzQtComponents/Components/Widgets/LineEdit.h>
#include <AzToolsFramework/API/ComponentModeCollectionInterface.h>
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
@@ -486,8 +487,12 @@ namespace AzToolsFramework
, m_isSystemEntityEditor(false)
, m_isLevelEntityEditor(isLevelEntityEditor)
{
initEntityPropertyEditorResources();
m_componentModeCollection = AZ::Interface<ComponentModeCollectionInterface>::Get();
AZ_Assert(m_componentModeCollection, "Could not retrieve component mode collection.");
m_prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get();
AZ_Assert(m_prefabPublicInterface != nullptr, "EntityPropertyEditor requires a PrefabPublicInterface instance on Initialize.");
@@ -5698,39 +5703,49 @@ namespace AzToolsFramework
SaveComponentEditorState();
}
void EntityPropertyEditor::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes)
void EntityPropertyEditor::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
DisableComponentActions(this, m_entityComponentActions);
SetPropertyEditorState(m_gui, false);
m_disabled = true;
if (!componentModeTypes.empty())
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
m_componentEditorLastSelectedIndex = GetComponentEditorIndexFromType(componentModeTypes.front());
}
DisableComponentActions(this, m_entityComponentActions);
SetPropertyEditorState(m_gui, false);
const auto componentModeTypes = m_componentModeCollection->GetComponentTypes();
m_disabled = true;
if (!componentModeTypes.empty())
{
m_componentEditorLastSelectedIndex = GetComponentEditorIndexFromType(componentModeTypes.front());
}
for (auto componentEditor : m_componentEditors)
{
componentEditor->EnteredComponentMode(componentModeTypes);
}
for (auto componentEditor : m_componentEditors)
{
componentEditor->EnteredComponentMode(componentModeTypes);
}
// record the selected state after entering component mode
SaveComponentEditorState();
// record the selected state after entering component mode
SaveComponentEditorState();
}
}
void EntityPropertyEditor::LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes)
void EntityPropertyEditor::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
EnableComponentActions(this, m_entityComponentActions);
SetPropertyEditorState(m_gui, true);
m_disabled = false;
for (auto componentEditor : m_componentEditors)
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
componentEditor->LeftComponentMode(componentModeTypes);
}
EnableComponentActions(this, m_entityComponentActions);
SetPropertyEditorState(m_gui, true);
const auto componentModeTypes = m_componentModeCollection->GetComponentTypes();
m_disabled = false;
// record the selected state after leaving component mode
SaveComponentEditorState();
for (auto componentEditor : m_componentEditors)
{
componentEditor->LeftComponentMode(componentModeTypes);
}
// record the selected state after leaving component mode
SaveComponentEditorState();
}
}
void EntityPropertyEditor::ActiveComponentModeChanged(const AZ::Uuid& componentType)
@@ -26,6 +26,7 @@
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/API/EntityPropertyEditorRequestsBus.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/ToolsComponents/ComponentMimeData.h>
@@ -59,6 +60,7 @@ namespace AzToolsFramework
{
class ComponentEditor;
class ComponentPaletteWidget;
class ComponentModeCollectionInterface;
struct SourceControlFileInfo;
namespace AssetBrowser
@@ -108,6 +110,7 @@ namespace AzToolsFramework
, public AzToolsFramework::EditorEntityContextNotificationBus::Handler
, public AzToolsFramework::EntityPropertyEditorRequestBus::Handler
, public AzToolsFramework::PropertyEditorEntityChangeNotificationBus::MultiHandler
, private AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
, public EditorInspectorComponentNotificationBus::MultiHandler
, private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, public AZ::EntitySystemBus::Handler
@@ -231,10 +234,14 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
// EditorComponentModeNotificationBus
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void ActiveComponentModeChanged(const AZ::Uuid& componentType) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
// EntityPropertEditorRequestBus
void GetSelectedAndPinnedEntities(EntityIdList& selectedEntityIds) override;
void GetSelectedEntities(EntityIdList& selectedEntityIds) override;
@@ -627,6 +634,8 @@ namespace AzToolsFramework
float m_moveFadeSecondsRemaining;
AZStd::vector<int> m_indexMapOfMovedRow;
AzToolsFramework::ComponentModeCollectionInterface* m_componentModeCollection = nullptr;
// When m_initiatingPropertyChangeNotification is set to true, it means this EntityPropertyEditor is
// broadcasting a change to all listeners about a property change for a given entity. This is needed
// so that we don't update the values twice for this inspector
@@ -129,7 +129,7 @@ namespace UnitTest
using AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus;
AzToolsFramework::EditorActionRequestBus::Handler::BusConnect();
EditorComponentModeNotificationBus::Handler::BusConnect(GetEntityContextId());
ViewportEditorModeNotificationsBus::Handler::BusConnect(GetEntityContextId());
m_defaultWidget.setFocus();
}
@@ -137,18 +137,26 @@ namespace UnitTest
{
using AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus;
EditorComponentModeNotificationBus::Handler::BusDisconnect();
ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
AzToolsFramework::EditorActionRequestBus::Handler::BusDisconnect();
}
void TestEditorActions::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentTypes)
void TestEditorActions::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
m_componentModeWidget.setFocus();
if (mode == ViewportEditorMode::Component)
{
m_componentModeWidget.setFocus();
}
}
void TestEditorActions::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentTypes)
void TestEditorActions::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
m_defaultWidget.setFocus();
if (mode == ViewportEditorMode::Component)
{
m_defaultWidget.setFocus();
}
}
void TestEditorActions::AddActionViaBus(int id, QAction* action)
@@ -23,9 +23,9 @@
#include <AZTestShared/Utils/Utils.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerInterface.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzToolsFramework/Application/ToolsApplication.h>
#include <AzToolsFramework/Entity/EditorEntityTransformBus.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
#include <AzToolsFramework/Viewport/ActionBus.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
@@ -103,7 +103,7 @@ namespace UnitTest
/// component mode editing.
class TestEditorActions
: private AzToolsFramework::EditorActionRequestBus::Handler
, private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
{
// EditorActionRequestBus ...
void AddActionViaBus(int id, QAction* action) override;
@@ -114,9 +114,11 @@ namespace UnitTest
void AttachOverride(QWidget* /*object*/) override {}
void DetachOverride() override {}
// EditorComponentModeNotificationBus ...
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentTypes) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
public:
void Connect();
@@ -27,6 +27,10 @@ namespace AzToolsFramework
, m_viewportEditorModeTracker(viewportEditorModeTracker)
, m_componentModeCollection(viewportEditorModeTracker)
{
AZ_Assert(
AZ::Interface<ComponentModeCollectionInterface>::Get() == nullptr, "Unexpected registration of component mode collection.")
AZ::Interface<ComponentModeCollectionInterface>::Register(&m_componentModeCollection);
ActionOverrideRequestBus::Handler::BusConnect(GetEntityContextId());
ComponentModeFramework::ComponentModeSystemRequestBus::Handler::BusConnect();
@@ -40,6 +44,11 @@ namespace AzToolsFramework
ComponentModeFramework::ComponentModeSystemRequestBus::Handler::BusDisconnect();
ActionOverrideRequestBus::Handler::BusDisconnect();
m_viewportEditorModeTracker->DeactivateMode({ GetEntityContextId() }, ViewportEditorMode::Default);
AZ_Assert(
AZ::Interface<ComponentModeCollectionInterface>::Get() != nullptr,
"Unexpected unregistration of component mode collection.")
AZ::Interface<ComponentModeCollectionInterface>::Unregister(&m_componentModeCollection);
}
void EditorDefaultSelection::SetOverridePhantomWidget(QWidget* phantomOverrideWidget)
@@ -1023,7 +1023,7 @@ namespace AzToolsFramework
EditorTransformComponentSelectionRequestBus::Handler::BusConnect(entityContextId);
ToolsApplicationNotificationBus::Handler::BusConnect();
Camera::EditorCameraNotificationBus::Handler::BusConnect();
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(entityContextId);
ViewportEditorModeNotificationsBus::Handler::BusConnect(entityContextId);
EditorEntityContextNotificationBus::Handler::BusConnect();
EditorEntityVisibilityNotificationBus::Router::BusRouterConnect();
EditorEntityLockComponentNotificationBus::Router::BusRouterConnect();
@@ -1071,7 +1071,7 @@ namespace AzToolsFramework
EditorEntityLockComponentNotificationBus::Router::BusRouterDisconnect();
EditorEntityVisibilityNotificationBus::Router::BusRouterDisconnect();
EditorEntityContextNotificationBus::Handler::BusDisconnect();
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
Camera::EditorCameraNotificationBus::Handler::BusDisconnect();
ToolsApplicationNotificationBus::Handler::BusDisconnect();
EditorTransformComponentSelectionRequestBus::Handler::BusDisconnect();
@@ -3667,22 +3667,30 @@ namespace AzToolsFramework
m_selectedEntityIdsAndManipulatorsDirty = true;
}
void EditorTransformComponentSelection::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
void EditorTransformComponentSelection::OnEditorModeActivated(
[[maybe_unused]] const ViewportEditorModesInterface& editorModeState, ViewportEditorMode mode)
{
SetAllViewportUiVisible(false);
if (mode == ViewportEditorMode::Component)
{
SetAllViewportUiVisible(false);
EditorEntityLockComponentNotificationBus::Router::BusRouterDisconnect();
EditorEntityVisibilityNotificationBus::Router::BusRouterDisconnect();
ToolsApplicationNotificationBus::Handler::BusDisconnect();
EditorEntityLockComponentNotificationBus::Router::BusRouterDisconnect();
EditorEntityVisibilityNotificationBus::Router::BusRouterDisconnect();
ToolsApplicationNotificationBus::Handler::BusDisconnect();
}
}
void EditorTransformComponentSelection::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
void EditorTransformComponentSelection::OnEditorModeDeactivated(
[[maybe_unused]] const ViewportEditorModesInterface& editorModeState, ViewportEditorMode mode)
{
SetAllViewportUiVisible(true);
if (mode == ViewportEditorMode::Component)
{
SetAllViewportUiVisible(true);
ToolsApplicationNotificationBus::Handler::BusConnect();
EditorEntityVisibilityNotificationBus::Router::BusRouterConnect();
EditorEntityLockComponentNotificationBus::Router::BusRouterConnect();
ToolsApplicationNotificationBus::Handler::BusConnect();
EditorEntityVisibilityNotificationBus::Router::BusRouterConnect();
EditorEntityLockComponentNotificationBus::Router::BusRouterConnect();
}
}
void EditorTransformComponentSelection::CreateEntityManipulatorDeselectCommand(ScopedUndoBatch& undoBatch)
@@ -18,7 +18,7 @@
#include <AzFramework/Viewport/CursorState.h>
#include <AzToolsFramework/API/EditorCameraBus.h>
#include <AzToolsFramework/Commands/EntityManipulatorCommand.h>
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
#include <AzToolsFramework/Manipulators/BaseManipulator.h>
#include <AzToolsFramework/ToolsComponents/EditorLockComponentBus.h>
@@ -153,7 +153,7 @@ namespace AzToolsFramework
, private EditorTransformComponentSelectionRequestBus::Handler
, private ToolsApplicationNotificationBus::Handler
, private Camera::EditorCameraNotificationBus::Handler
, private ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private ViewportEditorModeNotificationsBus::Handler
, private EditorEntityContextNotificationBus::Handler
, private EditorEntityVisibilityNotificationBus::Router
, private EditorEntityLockComponentNotificationBus::Router
@@ -286,9 +286,9 @@ namespace AzToolsFramework
// EditorContextLockComponentNotificationBus overrides ...
void OnEntityLockChanged(bool locked) override;
// EditorComponentModeNotificationBus overrides ...
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(const ViewportEditorModesInterface& editorModeState, ViewportEditorMode mode) override;
void OnEditorModeDeactivated(const ViewportEditorModesInterface& editorModeState, ViewportEditorMode mode) override;
// EditorEntityContextNotificationBus overrides ...
void OnStartPlayInEditor() override;
@@ -339,7 +339,7 @@ namespace AzToolsFramework::ViewportUi::Internal
{
// no background for the widget else each set of buttons/text-fields/etc would have a black box around them
SetTransparentBackground(mainWindow);
mainWindow->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
mainWindow->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
}
void ViewportUiDisplay::InitializeUiOverlay()
@@ -30,12 +30,14 @@ set(FILES
API/AssetDatabaseBus.h
API/ComponentEntityObjectBus.h
API/ComponentEntitySelectionBus.h
API/ComponentModeCollectionInterface.h
API/EditorCameraBus.h
API/EditorCameraBus.cpp
API/EditorAnimationSystemRequestBus.h
API/EditorEntityAPI.h
API/EditorLevelNotificationBus.h
API/ViewportEditorModeTrackerNotificationBus.h
API/ViewportEditorModeTrackerNotificationBus.cpp
API/EditorVegetationRequestsBus.h
API/EditorPythonConsoleBus.h
API/EditorPythonRunnerRequestsBus.h
@@ -496,13 +496,34 @@ QProgressBar::chunk {
background-color: #333333;
}
/************** Filter tag widget **************/
#GemDependenciesDialog QLabel {
margin-bottom:10px;
}
#GemDependenciesDialog QCheckBox {
background-color: #333333;
border-radius: 3px;
spacing:3px;
margin-right:5px;
padding:4px;
margin-top:5px;
}
/************** Filter Tag widget **************/
#FilterTagWidgetTextLabel {
color: #94D2FF;
font-size: 10px;
}
#TagWidget {
background-color: #333333;
padding:3px;
font-size:12px;
border-radius: 3px;
margin-right: 3px;
}
/************** Gems SubWidget **************/
#gemSubWidgetTitleLabel {
@@ -238,9 +238,13 @@ namespace O3DE::ProjectManager
PythonBindingsInterface::Get()->AddProject(projectInfo.m_path);
#ifdef TEMPLATE_GEM_CONFIGURATION_ENABLED
if (!m_gemCatalogScreen->EnableDisableGemsForProject(projectInfo.m_path))
const GemCatalogScreen::EnableDisableGemsResult gemResult = m_gemCatalogScreen->EnableDisableGemsForProject(m_projectInfo.m_path);
if (gemResult == GemCatalogScreen::EnableDisableGemsResult::Failed)
{
QMessageBox::critical(this, tr("Failed to configure gems"), tr("Failed to configure gems for template."));
}
if (gemResult != GemCatalogScreen::EnableDisableGemsResult::Success)
{
return;
}
#endif // TEMPLATE_GEM_CONFIGURATION_ENABLED
@@ -11,6 +11,7 @@
#include <GemCatalog/GemListHeaderWidget.h>
#include <GemCatalog/GemSortFilterProxyModel.h>
#include <GemCatalog/GemRequirementDialog.h>
#include <GemCatalog/GemDependenciesDialog.h>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
@@ -134,7 +135,7 @@ namespace O3DE::ProjectManager
}
}
bool GemCatalogScreen::EnableDisableGemsForProject(const QString& projectPath)
GemCatalogScreen::EnableDisableGemsResult GemCatalogScreen::EnableDisableGemsForProject(const QString& projectPath)
{
IPythonBindings* pythonBindings = PythonBindingsInterface::Get();
QVector<QModelIndex> toBeAdded = m_gemModel->GatherGemsToBeAdded();
@@ -142,15 +143,25 @@ namespace O3DE::ProjectManager
if (m_gemModel->DoGemsToBeAddedHaveRequirements())
{
GemRequirementDialog* confirmRequirementsDialog = new GemRequirementDialog(m_gemModel, toBeAdded, this);
confirmRequirementsDialog->exec();
if (confirmRequirementsDialog->GetButtonResult() != QDialogButtonBox::ApplyRole)
GemRequirementDialog* confirmRequirementsDialog = new GemRequirementDialog(m_gemModel, this);
if(confirmRequirementsDialog->exec() == QDialog::Rejected)
{
return false;
return EnableDisableGemsResult::Cancel;
}
}
if (m_gemModel->HasDependentGemsToRemove())
{
GemDependenciesDialog* dependenciesDialog = new GemDependenciesDialog(m_gemModel, this);
if(dependenciesDialog->exec() == QDialog::Rejected)
{
return EnableDisableGemsResult::Cancel;
}
toBeAdded = m_gemModel->GatherGemsToBeAdded();
toBeRemoved = m_gemModel->GatherGemsToBeRemoved();
}
for (const QModelIndex& modelIndex : toBeAdded)
{
const QString gemPath = GemModel::GetPath(modelIndex);
@@ -160,7 +171,7 @@ namespace O3DE::ProjectManager
QMessageBox::critical(nullptr, "Operation failed",
QString("Cannot add gem %1 to project.\n\nError:\n%2").arg(GemModel::GetDisplayName(modelIndex), result.GetError().c_str()));
return false;
return EnableDisableGemsResult::Failed;
}
}
@@ -173,11 +184,11 @@ namespace O3DE::ProjectManager
QMessageBox::critical(nullptr, "Operation failed",
QString("Cannot remove gem %1 from project.\n\nError:\n%2").arg(GemModel::GetDisplayName(modelIndex), result.GetError().c_str()));
return false;
return EnableDisableGemsResult::Failed;
}
}
return true;
return EnableDisableGemsResult::Success;
}
ProjectManagerScreen GemCatalogScreen::GetScreenEnum()
@@ -29,7 +29,14 @@ namespace O3DE::ProjectManager
ProjectManagerScreen GetScreenEnum() override;
void ReinitForProject(const QString& projectPath);
bool EnableDisableGemsForProject(const QString& projectPath);
enum class EnableDisableGemsResult
{
Failed = 0,
Success,
Cancel
};
EnableDisableGemsResult EnableDisableGemsForProject(const QString& projectPath);
GemModel* GetGemModel() const { return m_gemModel; }
@@ -0,0 +1,80 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <GemCatalog/GemDependenciesDialog.h>
#include <GemCatalog/GemModel.h>
#include <AzQtComponents/Components/FlowLayout.h>
#include <QVBoxLayout>
#include <QLabel>
#include <QDialogButtonBox>
#include <QCheckBox>
namespace O3DE::ProjectManager
{
GemDependenciesDialog::GemDependenciesDialog(GemModel* gemModel, QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Dependent Gems"));
setObjectName("GemDependenciesDialog");
setAttribute(Qt::WA_DeleteOnClose);
setModal(true);
QVBoxLayout* layout = new QVBoxLayout();
// layout margin/alignment cannot be set with qss
layout->setMargin(15);
layout->setAlignment(Qt::AlignTop);
setLayout(layout);
// message
QLabel* instructionLabel = new QLabel(
tr("The following gem dependencies are no longer needed and will be deactivated.<br><br>"
"To keep these Gems enabled, select the checkbox next to it."));
layout->addWidget(instructionLabel);
// checkboxes
FlowLayout* flowLayout = new FlowLayout();
QVector<QModelIndex> gemsToRemove = gemModel->GatherGemsToBeRemoved(/*includeDependencies=*/true);
for (const QModelIndex& gem : gemsToRemove)
{
if (GemModel::WasPreviouslyAddedDependency(gem))
{
QCheckBox* checkBox = new QCheckBox(GemModel::GetName(gem));
connect(checkBox, &QCheckBox::stateChanged, this,
[=](int state)
{
GemModel::SetIsAdded(*gemModel, gem, /*isAdded=*/state == Qt::Checked);
});
flowLayout->addWidget(checkBox);
}
}
layout->addLayout(flowLayout);
layout->addSpacing(10);
layout->addStretch(1);
// buttons
QDialogButtonBox* dialogButtons = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
connect(dialogButtons, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(dialogButtons, &QDialogButtonBox::rejected, this,
[=]()
{
// de-select any Gems the user selected because they're canceling
for (const QModelIndex& gem : gemsToRemove)
{
if (GemModel::WasPreviouslyAddedDependency(gem) && GemModel::IsAdded(gem))
{
GemModel::SetIsAdded(*gemModel, gem, /*isAdded=*/false);
}
}
reject();
});
layout->addWidget(dialogButtons);
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,27 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QDialog>
#endif
namespace O3DE::ProjectManager
{
QT_FORWARD_DECLARE_CLASS(GemModel)
class GemDependenciesDialog
: public QDialog
{
Q_OBJECT // AUTOMOC
public:
explicit GemDependenciesDialog(GemModel* gemModel, QWidget *parent = nullptr);
~GemDependenciesDialog() = default;
};
} // namespace O3DE::ProjectManager
@@ -9,6 +9,7 @@
#include <GemCatalog/GemItemDelegate.h>
#include <GemCatalog/GemModel.h>
#include <GemCatalog/GemSortFilterProxyModel.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <QEvent>
#include <QAbstractItemView>
#include <QPainter>
@@ -16,6 +17,9 @@
#include <QHelpEvent>
#include <QToolTip>
#include <QHoverEvent>
#include <QTextDocument>
#include <QAbstractTextDocumentLayout>
#include <QDesktopServices>
namespace O3DE::ProjectManager
{
@@ -104,22 +108,11 @@ namespace O3DE::ProjectManager
painter->drawText(gemCreatorRect, Qt::TextSingleLine, gemCreator);
// Gem summary
// In case there are feature tags displayed at the bottom, decrease the size of the summary text field.
const QStringList featureTags = GemModel::GetFeatures(modelIndex);
const int featureTagAreaHeight = 30;
const int summaryHeight = contentRect.height() - (!featureTags.empty() * featureTagAreaHeight);
const int additionalSummarySpacing = s_itemMargins.right() * 3;
const QSize summarySize = QSize(contentRect.width() - s_summaryStartX - s_buttonWidth - additionalSummarySpacing,
summaryHeight);
const QRect summaryRect = QRect(/*topLeft=*/QPoint(contentRect.left() + s_summaryStartX, contentRect.top()), summarySize);
painter->setFont(standardFont);
painter->setPen(m_textColor);
const bool hasTags = !featureTags.isEmpty();
const QString summary = GemModel::GetSummary(modelIndex);
painter->drawText(summaryRect, Qt::AlignLeft | Qt::TextWordWrap, summary);
const QRect summaryRect = CalcSummaryRect(contentRect, hasTags);
DrawText(summary, painter, summaryRect, standardFont);
DrawButton(painter, contentRect, modelIndex);
DrawPlatformIcons(painter, contentRect, modelIndex);
@@ -128,6 +121,17 @@ namespace O3DE::ProjectManager
painter->restore();
}
QRect GemItemDelegate::CalcSummaryRect(const QRect& contentRect, bool hasTags) const
{
const int featureTagAreaHeight = 30;
const int summaryHeight = contentRect.height() - (hasTags * featureTagAreaHeight);
const int additionalSummarySpacing = s_itemMargins.right() * 3;
const QSize summarySize = QSize(contentRect.width() - s_summaryStartX - s_buttonWidth - additionalSummarySpacing,
summaryHeight);
return QRect(QPoint(contentRect.left() + s_summaryStartX, contentRect.top()), summarySize);
}
QSize GemItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const
{
QStyleOptionViewItem options(option);
@@ -154,7 +158,7 @@ namespace O3DE::ProjectManager
return true;
}
}
else if (event->type() == QEvent::MouseButtonPress )
else if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
@@ -168,6 +172,21 @@ namespace O3DE::ProjectManager
GemModel::SetIsAdded(*model, modelIndex, !isAdded);
return true;
}
// we must manually handle html links because we aren't using QLabels
const QStringList featureTags = GemModel::GetFeatures(modelIndex);
const bool hasTags = !featureTags.isEmpty();
const QRect summaryRect = CalcSummaryRect(contentRect, hasTags);
if (summaryRect.contains(mouseEvent->pos()))
{
const QString html = GemModel::GetSummary(modelIndex);
QString anchor = anchorAt(html, mouseEvent->pos(), summaryRect);
if (!anchor.isEmpty())
{
QDesktopServices::openUrl(QUrl(anchor));
return true;
}
}
}
return QStyledItemDelegate::editorEvent(event, model, option, modelIndex);
@@ -321,6 +340,44 @@ namespace O3DE::ProjectManager
}
}
AZStd::unique_ptr<QTextDocument> GetTextDocument(const QString& text, int width)
{
// using unique_ptr as a workaround for QTextDocument having a private copy constructor
auto doc = AZStd::make_unique<QTextDocument>();
QTextOption textOption(doc->defaultTextOption());
textOption.setWrapMode(QTextOption::WordWrap);
doc->setDefaultTextOption(textOption);
doc->setHtml(text);
doc->setTextWidth(width);
return doc;
}
void GemItemDelegate::DrawText(const QString& text, QPainter* painter, const QRect& rect, const QFont& standardFont) const
{
painter->save();
if (text.contains('<'))
{
painter->translate(rect.topLeft());
// use QTextDocument because drawText does not support rich text or html
QAbstractTextDocumentLayout::PaintContext paintContext;
paintContext.clip = QRect(0, 0, rect.width(), rect.height());
paintContext.palette.setColor(QPalette::Text, painter->pen().color());
AZStd::unique_ptr<QTextDocument> textDocument = GetTextDocument(text, rect.width());
textDocument->documentLayout()->draw(painter, paintContext);
}
else
{
painter->setFont(standardFont);
painter->setPen(m_textColor);
painter->drawText(rect, Qt::AlignLeft | Qt::TextWordWrap, text);
}
painter->restore();
}
void GemItemDelegate::DrawButton(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const
{
painter->save();
@@ -355,4 +412,19 @@ namespace O3DE::ProjectManager
painter->restore();
}
QString GemItemDelegate::anchorAt(const QString& html, const QPoint& position, const QRect& rect)
{
if (!html.isEmpty())
{
AZStd::unique_ptr<QTextDocument> doc = GetTextDocument(html, rect.width());
QAbstractTextDocumentLayout* layout = doc->documentLayout();
if (layout)
{
return layout->anchorAt(position - rect.topLeft());
}
}
return QString();
}
} // namespace O3DE::ProjectManager
@@ -30,6 +30,7 @@ namespace O3DE::ProjectManager
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
virtual QString anchorAt(const QString& html, const QPoint& position, const QRect& rect);
// Colors
const QColor m_textColor = QColor("#FFFFFF");
@@ -71,9 +72,11 @@ namespace O3DE::ProjectManager
void CalcRects(const QStyleOptionViewItem& option, QRect& outFullRect, QRect& outItemRect, QRect& outContentRect) const;
QRect GetTextRect(QFont& font, const QString& text, qreal fontSize) const;
QRect CalcButtonRect(const QRect& contentRect) const;
QRect CalcSummaryRect(const QRect& contentRect, bool hasTags) const;
void DrawPlatformIcons(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const;
void DrawButton(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const;
void DrawFeatureTags(QPainter* painter, const QRect& contentRect, const QStringList& featureTags, const QFont& standardFont, const QRect& summaryRect) const;
void DrawText(const QString& text, QPainter* painter, const QRect& rect, const QFont& standardFont) const;
QAbstractItemModel* m_model = nullptr;
@@ -8,27 +8,9 @@
#include <GemCatalog/GemListView.h>
#include <GemCatalog/GemItemDelegate.h>
#include <QStandardItemModel>
#include <QProxyStyle>
namespace O3DE::ProjectManager
{
class GemListViewProxyStyle : public QProxyStyle
{
public:
using QProxyStyle::QProxyStyle;
int styleHint(StyleHint hint, const QStyleOption* option = nullptr, const QWidget* widget = nullptr, QStyleHintReturn* returnData = nullptr) const override
{
if (hint == QStyle::SH_ToolTip_WakeUpDelay || hint == QStyle::SH_ToolTip_FallAsleepDelay)
{
// no delay
return 0;
}
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
};
GemListView::GemListView(QAbstractItemModel* model, QItemSelectionModel* selectionModel, QWidget* parent)
: QListView(parent)
{
@@ -38,8 +20,5 @@ namespace O3DE::ProjectManager
setModel(model);
setSelectionModel(selectionModel);
setItemDelegate(new GemItemDelegate(model, this));
// use a custom proxy style so we get immediate tooltips for gem radio buttons
setStyle(new GemListViewProxyStyle(this->style()));
}
} // namespace O3DE::ProjectManager
@@ -391,6 +391,20 @@ namespace O3DE::ProjectManager
return false;
}
bool GemModel::HasDependentGemsToRemove() const
{
for (int row = 0; row < rowCount(); ++row)
{
const QModelIndex modelIndex = index(row, 0);
if (GemModel::NeedsToBeRemoved(modelIndex, /*includeDependencies=*/true) &&
GemModel::WasPreviouslyAddedDependency(modelIndex))
{
return true;
}
}
return false;
}
QVector<QModelIndex> GemModel::GatherGemDependencies(const QModelIndex& modelIndex) const
{
QVector<QModelIndex> result;

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