Merge branch 'development' of https://github.com/aws-lumberyard/o3de into Neil_P0_updates
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bfc2ef8c6dbf2fba078e27e4e94384099e090468e679327dd826a5cbf22b04ed
|
||||
size 1019
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:708b12d41229afab78e0f7d59097ae3de855fea8525a920c5c214fc0ce79f1bd
|
||||
size 1209
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fab63af9b50790dca25330058e70517987ea8bf11c00f9353dd951ebdbd1dbe5
|
||||
size 5008
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa
|
||||
size 41127
|
||||
oid sha256:de0e6e480ece5b423222f4feacf56553d73713fe9afea8bbc9a2660a3cd54ec7
|
||||
size 1232
|
||||
|
||||
@@ -87,12 +87,18 @@ class AtomComponentProperties:
|
||||
def decal(property: str = 'name') -> str:
|
||||
"""
|
||||
Decal component properties.
|
||||
- 'Attenuation Angle' controls how much the angle between geometry and decal impacts opacity. 0-1 Radians
|
||||
- 'Opacity' where one is opaque and zero is transparent
|
||||
- 'Sort Key' 0-255 stacking z-sort like key to define which decal is on top of another
|
||||
- 'Material' the material Asset.id of the decal.
|
||||
:param property: From the last element of the property tree path. Default 'name' for component name string.
|
||||
:return: Full property path OR component name if no property specified.
|
||||
"""
|
||||
properties = {
|
||||
'name': 'Decal',
|
||||
'Attenuation Angle': 'Controller|Configuration|Attenuation Angle',
|
||||
'Opacity': 'Controller|Configuration|Opacity',
|
||||
'Sort Key': 'Controller|Configuration|Sort Key',
|
||||
'Material': 'Controller|Configuration|Material',
|
||||
}
|
||||
return properties[property]
|
||||
|
||||
+86
-43
@@ -8,49 +8,61 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
class Tests:
|
||||
camera_creation = (
|
||||
"Camera Entity successfully created",
|
||||
"Camera Entity failed to be created")
|
||||
"P0: Camera Entity failed to be created")
|
||||
camera_component_added = (
|
||||
"Camera component was added to entity",
|
||||
"Camera component failed to be added to entity")
|
||||
"P0: Camera component failed to be added to entity")
|
||||
camera_component_check = (
|
||||
"Entity has a Camera component",
|
||||
"Entity failed to find Camera component")
|
||||
"P0: Entity failed to find Camera component")
|
||||
creation_undo = (
|
||||
"UNDO Entity creation success",
|
||||
"UNDO Entity creation failed")
|
||||
"P0: UNDO Entity creation failed")
|
||||
creation_redo = (
|
||||
"REDO Entity creation success",
|
||||
"REDO Entity creation failed")
|
||||
"P0: REDO Entity creation failed")
|
||||
decal_creation = (
|
||||
"Decal Entity successfully created",
|
||||
"Decal Entity failed to be created")
|
||||
"P0: Decal Entity failed to be created")
|
||||
decal_component = (
|
||||
"Entity has a Decal component",
|
||||
"Entity failed to find Decal component")
|
||||
"P0: Entity failed to find Decal component")
|
||||
decal_component_removed = (
|
||||
"Decal component removed",
|
||||
"P0: Decal component failed to be removed")
|
||||
material_property_set = (
|
||||
"Material property set on Decal component",
|
||||
"Couldn't set Material property on Decal component")
|
||||
"P0: Couldn't set Material property on Decal component")
|
||||
attenuation_property_set = (
|
||||
"Attenuation Angle property set on Decal component",
|
||||
"P1: Couldn't set Attenuation Angle property on Decal component")
|
||||
opacity_property_set = (
|
||||
"Opacity property set on Decal component",
|
||||
"P1: Coudn't set Opacity property on Decal component")
|
||||
sort_key_property_set = (
|
||||
"Sort Key property set on Decal component",
|
||||
"P1: Couldn't set Sort Key property on Decal component")
|
||||
enter_game_mode = (
|
||||
"Entered game mode",
|
||||
"Failed to enter game mode")
|
||||
"P0: Failed to enter game mode")
|
||||
exit_game_mode = (
|
||||
"Exited game mode",
|
||||
"Couldn't exit game mode")
|
||||
"P0: Couldn't exit game mode")
|
||||
is_visible = (
|
||||
"Entity is visible",
|
||||
"Entity was not visible")
|
||||
"P0: Entity was not visible")
|
||||
is_hidden = (
|
||||
"Entity is hidden",
|
||||
"Entity was not hidden")
|
||||
"P0: Entity was not hidden")
|
||||
entity_deleted = (
|
||||
"Entity deleted",
|
||||
"Entity was not deleted")
|
||||
"P0: Entity was not deleted")
|
||||
deletion_undo = (
|
||||
"UNDO deletion success",
|
||||
"UNDO deletion failed")
|
||||
"P0: UNDO deletion failed")
|
||||
deletion_redo = (
|
||||
"REDO deletion success",
|
||||
"REDO deletion failed")
|
||||
"P0: REDO deletion failed")
|
||||
|
||||
|
||||
def AtomEditorComponents_Decal_AddedToEntity():
|
||||
@@ -71,14 +83,18 @@ def AtomEditorComponents_Decal_AddedToEntity():
|
||||
2) Add Decal component to Decal entity.
|
||||
3) UNDO the entity creation and component addition.
|
||||
4) REDO the entity creation and component addition.
|
||||
5) Enter/Exit game mode.
|
||||
6) Test IsHidden.
|
||||
7) Test IsVisible.
|
||||
8) Set Material property on Decal component.
|
||||
9) Delete Decal entity.
|
||||
10) UNDO deletion.
|
||||
11) REDO deletion.
|
||||
12) Look for errors and asserts.
|
||||
5) Set Material property on Decal component.
|
||||
6) Set Attenuation Angle property on Decal component.
|
||||
7) Set Opacity property on Decal component
|
||||
8) Set Sort Key property on Decal Component
|
||||
9) Remove Decal component then UNDO the remove
|
||||
10) Enter/Exit game mode.
|
||||
11) Test IsHidden.
|
||||
12) Test IsVisible.
|
||||
13) Delete Decal entity.
|
||||
14) UNDO deletion.
|
||||
15) REDO deletion.
|
||||
16) Look for errors and asserts.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
@@ -130,42 +146,69 @@ def AtomEditorComponents_Decal_AddedToEntity():
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.creation_redo, decal_entity.exists())
|
||||
|
||||
# 5. 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)
|
||||
|
||||
# 6. Test IsHidden.
|
||||
decal_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, decal_entity.is_hidden() is True)
|
||||
|
||||
# 7. Test IsVisible.
|
||||
decal_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, decal_entity.is_visible() is True)
|
||||
|
||||
# 8. Set Material property on Decal component.
|
||||
decal_material_asset_path = os.path.join("materials", "basic_grey.azmaterial")
|
||||
# 5. Set Material property on Decal component.
|
||||
decal_material_asset_path = os.path.join("materials", "decal", "airship_symbol_decal.azmaterial")
|
||||
decal_material_asset = Asset.find_asset_by_path(decal_material_asset_path, False)
|
||||
decal_component.set_component_property_value(AtomComponentProperties.decal('Material'), decal_material_asset.id)
|
||||
get_material_property = decal_component.get_component_property_value(AtomComponentProperties.decal('Material'))
|
||||
Report.result(Tests.material_property_set, get_material_property == decal_material_asset.id)
|
||||
|
||||
# 9. Delete Decal entity.
|
||||
# 6. Set Attenuation Angle property on Decal component
|
||||
decal_component.set_component_property_value(AtomComponentProperties.decal('Attenuation Angle'), value=0.75)
|
||||
get_attenuation_property = decal_component.get_component_property_value(
|
||||
AtomComponentProperties.decal('Attenuation Angle'))
|
||||
Report.result(Tests.attenuation_property_set, get_attenuation_property == 0.75)
|
||||
|
||||
# 7. Set Opacity property on Decal component
|
||||
decal_component.set_component_property_value(AtomComponentProperties.decal('Opacity'), value=0.5)
|
||||
get_opacity_property = decal_component.get_component_property_value(AtomComponentProperties.decal('Opacity'))
|
||||
Report.result(Tests.opacity_property_set, get_opacity_property == 0.5)
|
||||
|
||||
# 8. Set Sort Key property on Decal component
|
||||
decal_component.set_component_property_value(AtomComponentProperties.decal('Sort Key'), value=255.0)
|
||||
get_sort_key_property = decal_component.get_component_property_value(AtomComponentProperties.decal('Sort Key'))
|
||||
Report.result(Tests.sort_key_property_set, get_sort_key_property == 255.0)
|
||||
decal_component.set_component_property_value(AtomComponentProperties.decal('Sort Key'), value=0)
|
||||
get_sort_key_property = decal_component.get_component_property_value(AtomComponentProperties.decal('Sort Key'))
|
||||
Report.result(Tests.sort_key_property_set, get_sort_key_property == 0)
|
||||
|
||||
# 9. Remove Decal component then UNDO the remove
|
||||
decal_component.remove()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.decal_component_removed, not decal_entity.has_component(AtomComponentProperties.decal()))
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.decal_component, decal_entity.has_component(AtomComponentProperties.decal()))
|
||||
|
||||
# 10. 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)
|
||||
|
||||
# 11. Test IsHidden.
|
||||
decal_entity.set_visibility_state(False)
|
||||
Report.result(Tests.is_hidden, decal_entity.is_hidden() is True)
|
||||
|
||||
# 12. Test IsVisible.
|
||||
decal_entity.set_visibility_state(True)
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.is_visible, decal_entity.is_visible() is True)
|
||||
|
||||
# 13. Delete Decal entity.
|
||||
decal_entity.delete()
|
||||
Report.result(Tests.entity_deleted, not decal_entity.exists())
|
||||
|
||||
# 10. UNDO deletion.
|
||||
# 14. UNDO deletion.
|
||||
general.undo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.deletion_undo, decal_entity.exists())
|
||||
|
||||
# 11. REDO deletion.
|
||||
# 15. REDO deletion.
|
||||
general.redo()
|
||||
general.idle_wait_frames(1)
|
||||
Report.result(Tests.deletion_redo, not decal_entity.exists())
|
||||
|
||||
# 12. Look for errors and asserts.
|
||||
# 16. Look for errors and 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}")
|
||||
|
||||
+8
@@ -34,6 +34,7 @@ class EditorComponent:
|
||||
EditorEntity.add_component() or Entity.add_components() or EditorEntity.get_components_of_type()
|
||||
which also assigns self.id and self.type_id to the EditorComponent object.
|
||||
self.type_id is the UUID for the component type as provided by an ebus call.
|
||||
self.id is an azlmbr.entity.EntityComponentIdPair which contains both entity and component id's
|
||||
"""
|
||||
|
||||
def __init__(self, type_id: uuid):
|
||||
@@ -270,6 +271,13 @@ class EditorComponent:
|
||||
warnings.warn("disable_component is deprecated, use set_enabled(False) instead.", DeprecationWarning)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, "DisableComponents", [self.id])
|
||||
|
||||
def remove(self):
|
||||
"""
|
||||
Removes the component from its associated entity. Essentially a delete since only UNDO can return it.
|
||||
:return: None
|
||||
"""
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, "RemoveComponents", [self.id])
|
||||
|
||||
@staticmethod
|
||||
def get_type_ids(component_names: list, entity_type: EditorEntityType = EditorEntityType.GAME) -> list:
|
||||
"""
|
||||
|
||||
@@ -31,11 +31,15 @@ class TestAutomation(TestAutomationBase):
|
||||
def test_Multiplayer_AutoComponent_NetworkInput(self, request, workspace, editor, launcher_platform):
|
||||
from .tests import Multiplayer_AutoComponent_NetworkInput as test_module
|
||||
self._run_prefab_test(request, workspace, editor, test_module)
|
||||
|
||||
|
||||
def test_Multiplayer_AutoComponent_RPC(self, request, workspace, editor, launcher_platform):
|
||||
from .tests import Multiplayer_AutoComponent_RPC as test_module
|
||||
self._run_prefab_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_Multiplayer_BasicConnectivity_Connects(self, request, workspace, editor, launcher_platform):
|
||||
from .tests import Multiplayer_BasicConnectivity_Connects as test_module
|
||||
self._run_prefab_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_Multiplayer_SimpleNetworkLevelEntity(self, request, workspace, editor, launcher_platform):
|
||||
from .tests import Multiplayer_SimpleNetworkLevelEntity as test_module
|
||||
self._run_prefab_test(request, workspace, editor, test_module)
|
||||
|
||||
@@ -62,15 +62,16 @@ def Multiplayer_AutoComponent_RPC():
|
||||
Report.critical_result(TestSuccessFailTuples.find_network_player, player_id.IsValid())
|
||||
|
||||
# 4) Check the editor logs for expected and unexpected log output
|
||||
# Authority->Autonomous RPC
|
||||
PLAYERID_RPC_WAIT_TIME_SECONDS = 1.0 # The player id is sent from the server as soon as the player script is spawned. 1 second should be more than enough time to send/receive that RPC.
|
||||
helper.succeed_if_log_line_found('EditorServer', 'Script: AutoComponent_RPC: Sending client PlayerNumber 1', section_tracer.prints, PLAYERID_RPC_WAIT_TIME_SECONDS)
|
||||
helper.succeed_if_log_line_found('Script', "AutoComponent_RPC: I'm Player #1", section_tracer.prints, PLAYERID_RPC_WAIT_TIME_SECONDS)
|
||||
|
||||
# Uncomment once editor game-play mode supports level entities with net-binding
|
||||
#PLAYFX_RPC_WAIT_TIME_SECONDS = 1.1 # The server will send an RPC to play an fx on the client every second.
|
||||
#helper.succeed_if_log_line_found('EditorServer', "Script: AutoComponent_RPC_NetLevelEntity Activated on entity: NetLevelEntity", section_tracer.prints, PLAYFX_RPC_WAIT_TIME_SECONDS)
|
||||
#helper.succeed_if_log_line_found('EditorServer', "Script: AutoComponent_RPC_NetLevelEntity: Authority sending RPC to play some fx.", section_tracer.prints, PLAYFX_RPC_WAIT_TIME_SECONDS)
|
||||
#helper.succeed_if_log_line_found('Script', "AutoComponent_RPC_NetLevelEntity: I'm a client playing some superficial fx.", section_tracer.prints, PLAYFX_RPC_WAIT_TIME_SECONDS)
|
||||
# Authority->Client RPC
|
||||
PLAYFX_RPC_WAIT_TIME_SECONDS = 1.1 # The server will send an RPC to play an fx on the client every second.
|
||||
helper.succeed_if_log_line_found('EditorServer', "Script: AutoComponent_RPC_NetLevelEntity Activated on entity: NetLevelEntity", section_tracer.prints, PLAYFX_RPC_WAIT_TIME_SECONDS)
|
||||
helper.succeed_if_log_line_found('EditorServer', "Script: AutoComponent_RPC_NetLevelEntity: Authority sending RPC to play some fx.", section_tracer.prints, PLAYFX_RPC_WAIT_TIME_SECONDS)
|
||||
helper.succeed_if_log_line_found('Script', "AutoComponent_RPC_NetLevelEntity: I'm a client playing some fx.", section_tracer.prints, PLAYFX_RPC_WAIT_TIME_SECONDS)
|
||||
|
||||
|
||||
# Exit game mode
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
"""
|
||||
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 Title : Check that the basic client connect test works
|
||||
|
||||
|
||||
# fmt: off
|
||||
class TestConstants:
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
find_network_player = ("Found network player", "Couldn't find network player")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Multiplayer_BasicConnectivity_Connects():
|
||||
r"""
|
||||
Summary:
|
||||
Runs a test to make sure that a networked player can be spawned
|
||||
|
||||
Level Description:
|
||||
- Dynamic
|
||||
1. Although the level is empty, when the server and editor connect the server will spawn the player prefab.
|
||||
- Static
|
||||
1. This is an empty level.
|
||||
|
||||
Expected Outcome:
|
||||
We should see the player connect and spawn with no errors.
|
||||
|
||||
:return:
|
||||
"""
|
||||
import azlmbr.legacy.general as general
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import Tracer
|
||||
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
|
||||
level_name = "BasicConnectivity_Connects"
|
||||
player_prefab_name = "Player"
|
||||
player_prefab_path = f"levels/multiplayer/{level_name}/{player_prefab_name}.network.spawnable"
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
# 1) Open Level
|
||||
helper.open_level("Multiplayer", level_name)
|
||||
|
||||
with Tracer() as section_tracer:
|
||||
# 2) Enter game mode
|
||||
helper.multiplayer_enter_game_mode(TestConstants.enter_game_mode, player_prefab_path.lower())
|
||||
|
||||
# 3) Make sure the network player was spawned
|
||||
player_id = general.find_game_entity(player_prefab_name)
|
||||
Report.critical_result(TestConstants.find_network_player, player_id.IsValid())
|
||||
|
||||
# Exit game mode
|
||||
helper.exit_game_mode(TestConstants.exit_game_mode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Multiplayer_BasicConnectivity_Connects)
|
||||
+2
-3
@@ -93,7 +93,7 @@ def Terrain_World_ConfigurationWorks():
|
||||
# 5) Set the base Terrain World values
|
||||
world_bounds_max = azmath.Vector3(1100.0, 1100.0, 1100.0)
|
||||
world_bounds_min = azmath.Vector3(10.0, 10.0, 10.0)
|
||||
height_query_resolution = azmath.Vector2(1.0, 1.0)
|
||||
height_query_resolution = 1.0
|
||||
hydra.set_component_property_value(terrain_world_component, "Configuration|World Bounds (Max)", world_bounds_max)
|
||||
hydra.set_component_property_value(terrain_world_component, "Configuration|World Bounds (Min)", world_bounds_min)
|
||||
hydra.set_component_property_value(terrain_world_component, "Configuration|Height Query Resolution (m)", height_query_resolution)
|
||||
@@ -148,7 +148,7 @@ def Terrain_World_ConfigurationWorks():
|
||||
|
||||
# 13) Check height value is the expected one when query resolution is changed
|
||||
testpoint = terrain.TerrainDataRequestBus(bus.Broadcast, 'GetHeightFromFloats', 10.5, 10.5, CLAMP)
|
||||
height_query_resolution = azmath.Vector2(0.5, 0.5)
|
||||
height_query_resolution = 0.5
|
||||
hydra.set_component_property_value(terrain_world_component, "Configuration|Height Query Resolution (m)", height_query_resolution)
|
||||
general.idle_wait_frames(1)
|
||||
testpoint2 = terrain.TerrainDataRequestBus(bus.Broadcast, 'GetHeightFromFloats', 10.5, 10.5, CLAMP)
|
||||
@@ -165,4 +165,3 @@ if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_World_ConfigurationWorks)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ def Menus_FileMenuOptions_Work():
|
||||
("Save As",),
|
||||
("Save Level Statistics",),
|
||||
("Edit Project Settings",),
|
||||
#("Edit Platform Settings",), Temporarily disabled due to https://github.com/o3de/o3de/issues/6604
|
||||
("Edit Platform Settings",),
|
||||
("New Project",),
|
||||
("Open Project",),
|
||||
("Show Log File",),
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:de0e6e480ece5b423222f4feacf56553d73713fe9afea8bbc9a2660a3cd54ec7
|
||||
size 1232
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa
|
||||
size 41127
|
||||
oid sha256:de0e6e480ece5b423222f4feacf56553d73713fe9afea8bbc9a2660a3cd54ec7
|
||||
size 1232
|
||||
|
||||
@@ -568,22 +568,10 @@
|
||||
"$type": "EditorScriptCanvasComponent",
|
||||
"Id": 14750978061505735417,
|
||||
"m_name": "GlobalGameData",
|
||||
"m_assetHolder": {
|
||||
"m_asset": {
|
||||
"assetId": {
|
||||
"guid": "{B16589A0-EA01-56BC-8141-91A3967FB95F}"
|
||||
},
|
||||
"assetHint": "levels/multiplayer/autocomponent_rpc/globalgamedata.scriptcanvas"
|
||||
}
|
||||
},
|
||||
"runtimeDataIsValid": true,
|
||||
"runtimeDataOverrides": {
|
||||
"source": {
|
||||
"assetId": {
|
||||
"guid": "{B16589A0-EA01-56BC-8141-91A3967FB95F}"
|
||||
},
|
||||
"assetHint": "levels/multiplayer/autocomponent_rpc/globalgamedata.scriptcanvas"
|
||||
}
|
||||
"sourceHandle": {
|
||||
"id": "{B16589A0-EA01-56BC-8141-91A3967FB95F}",
|
||||
"path": "levels/multiplayer/autocomponent_rpc/globalgamedata.scriptcanvas"
|
||||
}
|
||||
},
|
||||
"Component_[16436925042043744033]": {
|
||||
@@ -636,6 +624,13 @@
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 12302672911455629152
|
||||
},
|
||||
"Component_[12517591696100736853]": {
|
||||
"$type": "GenericComponentWrapper",
|
||||
"Id": 12517591696100736853,
|
||||
"m_template": {
|
||||
"$type": "AutomatedTesting::NetworkTestLevelEntityComponent"
|
||||
}
|
||||
},
|
||||
"Component_[14169903623243423134]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 14169903623243423134
|
||||
@@ -644,13 +639,6 @@
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 14607413934411389854
|
||||
},
|
||||
"Component_[15396284312416541768]": {
|
||||
"$type": "GenericComponentWrapper",
|
||||
"Id": 15396284312416541768,
|
||||
"m_template": {
|
||||
"$type": "Multiplayer::LocalPredictionPlayerInputComponent"
|
||||
}
|
||||
},
|
||||
"Component_[15494977028055234270]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15494977028055234270
|
||||
@@ -682,22 +670,10 @@
|
||||
"$type": "EditorScriptCanvasComponent",
|
||||
"Id": 7256163899440301540,
|
||||
"m_name": "AutoComponent_RPC_NetLevelEntity",
|
||||
"m_assetHolder": {
|
||||
"m_asset": {
|
||||
"assetId": {
|
||||
"guid": "{1D517006-AC01-5ECA-AE66-0E007871F0CD}"
|
||||
},
|
||||
"assetHint": "levels/multiplayer/autocomponent_rpc/autocomponent_rpc_netlevelentity.scriptcanvas"
|
||||
}
|
||||
},
|
||||
"runtimeDataIsValid": true,
|
||||
"runtimeDataOverrides": {
|
||||
"source": {
|
||||
"assetId": {
|
||||
"guid": "{1D517006-AC01-5ECA-AE66-0E007871F0CD}"
|
||||
},
|
||||
"assetHint": "levels/multiplayer/autocomponent_rpc/autocomponent_rpc_netlevelentity.scriptcanvas"
|
||||
}
|
||||
"sourceHandle": {
|
||||
"id": "{1D517006-AC01-5ECA-AE66-0E007871F0CD}",
|
||||
"path": "levels/multiplayer/autocomponent_rpc/autocomponent_rpc_netlevelentity.scriptcanvas"
|
||||
}
|
||||
},
|
||||
"Component_[731336627222243355]": {
|
||||
@@ -730,13 +706,6 @@
|
||||
"$type": "NetBindComponent"
|
||||
}
|
||||
},
|
||||
"Component_[9816897251206708579]": {
|
||||
"$type": "GenericComponentWrapper",
|
||||
"Id": 9816897251206708579,
|
||||
"m_template": {
|
||||
"$type": "AutomatedTesting::NetworkTestPlayerComponent"
|
||||
}
|
||||
},
|
||||
"Component_[9880860858035405475]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 9880860858035405475
|
||||
|
||||
+3079
-6
File diff suppressed because it is too large
Load Diff
+889
-542
File diff suppressed because it is too large
Load Diff
+581
@@ -0,0 +1,581 @@
|
||||
{
|
||||
"ContainerEntity": {
|
||||
"Id": "Entity_[1146574390643]",
|
||||
"Name": "Level",
|
||||
"Components": {
|
||||
"Component_[10641544592923449938]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 10641544592923449938
|
||||
},
|
||||
"Component_[12039882709170782873]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 12039882709170782873
|
||||
},
|
||||
"Component_[12265484671603697631]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 12265484671603697631
|
||||
},
|
||||
"Component_[14126657869720434043]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 14126657869720434043
|
||||
},
|
||||
"Component_[15230859088967841193]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 15230859088967841193,
|
||||
"Parent Entity": ""
|
||||
},
|
||||
"Component_[16239496886950819870]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 16239496886950819870
|
||||
},
|
||||
"Component_[5688118765544765547]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 5688118765544765547
|
||||
},
|
||||
"Component_[6545738857812235305]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 6545738857812235305
|
||||
},
|
||||
"Component_[7247035804068349658]": {
|
||||
"$type": "EditorPrefabComponent",
|
||||
"Id": 7247035804068349658
|
||||
},
|
||||
"Component_[9307224322037797205]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 9307224322037797205
|
||||
},
|
||||
"Component_[9562516168917670048]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 9562516168917670048
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entities": {
|
||||
"Entity_[1155164325235]": {
|
||||
"Id": "Entity_[1155164325235]",
|
||||
"Name": "Sun",
|
||||
"Components": {
|
||||
"Component_[10440557478882592717]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10440557478882592717
|
||||
},
|
||||
"Component_[13620450453324765907]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 13620450453324765907
|
||||
},
|
||||
"Component_[2134313378593666258]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 2134313378593666258
|
||||
},
|
||||
"Component_[234010807770404186]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 234010807770404186
|
||||
},
|
||||
"Component_[2970359110423865725]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 2970359110423865725
|
||||
},
|
||||
"Component_[3722854130373041803]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3722854130373041803
|
||||
},
|
||||
"Component_[5992533738676323195]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 5992533738676323195
|
||||
},
|
||||
"Component_[7378860763541895402]": {
|
||||
"$type": "AZ::Render::EditorDirectionalLightComponent",
|
||||
"Id": 7378860763541895402,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"Intensity": 1.0,
|
||||
"CameraEntityId": "",
|
||||
"ShadowFilterMethod": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[7892834440890947578]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 7892834440890947578,
|
||||
"Parent Entity": "Entity_[1176639161715]",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
0.0,
|
||||
0.0,
|
||||
13.487043380737305
|
||||
],
|
||||
"Rotate": [
|
||||
-76.13099670410156,
|
||||
-0.847000002861023,
|
||||
-15.8100004196167
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[8599729549570828259]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 8599729549570828259
|
||||
},
|
||||
"Component_[952797371922080273]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 952797371922080273
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[1159459292531]": {
|
||||
"Id": "Entity_[1159459292531]",
|
||||
"Name": "Ground",
|
||||
"Components": {
|
||||
"Component_[11701138785793981042]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 11701138785793981042
|
||||
},
|
||||
"Component_[12260880513256986252]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 12260880513256986252
|
||||
},
|
||||
"Component_[13711420870643673468]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 13711420870643673468
|
||||
},
|
||||
"Component_[138002849734991713]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 138002849734991713
|
||||
},
|
||||
"Component_[16578565737331764849]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 16578565737331764849,
|
||||
"Parent Entity": "Entity_[1176639161715]"
|
||||
},
|
||||
"Component_[16919232076966545697]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 16919232076966545697
|
||||
},
|
||||
"Component_[5182430712893438093]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 5182430712893438093
|
||||
},
|
||||
"Component_[5675108321710651991]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 5675108321710651991,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{0CD745C0-6AA8-569A-A68A-73A3270986C4}",
|
||||
"subId": 277889906
|
||||
},
|
||||
"assetHint": "objects/groudplane/groundplane_512x512m.azmodel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[5681893399601237518]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 5681893399601237518
|
||||
},
|
||||
"Component_[592692962543397545]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 592692962543397545
|
||||
},
|
||||
"Component_[7090012899106946164]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 7090012899106946164
|
||||
},
|
||||
"Component_[9410832619875640998]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 9410832619875640998
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[1163754259827]": {
|
||||
"Id": "Entity_[1163754259827]",
|
||||
"Name": "Camera",
|
||||
"Components": {
|
||||
"Component_[11895140916889160460]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 11895140916889160460
|
||||
},
|
||||
"Component_[16880285896855930892]": {
|
||||
"$type": "{CA11DA46-29FF-4083-B5F6-E02C3A8C3A3D} EditorCameraComponent",
|
||||
"Id": 16880285896855930892,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"Field of View": 55.0,
|
||||
"EditorEntityId": 8929576024571800510
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[17187464423780271193]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 17187464423780271193
|
||||
},
|
||||
"Component_[17495696818315413311]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 17495696818315413311
|
||||
},
|
||||
"Component_[18086214374043522055]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 18086214374043522055,
|
||||
"Parent Entity": "Entity_[1176639161715]",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-2.3000001907348633,
|
||||
-3.9368600845336914,
|
||||
1.0
|
||||
],
|
||||
"Rotate": [
|
||||
-2.050307512283325,
|
||||
1.9552897214889526,
|
||||
-43.623355865478516
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[18387556550380114975]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 18387556550380114975
|
||||
},
|
||||
"Component_[2654521436129313160]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 2654521436129313160
|
||||
},
|
||||
"Component_[5265045084611556958]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 5265045084611556958
|
||||
},
|
||||
"Component_[7169798125182238623]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 7169798125182238623
|
||||
},
|
||||
"Component_[7255796294953281766]": {
|
||||
"$type": "GenericComponentWrapper",
|
||||
"Id": 7255796294953281766,
|
||||
"m_template": {
|
||||
"$type": "FlyCameraInputComponent"
|
||||
}
|
||||
},
|
||||
"Component_[8866210352157164042]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 8866210352157164042
|
||||
},
|
||||
"Component_[9129253381063760879]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 9129253381063760879
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[1168049227123]": {
|
||||
"Id": "Entity_[1168049227123]",
|
||||
"Name": "Grid",
|
||||
"Components": {
|
||||
"Component_[11443347433215807130]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 11443347433215807130
|
||||
},
|
||||
"Component_[11779275529534764488]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 11779275529534764488
|
||||
},
|
||||
"Component_[14249419413039427459]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 14249419413039427459
|
||||
},
|
||||
"Component_[15448581635946161318]": {
|
||||
"$type": "AZ::Render::EditorGridComponent",
|
||||
"Id": 15448581635946161318,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"primarySpacing": 4.0,
|
||||
"primaryColor": [
|
||||
0.501960813999176,
|
||||
0.501960813999176,
|
||||
0.501960813999176
|
||||
],
|
||||
"secondarySpacing": 0.5,
|
||||
"secondaryColor": [
|
||||
0.250980406999588,
|
||||
0.250980406999588,
|
||||
0.250980406999588
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[1843303322527297409]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 1843303322527297409
|
||||
},
|
||||
"Component_[380249072065273654]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 380249072065273654,
|
||||
"Parent Entity": "Entity_[1176639161715]"
|
||||
},
|
||||
"Component_[7476660583684339787]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 7476660583684339787
|
||||
},
|
||||
"Component_[7557626501215118375]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 7557626501215118375
|
||||
},
|
||||
"Component_[7984048488947365511]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 7984048488947365511
|
||||
},
|
||||
"Component_[8118181039276487398]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 8118181039276487398
|
||||
},
|
||||
"Component_[9189909764215270515]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 9189909764215270515
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[1172344194419]": {
|
||||
"Id": "Entity_[1172344194419]",
|
||||
"Name": "Shader Ball",
|
||||
"Components": {
|
||||
"Component_[10789351944715265527]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 10789351944715265527
|
||||
},
|
||||
"Component_[12037033284781049225]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 12037033284781049225
|
||||
},
|
||||
"Component_[13759153306105970079]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 13759153306105970079
|
||||
},
|
||||
"Component_[14135560884830586279]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 14135560884830586279
|
||||
},
|
||||
"Component_[16247165675903986673]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16247165675903986673
|
||||
},
|
||||
"Component_[18082433625958885247]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 18082433625958885247
|
||||
},
|
||||
"Component_[6472623349872972660]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 6472623349872972660,
|
||||
"Parent Entity": "Entity_[1176639161715]",
|
||||
"Transform Data": {
|
||||
"Rotate": [
|
||||
0.0,
|
||||
0.10000000149011612,
|
||||
180.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[6495255223970673916]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 6495255223970673916,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}",
|
||||
"subId": 281415304
|
||||
},
|
||||
"assetHint": "objects/shaderball/shaderball_default_1m.azmodel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[8056625192494070973]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 8056625192494070973
|
||||
},
|
||||
"Component_[8550141614185782969]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8550141614185782969
|
||||
},
|
||||
"Component_[9439770997198325425]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 9439770997198325425
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[1176639161715]": {
|
||||
"Id": "Entity_[1176639161715]",
|
||||
"Name": "Atom Default Environment",
|
||||
"Components": {
|
||||
"Component_[10757302973393310045]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 10757302973393310045,
|
||||
"Parent Entity": "Entity_[1146574390643]"
|
||||
},
|
||||
"Component_[14505817420424255464]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 14505817420424255464,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 10757302973393310045
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[14988041764659020032]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 14988041764659020032
|
||||
},
|
||||
"Component_[15808690248755038124]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 15808690248755038124
|
||||
},
|
||||
"Component_[15900837685796817138]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 15900837685796817138
|
||||
},
|
||||
"Component_[3298767348226484884]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3298767348226484884
|
||||
},
|
||||
"Component_[4076975109609220594]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 4076975109609220594
|
||||
},
|
||||
"Component_[5679760548946028854]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 5679760548946028854
|
||||
},
|
||||
"Component_[5855590796136709437]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 5855590796136709437,
|
||||
"ChildEntityOrderEntryArray": [
|
||||
{
|
||||
"EntityId": "Entity_[1155164325235]"
|
||||
},
|
||||
{
|
||||
"EntityId": "Entity_[1180934129011]",
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"EntityId": "Entity_[1172344194419]",
|
||||
"SortIndex": 2
|
||||
},
|
||||
{
|
||||
"EntityId": "Entity_[1168049227123]",
|
||||
"SortIndex": 3
|
||||
},
|
||||
{
|
||||
"EntityId": "Entity_[1163754259827]",
|
||||
"SortIndex": 4
|
||||
},
|
||||
{
|
||||
"EntityId": "Entity_[1159459292531]",
|
||||
"SortIndex": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[9277695270015777859]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 9277695270015777859
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[1180934129011]": {
|
||||
"Id": "Entity_[1180934129011]",
|
||||
"Name": "Global Sky",
|
||||
"Components": {
|
||||
"Component_[11231930600558681245]": {
|
||||
"$type": "AZ::Render::EditorHDRiSkyboxComponent",
|
||||
"Id": 11231930600558681245,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"CubemapAsset": {
|
||||
"assetId": {
|
||||
"guid": "{215E47FD-D181-5832-B1AB-91673ABF6399}",
|
||||
"subId": 1000
|
||||
},
|
||||
"assetHint": "lightingpresets/highcontrast/goegap_4k_skyboxcm.exr.streamingimage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[11980494120202836095]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 11980494120202836095
|
||||
},
|
||||
"Component_[1428633914413949476]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 1428633914413949476
|
||||
},
|
||||
"Component_[14936200426671614999]": {
|
||||
"$type": "AZ::Render::EditorImageBasedLightComponent",
|
||||
"Id": 14936200426671614999,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"diffuseImageAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3FD09945-D0F2-55C8-B9AF-B2FD421FE3BE}",
|
||||
"subId": 3000
|
||||
},
|
||||
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_ibldiffuse.exr.streamingimage"
|
||||
},
|
||||
"specularImageAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3FD09945-D0F2-55C8-B9AF-B2FD421FE3BE}",
|
||||
"subId": 2000
|
||||
},
|
||||
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_iblspecular.exr.streamingimage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[14994774102579326069]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 14994774102579326069
|
||||
},
|
||||
"Component_[15417479889044493340]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 15417479889044493340
|
||||
},
|
||||
"Component_[15826613364991382688]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 15826613364991382688
|
||||
},
|
||||
"Component_[1665003113283562343]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 1665003113283562343
|
||||
},
|
||||
"Component_[3704934735944502280]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 3704934735944502280
|
||||
},
|
||||
"Component_[5698542331457326479]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 5698542331457326479
|
||||
},
|
||||
"Component_[6644513399057217122]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 6644513399057217122,
|
||||
"Parent Entity": "Entity_[1176639161715]"
|
||||
},
|
||||
"Component_[931091830724002070]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 931091830724002070
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Instances": {
|
||||
"Instance_[450137905015]": {
|
||||
"Source": "Levels/Multiplayer/BasicConnectivity_Connects/Player.prefab",
|
||||
"Patches": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/ContainerEntity/Components/Component_[14438229160106431107]/Parent Entity",
|
||||
"value": "../Entity_[1146574390643]"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/ContainerEntity/Components/Component_[14438229160106431107]/Transform Data/Translate/1",
|
||||
"value": 10.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"ContainerEntity": {
|
||||
"Id": "ContainerEntity",
|
||||
"Name": "Player",
|
||||
"Components": {
|
||||
"Component_[10518577910351346732]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 10518577910351346732
|
||||
},
|
||||
"Component_[10982887273490848966]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10982887273490848966
|
||||
},
|
||||
"Component_[12400551793021799684]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 12400551793021799684
|
||||
},
|
||||
"Component_[1257365873906714292]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1257365873906714292
|
||||
},
|
||||
"Component_[13311663931994949767]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 13311663931994949767
|
||||
},
|
||||
"Component_[14438229160106431107]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 14438229160106431107,
|
||||
"Parent Entity": ""
|
||||
},
|
||||
"Component_[14636573223251575153]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 14636573223251575153
|
||||
},
|
||||
"Component_[18139850826775373128]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 18139850826775373128
|
||||
},
|
||||
"Component_[18149872971727933150]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 18149872971727933150
|
||||
},
|
||||
"Component_[3361461948531668955]": {
|
||||
"$type": "EditorPrefabComponent",
|
||||
"Id": 3361461948531668955
|
||||
},
|
||||
"Component_[5198421115432838729]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 5198421115432838729
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entities": {
|
||||
"Entity_[458727839607]": {
|
||||
"Id": "Entity_[458727839607]",
|
||||
"Name": "Dummy",
|
||||
"Components": {
|
||||
"Component_[10453091667729858383]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 10453091667729858383
|
||||
},
|
||||
"Component_[15287888392848689630]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 15287888392848689630
|
||||
},
|
||||
"Component_[15410933204460181490]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 15410933204460181490,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 868882495636022739
|
||||
},
|
||||
{
|
||||
"ComponentId": 517239536919559179,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[17682830444684716936]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 17682830444684716936
|
||||
},
|
||||
"Component_[18433579260689698157]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 18433579260689698157
|
||||
},
|
||||
"Component_[2684999590909523769]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2684999590909523769
|
||||
},
|
||||
"Component_[517239536919559179]": {
|
||||
"$type": "GenericComponentWrapper",
|
||||
"Id": 517239536919559179,
|
||||
"m_template": {
|
||||
"$type": "NetBindComponent"
|
||||
}
|
||||
},
|
||||
"Component_[5980561685482761342]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 5980561685482761342
|
||||
},
|
||||
"Component_[6553553408068929590]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 6553553408068929590
|
||||
},
|
||||
"Component_[8307469961954670365]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 8307469961954670365
|
||||
},
|
||||
"Component_[868882495636022739]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 868882495636022739,
|
||||
"Parent Entity": "ContainerEntity"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +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,36 @@
|
||||
{
|
||||
"materialType": "Materials/Types/StandardPBR.materialtype",
|
||||
"materialTypeVersion": 4,
|
||||
"properties": {
|
||||
"baseColor": {
|
||||
"textureMap": "Materials/decal/airship_symbol_decal.tif"
|
||||
},
|
||||
"general": {
|
||||
"doubleSided": true
|
||||
},
|
||||
"metallic": {
|
||||
"useTexture": false
|
||||
},
|
||||
"normal": {
|
||||
"useTexture": false
|
||||
},
|
||||
"opacity": {
|
||||
"alphaSource": "Split",
|
||||
"factor": 0.6899999976158142,
|
||||
"mode": "Cutout",
|
||||
"textureMap": "Materials/decal/airship_symbol_decal.tif"
|
||||
},
|
||||
"roughness": {
|
||||
"useTexture": false
|
||||
},
|
||||
"specularF0": {
|
||||
"useTexture": false
|
||||
},
|
||||
"uv": {
|
||||
"center": [
|
||||
0.0,
|
||||
1.0
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2252ba28e19432d99e58fa03b672f855e1f520805eda71764e076fe349e1915a
|
||||
size 4205906
|
||||
@@ -42,6 +42,16 @@
|
||||
"RayTracingAccelerationStructurePass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "TerrainDetailTextureComputePass",
|
||||
"TemplateName": "TerrainDetailTextureComputePassTemplate",
|
||||
"Enabled": false
|
||||
},
|
||||
{
|
||||
"Name": "TerrainMacroTextureComputePass",
|
||||
"TemplateName": "TerrainMacroTextureComputePassTemplate",
|
||||
"Enabled": false
|
||||
},
|
||||
{
|
||||
"Name": "DepthPrePass",
|
||||
"TemplateName": "DepthMSAAParentTemplate",
|
||||
@@ -215,7 +225,7 @@
|
||||
// Note: The following two lines represent the choice of rendering pipeline for the hair.
|
||||
// You can either choose to use PPLL or ShortCut and accordingly change the flag
|
||||
// 'm_usePPLLRenderTechnique' in the class 'HairFeatureProcessor.cpp'
|
||||
// "TemplateName": "HairParentPassTemplate",
|
||||
// "TemplateName": "HairParentPassTemplate",
|
||||
"TemplateName": "HairParentShortCutPassTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
|
||||
+9
-47
@@ -44,51 +44,11 @@ include(cmake/SettingsRegistry.cmake)
|
||||
include(cmake/TestImpactFramework/LYTestImpactFramework.cmake)
|
||||
include(cmake/CMakeFiles.cmake)
|
||||
include(cmake/O3DEJson.cmake)
|
||||
include(cmake/Subdirectories.cmake)
|
||||
|
||||
################################################################################
|
||||
# Subdirectory processing
|
||||
################################################################################
|
||||
|
||||
# this function is building up the LY_EXTERNAL_SUBDIRS global property
|
||||
function(add_engine_gem_json_external_subdirectories gem_path)
|
||||
set(gem_json_path ${gem_path}/gem.json)
|
||||
if(EXISTS ${gem_json_path})
|
||||
read_json_external_subdirs(gem_external_subdirs ${gem_path}/gem.json)
|
||||
foreach(gem_external_subdir ${gem_external_subdirs})
|
||||
file(REAL_PATH ${gem_external_subdir} real_external_subdir BASE_DIRECTORY ${gem_path})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_EXTERNAL_SUBDIRS ${real_external_subdir})
|
||||
add_engine_gem_json_external_subdirectories(${real_external_subdir})
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(add_engine_json_external_subdirectories)
|
||||
read_json_external_subdirs(engine_external_subdirs ${LY_ROOT_FOLDER}/engine.json)
|
||||
foreach(engine_external_subdir ${engine_external_subdirs})
|
||||
file(REAL_PATH ${engine_external_subdir} real_external_subdir BASE_DIRECTORY ${LY_ROOT_FOLDER})
|
||||
set_property(GLOBAL APPEND PROPERTY LY_EXTERNAL_SUBDIRS ${real_external_subdir})
|
||||
add_engine_gem_json_external_subdirectories(${real_external_subdir})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(add_subdirectory_on_externalsubdirs)
|
||||
get_property(external_subdirs GLOBAL PROPERTY LY_EXTERNAL_SUBDIRS)
|
||||
list(APPEND LY_EXTERNAL_SUBDIRS ${external_subdirs})
|
||||
# Loop over the additional external subdirectories and invoke add_subdirectory on them
|
||||
foreach(external_directory ${LY_EXTERNAL_SUBDIRS})
|
||||
# Hash the external_directory name and append it to the Binary Directory section of add_subdirectory
|
||||
# This is to deal with potential situations where multiple external directories has the same last directory name
|
||||
# For example if D:/Company1/RayTracingGem and F:/Company2/Path/RayTracingGem were both added as a subdirectory
|
||||
file(REAL_PATH ${external_directory} full_directory_path)
|
||||
string(SHA256 full_directory_hash ${full_directory_path})
|
||||
# Truncate the full_directory_hash down to 8 characters to avoid hitting the Windows 260 character path limit
|
||||
# when the external subdirectory contains relative paths of significant length
|
||||
string(SUBSTRING ${full_directory_hash} 0 8 full_directory_hash)
|
||||
# Use the last directory as the suffix path to use for the Binary Directory
|
||||
get_filename_component(directory_name ${external_directory} NAME)
|
||||
add_subdirectory(${external_directory} ${CMAKE_BINARY_DIR}/External/${directory_name}-${full_directory_hash})
|
||||
endforeach()
|
||||
endfunction()
|
||||
# Gather the list of o3de_manifest external Subdirectories
|
||||
# into the LY_EXTERNAL_SUBDIRS_O3DE_MANIFEST_PROPERTY
|
||||
add_o3de_manifest_json_external_subdirectories()
|
||||
|
||||
# Add the projects first so the Launcher can find them
|
||||
include(cmake/Projects.cmake)
|
||||
@@ -99,9 +59,11 @@ endif()
|
||||
|
||||
if(NOT INSTALLED_ENGINE)
|
||||
# Add external subdirectories listed in the engine.json. LY_EXTERNAL_SUBDIRS is a cache variable so the user can add extra
|
||||
# external subdirectories. This should go before adding the rest of the targets so the targets are availbe to the launcher.
|
||||
# external subdirectories. This should go before adding the rest of the targets so the targets are available to the launcher.
|
||||
add_engine_json_external_subdirectories()
|
||||
add_subdirectory_on_externalsubdirs()
|
||||
|
||||
# Invoke add_subdirectory on external subdirectories that should be used a this point
|
||||
add_subdirectory_on_external_subdirs()
|
||||
|
||||
# Add the rest of the targets
|
||||
add_subdirectory(Assets)
|
||||
@@ -114,7 +76,7 @@ if(NOT INSTALLED_ENGINE)
|
||||
|
||||
else()
|
||||
ly_find_o3de_packages()
|
||||
add_subdirectory_on_externalsubdirs()
|
||||
add_subdirectory_on_external_subdirs()
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "AzAssetBrowserWindow.h"
|
||||
#include "AzAssetBrowser/ui_AssetBrowserWindow.h"
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/UI/AssetTreeView.h>
|
||||
#include <AzToolsFramework/AssetBrowser/UI/SortFilterProxyModel.hxx>
|
||||
#include <AzToolsFramework/AssetBrowser/UI/AssetBrowserModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetCache/AssetCacheBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserRequestBus.h>
|
||||
|
||||
const char* ASSET_BROWSER_PREVIEW_NAME = "Asset Browser (PREVIEW)";
|
||||
|
||||
AzAssetBrowserWindow::AzAssetBrowserWindow(const QString& name, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::AssetBrowserWindowClass())
|
||||
, m_assetDatabaseSortFilterProxyModel(new AssetBrowser::UI::SortFilterProxyModel(parent))
|
||||
, m_name(name)
|
||||
, m_assetBrowser(new AssetBrowser::UI::AssetTreeView(name, this))
|
||||
{
|
||||
EBUS_EVENT_RESULT(m_assetBrowserModel, AssetBrowser::AssetCache::AssetCacheRequestsBus, GetAssetBrowserModel);
|
||||
AZ_Assert(m_assetBrowserModel, "Failed to get filebrowser model");
|
||||
m_assetDatabaseSortFilterProxyModel->setSourceModel(m_assetBrowserModel);
|
||||
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->searchCriteriaWidget,
|
||||
&AzToolsFramework::SearchCriteriaWidget::SearchCriteriaChanged,
|
||||
m_assetDatabaseSortFilterProxyModel.data(),
|
||||
&AssetBrowser::UI::SortFilterProxyModel::OnSearchCriteriaChanged);
|
||||
|
||||
connect(m_assetBrowser, &QTreeView::customContextMenuRequested, this, &AzAssetBrowserWindow::OnContextMenu);
|
||||
}
|
||||
|
||||
AzAssetBrowserWindow::~AzAssetBrowserWindow()
|
||||
{
|
||||
m_assetBrowser->SaveState();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const AZ::Uuid& AzAssetBrowserWindow::GetClassID()
|
||||
{
|
||||
return AZ::AzTypeInfo<AzAssetBrowserWindow>::Uuid();
|
||||
}
|
||||
|
||||
void AzAssetBrowserWindow::OnContextMenu(const QPoint& point)
|
||||
{
|
||||
(void)point;
|
||||
//get the selected entries
|
||||
QModelIndexList sourceIndexes;
|
||||
for (const auto& index : m_assetBrowser->selectedIndexes())
|
||||
{
|
||||
sourceIndexes.push_back(m_assetDatabaseSortFilterProxyModel->mapToSource(index));
|
||||
}
|
||||
AZStd::vector<AssetBrowser::UI::Entry*> entries;
|
||||
m_assetBrowserModel->SourceIndexesToAssetDatabaseEntries(sourceIndexes, entries);
|
||||
|
||||
if (entries.empty() || entries.size() > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto entry = entries.front();
|
||||
|
||||
EBUS_EVENT(AssetBrowser::AssetBrowserRequestBus::Bus, OnItemContextMenu, this, entry);
|
||||
}
|
||||
|
||||
#include <AzAssetBrowser/moc_AzAssetBrowserWindow.cpp>
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AssetBrowserWindowClass;
|
||||
}
|
||||
|
||||
namespace AssetBrowser
|
||||
{
|
||||
namespace UI
|
||||
{
|
||||
class AssetTreeView;
|
||||
class SortFilterProxyModel;
|
||||
class AssetBrowserModel;
|
||||
}
|
||||
}
|
||||
|
||||
class AzAssetBrowserWindow
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(AzAssetBrowserWindow, AZ::SystemAllocator, 0);
|
||||
AZ_TYPE_INFO(AzAssetBrowserWindow, "{20238D23-2670-44BC-9110-A51374C18B5A}");
|
||||
|
||||
explicit AzAssetBrowserWindow(const QString& name = "default", QWidget* parent = nullptr);
|
||||
virtual ~AzAssetBrowserWindow();
|
||||
|
||||
static const AZ::Uuid& GetClassID();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void OnContextMenu(const QPoint& point);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::AssetBrowserWindowClass> m_ui;
|
||||
QScopedPointer<AssetBrowser::UI::AssetBrowserModel> m_assetDatabaseModel;
|
||||
QScopedPointer<AssetBrowser::UI::SortFilterProxyModel> m_assetDatabaseSortFilterProxyModel;
|
||||
QString m_name;
|
||||
AssetBrowser::UI::AssetTreeView* m_assetBrowser;
|
||||
AssetBrowser::UI::AssetBrowserModel* m_assetBrowserModel;
|
||||
};
|
||||
|
||||
extern const char* ASSET_BROWSER_PREVIEW_NAME;
|
||||
@@ -78,10 +78,7 @@
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string extracomment="Collapse All"/>
|
||||
</property>
|
||||
<property name="toolTipDuration">
|
||||
<number>3</number>
|
||||
<string extracomment="Collapse All">Collapse All</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "CVarMenu.h"
|
||||
|
||||
CVarMenu::CVarMenu(QWidget* parent)
|
||||
: QMenu(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void CVarMenu::AddCVarToggleItem(CVarToggle cVarToggle)
|
||||
{
|
||||
// Add CVar toggle action
|
||||
QAction* action = addAction(cVarToggle.m_displayName);
|
||||
connect(action, &QAction::triggered, [this, cVarToggle](bool checked)
|
||||
{
|
||||
// Update the CVar's value based on the action's new checked state
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(cVarToggle.m_cVarName.toUtf8().data());
|
||||
if (cVar)
|
||||
{
|
||||
SetCVar(cVar, checked ? cVarToggle.m_onValue : cVarToggle.m_offValue);
|
||||
}
|
||||
});
|
||||
action->setCheckable(true);
|
||||
|
||||
// Initialize the action's checked state based on the associated CVar's value
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(cVarToggle.m_cVarName.toUtf8().data());
|
||||
bool checked = (cVar && cVar->GetFVal() == cVarToggle.m_onValue);
|
||||
action->setChecked(checked);
|
||||
}
|
||||
|
||||
void CVarMenu::AddCVarValuesItem(QString cVarName,
|
||||
QString displayName,
|
||||
CVarDisplayNameValuePairs availableCVarValues,
|
||||
float offValue)
|
||||
{
|
||||
// Add a submenu offering multiple values for one CVar
|
||||
QMenu* menu = addMenu(displayName);
|
||||
QActionGroup* group = new QActionGroup(menu);
|
||||
group->setExclusive(true);
|
||||
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(cVarName.toUtf8().data());
|
||||
float cVarValue = cVar ? cVar->GetFVal() : 0.0f;
|
||||
for (const auto& availableCVarValue : availableCVarValues)
|
||||
{
|
||||
QAction* action = menu->addAction(availableCVarValue.first);
|
||||
action->setCheckable(true);
|
||||
group->addAction(action);
|
||||
|
||||
float availableOnValue = availableCVarValue.second;
|
||||
connect(action, &QAction::triggered, [this, action, cVarName, availableOnValue, offValue](bool checked)
|
||||
{
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(cVarName.toUtf8().data());
|
||||
if (cVar)
|
||||
{
|
||||
if (!checked)
|
||||
{
|
||||
SetCVar(cVar, offValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Toggle the CVar and update the action's checked state to
|
||||
// allow none of the items to be checked in the exclusive group.
|
||||
// Otherwise we could have just used the action's currently checked
|
||||
// state and updated the CVar's value only
|
||||
bool cVarOn = (cVar->GetFVal() == availableOnValue);
|
||||
checked = !cVarOn;
|
||||
SetCVar(cVar, checked ? availableOnValue : offValue);
|
||||
action->setChecked(checked);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize the action's checked state based on the CVar's current value
|
||||
bool checked = (cVarValue == availableOnValue);
|
||||
action->setChecked(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void CVarMenu::AddUniqueCVarsItem(QString displayName,
|
||||
AZStd::vector<CVarToggle> availableCVars)
|
||||
{
|
||||
// Add a submenu of actions offering values for unique CVars
|
||||
QMenu* menu = addMenu(displayName);
|
||||
QActionGroup* group = new QActionGroup(menu);
|
||||
group->setExclusive(true);
|
||||
|
||||
for (const CVarToggle& availableCVar : availableCVars)
|
||||
{
|
||||
QAction* action = menu->addAction(availableCVar.m_displayName);
|
||||
action->setCheckable(true);
|
||||
group->addAction(action);
|
||||
|
||||
connect(action, &QAction::triggered, [this, action, availableCVar, availableCVars](bool checked)
|
||||
{
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(availableCVar.m_cVarName.toUtf8().data());
|
||||
if (cVar)
|
||||
{
|
||||
if (!checked)
|
||||
{
|
||||
SetCVar(cVar, availableCVar.m_offValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Toggle the CVar and update the action's checked state to
|
||||
// allow none of the items to be checked in the exclusive group.
|
||||
// Otherwise we could have just used the action's currently checked
|
||||
// state and updated the CVar's value only
|
||||
bool cVarOn = (cVar->GetFVal() == availableCVar.m_onValue);
|
||||
bool cVarChecked = !cVarOn;
|
||||
SetCVar(cVar, cVarChecked ? availableCVar.m_onValue : availableCVar.m_offValue);
|
||||
action->setChecked(cVarChecked);
|
||||
if (cVarChecked)
|
||||
{
|
||||
// Set the rest of the CVars in the group to their off values
|
||||
SetCVarsToOffValue(availableCVars, availableCVar);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize the action's checked state based on its associated CVar's current value
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(availableCVar.m_cVarName.toUtf8().data());
|
||||
bool cVarChecked = (cVar && cVar->GetFVal() == availableCVar.m_onValue);
|
||||
action->setChecked(cVarChecked);
|
||||
if (cVarChecked)
|
||||
{
|
||||
// Set the rest of the CVars in the group to their off values
|
||||
SetCVarsToOffValue(availableCVars, availableCVar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CVarMenu::AddResetCVarsItem()
|
||||
{
|
||||
QAction* action = addAction(tr("Reset to Default"));
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
{
|
||||
for (auto it : m_originalCVarValues)
|
||||
{
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(it.first.c_str());
|
||||
if (cVar)
|
||||
{
|
||||
cVar->Set(it.second);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void CVarMenu::SetCVarsToOffValue(const AZStd::vector<CVarToggle>& cVarToggles, const CVarToggle& excludeCVarToggle)
|
||||
{
|
||||
// Set all but the specified CVars to their off values
|
||||
for (const CVarToggle& cVarToggle : cVarToggles)
|
||||
{
|
||||
if (cVarToggle.m_cVarName != excludeCVarToggle.m_cVarName
|
||||
|| cVarToggle.m_onValue != excludeCVarToggle.m_onValue)
|
||||
{
|
||||
ICVar* cVar = gEnv->pConsole->GetCVar(cVarToggle.m_cVarName.toUtf8().data());
|
||||
if (cVar)
|
||||
{
|
||||
SetCVar(cVar, cVarToggle.m_offValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CVarMenu::SetCVar(ICVar* cVar, float newValue)
|
||||
{
|
||||
float oldValue = cVar->GetFVal();
|
||||
cVar->Set(newValue);
|
||||
|
||||
// Store original value for CVar if not already in the list
|
||||
m_originalCVarValues.emplace(AZStd::string(cVar->GetName()), oldValue);
|
||||
}
|
||||
|
||||
void CVarMenu::AddSeparator()
|
||||
{
|
||||
addSeparator();
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMenu>
|
||||
#include <QString>
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
|
||||
struct ICVar;
|
||||
|
||||
class CVarMenu
|
||||
: public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// CVar that can be toggled on and off
|
||||
struct CVarToggle
|
||||
{
|
||||
QString m_cVarName;
|
||||
QString m_displayName;
|
||||
float m_onValue;
|
||||
float m_offValue;
|
||||
};
|
||||
|
||||
// List of a CVar's available values and their descriptions
|
||||
using CVarDisplayNameValuePairs = AZStd::vector<AZStd::pair<QString, float>>;
|
||||
|
||||
CVarMenu(QWidget* parent = nullptr);
|
||||
|
||||
// Add an action that turns a CVar on/off
|
||||
void AddCVarToggleItem(CVarToggle cVarToggle);
|
||||
|
||||
// Add a submenu of actions for a CVar that offers multiple values for exclusive selection
|
||||
void AddCVarValuesItem(QString cVarName,
|
||||
QString displayName,
|
||||
CVarDisplayNameValuePairs availableCVarValues,
|
||||
float offValue);
|
||||
|
||||
// Add a submenu of actions for exclusively turning unique CVars on/off
|
||||
void AddUniqueCVarsItem(QString displayName,
|
||||
AZStd::vector<CVarToggle> availableCVars);
|
||||
|
||||
// Add an action to reset all CVars to their original values before they
|
||||
// were modified by this menu
|
||||
void AddResetCVarsItem();
|
||||
|
||||
void AddSeparator();
|
||||
|
||||
private:
|
||||
void SetCVarsToOffValue(const AZStd::vector<CVarToggle>& cVarToggles, const CVarToggle& excludeCVarToggle);
|
||||
void SetCVar(ICVar* cVar, float newValue);
|
||||
|
||||
// Original CVar values before they were modified by this menu
|
||||
AZStd::unordered_map<AZStd::string, float> m_originalCVarValues;
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
|
||||
class CommandManagerRequests : public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
struct CommandDetails
|
||||
{
|
||||
AZStd::string m_name;
|
||||
AZStd::vector<AZStd::string> m_arguments;
|
||||
};
|
||||
|
||||
virtual AZStd::vector<AZStd::string> GetCommands() const = 0;
|
||||
virtual void ExecuteCommand(const AZStd::string& commandLine) {}
|
||||
|
||||
virtual void GetCommandDetails(AZStd::string commandName, CommandDetails& outArguments) const = 0;
|
||||
|
||||
};
|
||||
|
||||
using CommandManagerRequestBus = AZ::EBus<CommandManagerRequests>;
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "ConfigGroup.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
CConfigGroup::CConfigGroup()
|
||||
{
|
||||
}
|
||||
|
||||
CConfigGroup::~CConfigGroup()
|
||||
{
|
||||
for (IConfigVar* var : m_vars)
|
||||
{
|
||||
delete var;
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigGroup::AddVar(IConfigVar* var)
|
||||
{
|
||||
m_vars.push_back(var);
|
||||
}
|
||||
|
||||
AZ::u32 CConfigGroup::GetVarCount()
|
||||
{
|
||||
return aznumeric_cast<AZ::u32>(m_vars.size());
|
||||
}
|
||||
|
||||
IConfigVar* CConfigGroup::GetVar(const char* szName)
|
||||
{
|
||||
for (IConfigVar* var : m_vars)
|
||||
{
|
||||
if (0 == _stricmp(szName, var->GetName().c_str()))
|
||||
{
|
||||
return var;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const IConfigVar* CConfigGroup::GetVar(const char* szName) const
|
||||
{
|
||||
for (const IConfigVar* var : m_vars)
|
||||
{
|
||||
if (0 == _stricmp(szName, var->GetName().c_str()))
|
||||
{
|
||||
return var;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IConfigVar* CConfigGroup::GetVar(AZ::u32 index)
|
||||
{
|
||||
if (index < m_vars.size())
|
||||
{
|
||||
return m_vars[index];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const IConfigVar* CConfigGroup::GetVar(AZ::u32 index) const
|
||||
{
|
||||
if (index < m_vars.size())
|
||||
{
|
||||
return m_vars[index];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CConfigGroup::SaveToXML(XmlNodeRef node)
|
||||
{
|
||||
// save only values that don't have default values
|
||||
for (const IConfigVar* var : m_vars)
|
||||
{
|
||||
if (var->IsFlagSet(IConfigVar::eFlag_DoNotSave) || var->IsDefault())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* szName = var->GetName().c_str();
|
||||
|
||||
switch (var->GetType())
|
||||
{
|
||||
case IConfigVar::eType_BOOL:
|
||||
{
|
||||
bool currentValue = false;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_INT:
|
||||
{
|
||||
int currentValue = 0;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_FLOAT:
|
||||
{
|
||||
float currentValue = 0;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
AZStd::string currentValue;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigGroup::LoadFromXML(XmlNodeRef node)
|
||||
{
|
||||
// load values that are save-able
|
||||
for (IConfigVar* var : m_vars)
|
||||
{
|
||||
if (var->IsFlagSet(IConfigVar::eFlag_DoNotSave))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const char* szName = var->GetName().c_str();
|
||||
|
||||
switch (var->GetType())
|
||||
{
|
||||
case IConfigVar::eType_BOOL:
|
||||
{
|
||||
bool currentValue = false;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_INT:
|
||||
{
|
||||
int currentValue = 0;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_FLOAT:
|
||||
{
|
||||
float currentValue = 0;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
AZStd::string currentValue;
|
||||
var->GetDefault(¤tValue);
|
||||
QString readValue(currentValue.c_str());
|
||||
if (node->getAttr(szName, readValue))
|
||||
{
|
||||
currentValue = readValue.toUtf8().data();
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
struct ICVar;
|
||||
class XmlNodeRef;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
// Abstract configurable variable
|
||||
struct IConfigVar
|
||||
{
|
||||
public:
|
||||
enum EType
|
||||
{
|
||||
eType_BOOL,
|
||||
eType_INT,
|
||||
eType_FLOAT,
|
||||
eType_STRING,
|
||||
};
|
||||
|
||||
enum EFlags
|
||||
{
|
||||
eFlag_NoUI = 1 << 0,
|
||||
eFlag_NoCVar = 1 << 1,
|
||||
eFlag_DoNotSave = 1 << 2,
|
||||
};
|
||||
|
||||
IConfigVar(const char* szName, const char* szDescription, EType varType, AZ::u8 flags)
|
||||
: m_name(szName)
|
||||
, m_description(szDescription)
|
||||
, m_type(varType)
|
||||
, m_flags(flags)
|
||||
, m_ptr(nullptr)
|
||||
{};
|
||||
|
||||
virtual ~IConfigVar() = default;
|
||||
|
||||
AZ_FORCE_INLINE EType GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
AZ_FORCE_INLINE const AZStd::string& GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
AZ_FORCE_INLINE const AZStd::string& GetDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
AZ_FORCE_INLINE bool IsFlagSet(EFlags flag) const
|
||||
{
|
||||
return 0 != (m_flags & flag);
|
||||
}
|
||||
|
||||
virtual void Get(void* outPtr) const = 0;
|
||||
virtual void Set(const void* ptr) = 0;
|
||||
virtual bool IsDefault() const = 0;
|
||||
virtual void GetDefault(void* outPtr) const = 0;
|
||||
virtual void Reset() = 0;
|
||||
|
||||
static constexpr EType TranslateType(const bool&) { return eType_BOOL; }
|
||||
static constexpr EType TranslateType(const int&) { return eType_INT; }
|
||||
static constexpr EType TranslateType(const float&) { return eType_FLOAT; }
|
||||
static constexpr EType TranslateType(const AZStd::string&) { return eType_STRING; }
|
||||
|
||||
protected:
|
||||
EType m_type;
|
||||
AZ::u8 m_flags;
|
||||
AZStd::string m_name;
|
||||
AZStd::string m_description;
|
||||
void* m_ptr;
|
||||
ICVar* m_pCVar;
|
||||
};
|
||||
|
||||
// Group of configuration variables with optional mapping to CVars
|
||||
class CConfigGroup
|
||||
{
|
||||
private:
|
||||
using TConfigVariables = AZStd::vector<IConfigVar*> ;
|
||||
TConfigVariables m_vars;
|
||||
|
||||
using TConsoleVariables = AZStd::vector<ICVar*>;
|
||||
TConsoleVariables m_consoleVars;
|
||||
|
||||
public:
|
||||
CConfigGroup();
|
||||
virtual ~CConfigGroup();
|
||||
|
||||
void AddVar(IConfigVar* var);
|
||||
AZ::u32 GetVarCount();
|
||||
IConfigVar* GetVar(const char* szName);
|
||||
IConfigVar* GetVar(AZ::u32 index);
|
||||
const IConfigVar* GetVar(const char* szName) const;
|
||||
const IConfigVar* GetVar(AZ::u32 index) const;
|
||||
|
||||
void SaveToXML(XmlNodeRef node);
|
||||
void LoadFromXML(XmlNodeRef node);
|
||||
};
|
||||
};
|
||||
@@ -1,369 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Tooltip that displays bitmap.
|
||||
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "BitmapToolTip.h"
|
||||
|
||||
// Qt
|
||||
#include <QVBoxLayout>
|
||||
|
||||
// Editor
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h"
|
||||
|
||||
|
||||
static const int STATIC_TEXT_C_HEIGHT = 42;
|
||||
static const int HISTOGRAM_C_HEIGHT = 130;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapToolTip
|
||||
CBitmapToolTip::CBitmapToolTip(QWidget* parent)
|
||||
: QWidget(parent, Qt::ToolTip)
|
||||
, m_staticBitmap(new QLabel(this))
|
||||
, m_staticText(new QLabel(this))
|
||||
, m_rgbaHistogram(new CImageHistogramCtrl(this))
|
||||
, m_alphaChannelHistogram(new CImageHistogramCtrl(this))
|
||||
{
|
||||
m_nTimer = 0;
|
||||
m_hToolWnd = nullptr;
|
||||
m_bShowHistogram = true;
|
||||
m_bShowFullsize = false;
|
||||
m_eShowMode = ESHOW_RGB;
|
||||
|
||||
connect(&m_timer, &QTimer::timeout, this, &CBitmapToolTip::OnTimer);
|
||||
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
layout->addWidget(m_staticBitmap);
|
||||
layout->addWidget(m_staticText);
|
||||
|
||||
auto* histogramLayout = new QHBoxLayout();
|
||||
histogramLayout->addWidget(m_rgbaHistogram);
|
||||
histogramLayout->addWidget(m_alphaChannelHistogram);
|
||||
m_alphaChannelHistogram->setVisible(false);
|
||||
|
||||
layout->addLayout(histogramLayout);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
CBitmapToolTip::~CBitmapToolTip()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBitmapToolTip::GetShowMode(EShowMode& eShowMode, bool& bShowInOriginalSize) const
|
||||
{
|
||||
bShowInOriginalSize = CheckVirtualKey(Qt::Key_Space);
|
||||
eShowMode = ESHOW_RGB;
|
||||
|
||||
if (m_bHasAlpha)
|
||||
{
|
||||
if (CheckVirtualKey(Qt::Key_Control))
|
||||
{
|
||||
eShowMode = ESHOW_RGB_ALPHA;
|
||||
}
|
||||
else if (CheckVirtualKey(Qt::Key_Alt))
|
||||
{
|
||||
eShowMode = ESHOW_ALPHA;
|
||||
}
|
||||
else if (CheckVirtualKey(Qt::Key_Shift))
|
||||
{
|
||||
eShowMode = ESHOW_RGBA;
|
||||
}
|
||||
}
|
||||
else if (m_bIsLimitedHDR)
|
||||
{
|
||||
if (CheckVirtualKey(Qt::Key_Shift))
|
||||
{
|
||||
eShowMode = ESHOW_RGBE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char* CBitmapToolTip::GetShowModeDescription(EShowMode eShowMode, [[maybe_unused]] bool bShowInOriginalSize) const
|
||||
{
|
||||
switch (eShowMode)
|
||||
{
|
||||
case ESHOW_RGB:
|
||||
return "RGB";
|
||||
case ESHOW_RGB_ALPHA:
|
||||
return "RGB+A";
|
||||
case ESHOW_ALPHA:
|
||||
return "Alpha";
|
||||
case ESHOW_RGBA:
|
||||
return "RGBA";
|
||||
case ESHOW_RGBE:
|
||||
return "RGBExp";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void CBitmapToolTip::RefreshViewmode()
|
||||
{
|
||||
LoadImage(m_filename);
|
||||
|
||||
if (m_eShowMode == ESHOW_RGB_ALPHA || m_eShowMode == ESHOW_RGBA)
|
||||
{
|
||||
m_rgbaHistogram->setVisible(true);
|
||||
m_alphaChannelHistogram->setVisible(true);
|
||||
}
|
||||
else if (m_eShowMode == ESHOW_ALPHA)
|
||||
{
|
||||
m_rgbaHistogram->setVisible(false);
|
||||
m_alphaChannelHistogram->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rgbaHistogram->setVisible(true);
|
||||
m_alphaChannelHistogram->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CBitmapToolTip::LoadImage(const QString& imageFilename)
|
||||
{
|
||||
EShowMode eShowMode = ESHOW_RGB;
|
||||
const char* pShowModeDescription = "RGB";
|
||||
bool bShowInOriginalSize = false;
|
||||
|
||||
GetShowMode(eShowMode, bShowInOriginalSize);
|
||||
pShowModeDescription = GetShowModeDescription(eShowMode, bShowInOriginalSize);
|
||||
|
||||
QString convertedFileName = Path::GamePathToFullPath(Path::ReplaceExtension(imageFilename, ".dds"));
|
||||
|
||||
// We need to check against both the image filename and the converted filename as it is possible that the
|
||||
// converted file existed but failed to load previously and we reverted to loading the source asset.
|
||||
bool alreadyLoadedImage = ((m_filename == convertedFileName) || (m_filename == imageFilename));
|
||||
if (alreadyLoadedImage && (m_eShowMode == eShowMode) && (m_bShowFullsize == bShowInOriginalSize))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
CCryFile fileCheck;
|
||||
if (!fileCheck.Open(convertedFileName.toUtf8().data(), "rb"))
|
||||
{
|
||||
// if we didn't find it, then default back to just using what we can find (if any)
|
||||
convertedFileName = imageFilename;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileCheck.Close();
|
||||
}
|
||||
|
||||
m_eShowMode = eShowMode;
|
||||
m_bShowFullsize = bShowInOriginalSize;
|
||||
|
||||
CImageEx image;
|
||||
image.SetHistogramEqualization(CheckVirtualKey(Qt::Key_Shift));
|
||||
bool loadedRequestedAsset = true;
|
||||
if (!CImageUtil::LoadImage(convertedFileName, image))
|
||||
{
|
||||
//Failed to load the requested asset, let's try loading the source asset if available.
|
||||
loadedRequestedAsset = false;
|
||||
if (!CImageUtil::LoadImage(imageFilename, image))
|
||||
{
|
||||
m_staticBitmap->clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QString imginfo;
|
||||
|
||||
m_filename = loadedRequestedAsset ? convertedFileName : imageFilename;
|
||||
m_bHasAlpha = image.HasAlphaChannel();
|
||||
m_bIsLimitedHDR = image.IsLimitedHDR();
|
||||
|
||||
GetShowMode(eShowMode, bShowInOriginalSize);
|
||||
pShowModeDescription = GetShowModeDescription(eShowMode, bShowInOriginalSize);
|
||||
|
||||
if (m_bHasAlpha)
|
||||
{
|
||||
imginfo = tr("%1x%2 %3\nShowing %4 (ALT=Alpha, SHIFT=RGBA, CTRL=RGB+A, SPACE=see in original size)");
|
||||
}
|
||||
else if (m_bIsLimitedHDR)
|
||||
{
|
||||
imginfo = tr("%1x%2 %3\nShowing %4 (SHIFT=see hist.-equalized, SPACE=see in original size)");
|
||||
}
|
||||
else
|
||||
{
|
||||
imginfo = tr("%1x%2 %3\nShowing %4 (SPACE=see in original size)");
|
||||
}
|
||||
|
||||
imginfo = imginfo.arg(image.GetWidth()).arg(image.GetHeight()).arg(image.GetFormatDescription()).arg(pShowModeDescription);
|
||||
|
||||
m_staticText->setText(imginfo);
|
||||
|
||||
int w = image.GetWidth();
|
||||
int h = image.GetHeight();
|
||||
int multiplier = (m_eShowMode == ESHOW_RGB_ALPHA ? 2 : 1);
|
||||
int originalW = w * multiplier;
|
||||
int originalH = h;
|
||||
|
||||
if (!bShowInOriginalSize || (w == 0))
|
||||
{
|
||||
w = 256;
|
||||
}
|
||||
if (!bShowInOriginalSize || (h == 0))
|
||||
{
|
||||
h = 256;
|
||||
}
|
||||
|
||||
w *= multiplier;
|
||||
|
||||
resize(w + 4, h + 4 + STATIC_TEXT_C_HEIGHT + HISTOGRAM_C_HEIGHT);
|
||||
setVisible(true);
|
||||
|
||||
CImageEx scaledImage;
|
||||
|
||||
if (bShowInOriginalSize && (originalW < w))
|
||||
{
|
||||
w = originalW;
|
||||
}
|
||||
if (bShowInOriginalSize && (originalH < h))
|
||||
{
|
||||
h = originalH;
|
||||
}
|
||||
|
||||
scaledImage.Allocate(w, h);
|
||||
|
||||
if (m_eShowMode == ESHOW_RGB_ALPHA)
|
||||
{
|
||||
CImageUtil::ScaleToDoubleFit(image, scaledImage);
|
||||
}
|
||||
else
|
||||
{
|
||||
CImageUtil::ScaleToFit(image, scaledImage);
|
||||
}
|
||||
|
||||
if (m_eShowMode == ESHOW_RGB || m_eShowMode == ESHOW_RGBE)
|
||||
{
|
||||
scaledImage.SwapRedAndBlue();
|
||||
scaledImage.FillAlpha();
|
||||
}
|
||||
else if (m_eShowMode == ESHOW_ALPHA)
|
||||
{
|
||||
for (int hh = 0; hh < scaledImage.GetHeight(); hh++)
|
||||
{
|
||||
for (int ww = 0; ww < scaledImage.GetWidth(); ww++)
|
||||
{
|
||||
int a = scaledImage.ValueAt(ww, hh) >> 24;
|
||||
scaledImage.ValueAt(ww, hh) = RGB(a, a, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_eShowMode == ESHOW_RGB_ALPHA)
|
||||
{
|
||||
int halfWidth = scaledImage.GetWidth() / 2;
|
||||
for (int hh = 0; hh < scaledImage.GetHeight(); hh++)
|
||||
{
|
||||
for (int ww = 0; ww < halfWidth; ww++)
|
||||
{
|
||||
int r = GetRValue(scaledImage.ValueAt(ww, hh));
|
||||
int g = GetGValue(scaledImage.ValueAt(ww, hh));
|
||||
int b = GetBValue(scaledImage.ValueAt(ww, hh));
|
||||
int a = scaledImage.ValueAt(ww, hh) >> 24;
|
||||
scaledImage.ValueAt(ww, hh) = RGB(b, g, r);
|
||||
scaledImage.ValueAt(ww + halfWidth, hh) = RGB(a, a, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
else //if (m_showMode == ESHOW_RGBA)
|
||||
{
|
||||
scaledImage.SwapRedAndBlue();
|
||||
}
|
||||
|
||||
QImage qImage(scaledImage.GetWidth(), scaledImage.GetHeight(), QImage::Format_RGB32);
|
||||
memcpy(qImage.bits(), scaledImage.GetData(), qImage.sizeInBytes());
|
||||
m_staticBitmap->setPixmap(QPixmap::fromImage(qImage));
|
||||
|
||||
if (m_bShowHistogram && scaledImage.GetData())
|
||||
{
|
||||
m_rgbaHistogram->ComputeHistogram(image, CImageHistogram::eImageFormat_32BPP_BGRA);
|
||||
m_rgbaHistogram->setDrawMode(EHistogramDrawMode::OverlappedRGB);
|
||||
|
||||
m_alphaChannelHistogram->histogramDisplay()->CopyComputedDataFrom(m_rgbaHistogram->histogramDisplay());
|
||||
m_alphaChannelHistogram->setDrawMode(EHistogramDrawMode::AlphaChannel);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CBitmapToolTip::OnTimer()
|
||||
{
|
||||
/*
|
||||
if (IsWindowVisible())
|
||||
{
|
||||
if (m_bHaveAnythingToRender)
|
||||
Invalidate();
|
||||
}
|
||||
*/
|
||||
if (m_hToolWnd)
|
||||
{
|
||||
QRect toolRc(m_toolRect);
|
||||
QRect rc = geometry();
|
||||
QPoint cursorPos = QCursor::pos();
|
||||
toolRc.moveTopLeft(m_hToolWnd->mapToGlobal(toolRc.topLeft()));
|
||||
if (!toolRc.contains(cursorPos) && !rc.contains(cursorPos))
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshViewmode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBitmapToolTip::showEvent([[maybe_unused]] QShowEvent* event)
|
||||
{
|
||||
QPoint cursorPos = QCursor::pos();
|
||||
move(cursorPos);
|
||||
m_timer.start(500);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBitmapToolTip::hideEvent([[maybe_unused]] QHideEvent* event)
|
||||
{
|
||||
m_timer.stop();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CBitmapToolTip::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Control || event->key() == Qt::Key_Alt || event->key() == Qt::Key_Shift)
|
||||
{
|
||||
RefreshViewmode();
|
||||
}
|
||||
}
|
||||
|
||||
void CBitmapToolTip::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Control || event->key() == Qt::Key_Alt || event->key() == Qt::Key_Shift)
|
||||
{
|
||||
RefreshViewmode();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBitmapToolTip::SetTool(QWidget* pWnd, const QRect& rect)
|
||||
{
|
||||
assert(pWnd);
|
||||
m_hToolWnd = pWnd;
|
||||
m_toolRect = rect;
|
||||
}
|
||||
|
||||
#include <Controls/moc_BitmapToolTip.cpp>
|
||||
@@ -1,88 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Tooltip that displays bitmap.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_CONTROLS_BITMAPTOOLTIP_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_BITMAPTOOLTIP_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "Controls/ImageHistogramCtrl.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CBitmapToolTip
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
// Construction
|
||||
public:
|
||||
|
||||
enum EShowMode
|
||||
{
|
||||
ESHOW_RGB = 0,
|
||||
ESHOW_ALPHA,
|
||||
ESHOW_RGBA,
|
||||
ESHOW_RGB_ALPHA,
|
||||
ESHOW_RGBE
|
||||
};
|
||||
|
||||
CBitmapToolTip(QWidget* parent = nullptr);
|
||||
virtual ~CBitmapToolTip();
|
||||
|
||||
bool Create(const RECT& rect);
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
void RefreshViewmode();
|
||||
|
||||
bool LoadImage(const QString& imageFilename);
|
||||
void SetTool(QWidget* pWnd, const QRect& rect);
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
void OnTimer();
|
||||
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
|
||||
private:
|
||||
void GetShowMode(EShowMode& showMode, bool& showInOriginalSize) const;
|
||||
const char* GetShowModeDescription(EShowMode showMode, bool showInOriginalSize) const;
|
||||
|
||||
QLabel* m_staticBitmap;
|
||||
QLabel* m_staticText;
|
||||
QString m_filename;
|
||||
bool m_bShowHistogram;
|
||||
EShowMode m_eShowMode;
|
||||
bool m_bShowFullsize;
|
||||
bool m_bHasAlpha;
|
||||
bool m_bIsLimitedHDR;
|
||||
CImageHistogramCtrl* m_rgbaHistogram;
|
||||
CImageHistogramCtrl* m_alphaChannelHistogram;
|
||||
int m_nTimer;
|
||||
QWidget* m_hToolWnd;
|
||||
QRect m_toolRect;
|
||||
QTimer m_timer;
|
||||
};
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_BITMAPTOOLTIP_H
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "QBitmapPreviewDialog.h"
|
||||
#include <Controls/ui_QBitmapPreviewDialog.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QPainter>
|
||||
#include <QScreen>
|
||||
|
||||
void QBitmapPreviewDialog::ImageData::setRgba8888(const void* buffer, const int& w, const int& h)
|
||||
{
|
||||
const unsigned long bytes = w * h * 4;
|
||||
m_buffer.resize(bytes);
|
||||
memcpy(m_buffer.data(), buffer, bytes);
|
||||
m_image = QImage((uchar*)m_buffer.constData(), w, h, QImage::Format::Format_RGBA8888);
|
||||
}
|
||||
|
||||
static void fillChecker(int w, int h, unsigned int* dst)
|
||||
{
|
||||
for (int y = 0; y < h; y++)
|
||||
{
|
||||
for (int x = 0; x < w; x++)
|
||||
{
|
||||
dst[y * w + x] = 0xFF000000 | (((x >> 2) + (y >> 2)) % 2 == 0 ? 0x007F7F7F : 0x00000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QBitmapPreviewDialog::QBitmapPreviewDialog(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::QBitmapTooltip)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||
|
||||
// Clear label text
|
||||
ui->m_placeholderBitmap->setText("");
|
||||
ui->m_placeholderHistogram->setText("");
|
||||
|
||||
ui->m_bitmapSize->setProperty("tableRow", "Odd");
|
||||
ui->m_Mips->setProperty("tableRow", "Even");
|
||||
ui->m_Mean->setProperty("tableRow", "Odd");
|
||||
ui->m_StdDev->setProperty("tableRow", "Even");
|
||||
ui->m_Median->setProperty("tableRow", "Odd");
|
||||
ui->m_labelForBitmapSize->setProperty("tooltipLabel", "content");
|
||||
ui->m_labelForMean->setProperty("tooltipLabel", "content");
|
||||
ui->m_labelForMedian->setProperty("tooltipLabel", "content");
|
||||
ui->m_labelForMips->setProperty("tooltipLabel", "content");
|
||||
ui->m_labelForStdDev->setProperty("tooltipLabel", "content");
|
||||
ui->m_vBitmapSize->setProperty("tooltipLabel", "content");
|
||||
ui->m_vMean->setProperty("tooltipLabel", "content");
|
||||
ui->m_vMedian->setProperty("tooltipLabel", "content");
|
||||
ui->m_vMips->setProperty("tooltipLabel", "content");
|
||||
ui->m_vStdDev->setProperty("tooltipLabel", "content");
|
||||
|
||||
// Initialize placeholder images
|
||||
const int w = 64;
|
||||
const int h = 64;
|
||||
QByteArray buffer;
|
||||
buffer.resize(w * h * 4);
|
||||
unsigned int* dst = (unsigned int*)buffer.data();
|
||||
fillChecker(w, h, dst);
|
||||
m_checker.setRgba8888(buffer.constData(), w, h);
|
||||
|
||||
m_initialSize = window()->window()->geometry().size();
|
||||
}
|
||||
|
||||
QBitmapPreviewDialog::~QBitmapPreviewDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setImageRgba8888(const void* buffer, const int& w, const int& h, [[maybe_unused]] const QString& info)
|
||||
{
|
||||
m_imageMain.setRgba8888(buffer, w, h);
|
||||
}
|
||||
|
||||
|
||||
QRect QBitmapPreviewDialog::getHistogramArea()
|
||||
{
|
||||
return QRect(ui->m_placeholderHistogram->pos(), ui->m_placeholderHistogram->size());
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setFullSize(const bool& fullSize)
|
||||
{
|
||||
if (fullSize)
|
||||
{
|
||||
QSize desktop = QApplication::screenAt(ui->m_placeholderBitmap->pos())->availableGeometry().size();
|
||||
QSize image = m_imageMain.m_image.size();
|
||||
QPoint location = mapToGlobal(ui->m_placeholderBitmap->pos());
|
||||
QSize finalSize;
|
||||
finalSize.setWidth((image.width() < (desktop.width() - location.x())) ? image.width() : (desktop.width() - location.x()));
|
||||
finalSize.setHeight((image.height() < (desktop.height() - location.y())) ? image.height() : (desktop.height() - location.y()));
|
||||
float scale = (finalSize.width() < finalSize.height()) ? finalSize.width() / float(m_imageMain.m_image.width()) : finalSize.height() / float(m_imageMain.m_image.height());
|
||||
ui->m_placeholderBitmap->setFixedSize(scale * m_imageMain.m_image.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_placeholderBitmap->setFixedSize(256, 256);
|
||||
}
|
||||
|
||||
adjustSize();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::paintEvent(QPaintEvent* e)
|
||||
{
|
||||
QWidget::paintEvent(e);
|
||||
QRect rect(ui->m_placeholderBitmap->pos(), ui->m_placeholderBitmap->size());
|
||||
drawImageData(rect, m_imageMain);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::drawImageData(const QRect& rect, const ImageData& imgData)
|
||||
{
|
||||
// Draw the
|
||||
QPainter p(this);
|
||||
p.drawImage(rect.topLeft(), m_checker.m_image.scaled(rect.size()));
|
||||
p.drawImage(rect.topLeft(), imgData.m_image.scaled(rect.size()));
|
||||
|
||||
// Draw border
|
||||
QPen pen;
|
||||
pen.setColor(QColor(0, 0, 0));
|
||||
p.drawRect(rect.top(), rect.left(), rect.width() - 1, rect.height());
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setSize(QString _value)
|
||||
{
|
||||
ui->m_vBitmapSize->setText(_value);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setMips(QString _value)
|
||||
{
|
||||
ui->m_vMips->setText(_value);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setMean(QString _value)
|
||||
{
|
||||
ui->m_vMean->setText(_value);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setMedian(QString _value)
|
||||
{
|
||||
ui->m_vMedian->setText(_value);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialog::setStdDev(QString _value)
|
||||
{
|
||||
ui->m_vStdDev->setText(_value);
|
||||
}
|
||||
|
||||
QSize QBitmapPreviewDialog::GetCurrentBitmapSize()
|
||||
{
|
||||
return ui->m_placeholderBitmap->size();
|
||||
}
|
||||
|
||||
QSize QBitmapPreviewDialog::GetOriginalImageSize()
|
||||
{
|
||||
return m_imageMain.m_image.size();
|
||||
}
|
||||
|
||||
|
||||
#include <Controls/moc_QBitmapPreviewDialog.cpp>
|
||||
@@ -1,64 +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
|
||||
*
|
||||
*/
|
||||
#ifndef QBITMAPPREVIEWDIALOG_H
|
||||
#define QBITMAPPREVIEWDIALOG_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
#endif
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace Ui {
|
||||
class QBitmapTooltip;
|
||||
}
|
||||
|
||||
class QBitmapPreviewDialog
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
struct ImageData
|
||||
{
|
||||
QByteArray m_buffer;
|
||||
QImage m_image;
|
||||
|
||||
void setRgba8888(const void* buffer, const int& w, const int& h);
|
||||
};
|
||||
|
||||
public:
|
||||
explicit QBitmapPreviewDialog(QWidget* parent = 0);
|
||||
virtual ~QBitmapPreviewDialog();
|
||||
QSize GetCurrentBitmapSize();
|
||||
QSize GetOriginalImageSize();
|
||||
|
||||
protected:
|
||||
void setImageRgba8888(const void* buffer, const int& w, const int& h, const QString& info);
|
||||
void setSize(QString _value);
|
||||
void setMips(QString _value);
|
||||
void setMean(QString _value);
|
||||
void setMedian(QString _value);
|
||||
void setStdDev(QString _value);
|
||||
QRect getHistogramArea();
|
||||
void setFullSize(const bool& fullSize);
|
||||
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
|
||||
private:
|
||||
void drawImageData(const QRect& rect, const ImageData& imgData);
|
||||
|
||||
protected:
|
||||
Ui::QBitmapTooltip* ui;
|
||||
QSize m_initialSize;
|
||||
ImageData m_checker;
|
||||
ImageData m_imageMain;
|
||||
};
|
||||
|
||||
#endif // QBITMAPPREVIEWDIALOG_H
|
||||
@@ -1,390 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QBitmapTooltip</class>
|
||||
<widget class="QWidget" name="QBitmapTooltip">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>256</width>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>256</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_placeholderBitmap">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>256</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bitmap Area</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_placeholderHistogram">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Histogram Area</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_bitmapSize" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_labelForBitmapSize">
|
||||
<property name="text">
|
||||
<string>Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_vBitmapSize">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size Value</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_Mips" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_labelForMips">
|
||||
<property name="text">
|
||||
<string>DXT5 Mips:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_vMips">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size Value</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_Mean" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_labelForMean">
|
||||
<property name="text">
|
||||
<string>Mean:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_vMean">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size Value</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_StdDev" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_labelForStdDev">
|
||||
<property name="text">
|
||||
<string>StdDev:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_vStdDev">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size Value</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_Median" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_labelForMedian">
|
||||
<property name="text">
|
||||
<string>Median:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_vMedian">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size Value</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,528 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "QBitmapPreviewDialogImp.h"
|
||||
|
||||
// Cry
|
||||
#include <ITexture.h>
|
||||
|
||||
// EditorCore
|
||||
#include <Util/Image.h>
|
||||
#include <Include/IImageUtil.h>
|
||||
|
||||
// QT
|
||||
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: class '...' needs to have dll-interface to be used by clients of class '...'
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <qmath.h>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include <Controls/ui_QBitmapPreviewDialog.h>
|
||||
|
||||
static const int kDefaultWidth = 256;
|
||||
static const int kDefaultHeight = 256;
|
||||
|
||||
QBitmapPreviewDialogImp::QBitmapPreviewDialogImp(QWidget* parent)
|
||||
: QBitmapPreviewDialog(parent)
|
||||
, m_image(new CImageEx())
|
||||
, m_showOriginalSize(false)
|
||||
, m_showMode(ESHOW_RGB)
|
||||
, m_histrogramMode(eHistogramMode_OverlappedRGB)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setImage("");
|
||||
ui->m_placeholderBitmap->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
||||
ui->m_placeholderHistogram->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
||||
|
||||
ui->m_labelForBitmapSize->setProperty("tooltipLabel", "Content");
|
||||
ui->m_labelForMean->setProperty("tooltipLabel", "Content");
|
||||
ui->m_labelForMedian->setProperty("tooltipLabel", "Content");
|
||||
ui->m_labelForMips->setProperty("tooltipLabel", "Content");
|
||||
ui->m_labelForStdDev->setProperty("tooltipLabel", "Content");
|
||||
|
||||
ui->m_vBitmapSize->setProperty("tooltipLabel", "Content");
|
||||
ui->m_vMean->setProperty("tooltipLabel", "Content");
|
||||
ui->m_vMedian->setProperty("tooltipLabel", "Content");
|
||||
ui->m_vMips->setProperty("tooltipLabel", "Content");
|
||||
ui->m_vStdDev->setProperty("tooltipLabel", "Content");
|
||||
|
||||
setUIStyleMode(EUISTYLE_IMAGE_ONLY);
|
||||
}
|
||||
|
||||
QBitmapPreviewDialogImp::~QBitmapPreviewDialogImp()
|
||||
{
|
||||
SAFE_DELETE(m_image);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::setImage(const QString path)
|
||||
{
|
||||
if (path.isEmpty()
|
||||
|| m_path == path
|
||||
|| !GetIEditor()->GetImageUtil()->LoadImage(path.toUtf8().data(), *m_image))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_showOriginalSize = isSizeSmallerThanDefault();
|
||||
m_path = path;
|
||||
refreshData();
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::setShowMode(EShowMode mode)
|
||||
{
|
||||
if (mode == ESHOW_NumModes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_showMode = mode;
|
||||
refreshData();
|
||||
update();
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::toggleShowMode()
|
||||
{
|
||||
m_showMode = (EShowMode)(((int)m_showMode + 1) % ESHOW_NumModes);
|
||||
refreshData();
|
||||
update();
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::setUIStyleMode(EUIStyle mode)
|
||||
{
|
||||
if (mode >= EUISTYLE_NumModes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_uiStyle = mode;
|
||||
if (m_uiStyle == EUISTYLE_IMAGE_ONLY)
|
||||
{
|
||||
ui->m_placeholderHistogram->hide();
|
||||
|
||||
ui->m_labelForBitmapSize->hide();
|
||||
ui->m_labelForMean->hide();
|
||||
ui->m_labelForMedian->hide();
|
||||
ui->m_labelForMips->hide();
|
||||
ui->m_labelForStdDev->hide();
|
||||
|
||||
ui->m_vBitmapSize->hide();
|
||||
ui->m_vMean->hide();
|
||||
ui->m_vMedian->hide();
|
||||
ui->m_vMips->hide();
|
||||
ui->m_vStdDev->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_placeholderHistogram->show();
|
||||
|
||||
ui->m_labelForBitmapSize->show();
|
||||
ui->m_labelForMean->show();
|
||||
ui->m_labelForMedian->show();
|
||||
ui->m_labelForMips->show();
|
||||
ui->m_labelForStdDev->show();
|
||||
|
||||
ui->m_vBitmapSize->show();
|
||||
ui->m_vMean->show();
|
||||
ui->m_vMedian->show();
|
||||
ui->m_vMips->show();
|
||||
ui->m_vStdDev->show();
|
||||
}
|
||||
}
|
||||
|
||||
const QBitmapPreviewDialogImp::EShowMode& QBitmapPreviewDialogImp::getShowMode() const
|
||||
{
|
||||
return m_showMode;
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::setHistogramMode(EHistogramMode mode)
|
||||
{
|
||||
if (mode == eHistogramMode_NumModes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_histrogramMode = mode;
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::toggleHistrogramMode()
|
||||
{
|
||||
m_histrogramMode = (EHistogramMode)(((int)m_histrogramMode + 1) % eHistogramMode_NumModes);
|
||||
update();
|
||||
}
|
||||
|
||||
const QBitmapPreviewDialogImp::EHistogramMode& QBitmapPreviewDialogImp::getHistogramMode() const
|
||||
{
|
||||
return m_histrogramMode;
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::toggleOriginalSize()
|
||||
{
|
||||
m_showOriginalSize = !m_showOriginalSize;
|
||||
|
||||
refreshData();
|
||||
update();
|
||||
}
|
||||
|
||||
bool QBitmapPreviewDialogImp::isSizeSmallerThanDefault()
|
||||
{
|
||||
return m_image->GetWidth() < kDefaultWidth && m_image->GetHeight() < kDefaultHeight;
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::setOriginalSize(bool value)
|
||||
{
|
||||
m_showOriginalSize = value;
|
||||
|
||||
refreshData();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
const char* QBitmapPreviewDialogImp::GetShowModeDescription(EShowMode eShowMode, [[maybe_unused]] bool bShowInOriginalSize) const
|
||||
{
|
||||
switch (eShowMode)
|
||||
{
|
||||
case ESHOW_RGB:
|
||||
return "RGB";
|
||||
case ESHOW_RGB_ALPHA:
|
||||
return "RGB+A";
|
||||
case ESHOW_ALPHA:
|
||||
return "Alpha";
|
||||
case ESHOW_RGBA:
|
||||
return "RGBA";
|
||||
case ESHOW_RGBE:
|
||||
return "RGBExp";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* getHistrogramModeStr(QBitmapPreviewDialogImp::EHistogramMode mode, bool shortName)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_Luminosity:
|
||||
return shortName ? "Lum" : "Luminosity";
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_OverlappedRGB:
|
||||
return shortName ? "Overlap" : "Overlapped RGBA";
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_SplitRGB:
|
||||
return shortName ? "R|G|B" : "Split RGB";
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_RedChannel:
|
||||
return shortName ? "Red" : "Red Channel";
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_GreenChannel:
|
||||
return shortName ? "Green" : "Green Channel";
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_BlueChannel:
|
||||
return shortName ? "Blue" : "Blue Channel";
|
||||
case QBitmapPreviewDialogImp::eHistogramMode_AlphaChannel:
|
||||
return shortName ? "Alpha" : "Alpha Channel";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::refreshData()
|
||||
{
|
||||
// Check if we have some usefull data loaded
|
||||
if (m_image->GetWidth() * m_image->GetHeight() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int w = m_image->GetWidth();
|
||||
int h = m_image->GetHeight();
|
||||
|
||||
int multiplier = (m_showMode == ESHOW_RGB_ALPHA ? 2 : 1);
|
||||
int originalW = w * multiplier;
|
||||
int originalH = h;
|
||||
|
||||
if (!m_showOriginalSize || (w == 0))
|
||||
{
|
||||
w = kDefaultWidth;
|
||||
}
|
||||
if (!m_showOriginalSize || (h == 0))
|
||||
{
|
||||
h = kDefaultHeight;
|
||||
}
|
||||
|
||||
w *= multiplier;
|
||||
|
||||
CImageEx scaledImage;
|
||||
|
||||
if (m_showOriginalSize && (originalW < w))
|
||||
{
|
||||
w = originalW;
|
||||
}
|
||||
if (m_showOriginalSize && (originalH < h))
|
||||
{
|
||||
h = originalH;
|
||||
}
|
||||
|
||||
scaledImage.Allocate(w, h);
|
||||
|
||||
if (m_showMode == ESHOW_RGB_ALPHA)
|
||||
{
|
||||
GetIEditor()->GetImageUtil()->ScaleToDoubleFit(*m_image, scaledImage);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetIEditor()->GetImageUtil()->ScaleToFit(*m_image, scaledImage);
|
||||
}
|
||||
|
||||
if (m_showMode == ESHOW_RGB || m_showMode == ESHOW_RGBE)
|
||||
{
|
||||
scaledImage.FillAlpha();
|
||||
}
|
||||
else if (m_showMode == ESHOW_ALPHA)
|
||||
{
|
||||
for (int h2 = 0; h2 < scaledImage.GetHeight(); h2++)
|
||||
{
|
||||
for (int w2 = 0; w2 < scaledImage.GetWidth(); w2++)
|
||||
{
|
||||
int a = scaledImage.ValueAt(w2, h2) >> 24;
|
||||
scaledImage.ValueAt(w2, h2) = RGB(a, a, a) | (a << 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_showMode == ESHOW_RGB_ALPHA)
|
||||
{
|
||||
int halfWidth = scaledImage.GetWidth() / 2;
|
||||
for (int h2 = 0; h2 < scaledImage.GetHeight(); h2++)
|
||||
{
|
||||
for (int w2 = 0; w2 < halfWidth; w2++)
|
||||
{
|
||||
int r = GetRValue(scaledImage.ValueAt(w2, h2));
|
||||
int g = GetGValue(scaledImage.ValueAt(w2, h2));
|
||||
int b = GetBValue(scaledImage.ValueAt(w2, h2));
|
||||
int a = scaledImage.ValueAt(w2, h2) >> 24;
|
||||
scaledImage.ValueAt(w2, h2) = RGB(r, g, b) | (a << 24);
|
||||
scaledImage.ValueAt(w2 + halfWidth, h2) = RGB(a, a, a) | (a << 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setImageRgba8888(scaledImage.GetData(), w, h, "");
|
||||
setSize(QString().asprintf("%d x %d", m_image->GetWidth(), m_image->GetHeight()));
|
||||
setMips(QString().asprintf("%d", m_image->GetNumberOfMipMaps()));
|
||||
|
||||
setFullSize(m_showOriginalSize);
|
||||
|
||||
// Compute histogram
|
||||
m_histogram.ComputeHistogram((BYTE*)scaledImage.GetData(), w, h, CImageHistogram::eImageFormat_32BPP_RGBA);
|
||||
}
|
||||
|
||||
void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
|
||||
{
|
||||
QBitmapPreviewDialog::paintEvent(e);
|
||||
|
||||
//if showing original size hide other information so it's easier to see
|
||||
if (m_showOriginalSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_uiStyle == EUISTYLE_IMAGE_ONLY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QPainter p(this);
|
||||
QPen pen;
|
||||
QPainterPath path[4];
|
||||
|
||||
// Fill background color
|
||||
QRect histogramRect = getHistogramArea();
|
||||
p.fillRect(histogramRect, QColor(255, 255, 255));
|
||||
|
||||
// Draw borders
|
||||
pen.setColor(QColor(0, 0, 0));
|
||||
p.setPen(pen);
|
||||
p.drawRect(histogramRect);
|
||||
|
||||
// Draw histogram
|
||||
|
||||
QVector<int> drawChannels;
|
||||
|
||||
switch (m_histrogramMode)
|
||||
{
|
||||
case eHistogramMode_Luminosity:
|
||||
drawChannels.push_back(3);
|
||||
break;
|
||||
case eHistogramMode_SplitRGB:
|
||||
drawChannels.push_back(0);
|
||||
drawChannels.push_back(1);
|
||||
drawChannels.push_back(2);
|
||||
break;
|
||||
case eHistogramMode_OverlappedRGB:
|
||||
drawChannels.push_back(0);
|
||||
drawChannels.push_back(1);
|
||||
drawChannels.push_back(2);
|
||||
break;
|
||||
case eHistogramMode_RedChannel:
|
||||
drawChannels.push_back(0);
|
||||
break;
|
||||
case eHistogramMode_GreenChannel:
|
||||
drawChannels.push_back(1);
|
||||
break;
|
||||
case eHistogramMode_BlueChannel:
|
||||
drawChannels.push_back(2);
|
||||
break;
|
||||
case eHistogramMode_AlphaChannel:
|
||||
drawChannels.push_back(3);
|
||||
break;
|
||||
}
|
||||
|
||||
int graphWidth = qMax(histogramRect.width(), 1);
|
||||
int graphHeight = qMax(histogramRect.height() - 2, 0);
|
||||
int graphBottom = histogramRect.bottom() + 1;
|
||||
int currX[4] = {0, 0, 0, 0};
|
||||
int prevX[4] = {0, 0, 0, 0};
|
||||
float scale = 0.0f;
|
||||
static const int numSubGraphs = 3;
|
||||
const int subGraph = qCeil(graphWidth / numSubGraphs);
|
||||
|
||||
// Fill background for Split RGB histogram
|
||||
if (m_histrogramMode == eHistogramMode_SplitRGB)
|
||||
{
|
||||
const static QColor backgroundColor[numSubGraphs] =
|
||||
{
|
||||
QColor(255, 220, 220),
|
||||
QColor(220, 255, 220),
|
||||
QColor(220, 220, 255)
|
||||
};
|
||||
|
||||
for (int i = 0; i < numSubGraphs; i++)
|
||||
{
|
||||
p.fillRect(histogramRect.left() + subGraph * i,
|
||||
histogramRect.top(),
|
||||
subGraph + (i == numSubGraphs - 1 ? 1 : 0),
|
||||
histogramRect.height(), backgroundColor[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int lastHeight[CImageHistogram::kNumChannels] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
|
||||
|
||||
for (int x = 0; x < graphWidth; ++x)
|
||||
{
|
||||
for (int j = 0; j < drawChannels.size(); j++)
|
||||
{
|
||||
const int c = drawChannels[j];
|
||||
int& curr_x = currX[c];
|
||||
int& prev_x = prevX[c];
|
||||
int& last_height = lastHeight[c];
|
||||
QPainterPath& curr_path = path[c];
|
||||
|
||||
|
||||
curr_x = histogramRect.left() + x + 1;
|
||||
int i = static_cast<int>(((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1));
|
||||
if (m_histrogramMode == eHistogramMode_SplitRGB)
|
||||
{
|
||||
// Filter out to area which we are interested
|
||||
const int k = x / subGraph;
|
||||
if (k != c)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
i = qCeil((i - (subGraph * c)) * numSubGraphs);
|
||||
i = qMin(i, CImageHistogram::kNumColorLevels - 1);
|
||||
i = qMax(i, 0);
|
||||
}
|
||||
|
||||
if (m_histrogramMode == eHistogramMode_Luminosity)
|
||||
{
|
||||
scale = (float)m_histogram.m_lumCount[i] / m_histogram.m_maxLumCount;
|
||||
}
|
||||
else if (m_histogram.m_maxCount[c])
|
||||
{
|
||||
scale = (float)m_histogram.m_count[c][i] / m_histogram.m_maxCount[c];
|
||||
}
|
||||
|
||||
int height = static_cast<int>(graphBottom - graphHeight * scale);
|
||||
if (last_height == INT_MAX)
|
||||
{
|
||||
last_height = height;
|
||||
}
|
||||
|
||||
curr_path.moveTo(prev_x, last_height);
|
||||
curr_path.lineTo(curr_x, height);
|
||||
last_height = height;
|
||||
|
||||
if (prev_x == INT_MAX)
|
||||
{
|
||||
prev_x = curr_x;
|
||||
}
|
||||
|
||||
prev_x = curr_x;
|
||||
}
|
||||
}
|
||||
|
||||
static const QColor kChannelColor[4] =
|
||||
{
|
||||
QColor(255, 0, 0),
|
||||
QColor(0, 255, 0),
|
||||
QColor(0, 0, 255),
|
||||
QColor(120, 120, 120)
|
||||
};
|
||||
|
||||
for (int i = 0; i < drawChannels.size(); i++)
|
||||
{
|
||||
const int c = drawChannels[i];
|
||||
pen.setColor(kChannelColor[c]);
|
||||
p.setPen(pen);
|
||||
p.drawPath(path[c]);
|
||||
}
|
||||
|
||||
// Update histogram info
|
||||
{
|
||||
float mean = 0, stdDev = 0, median = 0;
|
||||
|
||||
switch (m_histrogramMode)
|
||||
{
|
||||
case eHistogramMode_Luminosity:
|
||||
case eHistogramMode_SplitRGB:
|
||||
case eHistogramMode_OverlappedRGB:
|
||||
mean = m_histogram.m_meanAvg;
|
||||
stdDev = m_histogram.m_stdDevAvg;
|
||||
median = m_histogram.m_medianAvg;
|
||||
break;
|
||||
case eHistogramMode_RedChannel:
|
||||
mean = m_histogram.m_mean[0];
|
||||
stdDev = m_histogram.m_stdDev[0];
|
||||
median = m_histogram.m_median[0];
|
||||
break;
|
||||
case eHistogramMode_GreenChannel:
|
||||
mean = m_histogram.m_mean[1];
|
||||
stdDev = m_histogram.m_stdDev[1];
|
||||
median = m_histogram.m_median[1];
|
||||
break;
|
||||
case eHistogramMode_BlueChannel:
|
||||
mean = m_histogram.m_mean[2];
|
||||
stdDev = m_histogram.m_stdDev[2];
|
||||
median = m_histogram.m_median[2];
|
||||
break;
|
||||
case eHistogramMode_AlphaChannel:
|
||||
mean = m_histogram.m_mean[3];
|
||||
stdDev = m_histogram.m_stdDev[3];
|
||||
median = m_histogram.m_median[3];
|
||||
break;
|
||||
}
|
||||
QString val;
|
||||
val.setNum(mean);
|
||||
setMean(val);
|
||||
val.setNum(stdDev);
|
||||
setStdDev(val);
|
||||
val.setNum(median);
|
||||
setMedian(val);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Controls/moc_QBitmapPreviewDialogImp.cpp>
|
||||
@@ -1,89 +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
|
||||
*
|
||||
*/
|
||||
#ifndef QBITMAPPREVIEWDIALOG_IMP_H
|
||||
#define QBITMAPPREVIEWDIALOG_IMP_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "QBitmapPreviewDialog.h"
|
||||
#include <Util/ImageHistogram.h>
|
||||
#endif
|
||||
|
||||
class CImageEx;
|
||||
|
||||
class QBitmapPreviewDialogImp
|
||||
: public QBitmapPreviewDialog
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
|
||||
enum EUIStyle
|
||||
{
|
||||
EUISTYLE_IMAGE_ONLY,
|
||||
EUISTYLE_IMAGE_HISTOGRAM,
|
||||
EUISTYLE_NumModes
|
||||
};
|
||||
|
||||
enum EShowMode
|
||||
{
|
||||
ESHOW_RGB = 0,
|
||||
ESHOW_ALPHA,
|
||||
ESHOW_RGBA,
|
||||
ESHOW_RGB_ALPHA,
|
||||
ESHOW_RGBE,
|
||||
ESHOW_NumModes,
|
||||
};
|
||||
|
||||
enum EHistogramMode
|
||||
{
|
||||
eHistogramMode_Luminosity,
|
||||
eHistogramMode_OverlappedRGB,
|
||||
eHistogramMode_SplitRGB,
|
||||
eHistogramMode_RedChannel,
|
||||
eHistogramMode_GreenChannel,
|
||||
eHistogramMode_BlueChannel,
|
||||
eHistogramMode_AlphaChannel,
|
||||
eHistogramMode_NumModes,
|
||||
};
|
||||
|
||||
explicit QBitmapPreviewDialogImp(QWidget* parent = 0);
|
||||
virtual ~QBitmapPreviewDialogImp();
|
||||
|
||||
void setImage(const QString path);
|
||||
|
||||
void setShowMode(EShowMode mode);
|
||||
void toggleShowMode();
|
||||
void setUIStyleMode(EUIStyle mode);
|
||||
const EShowMode& getShowMode() const;
|
||||
|
||||
void setHistogramMode(EHistogramMode mode);
|
||||
void toggleHistrogramMode();
|
||||
const EHistogramMode& getHistogramMode() const;
|
||||
|
||||
void setOriginalSize(bool value);
|
||||
void toggleOriginalSize();
|
||||
|
||||
bool isSizeSmallerThanDefault();
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
|
||||
protected:
|
||||
void refreshData();
|
||||
|
||||
private:
|
||||
const char* GetShowModeDescription(EShowMode eShowMode, bool bShowInOriginalSize) const;
|
||||
|
||||
private:
|
||||
CImageEx* m_image;
|
||||
QString m_path;
|
||||
CImageHistogram m_histogram;
|
||||
bool m_showOriginalSize;
|
||||
EShowMode m_showMode;
|
||||
EHistogramMode m_histrogramMode;
|
||||
EUIStyle m_uiStyle;
|
||||
};
|
||||
|
||||
#endif // QBITMAPPREVIEWDIALOG_IMP_H
|
||||
@@ -1,642 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include <Controls/QToolTipWidget.h>
|
||||
|
||||
#include "QBitmapPreviewDialogImp.h"
|
||||
#include "qcoreapplication.h"
|
||||
#include "qguiapplication.h"
|
||||
#include "qapplication.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QPainter>
|
||||
#include <QtGlobal>
|
||||
#include <qgraphicseffect.h>
|
||||
|
||||
void QToolTipWidget::RebuildLayout()
|
||||
{
|
||||
if (m_title != nullptr)
|
||||
{
|
||||
m_title->hide();
|
||||
}
|
||||
if (m_content != nullptr)
|
||||
{
|
||||
m_content->hide();
|
||||
}
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
m_specialContent->hide();
|
||||
}
|
||||
|
||||
//empty layout
|
||||
while (m_layout->count() > 0)
|
||||
{
|
||||
m_layout->takeAt(0);
|
||||
}
|
||||
qDeleteAll(m_currentShortcuts);
|
||||
m_currentShortcuts.clear();
|
||||
if (m_includeTextureShortcuts)
|
||||
{
|
||||
m_currentShortcuts.append(new QLabel(tr("Alt - Alpha"), this));
|
||||
m_currentShortcuts.back()->setProperty("tooltipLabel", "Shortcut");
|
||||
m_currentShortcuts.append(new QLabel(tr("Shift - RGBA"), this));
|
||||
m_currentShortcuts.back()->setProperty("tooltipLabel", "Shortcut");
|
||||
}
|
||||
|
||||
if (m_title != nullptr && !m_title->text().isEmpty())
|
||||
{
|
||||
m_layout->addWidget(m_title);
|
||||
m_title->show();
|
||||
}
|
||||
|
||||
for (QLabel* var : m_currentShortcuts)
|
||||
{
|
||||
if (var != nullptr)
|
||||
{
|
||||
m_layout->addWidget(var);
|
||||
var->show();
|
||||
}
|
||||
}
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
m_layout->addWidget(m_specialContent);
|
||||
m_specialContent->show();
|
||||
}
|
||||
if (m_content != nullptr && !m_content->text().isEmpty())
|
||||
{
|
||||
m_layout->addWidget(m_content);
|
||||
m_content->show();
|
||||
}
|
||||
m_background->adjustSize();
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void QToolTipWidget::Hide()
|
||||
{
|
||||
m_currentShortcuts.clear();
|
||||
hide();
|
||||
}
|
||||
|
||||
void QToolTipWidget::Show(QPoint pos, ArrowDirection dir)
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_arrow->m_direction = dir;
|
||||
pos = AdjustTipPosByArrowSize(pos, dir);
|
||||
m_normalPos = pos;
|
||||
move(pos);
|
||||
RebuildLayout();
|
||||
show();
|
||||
m_arrow->show();
|
||||
}
|
||||
|
||||
void QToolTipWidget::Display(QRect targetRect, ArrowDirection preferredArrowDir)
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KeepTipOnScreen(targetRect, preferredArrowDir);
|
||||
|
||||
RebuildLayout();
|
||||
show();
|
||||
m_arrow->show();
|
||||
}
|
||||
|
||||
void QToolTipWidget::TryDisplay(QPoint mousePos, const QRect& rect, [[maybe_unused]] ArrowDirection preferredArrowDir)
|
||||
{
|
||||
if (rect.contains(mousePos))
|
||||
{
|
||||
Display(rect, QToolTipWidget::ArrowDirection::ARROW_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
void QToolTipWidget::TryDisplay(QPoint mousePos, const QWidget* widget, ArrowDirection preferredArrowDir)
|
||||
{
|
||||
const QRect rect(widget->mapToGlobal(QPoint(0,0)), widget->size());
|
||||
TryDisplay(mousePos, rect, preferredArrowDir);
|
||||
}
|
||||
|
||||
void QToolTipWidget::SetTitle(QString title)
|
||||
{
|
||||
if (!title.isEmpty())
|
||||
{
|
||||
m_title->setText(title);
|
||||
}
|
||||
m_title->setProperty("tooltipLabel", "Title");
|
||||
|
||||
setWindowTitle("ToolTip - " + title);
|
||||
}
|
||||
|
||||
void QToolTipWidget::SetContent(QString content)
|
||||
{
|
||||
m_content->setWordWrap(true);
|
||||
|
||||
m_content->setProperty("tooltipLabel", "Content");
|
||||
//line-height is not supported via stylesheet so we use the html rich-text subset in QT for it.
|
||||
m_content->setText(QString("<span style=\"line-height: 14px;\">%1</span>").arg(content));
|
||||
}
|
||||
|
||||
void QToolTipWidget::AppendContent(QString content)
|
||||
{
|
||||
m_content->setText(m_content->text() + "\n\n" + content);
|
||||
update();
|
||||
RebuildLayout();
|
||||
m_content->update();
|
||||
m_content->repaint();
|
||||
}
|
||||
|
||||
QToolTipWidget::QToolTipWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_background = new QWidget(this);
|
||||
m_background->setProperty("tooltip", "Background");
|
||||
m_background->stackUnder(this);
|
||||
m_title = new QLabel(this);
|
||||
m_currentShortcuts = QVector<QLabel*>();
|
||||
m_content = new QLabel(this);
|
||||
m_specialContent = nullptr;
|
||||
setWindowTitle("ToolTip");
|
||||
setObjectName("ToolTip");
|
||||
m_layout = new QVBoxLayout(this);
|
||||
m_normalPos = QPoint(0, 0);
|
||||
m_arrow = new QArrow(m_background);
|
||||
setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint);
|
||||
m_arrow->setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint);
|
||||
m_arrow->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
m_background->setLayout(m_layout);
|
||||
m_arrow->setObjectName("ToolTipArrow");
|
||||
m_background->setObjectName("ToolTipBackground");
|
||||
|
||||
//we need a drop shadow for the background
|
||||
QGraphicsDropShadowEffect* dropShadow = new QGraphicsDropShadowEffect(this);
|
||||
dropShadow->setBlurRadius(m_shadowRadius);
|
||||
dropShadow->setColor(Qt::black);
|
||||
dropShadow->setOffset(0);
|
||||
dropShadow->setEnabled(true);
|
||||
m_background->setGraphicsEffect(dropShadow);
|
||||
//we need a second drop shadow effect for the arrow
|
||||
dropShadow = new QGraphicsDropShadowEffect(m_arrow);
|
||||
dropShadow->setBlurRadius(m_shadowRadius);
|
||||
dropShadow->setColor(Qt::black);
|
||||
dropShadow->setOffset(0);
|
||||
dropShadow->setEnabled(true);
|
||||
m_arrow->setGraphicsEffect(dropShadow);
|
||||
}
|
||||
|
||||
QToolTipWidget::~QToolTipWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void QToolTipWidget::AddSpecialContent(QString type, QString dataStream)
|
||||
{
|
||||
if (type.isEmpty())
|
||||
{
|
||||
m_includeTextureShortcuts = false;
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
delete m_specialContent;
|
||||
m_specialContent = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (type == "TEXTURE")
|
||||
{
|
||||
if (m_specialContent == nullptr)
|
||||
{
|
||||
QCoreApplication::instance()->installEventFilter(this); //grab the event filter while displaying the advanced texture tooltip
|
||||
m_specialContent = new QBitmapPreviewDialogImp(this);
|
||||
}
|
||||
QString path(dataStream);
|
||||
qobject_cast<QBitmapPreviewDialogImp*>(m_specialContent)->setImage(path);
|
||||
// set default showmode to RGB
|
||||
qobject_cast<QBitmapPreviewDialogImp*>(m_specialContent)->setShowMode(QBitmapPreviewDialogImp::EShowMode::ESHOW_RGB);
|
||||
QString dir = (path.split("/").count() > path.split("\\").count()) ? path.split("/").back() : path.split("\\").back();
|
||||
SetTitle(dir);
|
||||
//always use default size but not image size
|
||||
qobject_cast<QBitmapPreviewDialogImp*>(m_specialContent)->setOriginalSize(false);
|
||||
m_includeTextureShortcuts = true;
|
||||
}
|
||||
else if (type == "ADD TO CONTENT")
|
||||
{
|
||||
AppendContent(dataStream);
|
||||
|
||||
m_includeTextureShortcuts = false;
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
delete m_specialContent;
|
||||
m_specialContent = nullptr;
|
||||
}
|
||||
}
|
||||
else if (type == "REPLACE TITLE")
|
||||
{
|
||||
SetTitle(dataStream);
|
||||
m_includeTextureShortcuts = false;
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
delete m_specialContent;
|
||||
m_specialContent = nullptr;
|
||||
}
|
||||
}
|
||||
else if (type == "REPLACE CONTENT")
|
||||
{
|
||||
SetContent(dataStream);
|
||||
m_includeTextureShortcuts = false;
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
delete m_specialContent;
|
||||
m_specialContent = nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_includeTextureShortcuts = false;
|
||||
if (m_specialContent != nullptr)
|
||||
{
|
||||
delete m_specialContent;
|
||||
m_specialContent = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
m_special = type;
|
||||
}
|
||||
|
||||
|
||||
bool QToolTipWidget::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
if (m_special == "TEXTURE" && m_specialContent != nullptr)
|
||||
{
|
||||
const QKeyEvent* ke = static_cast<QKeyEvent*>(event);
|
||||
Qt::KeyboardModifiers mods = ke->modifiers();
|
||||
if (mods & Qt::KeyboardModifier::AltModifier)
|
||||
{
|
||||
((QBitmapPreviewDialogImp*)m_specialContent)->setShowMode(QBitmapPreviewDialogImp::ESHOW_ALPHA);
|
||||
}
|
||||
else if (mods & Qt::KeyboardModifier::ShiftModifier && !(mods & Qt::KeyboardModifier::ControlModifier))
|
||||
{
|
||||
((QBitmapPreviewDialogImp*)m_specialContent)->setShowMode(QBitmapPreviewDialogImp::ESHOW_RGBA);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event->type() == QEvent::KeyRelease)
|
||||
{
|
||||
if (m_special == "TEXTURE" && m_specialContent != nullptr)
|
||||
{
|
||||
const QKeyEvent* ke = static_cast<QKeyEvent*>(event);
|
||||
Qt::KeyboardModifiers mods = ke->modifiers();
|
||||
if (!(mods& Qt::KeyboardModifier::AltModifier) && !(mods & Qt::KeyboardModifier::ShiftModifier))
|
||||
{
|
||||
((QBitmapPreviewDialogImp*)m_specialContent)->setShowMode(QBitmapPreviewDialogImp::ESHOW_RGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void QToolTipWidget::hideEvent(QHideEvent* event)
|
||||
{
|
||||
QWidget::hideEvent(event);
|
||||
m_arrow->hide();
|
||||
}
|
||||
|
||||
void QToolTipWidget::UpdateOptionalData(QString optionalData)
|
||||
{
|
||||
AddSpecialContent(m_special, optionalData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QPoint QToolTipWidget::AdjustTipPosByArrowSize(QPoint pos, ArrowDirection dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case QToolTipWidget::ArrowDirection::ARROW_UP:
|
||||
{
|
||||
m_arrow->move(pos);
|
||||
pos.setY(pos.y() + 10);
|
||||
m_arrow->setFixedSize(20, 10);
|
||||
pos -= QPoint(m_shadowRadius, m_shadowRadius);
|
||||
break;
|
||||
}
|
||||
case QToolTipWidget::ArrowDirection::ARROW_LEFT:
|
||||
{
|
||||
m_arrow->move(pos);
|
||||
pos.setX(pos.x() + 10);
|
||||
m_arrow->setFixedSize(10, 20);
|
||||
pos -= QPoint(m_shadowRadius, m_shadowRadius);
|
||||
break;
|
||||
}
|
||||
case QToolTipWidget::ArrowDirection::ARROW_RIGHT:
|
||||
{
|
||||
pos.setX(pos.x() - 10);
|
||||
m_arrow->move(QPoint(pos.x() + width(), pos.y()));
|
||||
m_arrow->setFixedSize(10, 20);
|
||||
pos -= QPoint(-m_shadowRadius, m_shadowRadius);
|
||||
break;
|
||||
}
|
||||
case QToolTipWidget::ArrowDirection::ARROW_DOWN:
|
||||
{
|
||||
pos.setY(pos.y() - 10);
|
||||
m_arrow->move(QPoint(pos.x(), pos.y() + height()));
|
||||
m_arrow->setFixedSize(20, 10);
|
||||
pos -= QPoint(m_shadowRadius, -m_shadowRadius);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
m_arrow->move(-10, -10);
|
||||
break;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool QToolTipWidget::IsValid()
|
||||
{
|
||||
if (m_title->text().isEmpty() ||
|
||||
(m_content->text().isEmpty() && m_specialContent == nullptr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void QToolTipWidget::KeepTipOnScreen(QRect targetRect, ArrowDirection preferredArrowDir)
|
||||
{
|
||||
QRect desktop = QApplication::desktop()->availableGeometry(this);
|
||||
|
||||
if (this->isHidden())
|
||||
{
|
||||
setAttribute(Qt::WA_DontShowOnScreen, true);
|
||||
Show(QPoint(0, 0), preferredArrowDir);
|
||||
hide();
|
||||
setAttribute(Qt::WA_DontShowOnScreen, false);
|
||||
}
|
||||
//else assume the size is right
|
||||
|
||||
//calculate initial rect
|
||||
QRect tipRect = QRect(0, 0, 0, 0);
|
||||
switch (preferredArrowDir)
|
||||
{
|
||||
case QToolTipWidget::ArrowDirection::ARROW_UP:
|
||||
{
|
||||
//tip is below the widget with a left alignment
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(targetRect.bottomLeft(), preferredArrowDir));
|
||||
break;
|
||||
}
|
||||
case QToolTipWidget::ArrowDirection::ARROW_LEFT:
|
||||
{
|
||||
//tip is on the right with the top being even
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(targetRect.topRight(), preferredArrowDir));
|
||||
break;
|
||||
}
|
||||
case QToolTipWidget::ArrowDirection::ARROW_RIGHT:
|
||||
{
|
||||
//tip is on the left with the top being even
|
||||
tipRect.setY(targetRect.top());
|
||||
tipRect.setX(targetRect.left() - width());
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(tipRect.topLeft(), preferredArrowDir));
|
||||
break;
|
||||
}
|
||||
case QToolTipWidget::ArrowDirection::ARROW_DOWN:
|
||||
{
|
||||
//tip is above the widget with a left alignment
|
||||
tipRect.setX(targetRect.left());
|
||||
tipRect.setY(targetRect.top() - height());
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(tipRect.topLeft(), preferredArrowDir));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//tip is on the right with the top being even
|
||||
preferredArrowDir = QToolTipWidget::ArrowDirection::ARROW_LEFT;
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(targetRect.topRight(), QToolTipWidget::ArrowDirection::ARROW_LEFT));
|
||||
break;
|
||||
}
|
||||
}
|
||||
tipRect.setSize(size());
|
||||
|
||||
//FixPositioning
|
||||
if (preferredArrowDir == ArrowDirection::ARROW_LEFT || preferredArrowDir == ArrowDirection::ARROW_RIGHT)
|
||||
{
|
||||
if (tipRect.left() <= desktop.left())
|
||||
{
|
||||
m_arrow->m_direction = ArrowDirection::ARROW_LEFT;
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(targetRect.topRight(), m_arrow->m_direction));
|
||||
}
|
||||
else if (tipRect.right() >= desktop.right())
|
||||
{
|
||||
m_arrow->m_direction = ArrowDirection::ARROW_RIGHT;
|
||||
tipRect.setLeft(targetRect.left() - width());
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(tipRect.topLeft(), m_arrow->m_direction));
|
||||
}
|
||||
}
|
||||
else if (preferredArrowDir == ArrowDirection::ARROW_UP || preferredArrowDir == ArrowDirection::ARROW_DOWN)
|
||||
{
|
||||
if (tipRect.top() <= desktop.top())
|
||||
{
|
||||
m_arrow->m_direction = ArrowDirection::ARROW_UP;
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(targetRect.bottomLeft(), m_arrow->m_direction));
|
||||
}
|
||||
else if (tipRect.bottom() >= desktop.bottom())
|
||||
{
|
||||
m_arrow->m_direction = ArrowDirection::ARROW_DOWN;
|
||||
tipRect.setY(targetRect.top() - height());
|
||||
tipRect.setTopLeft(AdjustTipPosByArrowSize(tipRect.topLeft(), m_arrow->m_direction));
|
||||
}
|
||||
}
|
||||
|
||||
//Nudge tip without arrow
|
||||
if (preferredArrowDir == ArrowDirection::ARROW_UP || preferredArrowDir == ArrowDirection::ARROW_DOWN)
|
||||
{
|
||||
if (tipRect.left() <= desktop.left())
|
||||
{
|
||||
tipRect.setLeft(desktop.left());
|
||||
}
|
||||
else if (tipRect.right() >= desktop.right())
|
||||
{
|
||||
tipRect.setLeft(desktop.right() - width());
|
||||
}
|
||||
}
|
||||
else if (preferredArrowDir == ArrowDirection::ARROW_RIGHT || preferredArrowDir == ArrowDirection::ARROW_LEFT)
|
||||
{
|
||||
if (tipRect.top() <= desktop.top())
|
||||
{
|
||||
tipRect.setTop(desktop.top());
|
||||
}
|
||||
else if (tipRect.bottom() >= desktop.bottom())
|
||||
{
|
||||
tipRect.setTop(desktop.bottom() - height());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_normalPos = tipRect.topLeft();
|
||||
move(m_normalPos);
|
||||
}
|
||||
|
||||
QPolygonF QToolTipWidget::QArrow::CreateArrow()
|
||||
{
|
||||
QVector<QPointF> vertex;
|
||||
//3 points in triangle
|
||||
vertex.reserve(3);
|
||||
//all magic number below are given in order to draw smooth transitions between tooltip and arrow
|
||||
if (m_direction == ArrowDirection::ARROW_UP)
|
||||
{
|
||||
vertex.push_back(QPointF(10, 1));
|
||||
vertex.push_back(QPointF(19, 10));
|
||||
vertex.push_back(QPointF(0, 10));
|
||||
}
|
||||
else if (m_direction == ArrowDirection::ARROW_RIGHT)
|
||||
{
|
||||
vertex.push_back(QPointF(9, 10));
|
||||
vertex.push_back(QPointF(0, 19));
|
||||
vertex.push_back(QPointF(0, 1));
|
||||
}
|
||||
else if (m_direction == ArrowDirection::ARROW_LEFT)
|
||||
{
|
||||
vertex.push_back(QPointF(1, 10));
|
||||
vertex.push_back(QPointF(10, 19));
|
||||
vertex.push_back(QPointF(10, 0));
|
||||
}
|
||||
else //ArrowDirection::ARROW_DOWN
|
||||
{
|
||||
vertex.push_back(QPointF(10, 10));
|
||||
vertex.push_back(QPointF(19, 0));
|
||||
vertex.push_back(QPointF(0, 0));
|
||||
}
|
||||
return QPolygonF(vertex);
|
||||
}
|
||||
|
||||
void QToolTipWidget::QArrow::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
{
|
||||
QColor color(255, 255, 255, 255);
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), Qt::transparent); //force transparency
|
||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
painter.setBrush(color);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.drawPolygon(CreateArrow());
|
||||
//painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
}
|
||||
|
||||
QToolTipWrapper::QToolTipWrapper(QWidget* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void QToolTipWrapper::SetTitle(QString title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
void QToolTipWrapper::SetContent(QString content)
|
||||
{
|
||||
AddSpecialContent("REPLACE CONTENT", content);
|
||||
}
|
||||
|
||||
void QToolTipWrapper::AppendContent(QString content)
|
||||
{
|
||||
AddSpecialContent("ADD TO CONTENT", content);
|
||||
}
|
||||
|
||||
void QToolTipWrapper::AddSpecialContent(QString type, QString dataStream)
|
||||
{
|
||||
if (type == "REPLACE CONTENT")
|
||||
{
|
||||
m_contentOperations.clear();
|
||||
}
|
||||
m_contentOperations.push_back({type, dataStream});
|
||||
}
|
||||
|
||||
void QToolTipWrapper::UpdateOptionalData(QString optionalData)
|
||||
{
|
||||
m_contentOperations.push_back({"UPDATE OPTIONAL", optionalData});
|
||||
}
|
||||
|
||||
void QToolTipWrapper::Display(QRect targetRect, QToolTipWidget::ArrowDirection preferredArrowDir)
|
||||
{
|
||||
GetOrCreateToolTip()->Display(targetRect, preferredArrowDir);
|
||||
}
|
||||
|
||||
void QToolTipWrapper::TryDisplay(QPoint mousePos, const QWidget * widget, QToolTipWidget::ArrowDirection preferredArrowDir)
|
||||
{
|
||||
GetOrCreateToolTip()->TryDisplay(mousePos, widget, preferredArrowDir);
|
||||
}
|
||||
|
||||
void QToolTipWrapper::TryDisplay(QPoint mousePos, const QRect & widget, QToolTipWidget::ArrowDirection preferredArrowDir)
|
||||
{
|
||||
GetOrCreateToolTip()->TryDisplay(mousePos, widget, preferredArrowDir);
|
||||
}
|
||||
|
||||
void QToolTipWrapper::hide()
|
||||
{
|
||||
DestroyToolTip();
|
||||
}
|
||||
|
||||
void QToolTipWrapper::show()
|
||||
{
|
||||
GetOrCreateToolTip()->show();
|
||||
}
|
||||
|
||||
bool QToolTipWrapper::isVisible() const
|
||||
{
|
||||
return m_actualTooltip && m_actualTooltip->isVisible();
|
||||
}
|
||||
|
||||
void QToolTipWrapper::update()
|
||||
{
|
||||
if (m_actualTooltip)
|
||||
{
|
||||
m_actualTooltip->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QToolTipWrapper::ReplayContentOperations(QToolTipWidget* tooltipWidget)
|
||||
{
|
||||
tooltipWidget->SetTitle(m_title);
|
||||
for (const auto& operation : m_contentOperations)
|
||||
{
|
||||
if (operation.first == "UPDATE OPTIONAL")
|
||||
{
|
||||
tooltipWidget->UpdateOptionalData(operation.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipWidget->AddSpecialContent(operation.first, operation.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QToolTipWidget * QToolTipWrapper::GetOrCreateToolTip()
|
||||
{
|
||||
if (!m_actualTooltip)
|
||||
{
|
||||
QToolTipWidget* tooltipWidget = new QToolTipWidget(static_cast<QWidget*>(parent()));
|
||||
tooltipWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
ReplayContentOperations(tooltipWidget);
|
||||
m_actualTooltip = tooltipWidget;
|
||||
}
|
||||
return m_actualTooltip.data();
|
||||
}
|
||||
|
||||
void QToolTipWrapper::DestroyToolTip()
|
||||
{
|
||||
if (m_actualTooltip)
|
||||
{
|
||||
m_actualTooltip->deleteLater();
|
||||
}
|
||||
}
|
||||
@@ -1,148 +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
|
||||
*
|
||||
*/
|
||||
#ifndef QToolTipWidget_h__
|
||||
#define QToolTipWidget_h__
|
||||
|
||||
#include "EditorCoreAPI.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QMapIterator>
|
||||
#include <QVector>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class IQToolTip
|
||||
{
|
||||
public:
|
||||
virtual void SetTitle(QString title) = 0;
|
||||
virtual void SetContent(QString content) = 0;
|
||||
virtual void AppendContent(QString content) = 0;
|
||||
virtual void AddSpecialContent(QString type, QString dataStream) = 0;
|
||||
virtual void UpdateOptionalData(QString optionalData) = 0;
|
||||
};
|
||||
|
||||
class EDITOR_CORE_API QToolTipWidget
|
||||
: public QWidget
|
||||
, public IQToolTip
|
||||
{
|
||||
public:
|
||||
enum class ArrowDirection
|
||||
{
|
||||
ARROW_UP,
|
||||
ARROW_LEFT,
|
||||
ARROW_RIGHT,
|
||||
ARROW_DOWN
|
||||
};
|
||||
class QArrow
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
ArrowDirection m_direction;
|
||||
QPoint m_pos;
|
||||
QArrow(QWidget* parent)
|
||||
: QWidget(parent){ setWindowFlags(Qt::ToolTip); }
|
||||
virtual ~QArrow(){}
|
||||
|
||||
QPolygonF CreateArrow();
|
||||
virtual void paintEvent(QPaintEvent*) override;
|
||||
};
|
||||
QToolTipWidget(QWidget* parent);
|
||||
~QToolTipWidget();
|
||||
void SetTitle(QString title) override;
|
||||
void SetContent(QString content) override;
|
||||
void AppendContent(QString content) override;
|
||||
void AddSpecialContent(QString type, QString dataStream) override;
|
||||
void UpdateOptionalData(QString optionalData) override;
|
||||
void Display(QRect targetRect, ArrowDirection preferredArrowDir);
|
||||
|
||||
//! Displays the tooltip on the given widget, only if the mouse is over it.
|
||||
void TryDisplay(QPoint mousePos, const QWidget* widget, ArrowDirection preferredArrowDir);
|
||||
|
||||
//! Displays the tooltip on the given rect, only if the mouse is over it.
|
||||
void TryDisplay(QPoint mousePos, const QRect& widget, ArrowDirection preferredArrowDir);
|
||||
|
||||
void Hide();
|
||||
|
||||
protected:
|
||||
void Show(QPoint pos, ArrowDirection dir);
|
||||
bool IsValid();
|
||||
void KeepTipOnScreen(QRect targetRect, ArrowDirection preferredArrowDir);
|
||||
QPoint AdjustTipPosByArrowSize(QPoint pos, ArrowDirection dir);
|
||||
virtual bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
void RebuildLayout();
|
||||
virtual void hideEvent(QHideEvent*) override;
|
||||
|
||||
QLabel* m_title;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
QVector<QLabel*> m_currentShortcuts;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
//can be anything from QLabel to QBitMapPreviewDialog
|
||||
//must allow movement, and show/hide calls
|
||||
QLabel* m_content;
|
||||
QWidget* m_specialContent;
|
||||
QWidget* m_background;
|
||||
QVBoxLayout* m_layout;
|
||||
QString m_special;
|
||||
QPoint m_normalPos;
|
||||
QArrow* m_arrow;
|
||||
const int m_shadowRadius = 5;
|
||||
bool m_includeTextureShortcuts; //added since Qt does not support modifier only shortcuts
|
||||
};
|
||||
|
||||
// HACK: The EditorUI_QT classes all were keeping persistent references to QToolTipWidgets around
|
||||
// This led to many, many top-level widget creations, which led to many platform-side window allocations
|
||||
// which led to crashes in Qt5.15. As this is legacy code, this is a drop-in replacement that only
|
||||
// allocates the actual QToolTipWidget (and thus platform window) while the tooltip is visible
|
||||
class EDITOR_CORE_API QToolTipWrapper
|
||||
: public QObject
|
||||
, public IQToolTip
|
||||
{
|
||||
public:
|
||||
QToolTipWrapper(QWidget* parent);
|
||||
|
||||
void SetTitle(QString title) override;
|
||||
void SetContent(QString content) override;
|
||||
void AppendContent(QString content) override;
|
||||
void AddSpecialContent(QString type, QString dataStream) override;
|
||||
void UpdateOptionalData(QString optionalData) override;
|
||||
|
||||
void Display(QRect targetRect, QToolTipWidget::ArrowDirection preferredArrowDir);
|
||||
void TryDisplay(QPoint mousePos, const QWidget* widget, QToolTipWidget::ArrowDirection preferredArrowDir);
|
||||
void TryDisplay(QPoint mousePos, const QRect& widget, QToolTipWidget::ArrowDirection preferredArrowDir);
|
||||
void hide();
|
||||
void show();
|
||||
bool isVisible() const;
|
||||
void update();
|
||||
void repaint(){update();} //Things really shouldn't be calling repaint on these...
|
||||
|
||||
void Hide(){hide();}
|
||||
void close(){hide();}
|
||||
|
||||
private:
|
||||
void ReplayContentOperations(QToolTipWidget* tooltipWidget);
|
||||
|
||||
QToolTipWidget* GetOrCreateToolTip();
|
||||
void DestroyToolTip();
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // conditional expression is constant, needs to have dll-interface to be used by clients of class 'AzQtComponents::FilteredSearchWidget'
|
||||
QPointer<QToolTipWidget> m_actualTooltip;
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
QString m_title;
|
||||
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // conditional expression is constant, needs to have dll-interface to be used by clients of class 'AzQtComponents::FilteredSearchWidget'
|
||||
QVector<QPair<QString, QString>> m_contentOperations;
|
||||
AZ_POP_DISABLE_WARNING
|
||||
};
|
||||
|
||||
|
||||
#endif // QToolTipWidget_h__
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "PropertyAnimationCtrl.h"
|
||||
|
||||
// Qt
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
|
||||
// Editor
|
||||
#include "Util/UIEnumerations.h"
|
||||
#include "IResourceSelectorHost.h"
|
||||
|
||||
AnimationPropertyCtrl::AnimationPropertyCtrl(QWidget *pParent)
|
||||
: QWidget(pParent)
|
||||
{
|
||||
m_animationLabel = new QLabel;
|
||||
|
||||
m_pApplyButton = new QToolButton;
|
||||
m_pApplyButton->setIcon(QIcon(":/reflectedPropertyCtrl/img/apply.png"));
|
||||
|
||||
m_pApplyButton->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
QHBoxLayout *pLayout = new QHBoxLayout(this);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->addWidget(m_animationLabel, 1);
|
||||
pLayout->addWidget(m_pApplyButton);
|
||||
|
||||
connect(m_pApplyButton, &QAbstractButton::clicked, this, &AnimationPropertyCtrl::OnApplyClicked);
|
||||
};
|
||||
|
||||
AnimationPropertyCtrl::~AnimationPropertyCtrl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AnimationPropertyCtrl::SetValue(const CReflectedVarAnimation &animation)
|
||||
{
|
||||
m_animation = animation;
|
||||
m_animationLabel->setText(animation.m_animation.c_str());
|
||||
}
|
||||
|
||||
CReflectedVarAnimation AnimationPropertyCtrl::value() const
|
||||
{
|
||||
return m_animation;
|
||||
}
|
||||
|
||||
void AnimationPropertyCtrl::OnApplyClicked()
|
||||
{
|
||||
QStringList cSelectedAnimations;
|
||||
int nTotalAnimations(0);
|
||||
int nCurrentAnimation(0);
|
||||
|
||||
QString combinedString = GetIEditor()->GetResourceSelectorHost()->GetGlobalSelection("animation");
|
||||
SplitString(combinedString, cSelectedAnimations, ',');
|
||||
|
||||
nTotalAnimations = cSelectedAnimations.size();
|
||||
for (nCurrentAnimation = 0; nCurrentAnimation < nTotalAnimations; ++nCurrentAnimation)
|
||||
{
|
||||
QString& rstrCurrentAnimAction = cSelectedAnimations[nCurrentAnimation];
|
||||
if (!rstrCurrentAnimAction.isEmpty())
|
||||
{
|
||||
m_animation.m_animation = rstrCurrentAnimAction.toUtf8().data();
|
||||
m_animationLabel->setText(m_animation.m_animation.c_str());
|
||||
emit ValueChanged(m_animation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* AnimationPropertyCtrl::GetFirstInTabOrder()
|
||||
{
|
||||
return m_pApplyButton;
|
||||
}
|
||||
QWidget* AnimationPropertyCtrl::GetLastInTabOrder()
|
||||
{
|
||||
return m_pApplyButton;
|
||||
}
|
||||
|
||||
void AnimationPropertyCtrl::UpdateTabOrder()
|
||||
{
|
||||
setTabOrder(m_pApplyButton, m_pApplyButton);
|
||||
}
|
||||
|
||||
|
||||
QWidget* AnimationPropertyWidgetHandler::CreateGUI(QWidget *pParent)
|
||||
{
|
||||
AnimationPropertyCtrl* newCtrl = aznew AnimationPropertyCtrl(pParent);
|
||||
connect(newCtrl, &AnimationPropertyCtrl::ValueChanged, newCtrl, [newCtrl]()
|
||||
{
|
||||
EBUS_EVENT(AzToolsFramework::PropertyEditorGUIMessages::Bus, RequestWrite, newCtrl);
|
||||
});
|
||||
return newCtrl;
|
||||
}
|
||||
|
||||
|
||||
void AnimationPropertyWidgetHandler::ConsumeAttribute(AnimationPropertyCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
|
||||
{
|
||||
Q_UNUSED(GUI);
|
||||
Q_UNUSED(attrib);
|
||||
Q_UNUSED(attrValue);
|
||||
Q_UNUSED(debugName);
|
||||
}
|
||||
|
||||
void AnimationPropertyWidgetHandler::WriteGUIValuesIntoProperty(size_t index, AnimationPropertyCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(node);
|
||||
CReflectedVarAnimation val = GUI->value();
|
||||
instance = static_cast<property_t>(val);
|
||||
}
|
||||
|
||||
bool AnimationPropertyWidgetHandler::ReadValuesIntoGUI(size_t index, AnimationPropertyCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(node);
|
||||
CReflectedVarAnimation val = instance;
|
||||
GUI->SetValue(val);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#include <Controls/ReflectedPropertyControl/moc_PropertyAnimationCtrl.cpp>
|
||||
|
||||
@@ -1,78 +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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_UTILS_PROPERTYANIMATIONCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_UTILS_PROPERTYANIMATIONCTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
|
||||
#include "ReflectedVar.h"
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
#endif
|
||||
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
class QHBoxLayout;
|
||||
|
||||
class AnimationPropertyCtrl
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(AnimationPropertyCtrl, AZ::SystemAllocator, 0);
|
||||
|
||||
AnimationPropertyCtrl(QWidget* pParent = nullptr);
|
||||
virtual ~AnimationPropertyCtrl();
|
||||
|
||||
CReflectedVarAnimation value() const;
|
||||
|
||||
QWidget* GetFirstInTabOrder();
|
||||
QWidget* GetLastInTabOrder();
|
||||
void UpdateTabOrder();
|
||||
|
||||
signals:
|
||||
void ValueChanged(CReflectedVarAnimation value);
|
||||
|
||||
public slots:
|
||||
void SetValue(const CReflectedVarAnimation& animation);
|
||||
|
||||
protected slots:
|
||||
void OnApplyClicked();
|
||||
|
||||
private:
|
||||
QToolButton* m_pApplyButton;
|
||||
QLabel* m_animationLabel;
|
||||
|
||||
CReflectedVarAnimation m_animation;
|
||||
};
|
||||
|
||||
class AnimationPropertyWidgetHandler
|
||||
: QObject
|
||||
, public AzToolsFramework::PropertyHandler < CReflectedVarAnimation, AnimationPropertyCtrl >
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(AnimationPropertyWidgetHandler, AZ::SystemAllocator, 0);
|
||||
|
||||
virtual AZ::u32 GetHandlerName(void) const override { return AZ_CRC("Animation", 0x8d5284dc); }
|
||||
virtual bool IsDefaultHandler() const override { return true; }
|
||||
virtual QWidget* GetFirstInTabOrder(AnimationPropertyCtrl* widget) override { return widget->GetFirstInTabOrder(); }
|
||||
virtual QWidget* GetLastInTabOrder(AnimationPropertyCtrl* widget) override { return widget->GetLastInTabOrder(); }
|
||||
virtual void UpdateWidgetInternalTabbing(AnimationPropertyCtrl* widget) override { widget->UpdateTabOrder(); }
|
||||
|
||||
virtual QWidget* CreateGUI(QWidget* pParent) override;
|
||||
virtual void ConsumeAttribute(AnimationPropertyCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
|
||||
virtual void WriteGUIValuesIntoProperty(size_t index, AnimationPropertyCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
||||
virtual bool ReadValuesIntoGUI(size_t index, AnimationPropertyCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
||||
};
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_UTILS_PROPERTYANIMATIONCTRL_H
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
// Editor
|
||||
#include "PropertyCtrl.h"
|
||||
#include "PropertyResourceCtrl.h"
|
||||
#include "PropertyGenericCtrl.h"
|
||||
#include "PropertyMiscCtrl.h"
|
||||
#include "PropertyMotionCtrl.h"
|
||||
@@ -21,7 +20,6 @@ void RegisterReflectedVarHandlers()
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew FileResourceSelectorWidgetHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew SequencePropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew SequenceIdPropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew LocalStringPropertyHandler());
|
||||
|
||||
@@ -1,383 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "PropertyResourceCtrl.h"
|
||||
|
||||
// Qt
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyAudioCtrl.h>
|
||||
|
||||
// Editor
|
||||
#include "Controls/QToolTipWidget.h"
|
||||
#include "Controls/BitmapToolTip.h"
|
||||
|
||||
|
||||
BrowseButton::BrowseButton(PropertyType type, QWidget* parent /*= nullptr*/)
|
||||
: QToolButton(parent)
|
||||
, m_propertyType(type)
|
||||
{
|
||||
setAutoRaise(true);
|
||||
setIcon(QIcon(QStringLiteral(":/stylesheet/img/UI20/browse-edit.svg")));
|
||||
connect(this, &QAbstractButton::clicked, this, &BrowseButton::OnClicked);
|
||||
}
|
||||
|
||||
void BrowseButton::SetPathAndEmit(const QString& path)
|
||||
{
|
||||
//only emit if path changes. Old property control
|
||||
if (path != m_path)
|
||||
{
|
||||
m_path = path;
|
||||
emit PathChanged(m_path);
|
||||
}
|
||||
}
|
||||
|
||||
class FileBrowseButton
|
||||
: public BrowseButton
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(FileBrowseButton, AZ::SystemAllocator, 0);
|
||||
FileBrowseButton(PropertyType type, QWidget* pParent = nullptr)
|
||||
: BrowseButton(type, pParent)
|
||||
{
|
||||
setToolTip("Browse...");
|
||||
}
|
||||
|
||||
private:
|
||||
void OnClicked() override
|
||||
{
|
||||
QString tempValue("");
|
||||
if (!m_path.isEmpty() && !Path::GetExt(m_path).isEmpty())
|
||||
{
|
||||
tempValue = m_path;
|
||||
}
|
||||
|
||||
AssetSelectionModel selection;
|
||||
|
||||
if (m_propertyType == ePropertyTexture)
|
||||
{
|
||||
// Filters for texture.
|
||||
selection = AssetSelectionModel::AssetGroupSelection("Texture");
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AzToolsFramework::EditorRequests::Bus::Broadcast(&AzToolsFramework::EditorRequests::BrowseForAssets, selection);
|
||||
if (selection.IsValid())
|
||||
{
|
||||
QString newPath = Path::FullPathToGamePath(selection.GetResult()->GetFullPath().c_str()).c_str();
|
||||
|
||||
switch (m_propertyType)
|
||||
{
|
||||
case ePropertyTexture:
|
||||
newPath.replace("\\\\", "/");
|
||||
if (newPath.size() > MAX_PATH)
|
||||
{
|
||||
newPath.resize(MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
SetPathAndEmit(newPath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class AudioControlSelectorButton
|
||||
: public BrowseButton
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(AudioControlSelectorButton, AZ::SystemAllocator, 0);
|
||||
|
||||
AudioControlSelectorButton(PropertyType type, QWidget* pParent = nullptr)
|
||||
: BrowseButton(type, pParent)
|
||||
{
|
||||
setToolTip(tr("Select Audio Control"));
|
||||
}
|
||||
|
||||
private:
|
||||
void OnClicked() override
|
||||
{
|
||||
AZStd::string resourceResult;
|
||||
auto ConvertLegacyAudioPropertyType = [](const PropertyType type) -> AzToolsFramework::AudioPropertyType
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ePropertyAudioTrigger:
|
||||
return AzToolsFramework::AudioPropertyType::Trigger;
|
||||
case ePropertyAudioRTPC:
|
||||
return AzToolsFramework::AudioPropertyType::Rtpc;
|
||||
case ePropertyAudioSwitch:
|
||||
return AzToolsFramework::AudioPropertyType::Switch;
|
||||
case ePropertyAudioSwitchState:
|
||||
return AzToolsFramework::AudioPropertyType::SwitchState;
|
||||
case ePropertyAudioEnvironment:
|
||||
return AzToolsFramework::AudioPropertyType::Environment;
|
||||
case ePropertyAudioPreloadRequest:
|
||||
return AzToolsFramework::AudioPropertyType::Preload;
|
||||
default:
|
||||
return AzToolsFramework::AudioPropertyType::NumTypes;
|
||||
}
|
||||
};
|
||||
|
||||
auto propType = ConvertLegacyAudioPropertyType(m_propertyType);
|
||||
if (propType != AzToolsFramework::AudioPropertyType::NumTypes)
|
||||
{
|
||||
AzToolsFramework::AudioControlSelectorRequestBus::EventResult(
|
||||
resourceResult, propType, &AzToolsFramework::AudioControlSelectorRequestBus::Events::SelectResource,
|
||||
AZStd::string_view{ m_path.toUtf8().constData() });
|
||||
SetPathAndEmit(QString{ resourceResult.c_str() });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class TextureEditButton
|
||||
: public BrowseButton
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TextureEditButton, AZ::SystemAllocator, 0);
|
||||
TextureEditButton(QWidget* pParent = nullptr)
|
||||
: BrowseButton(ePropertyTexture, pParent)
|
||||
{
|
||||
setIcon(QIcon(QStringLiteral(":/stylesheet/img/UI20/open-in-internal-app.svg")));
|
||||
setToolTip(tr("Launch default editor"));
|
||||
}
|
||||
|
||||
private:
|
||||
void OnClicked() override
|
||||
{
|
||||
CFileUtil::EditTextureFile(m_path.toUtf8().data(), true);
|
||||
}
|
||||
};
|
||||
|
||||
FileResourceSelectorWidget::FileResourceSelectorWidget(QWidget* pParent /*= nullptr*/)
|
||||
: QWidget(pParent)
|
||||
, m_propertyType(ePropertyInvalid)
|
||||
, m_tooltip(nullptr)
|
||||
{
|
||||
m_pathEdit = new QLineEdit;
|
||||
m_mainLayout = new QHBoxLayout(this);
|
||||
m_mainLayout->addWidget(m_pathEdit, 1);
|
||||
|
||||
m_mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// KDAB just ported the MFC texture preview tooltip, but looks like Amazon added their own. Not sure which to use.
|
||||
// To switch to Amazon QToolTipWidget, remove FileResourceSelectorWidget::event and m_previewTooltip
|
||||
#ifdef USE_QTOOLTIPWIDGET
|
||||
m_tooltip = new QToolTipWidget(this);
|
||||
|
||||
installEventFilter(this);
|
||||
#endif
|
||||
connect(m_pathEdit, &QLineEdit::editingFinished, this, [this]() { OnPathChanged(m_pathEdit->text()); });
|
||||
}
|
||||
|
||||
bool FileResourceSelectorWidget::eventFilter([[maybe_unused]] QObject* obj, QEvent* event)
|
||||
{
|
||||
if (m_propertyType == ePropertyTexture)
|
||||
{
|
||||
if (event->type() == QEvent::ToolTip)
|
||||
{
|
||||
QHelpEvent* e = (QHelpEvent*)event;
|
||||
|
||||
m_tooltip->AddSpecialContent("TEXTURE", m_path);
|
||||
m_tooltip->TryDisplay(e->globalPos(), m_pathEdit, QToolTipWidget::ArrowDirection::ARROW_RIGHT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::Leave)
|
||||
{
|
||||
m_tooltip->hide();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void FileResourceSelectorWidget::SetPropertyType(PropertyType type)
|
||||
{
|
||||
if (m_propertyType == type)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//if the property type changed for some reason, delete all the existing widgets
|
||||
if (!m_buttons.isEmpty())
|
||||
{
|
||||
qDeleteAll(m_buttons.begin(), m_buttons.end());
|
||||
m_buttons.clear();
|
||||
}
|
||||
|
||||
m_previewToolTip.reset();
|
||||
m_propertyType = type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ePropertyTexture:
|
||||
AddButton(new FileBrowseButton(type));
|
||||
AddButton(new TextureEditButton);
|
||||
m_previewToolTip.reset(new CBitmapToolTip);
|
||||
break;
|
||||
case ePropertyAudioTrigger:
|
||||
case ePropertyAudioSwitch:
|
||||
case ePropertyAudioSwitchState:
|
||||
case ePropertyAudioRTPC:
|
||||
case ePropertyAudioEnvironment:
|
||||
case ePropertyAudioPreloadRequest:
|
||||
AddButton(new AudioControlSelectorButton(type));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_mainLayout->invalidate();
|
||||
}
|
||||
|
||||
void FileResourceSelectorWidget::AddButton(BrowseButton* button)
|
||||
{
|
||||
m_mainLayout->addWidget(button);
|
||||
m_buttons.push_back(button);
|
||||
connect(button, &BrowseButton::PathChanged, this, &FileResourceSelectorWidget::OnPathChanged);
|
||||
}
|
||||
|
||||
void FileResourceSelectorWidget::OnPathChanged(const QString& path)
|
||||
{
|
||||
bool changed = SetPath(path);
|
||||
if (changed)
|
||||
{
|
||||
emit PathChanged(m_path);
|
||||
}
|
||||
}
|
||||
|
||||
bool FileResourceSelectorWidget::SetPath(const QString& path)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
const QString newPath = path.toLower();
|
||||
if (m_path != newPath)
|
||||
{
|
||||
m_path = newPath;
|
||||
UpdateWidgets();
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
void FileResourceSelectorWidget::UpdateWidgets()
|
||||
{
|
||||
m_pathEdit->setText(m_path);
|
||||
|
||||
foreach(BrowseButton * button, m_buttons)
|
||||
{
|
||||
button->SetPath(m_path);
|
||||
}
|
||||
|
||||
if (m_previewToolTip)
|
||||
{
|
||||
m_previewToolTip->SetTool(this, rect());
|
||||
}
|
||||
}
|
||||
|
||||
QString FileResourceSelectorWidget::GetPath() const
|
||||
{
|
||||
return m_path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QWidget* FileResourceSelectorWidget::GetLastInTabOrder()
|
||||
{
|
||||
return m_buttons.empty() ? nullptr : m_buttons.last();
|
||||
}
|
||||
|
||||
QWidget* FileResourceSelectorWidget::GetFirstInTabOrder()
|
||||
{
|
||||
return m_buttons.empty() ? nullptr : m_buttons.first();
|
||||
}
|
||||
|
||||
void FileResourceSelectorWidget::UpdateTabOrder()
|
||||
{
|
||||
if (m_buttons.count() >= 2)
|
||||
{
|
||||
for (int i = 0; i < m_buttons.count() - 1; ++i)
|
||||
{
|
||||
setTabOrder(m_buttons[i], m_buttons[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileResourceSelectorWidget::event(QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::ToolTip && m_previewToolTip && !m_previewToolTip->isVisible())
|
||||
{
|
||||
if (!m_path.isEmpty())
|
||||
{
|
||||
m_previewToolTip->LoadImage(m_path);
|
||||
m_previewToolTip->setVisible(true);
|
||||
}
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::Resize && m_previewToolTip)
|
||||
{
|
||||
m_previewToolTip->SetTool(this, rect());
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
QWidget* FileResourceSelectorWidgetHandler::CreateGUI(QWidget* pParent)
|
||||
{
|
||||
FileResourceSelectorWidget* newCtrl = aznew FileResourceSelectorWidget(pParent);
|
||||
connect(newCtrl, &FileResourceSelectorWidget::PathChanged, newCtrl, [newCtrl]()
|
||||
{
|
||||
EBUS_EVENT(AzToolsFramework::PropertyEditorGUIMessages::Bus, RequestWrite, newCtrl);
|
||||
});
|
||||
return newCtrl;
|
||||
}
|
||||
|
||||
void FileResourceSelectorWidgetHandler::ConsumeAttribute(FileResourceSelectorWidget* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
|
||||
{
|
||||
Q_UNUSED(GUI);
|
||||
Q_UNUSED(attrib);
|
||||
Q_UNUSED(attrValue);
|
||||
Q_UNUSED(debugName);
|
||||
}
|
||||
|
||||
void FileResourceSelectorWidgetHandler::WriteGUIValuesIntoProperty(size_t index, FileResourceSelectorWidget* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(node);
|
||||
CReflectedVarResource val = instance;
|
||||
val.m_propertyType = GUI->GetPropertyType();
|
||||
val.m_path = GUI->GetPath().toUtf8().data();
|
||||
instance = static_cast<property_t>(val);
|
||||
}
|
||||
|
||||
bool FileResourceSelectorWidgetHandler::ReadValuesIntoGUI(size_t index, FileResourceSelectorWidget* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(node);
|
||||
CReflectedVarResource val = instance;
|
||||
GUI->SetPropertyType(val.m_propertyType);
|
||||
GUI->SetPath(val.m_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
#include <Controls/ReflectedPropertyControl/moc_PropertyResourceCtrl.cpp>
|
||||
@@ -1,118 +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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_UTILS_PROPERTYRESOURCECTRL_H
|
||||
#define CRYINCLUDE_EDITOR_UTILS_PROPERTYRESOURCECTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
|
||||
#include "ReflectedVar.h"
|
||||
#include "Util/VariablePropertyType.h"
|
||||
#include <QWidget>
|
||||
#include <QtWidgets/QToolButton>
|
||||
#include <QtCore/QVector>
|
||||
#endif
|
||||
|
||||
class QLineEdit;
|
||||
class QHBoxLayout;
|
||||
class CBitmapToolTip;
|
||||
class QToolTipWidget;
|
||||
|
||||
class BrowseButton
|
||||
: public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(BrowseButton, AZ::SystemAllocator, 0);
|
||||
|
||||
BrowseButton(PropertyType type, QWidget* parent = nullptr);
|
||||
|
||||
void SetPath(const QString& path) { m_path = path; }
|
||||
QString GetPath() const { return m_path; }
|
||||
|
||||
PropertyType GetPropertyType() const {return m_propertyType; }
|
||||
|
||||
signals:
|
||||
void PathChanged(const QString& path);
|
||||
|
||||
protected:
|
||||
void SetPathAndEmit(const QString& path);
|
||||
virtual void OnClicked() = 0;
|
||||
|
||||
PropertyType m_propertyType;
|
||||
QString m_path;
|
||||
};
|
||||
|
||||
class FileResourceSelectorWidget
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(FileResourceSelectorWidget, AZ::SystemAllocator, 0);
|
||||
FileResourceSelectorWidget(QWidget* pParent = nullptr);
|
||||
|
||||
bool SetPath(const QString& path);
|
||||
QString GetPath() const;
|
||||
void SetPropertyType(PropertyType type);
|
||||
PropertyType GetPropertyType() const { return m_propertyType; }
|
||||
|
||||
QWidget* GetFirstInTabOrder();
|
||||
QWidget* GetLastInTabOrder();
|
||||
void UpdateTabOrder();
|
||||
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
signals:
|
||||
void PathChanged(const QString& path);
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event) override;
|
||||
|
||||
private:
|
||||
void OnAssignClicked();
|
||||
void OnMaterialClicked();
|
||||
|
||||
void UpdateWidgets();
|
||||
void AddButton(BrowseButton* button);
|
||||
void OnPathChanged(const QString& path);
|
||||
|
||||
private:
|
||||
QLineEdit* m_pathEdit;
|
||||
PropertyType m_propertyType;
|
||||
QString m_path;
|
||||
|
||||
QHBoxLayout* m_mainLayout;
|
||||
QVector<BrowseButton*> m_buttons;
|
||||
QScopedPointer<CBitmapToolTip> m_previewToolTip;
|
||||
QToolTipWidget* m_tooltip;
|
||||
};
|
||||
|
||||
class FileResourceSelectorWidgetHandler
|
||||
: QObject
|
||||
, public AzToolsFramework::PropertyHandler < CReflectedVarResource, FileResourceSelectorWidget >
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(FileResourceSelectorWidgetHandler, AZ::SystemAllocator, 0);
|
||||
|
||||
virtual AZ::u32 GetHandlerName(void) const override { return AZ_CRC("Resource", 0xbc91f416); }
|
||||
virtual bool IsDefaultHandler() const override { return true; }
|
||||
virtual QWidget* GetFirstInTabOrder(FileResourceSelectorWidget* widget) override { return widget->GetFirstInTabOrder(); }
|
||||
virtual QWidget* GetLastInTabOrder(FileResourceSelectorWidget* widget) override { return widget->GetLastInTabOrder(); }
|
||||
virtual void UpdateWidgetInternalTabbing(FileResourceSelectorWidget* widget) override { widget->UpdateTabOrder(); }
|
||||
|
||||
virtual QWidget* CreateGUI(QWidget* pParent) override;
|
||||
virtual void ConsumeAttribute(FileResourceSelectorWidget* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
|
||||
virtual void WriteGUIValuesIntoProperty(size_t index, FileResourceSelectorWidget* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
||||
virtual bool ReadValuesIntoGUI(size_t index, FileResourceSelectorWidget* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_UTILS_PROPERTYRESOURCECTRL_H
|
||||
@@ -229,28 +229,16 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
|
||||
break;
|
||||
case ePropertyFloat:
|
||||
case ePropertyAngle:
|
||||
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal float editor
|
||||
if (desc.m_pEnumDBItem)
|
||||
m_reflectedVarAdapter = new ReflectedVarDBEnumAdapter;
|
||||
else
|
||||
m_reflectedVarAdapter = new ReflectedVarFloatAdapter;
|
||||
m_reflectedVarAdapter = new ReflectedVarFloatAdapter;
|
||||
break;
|
||||
case ePropertyInt:
|
||||
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal int editor
|
||||
if (desc.m_pEnumDBItem)
|
||||
m_reflectedVarAdapter = new ReflectedVarDBEnumAdapter;
|
||||
else
|
||||
m_reflectedVarAdapter = new ReflectedVarIntAdapter;
|
||||
m_reflectedVarAdapter = new ReflectedVarIntAdapter;
|
||||
break;
|
||||
case ePropertyBool:
|
||||
m_reflectedVarAdapter = new ReflectedVarBoolAdapter;
|
||||
break;
|
||||
case ePropertyString:
|
||||
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal string editor
|
||||
if (desc.m_pEnumDBItem)
|
||||
m_reflectedVarAdapter = new ReflectedVarDBEnumAdapter;
|
||||
else
|
||||
m_reflectedVarAdapter = new ReflectedVarStringAdapter;
|
||||
m_reflectedVarAdapter = new ReflectedVarStringAdapter;
|
||||
break;
|
||||
case ePropertySelection:
|
||||
m_reflectedVarAdapter = new ReflectedVarEnumAdapter;
|
||||
|
||||
@@ -70,12 +70,6 @@ void ReflectedVarInit::setupReflection(AZ::SerializeContext* serializeContext)
|
||||
AZ::EditContext* ec = serializeContext->GetEditContext();
|
||||
if (ec)
|
||||
{
|
||||
ec->Class< CReflectedVarResource >("VarResource", "Resource")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &CReflectedVarResource::varName)
|
||||
->Attribute(AZ::Edit::Attributes::DescriptionTextOverride, &CReflectedVarResource::description)
|
||||
;
|
||||
|
||||
ec->Class< CReflectedVarUser >("VarUser", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &CReflectedVarUser::varName)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
// Editor
|
||||
#include "ReflectedPropertyCtrl.h"
|
||||
#include "UIEnumsDatabase.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -254,41 +253,6 @@ void ReflectedVarEnumAdapter::OnVariableChange([[maybe_unused]] IVariable* pVari
|
||||
}
|
||||
}
|
||||
|
||||
void ReflectedVarDBEnumAdapter::SetVariable(IVariable *pVariable)
|
||||
{
|
||||
Prop::Description desc(pVariable);
|
||||
m_pEnumDBItem = desc.m_pEnumDBItem;
|
||||
m_reflectedVar.reset(new CReflectedVarEnum<AZStd::string>(pVariable->GetHumanName().toUtf8().data()));
|
||||
if (m_pEnumDBItem)
|
||||
{
|
||||
for (int i = 0; i < m_pEnumDBItem->strings.size(); i++)
|
||||
{
|
||||
QString name = m_pEnumDBItem->strings[i];
|
||||
m_reflectedVar->addEnum( m_pEnumDBItem->NameToValue(name).toUtf8().data(), name.toUtf8().data() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReflectedVarDBEnumAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
{
|
||||
const AZStd::string valueStr = pVariable->GetDisplayValue().toUtf8().data();
|
||||
const AZStd::string value = m_pEnumDBItem ? AZStd::string(m_pEnumDBItem->ValueToName(valueStr.c_str()).toUtf8().data()) : valueStr;
|
||||
m_reflectedVar->setEnumByName(value);
|
||||
|
||||
}
|
||||
|
||||
void ReflectedVarDBEnumAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
{
|
||||
QString iVarVal = m_reflectedVar->m_selectedEnumName.c_str();
|
||||
if (m_pEnumDBItem)
|
||||
{
|
||||
iVarVal = m_pEnumDBItem->NameToValue(iVarVal);
|
||||
}
|
||||
pVariable->SetDisplayValue(iVarVal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReflectedVarVector2Adapter::SetVariable(IVariable *pVariable)
|
||||
{
|
||||
m_reflectedVar.reset(new CReflectedVarVector2(pVariable->GetHumanName().toUtf8().data()));
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
struct CUIEnumsDatabase_SEnum;
|
||||
class ReflectedPropertyItem;
|
||||
|
||||
// Class to wrap the CReflectedVars and sync them with corresponding IVariable.
|
||||
@@ -145,22 +144,6 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
bool m_updatingEnums;
|
||||
};
|
||||
|
||||
class EDITOR_CORE_API ReflectedVarDBEnumAdapter
|
||||
: public ReflectedVarAdapter
|
||||
{
|
||||
public:
|
||||
void SetVariable(IVariable* pVariable) override;
|
||||
void SyncReflectedVarToIVar(IVariable* pVariable) override;
|
||||
void SyncIVarToReflectedVar(IVariable* pVariable) override;
|
||||
CReflectedVar* GetReflectedVar() override { return m_reflectedVar.data(); }
|
||||
private:
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
QScopedPointer<CReflectedVarEnum<AZStd::string> > m_reflectedVar;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
CUIEnumsDatabase_SEnum* m_pEnumDBItem;
|
||||
};
|
||||
|
||||
class EDITOR_CORE_API ReflectedVarVector2Adapter
|
||||
: public ReflectedVarAdapter
|
||||
{
|
||||
|
||||
@@ -588,7 +588,7 @@ QMenu* LevelEditorMenuHandler::CreateGameMenu()
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
// Export to Engine
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <QMap>
|
||||
#include <QTranslator>
|
||||
#include <QSet>
|
||||
#include "IEventLoopHook.h"
|
||||
#include <unordered_map>
|
||||
|
||||
#include <AzCore/PlatformDef.h>
|
||||
|
||||
+8
-40
@@ -706,7 +706,7 @@ void CCryEditApp::OnFileSave()
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
@@ -1709,7 +1709,6 @@ bool CCryEditApp::InitInstance()
|
||||
mainWindow->Initialize();
|
||||
|
||||
GetIEditor()->GetCommandManager()->RegisterAutoCommands();
|
||||
GetIEditor()->AddUIEnums();
|
||||
|
||||
mainWindowWrapper->enableSaveRestoreGeometry("O3DE", "O3DE", "mainWindowGeometry");
|
||||
m_pDocManager->OnFileNew();
|
||||
@@ -1820,10 +1819,7 @@ bool CCryEditApp::InitInstance()
|
||||
if (GetIEditor()->GetCommandManager()->IsRegistered("editor.open_lnm_editor"))
|
||||
{
|
||||
CCommand0::SUIInfo uiInfo;
|
||||
#if !defined(NDEBUG)
|
||||
bool ok =
|
||||
#endif
|
||||
GetIEditor()->GetCommandManager()->GetUIInfo("editor.open_lnm_editor", uiInfo);
|
||||
[[maybe_unused]] bool ok = GetIEditor()->GetCommandManager()->GetUIInfo("editor.open_lnm_editor", uiInfo);
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
@@ -1832,34 +1828,6 @@ bool CCryEditApp::InitInstance()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCryEditApp::RegisterEventLoopHook(IEventLoopHook* pHook)
|
||||
{
|
||||
pHook->pNextHook = m_pEventLoopHook;
|
||||
m_pEventLoopHook = pHook;
|
||||
}
|
||||
|
||||
void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
|
||||
{
|
||||
IEventLoopHook* pPrevious = nullptr;
|
||||
for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != nullptr; pHook = pHook->pNextHook)
|
||||
{
|
||||
if (pHook == pHookToRemove)
|
||||
{
|
||||
if (pPrevious)
|
||||
{
|
||||
pPrevious->pNextHook = pHookToRemove->pNextHook;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pEventLoopHook = pHookToRemove->pNextHook;
|
||||
}
|
||||
|
||||
pHookToRemove->pNextHook = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::LoadFile(QString fileName)
|
||||
{
|
||||
@@ -2396,7 +2364,7 @@ void CCryEditApp::ExportLevel(bool bExportToGame, bool bExportTexture, bool bAut
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
AZ_Assert(false, "Prefab system doesn't require level exports.");
|
||||
@@ -2437,7 +2405,7 @@ bool CCryEditApp::UserExportToGame(bool bNoMsgBox)
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
AZ_Assert(false, "Export Level should no longer exist.");
|
||||
@@ -2485,7 +2453,7 @@ void CCryEditApp::ExportToGame(bool bNoMsgBox)
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
AZ_Assert(false, "Prefab system no longer exports levels.");
|
||||
@@ -2993,7 +2961,7 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
// If we are creating a new level and we're in simulate mode, then switch it off before we do anything else
|
||||
if (GetIEditor()->GetGameEngine() && GetIEditor()->GetGameEngine()->GetSimulationMode())
|
||||
@@ -3139,7 +3107,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
|
||||
@@ -3353,7 +3321,7 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* filename, bool addToMostR
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
// If we are loading and we're in simulate mode, then switch it off before we do anything else
|
||||
if (GetIEditor()->GetGameEngine() && GetIEditor()->GetGameEngine()->GetSimulationMode())
|
||||
|
||||
@@ -30,7 +30,6 @@ class CConsoleDialog;
|
||||
struct mg_connection;
|
||||
struct mg_request_info;
|
||||
struct mg_context;
|
||||
struct IEventLoopHook;
|
||||
class QAction;
|
||||
class MainWindow;
|
||||
class QSharedMemory;
|
||||
@@ -153,8 +152,6 @@ public:
|
||||
int IdleProcessing(bool bBackground);
|
||||
bool IsWindowInForeground();
|
||||
void RunInitPythonScript(CEditCommandLineInfo& cmdInfo);
|
||||
void RegisterEventLoopHook(IEventLoopHook* pHook);
|
||||
void UnregisterEventLoopHook(IEventLoopHook* pHook);
|
||||
|
||||
void DisableIdleProcessing() override;
|
||||
void EnableIdleProcessing() override;
|
||||
@@ -344,7 +341,6 @@ private:
|
||||
|
||||
QString m_lastOpenLevelPath;
|
||||
CQuickAccessBar* m_pQuickAccessBar = nullptr;
|
||||
IEventLoopHook* m_pEventLoopHook = nullptr;
|
||||
QString m_rootEnginePath;
|
||||
|
||||
int m_disableIdleProcessingCounter = 0; //!< Counts requests to disable idle processing. When non-zero, idle processing will be disabled.
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
|
||||
// LmbrCentral
|
||||
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
|
||||
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
|
||||
|
||||
static const char* kAutoBackupFolder = "_autobackup";
|
||||
static const char* kHoldFolder = "$tmp_hold"; // conform to the ignored file types $tmp[0-9]*_ regex
|
||||
@@ -372,7 +371,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
@@ -637,7 +636,7 @@ bool CCryEditDoc::SaveModified()
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
QMessageBox saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
|
||||
@@ -700,7 +699,7 @@ void CCryEditDoc::OnFileSaveAs()
|
||||
CCryEditApp::instance()->AddToRecentFileList(levelFileDialog.GetFileName());
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId =
|
||||
@@ -729,7 +728,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
@@ -2130,52 +2129,13 @@ void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus interface implementation
|
||||
void CCryEditDoc::OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
||||
void CCryEditDoc::OnSliceInstantiated([[maybe_unused]] const AZ::Data::AssetId& sliceAssetId, [[maybe_unused]] AZ::SliceComponent::SliceInstanceAddress& sliceAddress, [[maybe_unused]] const AzFramework::SliceInstantiationTicket& ticket)
|
||||
{
|
||||
if (m_envProbeSliceAssetId == sliceAssetId)
|
||||
{
|
||||
const AZ::SliceComponent::EntityList& entities = sliceAddress.GetInstance()->GetInstantiated()->m_entities;
|
||||
const AZ::Uuid editorEnvProbeComponentId("{8DBD6035-583E-409F-AFD9-F36829A0655D}");
|
||||
AzToolsFramework::EntityIdList entityIds;
|
||||
entityIds.reserve(entities.size());
|
||||
for (const AZ::Entity* entity : entities)
|
||||
{
|
||||
if (entity->FindComponent(editorEnvProbeComponentId))
|
||||
{
|
||||
// Update Probe Area size to cover the whole terrain
|
||||
LmbrCentral::EditorLightComponentRequestBus::Event(entity->GetId(), &LmbrCentral::EditorLightComponentRequests::SetProbeAreaDimensions, AZ::Vector3(m_terrainSize, m_terrainSize, m_envProbeHeight));
|
||||
|
||||
// Force update the light to apply cubemap
|
||||
LmbrCentral::EditorLightComponentRequestBus::Event(entity->GetId(), &LmbrCentral::EditorLightComponentRequests::RefreshLight);
|
||||
}
|
||||
entityIds.push_back(entity->GetId());
|
||||
}
|
||||
|
||||
//Detach instantiated env probe entities from engine slice
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
|
||||
&AzToolsFramework::SliceEditorEntityOwnershipServiceRequests::DetachSliceEntities, entityIds);
|
||||
|
||||
sliceAddress.SetInstance(nullptr);
|
||||
sliceAddress.SetReference(nullptr);
|
||||
SetModifiedFlag(true);
|
||||
SetModifiedModules(eModifiedEntities);
|
||||
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
//save after level default slice fully instantiated
|
||||
Save();
|
||||
}
|
||||
GetIEditor()->ResumeUndo();
|
||||
}
|
||||
|
||||
|
||||
void CCryEditDoc::OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
||||
void CCryEditDoc::OnSliceInstantiationFailed([[maybe_unused]] const AZ::Data::AssetId& sliceAssetId, [[maybe_unused]] const AzFramework::SliceInstantiationTicket& ticket)
|
||||
{
|
||||
if (m_envProbeSliceAssetId == sliceAssetId)
|
||||
{
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
|
||||
AZ_Warning("Editor", false, "Failed to instantiate default environment probe slice.");
|
||||
}
|
||||
GetIEditor()->ResumeUndo();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -200,7 +200,6 @@ protected:
|
||||
QString m_pathName;
|
||||
QString m_slicePathName;
|
||||
QString m_title;
|
||||
AZ::Data::AssetId m_envProbeSliceAssetId;
|
||||
float m_terrainSize;
|
||||
const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
|
||||
const float m_envProbeHeight = 200.0f;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "Core/QtEditorApplication.h"
|
||||
#include "CheckOutDialog.h"
|
||||
#include "GameEngine.h"
|
||||
#include "UndoConfigSpec.h"
|
||||
#include "ViewManager.h"
|
||||
#include "EditorViewportCamera.h"
|
||||
|
||||
@@ -369,21 +368,6 @@ namespace
|
||||
|
||||
inline namespace Commands
|
||||
{
|
||||
void PySetConfigSpec(int spec, int platform)
|
||||
{
|
||||
CUndo undo("Set Config Spec");
|
||||
if (CUndo::IsRecording())
|
||||
{
|
||||
CUndo::Record(new CUndoConficSpec());
|
||||
}
|
||||
GetIEditor()->SetEditorConfigSpec((ESystemConfigSpec)spec, (ESystemConfigPlatform)platform);
|
||||
}
|
||||
|
||||
int PyGetConfigSpec()
|
||||
{
|
||||
return static_cast<int>(GetIEditor()->GetEditorConfigSpec());
|
||||
}
|
||||
|
||||
int PyGetConfigPlatform()
|
||||
{
|
||||
return static_cast<int>(GetIEditor()->GetEditorConfigPlatform());
|
||||
@@ -434,9 +418,7 @@ namespace AzToolsFramework
|
||||
addLegacyGeneral(behaviorContext->Method("set_current_view_rotation", PySetCurrentViewRotation, nullptr, "Sets the rotation of the current view as given x, y, z Euler angles in degrees."));
|
||||
|
||||
addLegacyGeneral(behaviorContext->Method("export_to_engine", CCryEditApp::Command_ExportToEngine, nullptr, "Exports the current level to the engine."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_config_spec", PySetConfigSpec, nullptr, "Sets the system config spec and platform."));
|
||||
addLegacyGeneral(behaviorContext->Method("get_config_platform", PyGetConfigPlatform, nullptr, "Gets the system config platform."));
|
||||
addLegacyGeneral(behaviorContext->Method("get_config_spec", PyGetConfigSpec, nullptr, "Gets the system config spec."));
|
||||
|
||||
addLegacyGeneral(behaviorContext->Method("set_result_to_success", PySetResultToSuccess, nullptr, "Sets the result of a script execution to success. Used only for Sandbox AutoTests."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_result_to_failure", PySetResultToFailure, nullptr, "Sets the result of a script execution to failure. Used only for Sandbox AutoTests."));
|
||||
@@ -464,17 +446,6 @@ namespace AzToolsFramework
|
||||
};
|
||||
addCheckoutDialog(behaviorContext->Method("enable_for_all", PyCheckOutDialogEnableForAll, nullptr, "Enables the 'Apply to all' button in the checkout dialog; useful for allowing the user to apply a decision to check out files to multiple, related operations."));
|
||||
|
||||
behaviorContext->EnumProperty<ESystemConfigSpec::CONFIG_AUTO_SPEC>("SystemConfigSpec_Auto")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigSpec::CONFIG_LOW_SPEC>("SystemConfigSpec_Low")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigSpec::CONFIG_MEDIUM_SPEC>("SystemConfigSpec_Medium")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigSpec::CONFIG_HIGH_SPEC>("SystemConfigSpec_High")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigSpec::CONFIG_VERYHIGH_SPEC>("SystemConfigSpec_VeryHigh")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
|
||||
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_INVALID_PLATFORM>("SystemConfigPlatform_InvalidPlatform")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_PC>("SystemConfigPlatform_Pc")
|
||||
|
||||
@@ -123,9 +123,7 @@
|
||||
#include "Util/XmlTemplate.h"
|
||||
|
||||
// Utility classes.
|
||||
#include "Util/bitarray.h"
|
||||
#include "Util/RefCountBase.h"
|
||||
#include "Util/TRefCountBase.h"
|
||||
#include "Util/MemoryBlock.h"
|
||||
#include "Util/PathUtil.h"
|
||||
|
||||
@@ -168,18 +166,3 @@
|
||||
#ifdef LoadCursor
|
||||
#undef LoadCursor
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#if !defined(AZ_PLATFORM_LINUX)
|
||||
#ifdef assert
|
||||
#undef assert
|
||||
#if defined(USE_AZ_ASSERT)
|
||||
#define assert(condition) AZ_Assert(condition, "")
|
||||
#else
|
||||
#define assert CRY_ASSERT
|
||||
#endif
|
||||
#endif // !defined(AZ_PLATFORM_LINUX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
|
||||
//! Allows handlers to be notified when settings are changed to refresh accordingly
|
||||
class EditorPreferencesNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
//! Notifies about changes in the Editor Preferences
|
||||
virtual void OnEditorPreferencesChanged() {}
|
||||
};
|
||||
using EditorPreferencesNotificationBus = AZ::EBus<EditorPreferencesNotifications>;
|
||||
@@ -101,7 +101,7 @@ void CEditorPreferencesPage_AWS::SaveSettingsRegistryFile()
|
||||
return;
|
||||
}
|
||||
|
||||
[[maybe_unused]] bool saved{};
|
||||
[[maybe_unused]] bool saved = false;
|
||||
constexpr auto configurationMode =
|
||||
AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_CREATE_PATH | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY;
|
||||
if (AZ::IO::SystemFile outputFile; outputFile.Open(resolvedPath.data(), configurationMode))
|
||||
|
||||
@@ -30,7 +30,6 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
serialize.Class<GeneralSettings>()
|
||||
->Version(3)
|
||||
->Field("PreviewPanel", &GeneralSettings::m_previewPanel)
|
||||
->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec)
|
||||
->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl)
|
||||
->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart)
|
||||
->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme)
|
||||
@@ -81,7 +80,6 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
{
|
||||
editContext->Class<GeneralSettings>("General Settings", "General Editor Preferences")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts")
|
||||
@@ -157,7 +155,6 @@ void CEditorPreferencesPage_General::OnApply()
|
||||
{
|
||||
//general settings
|
||||
gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel;
|
||||
gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec;
|
||||
gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl;
|
||||
gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart;
|
||||
gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme;
|
||||
@@ -195,7 +192,6 @@ void CEditorPreferencesPage_General::InitializeSettings()
|
||||
{
|
||||
//general settings
|
||||
m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow;
|
||||
m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor;
|
||||
m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl;
|
||||
m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart;
|
||||
m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme;
|
||||
|
||||
@@ -45,7 +45,6 @@ private:
|
||||
AZ_TYPE_INFO(GeneralSettings, "{C2AE8F6D-7AA6-499E-A3E8-ECCD0AC6F3D2}")
|
||||
|
||||
bool m_previewPanel;
|
||||
bool m_applyConfigSpec;
|
||||
bool m_enableSourceControl;
|
||||
bool m_clearConsoleOnGameModeStart;
|
||||
AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme;
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
#include <LmbrCentral/Rendering/EditorCameraCorrectionBus.h>
|
||||
|
||||
// Atom
|
||||
#include <Atom/RPI.Public/RenderPipeline.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
#include <Atom/RPI.Public/ViewportContextManager.h>
|
||||
#include <Atom/RPI.Public/ViewProviderBus.h>
|
||||
@@ -584,7 +585,8 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
m_renderViewport->SetScene(nullptr);
|
||||
break;
|
||||
|
||||
case eNotify_OnEndSceneOpen:
|
||||
case eNotify_OnEndLoad:
|
||||
case eNotify_OnEndCreate:
|
||||
UpdateScene();
|
||||
SetDefaultCamera();
|
||||
break;
|
||||
@@ -2324,7 +2326,26 @@ void EditorViewportWidget::UpdateScene()
|
||||
{
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusDisconnect();
|
||||
m_renderViewport->SetScene(mainScene);
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusConnect(m_renderViewport->GetViewportContext()->GetRenderScene()->GetId());
|
||||
auto viewportContext = m_renderViewport->GetViewportContext();
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusConnect(viewportContext->GetRenderScene()->GetId());
|
||||
|
||||
// Don't enable the render pipeline until a level has been loaded
|
||||
// Also show/hide the RenderViewportWidget accordingly so that we get the
|
||||
// expected gradient background when no level is loaded
|
||||
auto renderPipeline = viewportContext->GetCurrentPipeline();
|
||||
if (renderPipeline)
|
||||
{
|
||||
if (GetIEditor()->IsLevelLoaded())
|
||||
{
|
||||
m_renderViewport->show();
|
||||
renderPipeline->AddToRenderTick();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renderViewport->hide();
|
||||
renderPipeline->RemoveFromRenderTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define CRYINCLUDE_EDITOR_CORE_ERRORRECORDER_H
|
||||
#pragma once
|
||||
|
||||
#include "Include/EditorCoreAPI.h"
|
||||
#include <EditorCoreAPI.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Automatic class to record and display error.
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
// forward declarations.
|
||||
class CParticleItem;
|
||||
|
||||
#include <CryCommon/IValidator.h>
|
||||
#include <CryCommon/smartptr.h>
|
||||
|
||||
#include "Objects/BaseObject.h"
|
||||
#include "Include/EditorCoreAPI.h"
|
||||
#include "Include/IErrorReport.h"
|
||||
|
||||
@@ -489,7 +489,7 @@ bool CGameEngine::LoadLevel(
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
@@ -317,8 +317,8 @@ void CGameExporter::ExportLevelInfo(const QString& path)
|
||||
root->setAttr("Name", levelName.toUtf8().data());
|
||||
auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
|
||||
const AZ::Aabb terrainAabb = terrain ? terrain->GetTerrainAabb() : AZ::Aabb::CreateFromPoint(AZ::Vector3::CreateZero());
|
||||
const AZ::Vector2 terrainGridResolution = terrain ? terrain->GetTerrainHeightQueryResolution() : AZ::Vector2::CreateOne();
|
||||
const int compiledHeightmapSize = static_cast<int>(terrainAabb.GetXExtent() / terrainGridResolution.GetX());
|
||||
const float terrainGridResolution = terrain ? terrain->GetTerrainHeightQueryResolution() : 1.0f;
|
||||
const int compiledHeightmapSize = static_cast<int>(terrainAabb.GetXExtent() / terrainGridResolution);
|
||||
root->setAttr("HeightmapSize", compiledHeightmapSize);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
{
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
AZ_Assert(false, "Level.pak should no longer be used when prefabs are used for levels.");
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "Util/UndoUtil.h"
|
||||
#include <CryVersion.h>
|
||||
|
||||
#include <WinWidgetId.h>
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/Debug/Budget.h>
|
||||
|
||||
@@ -48,7 +46,6 @@ class ICommandManager;
|
||||
class CEditorCommandManager;
|
||||
class CHyperGraphManager;
|
||||
class CConsoleSynchronization;
|
||||
class CUIEnumsDatabase;
|
||||
struct ISourceControl;
|
||||
struct IEditorClassFactory;
|
||||
struct ITransformManipulator;
|
||||
@@ -66,15 +63,9 @@ struct SEditorSettings;
|
||||
class CGameExporter;
|
||||
class IAWSResourceManager;
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
class WinWidgetManager;
|
||||
}
|
||||
|
||||
struct ISystem;
|
||||
struct IRenderer;
|
||||
struct AABB;
|
||||
struct IEventLoopHook;
|
||||
struct IErrorReport; // Vladimir@conffx
|
||||
struct IFileUtil; // Vladimir@conffx
|
||||
struct IEditorLog; // Vladimir@conffx
|
||||
@@ -323,17 +314,6 @@ enum MouseCallbackFlags
|
||||
MK_CALLBACK_FLAGS = 0x100
|
||||
};
|
||||
|
||||
//! Types of database items
|
||||
enum EDataBaseItemType
|
||||
{
|
||||
EDB_TYPE_MATERIAL,
|
||||
EDB_TYPE_PARTICLE,
|
||||
EDB_TYPE_MUSIC,
|
||||
EDB_TYPE_EAXPRESET,
|
||||
EDB_TYPE_SOUNDMOOD,
|
||||
EDB_TYPE_FLARE
|
||||
};
|
||||
|
||||
enum EEditorPathName
|
||||
{
|
||||
EDITOR_PATH_OBJECTS,
|
||||
@@ -528,11 +508,6 @@ struct IEditor
|
||||
virtual void SetActiveView(CViewport* viewport) = 0;
|
||||
virtual struct IEditorFileMonitor* GetFileMonitor() = 0;
|
||||
|
||||
// These are needed for Qt integration:
|
||||
virtual void RegisterEventLoopHook(IEventLoopHook* pHook) = 0;
|
||||
virtual void UnregisterEventLoopHook(IEventLoopHook* pHook) = 0;
|
||||
// ^^^
|
||||
|
||||
//! QMimeData is used by the Qt clipboard.
|
||||
//! IMPORTANT: Any QMimeData allocated for the clipboard will be deleted
|
||||
//! when the editor exists. If a QMimeData is allocated by a different
|
||||
@@ -597,10 +572,6 @@ struct IEditor
|
||||
virtual bool SetViewFocus(const char* sViewClassName) = 0;
|
||||
virtual void CloseView(const GUID& classId) = 0; // close ALL panels related to classId, used when unloading plugins.
|
||||
|
||||
// We want to open a view object but not wrap it in a view pane)
|
||||
virtual QWidget* OpenWinWidget(WinWidgetId openId) = 0;
|
||||
virtual WinWidget::WinWidgetManager* GetWinWidgetManager() const = 0;
|
||||
|
||||
//! Opens standard color selection dialog.
|
||||
//! Initialized with the color specified in color parameter.
|
||||
//! Returns true if selection is made and false if selection is canceled.
|
||||
@@ -682,15 +653,10 @@ struct IEditor
|
||||
//! Only returns true if source control is both available AND currently connected and functioning
|
||||
virtual bool IsSourceControlConnected() = 0;
|
||||
|
||||
virtual CUIEnumsDatabase* GetUIEnumsDatabase() = 0;
|
||||
virtual void AddUIEnums() = 0;
|
||||
virtual void ReduceMemory() = 0;
|
||||
|
||||
//! Export manager for exporting objects and a terrain from the game to DCC tools
|
||||
virtual IExportManager* GetExportManager() = 0;
|
||||
//! Set current configuration spec of the editor.
|
||||
virtual void SetEditorConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform) = 0;
|
||||
virtual ESystemConfigSpec GetEditorConfigSpec() const = 0;
|
||||
virtual ESystemConfigPlatform GetEditorConfigPlatform() const = 0;
|
||||
virtual void ReloadTemplates() = 0;
|
||||
virtual void ShowStatusText(bool bEnable) = 0;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "IEditorImpl.h"
|
||||
#include <EditorCommonAPI.h>
|
||||
|
||||
// Qt
|
||||
#include <QByteArray>
|
||||
@@ -50,7 +51,6 @@
|
||||
#include "GameEngine.h"
|
||||
#include "ToolBox.h"
|
||||
#include "MainWindow.h"
|
||||
#include "UIEnumsDatabase.h"
|
||||
#include "RenderHelpers/AxisHelper.h"
|
||||
#include "Settings.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
@@ -69,9 +69,6 @@
|
||||
#include "Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.h"
|
||||
#include "Editor/AssetEditor/AssetEditorRequestsHandler.h"
|
||||
|
||||
// EditorCommon
|
||||
#include <WinWidget/WinWidgetManager.h>
|
||||
|
||||
#include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication
|
||||
|
||||
static CCryEditDoc * theDocument;
|
||||
@@ -118,7 +115,6 @@ CEditorImpl::CEditorImpl()
|
||||
, m_pErrorsDlg(nullptr)
|
||||
, m_pSourceControl(nullptr)
|
||||
, m_pSelectionTreeManager(nullptr)
|
||||
, m_pUIEnumsDatabase(nullptr)
|
||||
, m_pConsoleSync(nullptr)
|
||||
, m_pSettingsManager(nullptr)
|
||||
, m_pLevelIndependentFileMan(nullptr)
|
||||
@@ -148,7 +144,6 @@ CEditorImpl::CEditorImpl()
|
||||
regCtx.pCommandManager = m_pCommandManager;
|
||||
regCtx.pClassFactory = m_pClassFactory;
|
||||
m_pEditorFileMonitor.reset(new CEditorFileMonitor());
|
||||
m_pUIEnumsDatabase = new CUIEnumsDatabase;
|
||||
m_pDisplaySettings = new CDisplaySettings;
|
||||
m_pDisplaySettings->LoadRegistry();
|
||||
m_pPluginManager = new CPluginManager;
|
||||
@@ -167,8 +162,6 @@ CEditorImpl::CEditorImpl()
|
||||
DetectVersion();
|
||||
RegisterTools();
|
||||
|
||||
m_winWidgetManager.reset(new WinWidget::WinWidgetManager);
|
||||
|
||||
m_pAssetDatabaseLocationListener = nullptr;
|
||||
m_pAssetBrowserRequestHandler = nullptr;
|
||||
m_assetEditorRequestsHandler = nullptr;
|
||||
@@ -302,7 +295,6 @@ CEditorImpl::~CEditorImpl()
|
||||
SAFE_DELETE(m_pCommandManager)
|
||||
SAFE_DELETE(m_pClassFactory)
|
||||
SAFE_DELETE(m_pLasLoadedLevelErrorReport)
|
||||
SAFE_DELETE(m_pUIEnumsDatabase)
|
||||
|
||||
SAFE_DELETE(m_pSettingsManager);
|
||||
|
||||
@@ -797,16 +789,6 @@ IEditorFileMonitor* CEditorImpl::GetFileMonitor()
|
||||
return m_pEditorFileMonitor.get();
|
||||
}
|
||||
|
||||
void CEditorImpl::RegisterEventLoopHook(IEventLoopHook* pHook)
|
||||
{
|
||||
CCryEditApp::instance()->RegisterEventLoopHook(pHook);
|
||||
}
|
||||
|
||||
void CEditorImpl::UnregisterEventLoopHook(IEventLoopHook* pHook)
|
||||
{
|
||||
CCryEditApp::instance()->UnregisterEventLoopHook(pHook);
|
||||
}
|
||||
|
||||
float CEditorImpl::GetTerrainElevation(float x, float y)
|
||||
{
|
||||
float terrainElevation = AzFramework::Terrain::TerrainDataRequests::GetDefaultTerrainHeight();
|
||||
@@ -837,20 +819,6 @@ const QtViewPane* CEditorImpl::OpenView(QString sViewClassName, bool reuseOpened
|
||||
return QtViewPaneManager::instance()->OpenPane(sViewClassName, openMode);
|
||||
}
|
||||
|
||||
QWidget* CEditorImpl::OpenWinWidget(WinWidgetId openId)
|
||||
{
|
||||
if (m_winWidgetManager)
|
||||
{
|
||||
return m_winWidgetManager->OpenWinWidget(openId);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WinWidget::WinWidgetManager* CEditorImpl::GetWinWidgetManager() const
|
||||
{
|
||||
return m_winWidgetManager.get();
|
||||
}
|
||||
|
||||
QWidget* CEditorImpl::FindView(QString viewClassName)
|
||||
{
|
||||
return QtViewPaneManager::instance()->GetView(viewClassName);
|
||||
@@ -1491,48 +1459,6 @@ IExportManager* CEditorImpl::GetExportManager()
|
||||
return m_pExportManager;
|
||||
}
|
||||
|
||||
void CEditorImpl::AddUIEnums()
|
||||
{
|
||||
// Spec settings for shadow casting lights
|
||||
AZStd::string SpecString[4];
|
||||
QStringList types;
|
||||
types.push_back("Never=0");
|
||||
SpecString[0] = AZStd::string::format("VeryHigh Spec=%d", CONFIG_VERYHIGH_SPEC);
|
||||
types.push_back(SpecString[0].c_str());
|
||||
SpecString[1] = AZStd::string::format("High Spec=%d", CONFIG_HIGH_SPEC);
|
||||
types.push_back(SpecString[1].c_str());
|
||||
SpecString[2] = AZStd::string::format("Medium Spec=%d", CONFIG_MEDIUM_SPEC);
|
||||
types.push_back(SpecString[2].c_str());
|
||||
SpecString[3] = AZStd::string::format("Low Spec=%d", CONFIG_LOW_SPEC);
|
||||
types.push_back(SpecString[3].c_str());
|
||||
m_pUIEnumsDatabase->SetEnumStrings("CastShadows", types);
|
||||
|
||||
// Power-of-two percentages
|
||||
AZStd::string percentStringPOT[5];
|
||||
types.clear();
|
||||
percentStringPOT[0] = AZStd::string::format("Default=%d", 0);
|
||||
types.push_back(percentStringPOT[0].c_str());
|
||||
percentStringPOT[1] = AZStd::string::format("12.5=%d", 1);
|
||||
types.push_back(percentStringPOT[1].c_str());
|
||||
percentStringPOT[2] = AZStd::string::format("25=%d", 2);
|
||||
types.push_back(percentStringPOT[2].c_str());
|
||||
percentStringPOT[3] = AZStd::string::format("50=%d", 3);
|
||||
types.push_back(percentStringPOT[3].c_str());
|
||||
percentStringPOT[4] = AZStd::string::format("100=%d", 4);
|
||||
types.push_back(percentStringPOT[4].c_str());
|
||||
m_pUIEnumsDatabase->SetEnumStrings("ShadowMinResPercent", types);
|
||||
}
|
||||
|
||||
void CEditorImpl::SetEditorConfigSpec(ESystemConfigSpec spec, [[maybe_unused]]ESystemConfigPlatform platform)
|
||||
{
|
||||
gSettings.editorConfigSpec = spec;
|
||||
}
|
||||
|
||||
ESystemConfigSpec CEditorImpl::GetEditorConfigSpec() const
|
||||
{
|
||||
return (ESystemConfigSpec)gSettings.editorConfigSpec;
|
||||
}
|
||||
|
||||
ESystemConfigPlatform CEditorImpl::GetEditorConfigPlatform() const
|
||||
{
|
||||
return m_pSystem->GetConfigPlatform();
|
||||
|
||||
@@ -53,11 +53,6 @@ namespace Editor
|
||||
class EditorQtApplication;
|
||||
}
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
class WinWidgetManager;
|
||||
}
|
||||
|
||||
namespace AssetDatabase
|
||||
{
|
||||
class AssetDatabaseLocationListener;
|
||||
@@ -160,8 +155,6 @@ public:
|
||||
CMusicManager* GetMusicManager() override { return m_pMusicManager; };
|
||||
|
||||
IEditorFileMonitor* GetFileMonitor() override;
|
||||
void RegisterEventLoopHook(IEventLoopHook* pHook) override;
|
||||
void UnregisterEventLoopHook(IEventLoopHook* pHook) override;
|
||||
IIconManager* GetIconManager() override;
|
||||
float GetTerrainElevation(float x, float y) override;
|
||||
Editor::EditorQtApplication* GetEditorQtApplication() override { return m_QtApplication; }
|
||||
@@ -221,9 +214,6 @@ public:
|
||||
bool CloseView(const char* sViewClassName) override;
|
||||
bool SetViewFocus(const char* sViewClassName) override;
|
||||
|
||||
QWidget* OpenWinWidget(WinWidgetId openId) override;
|
||||
WinWidget::WinWidgetManager* GetWinWidgetManager() const override;
|
||||
|
||||
// close ALL panels related to classId, used when unloading plugins.
|
||||
void CloseView(const GUID& classId) override;
|
||||
bool SelectColor(QColor &color, QWidget *parent = 0) override;
|
||||
@@ -276,14 +266,9 @@ public:
|
||||
bool IsSourceControlConnected() override;
|
||||
//! Setup Material Editor mode
|
||||
void SetMatEditMode(bool bIsMatEditMode);
|
||||
CUIEnumsDatabase* GetUIEnumsDatabase() override { return m_pUIEnumsDatabase; };
|
||||
void AddUIEnums() override;
|
||||
void ReduceMemory() override;
|
||||
// Get Export manager
|
||||
IExportManager* GetExportManager() override;
|
||||
// Set current configuration spec of the editor.
|
||||
void SetEditorConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform) override;
|
||||
ESystemConfigSpec GetEditorConfigSpec() const override;
|
||||
ESystemConfigPlatform GetEditorConfigPlatform() const override;
|
||||
void ReloadTemplates() override;
|
||||
void AddErrorMessage(const QString& text, const QString& caption);
|
||||
@@ -355,7 +340,6 @@ protected:
|
||||
|
||||
CSelectionTreeManager* m_pSelectionTreeManager;
|
||||
|
||||
CUIEnumsDatabase* m_pUIEnumsDatabase;
|
||||
//! CConsole Synchronization
|
||||
CConsoleSynchronization* m_pConsoleSync;
|
||||
//! Editor Settings Manager
|
||||
@@ -369,7 +353,6 @@ protected:
|
||||
QString m_selectFileBuffer;
|
||||
QString m_levelNameBuffer;
|
||||
|
||||
std::unique_ptr<WinWidget::WinWidgetManager> m_winWidgetManager;
|
||||
|
||||
//! True if the editor is in material edit mode. Fast preview of materials.
|
||||
//! In this mode only very limited functionality is available.
|
||||
|
||||
@@ -1,20 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_IOBSERVABLE_H
|
||||
#define CRYINCLUDE_EDITOR_IOBSERVABLE_H
|
||||
#pragma once
|
||||
|
||||
//! Observable macro to be used in pure interfaces
|
||||
#define DEFINE_OBSERVABLE_PURE_METHODS(observerClassName) \
|
||||
virtual bool RegisterObserver(observerClassName * pObserver) = 0; \
|
||||
virtual bool UnregisterObserver(observerClassName * pObserver) = 0; \
|
||||
virtual void UnregisterAllObservers() = 0;
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_IOBSERVABLE_H
|
||||
@@ -135,9 +135,6 @@ struct IClassDesc
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
|
||||
struct IViewPaneClass;
|
||||
|
||||
struct CRYEDIT_API IEditorClassFactory
|
||||
{
|
||||
public:
|
||||
@@ -149,7 +146,6 @@ public:
|
||||
virtual IClassDesc* FindClass(const char* pClassName) const = 0;
|
||||
//! Find class in the factory by class id
|
||||
virtual IClassDesc* FindClass(const GUID& rClassID) const = 0;
|
||||
virtual IViewPaneClass* FindViewPaneClassByTitle(const char* pPaneTitle) const = 0;
|
||||
virtual void UnregisterClass(const char* pClassName) = 0;
|
||||
virtual void UnregisterClass(const GUID& rClassID) = 0;
|
||||
//! Get classes that matching specific requirements.
|
||||
|
||||
@@ -1,24 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEVENTLOOPHOOK_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEVENTLOOPHOOK_H
|
||||
#pragma once
|
||||
|
||||
struct IEventLoopHook
|
||||
{
|
||||
IEventLoopHook* pNextHook;
|
||||
|
||||
IEventLoopHook()
|
||||
: pNextHook(0) {}
|
||||
|
||||
virtual bool PrePumpMessage() { return false; }
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IEVENTLOOPHOOK_H
|
||||
@@ -1,74 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IVIEWPANE_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IVIEWPANE_H
|
||||
#pragma once
|
||||
|
||||
#include "IEditorClassFactory.h"
|
||||
|
||||
#include <QSize>
|
||||
|
||||
class QWidget;
|
||||
class QRect;
|
||||
|
||||
struct IViewPaneClass
|
||||
: public IClassDesc
|
||||
{
|
||||
DEFINE_UUID(0x7E13EC7C, 0xF621, 0x4aeb, 0xB6, 0x42, 0x67, 0xD7, 0x8E, 0xD4, 0x68, 0xF8)
|
||||
|
||||
enum EDockingDirection
|
||||
{
|
||||
DOCK_TOP,
|
||||
DOCK_LEFT,
|
||||
DOCK_RIGHT,
|
||||
DOCK_BOTTOM,
|
||||
DOCK_FLOAT,
|
||||
};
|
||||
|
||||
virtual ~IViewPaneClass() = default;
|
||||
|
||||
// Return text for view pane title.
|
||||
virtual QString GetPaneTitle() = 0;
|
||||
|
||||
// Return the string resource ID for the title's text.
|
||||
virtual unsigned int GetPaneTitleID() const = 0;
|
||||
|
||||
// Return preferable initial docking position for pane.
|
||||
virtual EDockingDirection GetDockingDirection() = 0;
|
||||
|
||||
// Initial pane size.
|
||||
virtual QRect GetPaneRect() = 0;
|
||||
|
||||
// Get Minimal view size
|
||||
virtual QSize GetMinSize() { return QSize(0, 0); }
|
||||
|
||||
// Return true if only one pane at a time of time view class can be created.
|
||||
virtual bool SinglePane() = 0;
|
||||
|
||||
// Return true if the view window wants to get ID_IDLE_UPDATE commands.
|
||||
virtual bool WantIdleUpdate() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObj)
|
||||
{
|
||||
if (riid == __az_uuidof(IViewPaneClass))
|
||||
{
|
||||
*ppvObj = this;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IVIEWPANE_H
|
||||
@@ -1,2 +0,0 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "..\\res\\lyeditor.ico"
|
||||
|
||||
@@ -1,9 +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
|
||||
*
|
||||
*/
|
||||
|
||||
#define IDI_ICON1 2
|
||||
@@ -97,8 +97,6 @@ public:
|
||||
MOCK_METHOD0(GetActiveView, class CViewport* ());
|
||||
MOCK_METHOD1(SetActiveView, void(CViewport*));
|
||||
MOCK_METHOD0(GetFileMonitor, struct IEditorFileMonitor* ());
|
||||
MOCK_METHOD1(RegisterEventLoopHook, void(IEventLoopHook* ));
|
||||
MOCK_METHOD1(UnregisterEventLoopHook, void(IEventLoopHook* ));
|
||||
MOCK_CONST_METHOD0(CreateQMimeData, QMimeData* ());
|
||||
MOCK_CONST_METHOD1(DestroyQMimeData, void(QMimeData*));
|
||||
MOCK_METHOD0(GetLevelIndependentFileMan, class CLevelIndependentFileMan* ());
|
||||
@@ -128,8 +126,6 @@ public:
|
||||
MOCK_METHOD1(CloseView, bool(const char* ));
|
||||
MOCK_METHOD1(SetViewFocus, bool(const char* ));
|
||||
MOCK_METHOD1(CloseView, void(const GUID& ));
|
||||
MOCK_METHOD1(OpenWinWidget, QWidget* (WinWidgetId ));
|
||||
MOCK_CONST_METHOD0(GetWinWidgetManager, WinWidget::WinWidgetManager* ());
|
||||
MOCK_METHOD2(SelectColor, bool(QColor &, QWidget *));
|
||||
MOCK_METHOD0(GetUndoManager, class CUndoManager* ());
|
||||
MOCK_METHOD0(BeginUndo, void());
|
||||
@@ -167,12 +163,8 @@ public:
|
||||
MOCK_METHOD0(GetSourceControl, ISourceControl* ());
|
||||
MOCK_METHOD0(IsSourceControlAvailable, bool());
|
||||
MOCK_METHOD0(IsSourceControlConnected, bool());
|
||||
MOCK_METHOD0(GetUIEnumsDatabase, CUIEnumsDatabase* ());
|
||||
MOCK_METHOD0(AddUIEnums, void());
|
||||
MOCK_METHOD0(ReduceMemory, void());
|
||||
MOCK_METHOD0(GetExportManager, IExportManager* ());
|
||||
MOCK_METHOD2(SetEditorConfigSpec, void(ESystemConfigSpec , ESystemConfigPlatform ));
|
||||
MOCK_CONST_METHOD0(GetEditorConfigSpec, ESystemConfigSpec());
|
||||
MOCK_CONST_METHOD0(GetEditorConfigPlatform, ESystemConfigPlatform());
|
||||
MOCK_METHOD0(ReloadTemplates, void());
|
||||
MOCK_METHOD1(ShowStatusText, void(bool ));
|
||||
|
||||
@@ -66,9 +66,7 @@ namespace CryEditPythonBindingsUnitTests
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_current_view_position") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_current_view_rotation") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("export_to_engine") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_config_spec") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("get_config_platform") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("get_config_spec") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_result_to_success") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("set_result_to_failure") != behaviorContext->m_methods.end());
|
||||
EXPECT_TRUE(behaviorContext->m_methods.find("idle_enable") != behaviorContext->m_methods.end());
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <Mocks/ICVarMock.h>
|
||||
#include <Mocks/ISystemMock.h>
|
||||
#include <Mocks/IConsoleMock.h>
|
||||
#include <Mocks/ILogMock.h>
|
||||
#include <Mocks/IConsoleMock.h>
|
||||
#include "IEditorMock.h"
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
#include "ToolbarManager.h"
|
||||
#include "Core/QtEditorApplication.h"
|
||||
#include "UndoDropDown.h"
|
||||
#include "CVarMenu.h"
|
||||
#include "EditorViewportSettings.h"
|
||||
|
||||
#include "KeyboardCustomizationSettings.h"
|
||||
@@ -660,7 +659,7 @@ void MainWindow::InitActions()
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
am->AddAction(ID_FILE_EXPORTTOGAMENOSURFACETEXTURE, tr("&Export to Engine"))
|
||||
|
||||
@@ -49,7 +49,6 @@ class ToolbarCustomizationDialog;
|
||||
class QWidgetAction;
|
||||
class ActionManager;
|
||||
class ShortcutDispatcher;
|
||||
class CVarMenu;
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ protected:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Undo object for CBaseObject that only stores its transform, color, area and minSpec
|
||||
//! Undo object for CBaseObject that only stores its transform, color, area
|
||||
class CUndoBaseObjectMinimal
|
||||
: public IUndoObject
|
||||
{
|
||||
@@ -84,7 +84,6 @@ private:
|
||||
Vec3 scale;
|
||||
QColor color;
|
||||
float area;
|
||||
int minSpec;
|
||||
};
|
||||
|
||||
void SetTransformsFromState(CBaseObject* pObject, const StateStruct& state, bool bUndo);
|
||||
@@ -253,7 +252,6 @@ CUndoBaseObjectMinimal::CUndoBaseObjectMinimal(CBaseObject* pObj, [[maybe_unused
|
||||
m_undoState.scale = pObj->GetScale();
|
||||
m_undoState.color = pObj->GetColor();
|
||||
m_undoState.area = pObj->GetArea();
|
||||
m_undoState.minSpec = pObj->GetMinSpec();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -284,14 +282,12 @@ void CUndoBaseObjectMinimal::Undo(bool bUndo)
|
||||
m_redoState.rotate = pObject->GetRotation();
|
||||
m_redoState.color = pObject->GetColor();
|
||||
m_redoState.area = pObject->GetArea();
|
||||
m_redoState.minSpec = pObject->GetMinSpec();
|
||||
}
|
||||
|
||||
SetTransformsFromState(pObject, m_undoState, bUndo);
|
||||
|
||||
pObject->ChangeColor(m_undoState.color);
|
||||
pObject->SetArea(m_undoState.area);
|
||||
pObject->SetMinSpec(m_undoState.minSpec, false);
|
||||
|
||||
using namespace AzToolsFramework;
|
||||
ComponentEntityObjectRequestBus::Event(pObject, &ComponentEntityObjectRequestBus::Events::UpdatePreemptiveUndoCache);
|
||||
@@ -310,7 +306,6 @@ void CUndoBaseObjectMinimal::Redo()
|
||||
|
||||
pObject->ChangeColor(m_redoState.color);
|
||||
pObject->SetArea(m_redoState.area);
|
||||
pObject->SetMinSpec(m_redoState.minSpec, false);
|
||||
|
||||
using namespace AzToolsFramework;
|
||||
ComponentEntityObjectRequestBus::Event(pObject, &ComponentEntityObjectRequestBus::Events::UpdatePreemptiveUndoCache);
|
||||
@@ -382,7 +377,6 @@ CBaseObject::CBaseObject()
|
||||
, m_bMatrixInWorldSpace(false)
|
||||
, m_bMatrixValid(false)
|
||||
, m_bWorldBoxValid(false)
|
||||
, m_nMinSpec(0)
|
||||
, m_vDrawIconPos(0, 0, 0)
|
||||
, m_nIconFlags(0)
|
||||
{
|
||||
@@ -413,7 +407,6 @@ bool CBaseObject::Init([[maybe_unused]] IEditor* ie, CBaseObject* prev, [[maybe_
|
||||
SetLocalTM(prev->GetPos(), prev->GetRotation(), prev->GetScale());
|
||||
SetArea(prev->GetArea());
|
||||
SetColor(prev->GetColor());
|
||||
SetMinSpec(prev->GetMinSpec(), false);
|
||||
|
||||
// Copy all basic variables.
|
||||
EnableUpdateCallbacks(false);
|
||||
@@ -1053,17 +1046,6 @@ void CBaseObject::SetSelected(bool bSelect)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseObject::IsHiddenBySpec() const
|
||||
{
|
||||
if (!gSettings.bApplyConfigSpecInEditor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > static_cast<uint32>(gSettings.editorConfigSpec));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Returns true if object hidden.
|
||||
bool CBaseObject::IsHidden() const
|
||||
@@ -1107,7 +1089,6 @@ void CBaseObject::Serialize(CObjectArchive& ar)
|
||||
Vec3 scale = m_scale;
|
||||
Quat quat = m_rotate;
|
||||
Ang3 angles(0, 0, 0);
|
||||
uint32 nMinSpec = m_nMinSpec;
|
||||
|
||||
QColor color = m_color;
|
||||
float flattenArea = m_flattenArea;
|
||||
@@ -1135,12 +1116,6 @@ void CBaseObject::Serialize(CObjectArchive& ar)
|
||||
xmlNode->getAttr("Parent", parentId);
|
||||
xmlNode->getAttr("LookAt", lookatId);
|
||||
xmlNode->getAttr("Material", mtlName);
|
||||
xmlNode->getAttr("MinSpec", nMinSpec);
|
||||
|
||||
if (nMinSpec <= CONFIG_VERYHIGH_SPEC) // Ignore invalid values.
|
||||
{
|
||||
m_nMinSpec = nMinSpec;
|
||||
}
|
||||
|
||||
bool bHidden = flags & OBJFLAG_HIDDEN;
|
||||
bool bFrozen = flags & OBJFLAG_FROZEN;
|
||||
@@ -1245,11 +1220,6 @@ void CBaseObject::Serialize(CObjectArchive& ar)
|
||||
{
|
||||
xmlNode->setAttr("Flags", flags);
|
||||
}
|
||||
|
||||
if (m_nMinSpec != 0)
|
||||
{
|
||||
xmlNode->setAttr("MinSpec", (uint32)m_nMinSpec);
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize variables after default entity parameters.
|
||||
@@ -1300,11 +1270,6 @@ XmlNodeRef CBaseObject::Export([[maybe_unused]] const QString& levelPath, XmlNod
|
||||
objNode->setAttr("Scale", scale);
|
||||
}
|
||||
|
||||
if (m_nMinSpec != 0)
|
||||
{
|
||||
objNode->setAttr("MinSpec", (uint32)m_nMinSpec);
|
||||
}
|
||||
|
||||
// Save variables.
|
||||
CVarObject::Serialize(objNode, false);
|
||||
|
||||
@@ -2134,22 +2099,6 @@ bool CBaseObject::IsSimilarObject(CBaseObject* pObject)
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
|
||||
{
|
||||
m_nMinSpec = nSpec;
|
||||
UpdateVisibility(!IsHidden());
|
||||
|
||||
// Set min spec for all childs.
|
||||
if (bSetChildren)
|
||||
{
|
||||
for (int i = static_cast<int>(m_childs.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
m_childs[i]->SetMinSpec(nSpec, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
EScaleWarningLevel CBaseObject::GetScaleWarningLevel() const
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ class CUndoBaseObject;
|
||||
class CObjectManager;
|
||||
class CGizmo;
|
||||
class CObjectArchive;
|
||||
struct SSubObjSelectionModifyContext;
|
||||
struct SRayHitInfo;
|
||||
class CPopupMenuItem;
|
||||
class QMenu;
|
||||
@@ -257,8 +256,6 @@ public:
|
||||
|
||||
//! Returns true if object hidden.
|
||||
bool IsHidden() const;
|
||||
//! Check against min spec.
|
||||
bool IsHiddenBySpec() const;
|
||||
//! Returns true if object frozen.
|
||||
virtual bool IsFrozen() const;
|
||||
//! Returns true if object is shared between missions.
|
||||
@@ -466,12 +463,6 @@ public:
|
||||
//! Check if specified object is very similar to this one.
|
||||
virtual bool IsSimilarObject(CBaseObject* pObject);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Object minimal usage spec (All/Low/Medium/High)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
uint32 GetMinSpec() const { return m_nMinSpec; }
|
||||
virtual void SetMinSpec(uint32 nSpec, bool bSetChildren = true);
|
||||
|
||||
//! In This function variables of the object must be initialized.
|
||||
virtual void InitVariables() {};
|
||||
|
||||
@@ -669,7 +660,6 @@ private:
|
||||
mutable uint32 m_bMatrixValid : 1;
|
||||
mutable uint32 m_bWorldBoxValid : 1;
|
||||
uint32 m_bInSelectionBox : 1;
|
||||
uint32 m_nMinSpec : 8;
|
||||
|
||||
Vec3 m_vDrawIconPos;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
@@ -200,7 +200,6 @@ CEntityObject::CEntityObject()
|
||||
|
||||
// Init Variables.
|
||||
mv_castShadow = true;
|
||||
mv_castShadowMinSpec = CONFIG_LOW_SPEC;
|
||||
mv_outdoor = false;
|
||||
mv_recvWind = false;
|
||||
mv_renderNearest = false;
|
||||
@@ -249,18 +248,10 @@ CEntityObject::~CEntityObject()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEntityObject::InitVariables()
|
||||
{
|
||||
mv_castShadowMinSpec.AddEnumItem("Never", END_CONFIG_SPEC_ENUM);
|
||||
mv_castShadowMinSpec.AddEnumItem("Low", CONFIG_LOW_SPEC);
|
||||
mv_castShadowMinSpec.AddEnumItem("Medium", CONFIG_MEDIUM_SPEC);
|
||||
mv_castShadowMinSpec.AddEnumItem("High", CONFIG_HIGH_SPEC);
|
||||
mv_castShadowMinSpec.AddEnumItem("VeryHigh", CONFIG_VERYHIGH_SPEC);
|
||||
|
||||
mv_castShadow.SetFlags(mv_castShadow.GetFlags() | IVariable::UI_INVISIBLE);
|
||||
mv_castShadowMinSpec->SetFlags(mv_castShadowMinSpec->GetFlags() | IVariable::UI_UNSORTED);
|
||||
|
||||
AddVariable(mv_outdoor, "OutdoorOnly", tr("Outdoor Only"));
|
||||
AddVariable(mv_castShadow, "CastShadow", tr("Cast Shadow"));
|
||||
AddVariable(mv_castShadowMinSpec, "CastShadowMinspec", tr("Cast Shadow MinSpec"));
|
||||
|
||||
AddVariable(mv_ratioLOD, "LodRatio");
|
||||
AddVariable(mv_viewDistanceMultiplier, "ViewDistanceMultiplier");
|
||||
@@ -361,7 +352,6 @@ bool CEntityObject::ConvertFromObject(CBaseObject* object)
|
||||
CEntityObject* pObject = ( CEntityObject* )object;
|
||||
|
||||
mv_outdoor = pObject->mv_outdoor;
|
||||
mv_castShadowMinSpec = pObject->mv_castShadowMinSpec;
|
||||
mv_ratioLOD = pObject->mv_ratioLOD;
|
||||
mv_viewDistanceMultiplier = pObject->mv_viewDistanceMultiplier;
|
||||
mv_hiddenInGame = pObject->mv_hiddenInGame;
|
||||
@@ -509,34 +499,16 @@ void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char*
|
||||
pAreaLight->SetHumanName("PlanarLight");
|
||||
}
|
||||
|
||||
bool bCastShadowLegacy = false; // Backward compatibility for existing shadow casting lights
|
||||
if (IVariable* pCastShadowVarLegacy = FindVariableInSubBlock(properties, pSubBlockVar, "bCastShadow"))
|
||||
{
|
||||
pCastShadowVarLegacy->SetFlags(pCastShadowVarLegacy->GetFlags() | IVariable::UI_INVISIBLE);
|
||||
const QString zeroPrefix("0");
|
||||
if (!pCastShadowVarLegacy->GetDisplayValue().startsWith(zeroPrefix))
|
||||
{
|
||||
bCastShadowLegacy = true;
|
||||
pCastShadowVarLegacy->SetDisplayValue(zeroPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
if (IVariable* pCastShadowVar = FindVariableInSubBlock(properties, pSubBlockVar, "nCastShadows"))
|
||||
{
|
||||
if (bCastShadowLegacy)
|
||||
{
|
||||
pCastShadowVar->SetDisplayValue("1");
|
||||
}
|
||||
pCastShadowVar->SetDataType(IVariable::DT_UIENUM);
|
||||
pCastShadowVar->SetFlags(pCastShadowVar->GetFlags() | IVariable::UI_UNSORTED);
|
||||
}
|
||||
|
||||
if (IVariable* pShadowMinRes = FindVariableInSubBlock(properties, pSubBlockVar, "nShadowMinResPercent"))
|
||||
{
|
||||
pShadowMinRes->SetDataType(IVariable::DT_UIENUM);
|
||||
pShadowMinRes->SetFlags(pShadowMinRes->GetFlags() | IVariable::UI_UNSORTED);
|
||||
}
|
||||
|
||||
if (IVariable* pFade = FindVariableInSubBlock(properties, pSubBlockVar, "vFadeDimensionsLeft"))
|
||||
{
|
||||
pFade->SetFlags(pFade->GetFlags() | IVariable::UI_INVISIBLE);
|
||||
@@ -873,12 +845,6 @@ void CEntityObject::Serialize(CObjectArchive& ar)
|
||||
RemoveAllEntityLinks();
|
||||
PostLoad(ar);
|
||||
}
|
||||
|
||||
if ((mv_castShadowMinSpec == CONFIG_LOW_SPEC) && !mv_castShadow) // backwards compatibility check
|
||||
{
|
||||
mv_castShadowMinSpec = END_CONFIG_SPEC_ENUM;
|
||||
mv_castShadow = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1033,8 +999,6 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
|
||||
objNode->setAttr("ViewDistanceMultiplier", mv_viewDistanceMultiplier);
|
||||
}
|
||||
|
||||
objNode->setAttr("CastShadowMinSpec", mv_castShadowMinSpec);
|
||||
|
||||
if (mv_recvWind)
|
||||
{
|
||||
objNode->setAttr("RecvWind", true);
|
||||
@@ -1050,11 +1014,6 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
|
||||
objNode->setAttr("OutdoorOnly", true);
|
||||
}
|
||||
|
||||
if (GetMinSpec() != 0)
|
||||
{
|
||||
objNode->setAttr("MinSpec", ( uint32 )GetMinSpec());
|
||||
}
|
||||
|
||||
if (mv_hiddenInGame)
|
||||
{
|
||||
objNode->setAttr("HiddenInGame", true);
|
||||
@@ -1163,7 +1122,7 @@ void CEntityObject::UpdateVisibility(bool bVisible)
|
||||
{
|
||||
CBaseObject::UpdateVisibility(bVisible);
|
||||
|
||||
bool bVisibleWithSpec = bVisible && !IsHiddenBySpec();
|
||||
bool bVisibleWithSpec = bVisible;
|
||||
if (bVisibleWithSpec != static_cast<bool>(m_bVisible))
|
||||
{
|
||||
m_bVisible = bVisibleWithSpec;
|
||||
|
||||
@@ -174,8 +174,6 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int GetCastShadowMinSpec() const { return mv_castShadowMinSpec; }
|
||||
|
||||
float GetRatioLod() const { return static_cast<float>(mv_ratioLOD); };
|
||||
float GetViewDistanceMultiplier() const { return mv_viewDistanceMultiplier; }
|
||||
|
||||
@@ -306,7 +304,6 @@ protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CVariable<bool> mv_outdoor;
|
||||
CVariable<bool> mv_castShadow; // Legacy, required for backwards compatibility
|
||||
CSmartVariableEnum<int> mv_castShadowMinSpec;
|
||||
CVariable<int> mv_ratioLOD;
|
||||
CVariable<float> mv_viewDistanceMultiplier;
|
||||
CVariable<bool> mv_hiddenInGame; // Entity is hidden in game (on start).
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "SubObjSelection.h"
|
||||
|
||||
SSubObjSelOptions g_SubObjSelOptions;
|
||||
|
||||
/*
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CSubObjSelContext::IsEmpty() const
|
||||
{
|
||||
if (GetCount() == 0)
|
||||
return false;
|
||||
for (int i = 0; i < GetCount(); i++)
|
||||
{
|
||||
CSubObjectSelection *pSel = GetSelection(i);
|
||||
if (!pSel->IsEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSubObjSelContext::ModifySelection( SSubObjSelectionModifyContext &modCtx )
|
||||
{
|
||||
for (int n = 0; n < GetCount(); n++)
|
||||
{
|
||||
CSubObjectSelection *pSel = GetSelection(n);
|
||||
if (pSel->IsEmpty())
|
||||
continue;
|
||||
modCtx.pSubObjSelection = pSel;
|
||||
pSel->pGeometry->SubObjSelectionModify( modCtx );
|
||||
}
|
||||
if (modCtx.type == SO_MODIFY_MOVE)
|
||||
{
|
||||
OnSelectionChange();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSubObjSelContext::AcceptModifySelection()
|
||||
{
|
||||
for (int n = 0; n < GetCount(); n++)
|
||||
{
|
||||
CSubObjectSelection *pSel = GetSelection(n);
|
||||
if (pSel->IsEmpty())
|
||||
continue;
|
||||
if (pSel->pGeometry)
|
||||
pSel->pGeometry->Update();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -1,91 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_OBJECTS_SUBOBJSELECTION_H
|
||||
#define CRYINCLUDE_EDITOR_OBJECTS_SUBOBJSELECTION_H
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Sub Object element type.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
enum ESubObjElementType
|
||||
{
|
||||
SO_ELEM_NONE = 0,
|
||||
SO_ELEM_VERTEX,
|
||||
SO_ELEM_EDGE,
|
||||
SO_ELEM_FACE,
|
||||
SO_ELEM_POLYGON,
|
||||
SO_ELEM_UV,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
enum ESubObjDisplayType
|
||||
{
|
||||
SO_DISPLAY_WIREFRAME,
|
||||
SO_DISPLAY_FLAT,
|
||||
SO_DISPLAY_GEOMETRY,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Options for sub-object selection.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SSubObjSelOptions
|
||||
{
|
||||
bool bSelectByVertex;
|
||||
bool bIgnoreBackfacing;
|
||||
int nMatID;
|
||||
|
||||
bool bSoftSelection;
|
||||
float fSoftSelFalloff;
|
||||
|
||||
// Display options.
|
||||
bool bDisplayBackfacing;
|
||||
bool bDisplayNormals;
|
||||
float fNormalsLength;
|
||||
ESubObjDisplayType displayType;
|
||||
|
||||
SSubObjSelOptions()
|
||||
{
|
||||
bSelectByVertex = false;
|
||||
bIgnoreBackfacing = false;
|
||||
bSoftSelection = false;
|
||||
nMatID = 0;
|
||||
fSoftSelFalloff = 1;
|
||||
|
||||
bDisplayBackfacing = true;
|
||||
bDisplayNormals = false;
|
||||
displayType = SO_DISPLAY_FLAT;
|
||||
fNormalsLength = 0.4f;
|
||||
}
|
||||
};
|
||||
|
||||
extern SSubObjSelOptions g_SubObjSelOptions;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
enum ESubObjSelectionModifyType
|
||||
{
|
||||
SO_MODIFY_UNSELECT,
|
||||
SO_MODIFY_MOVE,
|
||||
SO_MODIFY_ROTATE,
|
||||
SO_MODIFY_SCALE,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// This structure is passed when user is dragging sub object selection.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SSubObjSelectionModifyContext
|
||||
{
|
||||
CViewport* view;
|
||||
ESubObjSelectionModifyType type;
|
||||
Vec3 vValue;
|
||||
Matrix34 worldRefFrame;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_OBJECTS_SUBOBJSELECTION_H
|
||||
@@ -11,9 +11,6 @@
|
||||
|
||||
#include "Plugin.h"
|
||||
|
||||
// Editor
|
||||
#include "Include/IViewPane.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
CClassFactory* CClassFactory::s_pInstance = nullptr;
|
||||
@@ -149,23 +146,6 @@ IClassDesc* CClassFactory::FindClass(const GUID& rClassID) const
|
||||
return pClassDesc;
|
||||
}
|
||||
|
||||
IViewPaneClass* CClassFactory::FindViewPaneClassByTitle(const char* pPaneTitle) const
|
||||
{
|
||||
for (size_t i = 0; i < m_classes.size(); i++)
|
||||
{
|
||||
IViewPaneClass* viewPane = nullptr;
|
||||
IClassDesc* desc = m_classes[i];
|
||||
if (SUCCEEDED(desc->QueryInterface(__az_uuidof(IViewPaneClass), (void**)&viewPane)))
|
||||
{
|
||||
if (QString::compare(viewPane->GetPaneTitle(), pPaneTitle) == 0)
|
||||
{
|
||||
return viewPane;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CClassFactory::UnregisterClass(const char* pClassName)
|
||||
{
|
||||
IClassDesc* pClassDesc = FindClass(pClassName);
|
||||
|
||||
@@ -15,45 +15,6 @@
|
||||
#include "Util/GuidUtil.h"
|
||||
#include <map>
|
||||
|
||||
//! Derive from this class to decrease the amount of work for creating a new class description
|
||||
//! Provides standard reference counter implementation for IUnknown
|
||||
class CRefCountClassDesc
|
||||
: public IClassDesc
|
||||
{
|
||||
public:
|
||||
virtual ~CRefCountClassDesc() { }
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] const IID& riid, [[maybe_unused]] void** ppvObj)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
++m_nRefCount;
|
||||
return m_nRefCount;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
int refs = m_nRefCount;
|
||||
|
||||
if (--m_nRefCount <= 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
return refs;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_nRefCount;
|
||||
};
|
||||
|
||||
|
||||
// Use this for debugging unregistration problems.
|
||||
//#define DEBUG_CLASS_NAME_REGISTRATION
|
||||
|
||||
|
||||
//! Class factory is a common repository of all registered plugin classes,
|
||||
//! Classes here can found by their class ID or all classes of given system class retrieved
|
||||
class CRYEDIT_API CClassFactory
|
||||
@@ -71,8 +32,6 @@ public:
|
||||
IClassDesc* FindClass(const char* className) const;
|
||||
//! Find class in the factory by class ID
|
||||
IClassDesc* FindClass(const GUID& rClassID) const;
|
||||
//! Find View Pane Class in the factory by pane title
|
||||
IViewPaneClass* FindViewPaneClassByTitle(const char* pPaneTitle) const;
|
||||
void UnregisterClass(const char* pClassName);
|
||||
void UnregisterClass(const GUID& rClassID);
|
||||
//! Get classes matching specific requirements ordered alphabetically by name.
|
||||
@@ -135,10 +94,4 @@ public:
|
||||
#define REGISTER_CLASS_DESC(ClassDesc) \
|
||||
CAutoRegisterClassHelper g_AutoRegHelper##ClassDesc(new ClassDesc);
|
||||
|
||||
#define REGISTER_QT_CLASS_DESC(ClassDesc, name, category) \
|
||||
CAutoRegisterClassHelper g_AutoRegHelper##ClassDesc(new CQtViewClass<ClassDesc>(name, category));
|
||||
|
||||
#define REGISTER_QT_CLASS_DESC_SYSTEM_ID(ClassDesc, name, category, systemid) \
|
||||
CAutoRegisterClassHelper g_AutoRegHelper##ClassDesc(new CQtViewClass<ClassDesc>(name, category, systemid));
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_PLUGIN_H
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "UI/QComponentEntityEditorOutlinerWindow.h"
|
||||
#include "UI/QComponentLevelEntityEditorMainWindow.h"
|
||||
#include "UI/ComponentPalette/ComponentPaletteSettings.h"
|
||||
#include "UI/ComponentPalette/ComponentPaletteWindow.h"
|
||||
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Component/EntityUtils.h>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Manifest>
|
||||
</Manifest>
|
||||
@@ -69,7 +69,6 @@
|
||||
#include "ISourceControl.h"
|
||||
#include "UI/QComponentEntityEditorMainWindow.h"
|
||||
|
||||
#include <LmbrCentral/Rendering/EditorLightComponentBus.h>
|
||||
#include <LmbrCentral/Scripting/TagComponentBus.h>
|
||||
#include <LmbrCentral/Scripting/EditorTagComponentBus.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <qevent.h>
|
||||
#include <qmimedata.h>
|
||||
|
||||
#include <LmbrCentral/Rendering/LensFlareAsset.h>
|
||||
#include <LmbrCentral/Rendering/MeshAsset.h>
|
||||
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
|
||||
-97
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CategoriesList.h"
|
||||
|
||||
ComponentCategoryList::ComponentCategoryList(QWidget* parent /*= nullptr*/)
|
||||
: QTreeWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ComponentCategoryList::Init()
|
||||
{
|
||||
setColumnCount(1);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setDragDropMode(QAbstractItemView::DragDropMode::DragOnly);
|
||||
setDragEnabled(true);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setAllColumnsShowFocus(true);
|
||||
setStyleSheet("QTreeWidget { selection-background-color: rgba(255,255,255,0.2); }");
|
||||
|
||||
QStringList headers;
|
||||
headers << tr("Categories");
|
||||
setHeaderLabels(headers);
|
||||
|
||||
const QString parentCategoryIconPath = QString("Icons/PropertyEditor/Browse_on.png");
|
||||
const QString categoryIconPath = QString("Icons/PropertyEditor/Browse.png");
|
||||
|
||||
QTreeWidgetItem* allCategory = new QTreeWidgetItem(this);
|
||||
allCategory->setText(0, "All");
|
||||
allCategory->setIcon(0, QIcon(categoryIconPath));
|
||||
|
||||
// Need this briefly to collect the list of available categories.
|
||||
ComponentDataModel dataModel(this);
|
||||
for (const auto& cat : dataModel.GetCategories())
|
||||
{
|
||||
QString categoryString = QString(cat.c_str());
|
||||
QStringList categories = categoryString.split('/', Qt::SkipEmptyParts);
|
||||
|
||||
QTreeWidgetItem* parent = nullptr;
|
||||
QTreeWidgetItem* categoryWidget = nullptr;
|
||||
|
||||
for (const auto& categoryName : categories)
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
categoryWidget = new QTreeWidgetItem(parent);
|
||||
categoryWidget->setIcon(0, QIcon(categoryIconPath));
|
||||
|
||||
// Store the full category path in a user role because we'll need it to locate the actual category
|
||||
categoryWidget->setData(0, Qt::UserRole, QVariant::fromValue(categoryString));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto existingCategory = findItems(categoryName, Qt::MatchExactly);
|
||||
if (existingCategory.empty())
|
||||
{
|
||||
categoryWidget = new QTreeWidgetItem(this);
|
||||
categoryWidget->setIcon(0, QIcon(parentCategoryIconPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
categoryWidget = static_cast<QTreeWidgetItem*>(existingCategory.first());
|
||||
categoryWidget->setIcon(0, QIcon(parentCategoryIconPath));
|
||||
}
|
||||
}
|
||||
|
||||
parent = categoryWidget;
|
||||
|
||||
categoryWidget->setText(0, categoryName);
|
||||
}
|
||||
}
|
||||
|
||||
expandAll();
|
||||
|
||||
connect(this, &QTreeWidget::itemClicked, this, &ComponentCategoryList::OnItemClicked);
|
||||
}
|
||||
|
||||
void ComponentCategoryList::OnItemClicked(QTreeWidgetItem* item, int /*column*/)
|
||||
{
|
||||
QVariant userData = item->data(0, Qt::UserRole);
|
||||
if (userData.isValid())
|
||||
{
|
||||
// Send in the full category path, not just the child category name
|
||||
emit OnCategoryChange(userData.value<QString>().toStdString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
emit OnCategoryChange(item->text(0).toStdString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
#include <UI/ComponentPalette/moc_CategoriesList.cpp>
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "ComponentDataModel.h"
|
||||
#include <QTreeWidget>
|
||||
#endif
|
||||
|
||||
//! ComponentCategoryList
|
||||
//! Provides a list of all reflected categories that users can select for quick
|
||||
//! filtering the filtered component list.
|
||||
class ComponentCategoryList : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
AZ_CLASS_ALLOCATOR(ComponentCategoryList, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit ComponentCategoryList(QWidget* parent = nullptr);
|
||||
|
||||
void Init();
|
||||
|
||||
Q_SIGNALS:
|
||||
void OnCategoryChange(const char* category);
|
||||
|
||||
protected:
|
||||
|
||||
// Will emit OnCategoryChange signal
|
||||
void OnItemClicked(QTreeWidgetItem* item, int column);
|
||||
|
||||
};
|
||||
-547
@@ -1,547 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ComponentDataModel.h"
|
||||
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/ToolsComponents/ComponentMimeData.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Commands/EntityStateCommand.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
|
||||
#include <Editor/IEditor.h>
|
||||
#include <Editor/Viewport.h>
|
||||
#include <Editor/ViewManager.h>
|
||||
#include <CryCommon/MathConversion.h>
|
||||
|
||||
#include <AzQtComponents/DragAndDrop/ViewportDragAndDrop.h>
|
||||
|
||||
#include <QMimeData>
|
||||
|
||||
namespace
|
||||
{
|
||||
// This is a helper function that given an object that derives from QAbstractItemModel,
|
||||
// it will request the model's "ClassDataRole" class data for an entry and use that
|
||||
// information to create a new entity with the selected components.
|
||||
AZ::EntityId CreateEntityFromSelection(const QModelIndexList& selection, QAbstractItemModel* model)
|
||||
{
|
||||
AZ::Vector3 position = AZ::Vector3::CreateZero();
|
||||
CViewport *view = GetIEditor()->GetViewManager()->GetGameViewport();
|
||||
int width, height;
|
||||
view->GetDimensions(&width, &height);
|
||||
position = LYVec3ToAZVec3(view->ViewToWorld(QPoint(width / 2, height / 2)));
|
||||
|
||||
AZ::EntityId newEntityId;
|
||||
EBUS_EVENT_RESULT(newEntityId, AzToolsFramework::EditorRequests::Bus, CreateNewEntityAtPosition, position, AZ::EntityId());
|
||||
if (newEntityId.IsValid())
|
||||
{
|
||||
// Add all the selected components.
|
||||
AZ::ComponentTypeList componentsToAdd;
|
||||
for (auto index : selection)
|
||||
{
|
||||
// We only need to consider the first column, it's important that the data() function that
|
||||
// returns ComponentDataModel::ClassDataRole also does so for the first column.
|
||||
if (index.column() != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QVariant classDataVariant = model->data(index, ComponentDataModel::ClassDataRole);
|
||||
if (classDataVariant.isValid())
|
||||
{
|
||||
const AZ::SerializeContext::ClassData* classData = reinterpret_cast<const AZ::SerializeContext::ClassData*>(classDataVariant.value<void*>());
|
||||
componentsToAdd.push_back(classData->m_typeId);
|
||||
}
|
||||
}
|
||||
|
||||
AzToolsFramework::EntityCompositionRequestBus::Broadcast(&AzToolsFramework::EntityCompositionRequests::AddComponentsToEntities, AzToolsFramework::EntityIdList{ newEntityId }, componentsToAdd);
|
||||
|
||||
return newEntityId;
|
||||
}
|
||||
|
||||
return AZ::EntityId();
|
||||
}
|
||||
}
|
||||
|
||||
namespace ComponentDataUtilities
|
||||
{
|
||||
// This is a helper function to add the specified components to the selected entities, it relies on the provided
|
||||
// QAbstractItemModel to determine the appropriate ClassData to use to create the components (given that some widgets
|
||||
// may provide proxy models that alter the order).
|
||||
void AddComponentsToSelectedEntities(const QModelIndexList& selectedComponents, QAbstractItemModel* model)
|
||||
{
|
||||
AzToolsFramework::EntityIdList selectedEntities;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(selectedEntities, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
if (selectedEntities.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Add all the selected components.
|
||||
AZ::ComponentTypeList componentsToAdd;
|
||||
for (auto index : selectedComponents)
|
||||
{
|
||||
// We only need to consider the first column, it's important that the data() function that
|
||||
// returns ComponentDataModel::ClassDataRole also does so for the first column.
|
||||
if (index.column() != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QVariant classDataVariant = model->data(index, ComponentDataModel::ClassDataRole);
|
||||
if (classDataVariant.isValid())
|
||||
{
|
||||
const AZ::SerializeContext::ClassData* classData = reinterpret_cast<const AZ::SerializeContext::ClassData*>(classDataVariant.value<void*>());
|
||||
componentsToAdd.push_back(classData->m_typeId);
|
||||
}
|
||||
}
|
||||
|
||||
AzToolsFramework::EntityCompositionRequestBus::Broadcast(&AzToolsFramework::EntityCompositionRequests::AddComponentsToEntities, selectedEntities, componentsToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ComponentDataModel
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ComponentDataModel::ComponentDataModel(QObject* parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext);
|
||||
AZ_Assert(serializeContext, "Failed to acquire application serialize context.");
|
||||
|
||||
serializeContext->EnumerateDerived<AZ::Component>([this](const AZ::SerializeContext::ClassData* classData, const AZ::Uuid&) -> bool
|
||||
{
|
||||
bool allowed = false;
|
||||
bool hidden = false;
|
||||
AZStd::string category = "Miscellaneous";
|
||||
|
||||
if (classData->m_editData)
|
||||
{
|
||||
for (const AZ::Edit::ElementData& element : classData->m_editData->m_elements)
|
||||
{
|
||||
if (element.m_elementId == AZ::Edit::ClassElements::EditorData)
|
||||
{
|
||||
AZStd::string iconPath;
|
||||
AzToolsFramework::EditorRequestBus::BroadcastResult(iconPath, &AzToolsFramework::EditorRequests::GetComponentTypeEditorIcon, classData->m_typeId);
|
||||
if (!iconPath.empty())
|
||||
{
|
||||
m_componentIcons[classData->m_typeId] = QIcon(iconPath.c_str());
|
||||
}
|
||||
|
||||
for (const AZ::Edit::AttributePair& attribPair : element.m_attributes)
|
||||
{
|
||||
if (attribPair.first == AZ::Edit::Attributes::AppearsInAddComponentMenu)
|
||||
{
|
||||
if (auto data = azdynamic_cast<AZ::Edit::AttributeData<AZ::Crc32>*>(attribPair.second))
|
||||
{
|
||||
if (data->Get(nullptr) == AZ_CRC("Game"))
|
||||
{
|
||||
allowed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (attribPair.first == AZ::Edit::Attributes::AddableByUser)
|
||||
{
|
||||
// skip this component if user is not allowed to add it directly
|
||||
if (auto data = azdynamic_cast<AZ::Edit::AttributeData<bool>*>(attribPair.second))
|
||||
{
|
||||
if (!data->Get(nullptr))
|
||||
{
|
||||
hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (attribPair.first == AZ::Edit::Attributes::Category)
|
||||
{
|
||||
if (auto data = azdynamic_cast<AZ::Edit::AttributeData<const char*>*>(attribPair.second))
|
||||
{
|
||||
category = data->Get(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allowed && !hidden)
|
||||
{
|
||||
m_componentList.push_back(classData);
|
||||
m_componentMap[category].push_back(classData);
|
||||
m_categories.insert(category);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// we'd like viewport events
|
||||
AzQtComponents::DragAndDropEventsBus::Handler::BusConnect(AzQtComponents::DragAndDropContexts::EditorViewport);
|
||||
}
|
||||
|
||||
ComponentDataModel::~ComponentDataModel()
|
||||
{
|
||||
AzQtComponents::DragAndDropEventsBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
Qt::ItemFlags ComponentDataModel::flags([[maybe_unused]] const QModelIndex &index) const
|
||||
{
|
||||
return Qt::ItemFlags(
|
||||
Qt::ItemIsEnabled |
|
||||
Qt::ItemIsDragEnabled |
|
||||
Qt::ItemIsDropEnabled |
|
||||
Qt::ItemIsSelectable);
|
||||
}
|
||||
|
||||
const AZ::SerializeContext::ClassData* ComponentDataModel::GetClassData(const QModelIndex& index) const
|
||||
{
|
||||
int row = index.row();
|
||||
if (row < 0 || row >= m_componentList.size())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_componentList[row];
|
||||
}
|
||||
|
||||
const char* ComponentDataModel::GetCategory(const AZ::SerializeContext::ClassData* classData)
|
||||
{
|
||||
if (classData)
|
||||
{
|
||||
if (auto editorDataElement = classData->m_editData->FindElementData(AZ::Edit::ClassElements::EditorData))
|
||||
{
|
||||
if (auto categoryAttribute = editorDataElement->FindAttribute(AZ::Edit::Attributes::Category))
|
||||
{
|
||||
if (auto categoryData = azdynamic_cast<AZ::Edit::AttributeData<const char*>*>(categoryAttribute))
|
||||
{
|
||||
const char* result = categoryData->Get(nullptr);
|
||||
if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
QModelIndex ComponentDataModel::index(int row, int column, const QModelIndex &parent /*= QModelIndex()*/) const
|
||||
{
|
||||
if (row >= rowCount(parent) || column >= columnCount(parent))
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
return createIndex(row, column, (void*)(m_componentList[row]));
|
||||
}
|
||||
|
||||
QModelIndex ComponentDataModel::parent([[maybe_unused]] const QModelIndex &child) const
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int ComponentDataModel::rowCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const
|
||||
{
|
||||
return static_cast<int>(m_componentList.size());
|
||||
}
|
||||
|
||||
int ComponentDataModel::columnCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const
|
||||
{
|
||||
return ColumnIndex::Count;
|
||||
}
|
||||
|
||||
QVariant ComponentDataModel::data(const QModelIndex &index, int role /*= Qt::DisplayRole*/) const
|
||||
{
|
||||
if (index.isValid())
|
||||
{
|
||||
const AZ::SerializeContext::ClassData* classData = m_componentList[index.row()];
|
||||
if (!classData)
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case ClassDataRole:
|
||||
if (index.column() == 0) // Only get data for one column
|
||||
{
|
||||
return QVariant::fromValue<void*>(reinterpret_cast<void*>(const_cast<AZ::SerializeContext::ClassData*>(classData)));
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
if (index.column() == ColumnIndex::Name)
|
||||
{
|
||||
return QVariant(classData->m_editData->m_name);
|
||||
}
|
||||
else
|
||||
if (index.column() == ColumnIndex::Category)
|
||||
{
|
||||
if (auto editorDataElement = classData->m_editData->FindElementData(AZ::Edit::ClassElements::EditorData))
|
||||
{
|
||||
if (auto categoryAttribute = editorDataElement->FindAttribute(AZ::Edit::Attributes::Category))
|
||||
{
|
||||
if (auto categoryData = azdynamic_cast<const AZ::Edit::AttributeData<const char*>*>(categoryAttribute))
|
||||
{
|
||||
return QVariant(categoryData->Get(nullptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
{
|
||||
return QVariant(classData->m_editData->m_description);
|
||||
}
|
||||
|
||||
case Qt::DecorationRole:
|
||||
{
|
||||
if (index.column() == ColumnIndex::Icon)
|
||||
{
|
||||
auto iconIterator = m_componentIcons.find(classData->m_typeId);
|
||||
if (iconIterator != m_componentIcons.end())
|
||||
{
|
||||
return iconIterator->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QMimeData* ComponentDataModel::mimeData(const QModelIndexList& indices) const
|
||||
{
|
||||
QModelIndexList list;
|
||||
|
||||
// Filter out columns we are not interested in.
|
||||
for (const QModelIndex& index : indices)
|
||||
{
|
||||
if (index.column() == 0)
|
||||
{
|
||||
list.push_back(index);
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::vector<const AZ::SerializeContext::ClassData*> sortedList;
|
||||
for (QModelIndex index : list)
|
||||
{
|
||||
QVariant classDataVariant = index.data(ComponentDataModel::ClassDataRole);
|
||||
if (classDataVariant.isValid())
|
||||
{
|
||||
const AZ::SerializeContext::ClassData* classData = reinterpret_cast<const AZ::SerializeContext::ClassData*>(classDataVariant.value<void*>());
|
||||
sortedList.push_back(classData);
|
||||
}
|
||||
}
|
||||
|
||||
QMimeData* mimeData = nullptr;
|
||||
if (!sortedList.empty())
|
||||
{
|
||||
mimeData = AzToolsFramework::ComponentTypeMimeData::Create(sortedList).release();
|
||||
}
|
||||
|
||||
return mimeData;
|
||||
}
|
||||
|
||||
bool ComponentDataModel::CanAcceptDragAndDropEvent(QDropEvent* event, AzQtComponents::DragAndDropContextBase& context) const
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
using namespace AzQtComponents;
|
||||
|
||||
// if a listener with a higher priority already claimed this event, do not touch it.
|
||||
if ((!event) || (event->isAccepted()) || (!event->mimeData()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ViewportDragContext* contextVP = azrtti_cast<ViewportDragContext*>(&context);
|
||||
if (!contextVP)
|
||||
{
|
||||
// not a viewport event. This is for some other GUI such as the main window itself.
|
||||
return false;
|
||||
}
|
||||
|
||||
AZStd::vector<const AZ::SerializeContext::ClassData*> componentClassDataList;
|
||||
return AzToolsFramework::ComponentTypeMimeData::Get(event->mimeData(), componentClassDataList);
|
||||
}
|
||||
|
||||
void ComponentDataModel::DragEnter(QDragEnterEvent* event, AzQtComponents::DragAndDropContextBase& context)
|
||||
{
|
||||
if (CanAcceptDragAndDropEvent(event, context))
|
||||
{
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->setAccepted(true);
|
||||
// opportunities to show special highlights, or ghosted entities or previews here.
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentDataModel::DragMove(QDragMoveEvent* event, AzQtComponents::DragAndDropContextBase& context)
|
||||
{
|
||||
if (CanAcceptDragAndDropEvent(event, context))
|
||||
{
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->setAccepted(true);
|
||||
// opportunities to update special highlights, or ghosted entities or previews here.
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentDataModel::DragLeave(QDragLeaveEvent* /*event*/)
|
||||
{
|
||||
// opportunities to remove ghosted entities or previews here.
|
||||
}
|
||||
|
||||
void ComponentDataModel::Drop(QDropEvent* event, AzQtComponents::DragAndDropContextBase& context)
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
using namespace AzQtComponents;
|
||||
|
||||
// ALWAYS CHECK - you are not the only one connected to this bus, and someone else may have already
|
||||
// handled the event or accepted the drop - it might not contain types relevant to you.
|
||||
// you still get informed about the drop event in case you did some stuff in your gui and need to clean it up.
|
||||
if (!CanAcceptDragAndDropEvent(event, context))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// note that the above call already checks all the pointers such as event, or whether context is a VP context, mimetype, etc
|
||||
ViewportDragContext* contextVP = azrtti_cast<ViewportDragContext*>(&context);
|
||||
|
||||
// we don't get given this action by Qt unless we already returned accepted from one of the other ones (such as drag move of drag enter)
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->setAccepted(true);
|
||||
|
||||
AzToolsFramework::ScopedUndoBatch undo("Create entity from components");
|
||||
const AZStd::string name = AZStd::string::format("Entity%d", GetIEditor()->GetObjectManager()->GetObjectCount());
|
||||
|
||||
AZ::Entity* newEntity = aznew AZ::Entity(name.c_str());
|
||||
if (newEntity)
|
||||
{
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(&AzToolsFramework::EditorEntityContextRequests::AddRequiredComponents, *newEntity);
|
||||
auto* transformComponent = newEntity->FindComponent<AzToolsFramework::Components::TransformComponent>();
|
||||
if (transformComponent)
|
||||
{
|
||||
transformComponent->SetWorldTM(AZ::Transform::CreateTranslation(contextVP->m_hitLocation));
|
||||
}
|
||||
|
||||
// Add the entity to the editor context, which activates it and creates the sandbox object.
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(&AzToolsFramework::EditorEntityContextRequests::AddEditorEntity, newEntity);
|
||||
|
||||
// Prepare undo command last so it captures the final state of the entity.
|
||||
AzToolsFramework::EntityCreateCommand* command = aznew AzToolsFramework::EntityCreateCommand(static_cast<AZ::u64>(newEntity->GetId()));
|
||||
command->Capture(newEntity);
|
||||
command->SetParent(undo.GetUndoBatch());
|
||||
|
||||
// Only need to add components to the new entity
|
||||
AzToolsFramework::EntityIdList entities = { newEntity->GetId() };
|
||||
|
||||
AZStd::vector<const AZ::SerializeContext::ClassData*> componentClassDataList;
|
||||
AzToolsFramework::ComponentTypeMimeData::Get(event->mimeData(), componentClassDataList);
|
||||
|
||||
AZ::ComponentTypeList componentsToAdd;
|
||||
for (auto classData : componentClassDataList)
|
||||
{
|
||||
if (!classData)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
componentsToAdd.push_back(classData->m_typeId);
|
||||
}
|
||||
|
||||
AzToolsFramework::EntityCompositionRequests::AddComponentsOutcome addedComponentsResult = AZ::Failure(AZStd::string("Failed to call AddComponentsToEntities on EntityCompositionRequestBus"));
|
||||
AzToolsFramework::EntityCompositionRequestBus::BroadcastResult(addedComponentsResult, &AzToolsFramework::EntityCompositionRequests::AddComponentsToEntities, entities, componentsToAdd);
|
||||
|
||||
ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::AddDirtyEntity, newEntity->GetId());
|
||||
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequests::SetSelectedEntities, entities);
|
||||
}
|
||||
}
|
||||
|
||||
AZ::EntityId ComponentDataProxyModel::NewEntityFromSelection(const QModelIndexList& selection)
|
||||
{
|
||||
return CreateEntityFromSelection(selection, this);
|
||||
}
|
||||
|
||||
AZ::EntityId ComponentDataModel::NewEntityFromSelection(const QModelIndexList& selection)
|
||||
{
|
||||
return CreateEntityFromSelection(selection, this);
|
||||
}
|
||||
|
||||
bool ComponentDataProxyModel::filterAcceptsRow(int sourceRow, [[maybe_unused]] const QModelIndex &sourceParent) const
|
||||
{
|
||||
if (m_selectedCategory.empty() && !filterRegExp().isValid())
|
||||
return true;
|
||||
|
||||
ComponentDataModel* dataModel = static_cast<ComponentDataModel*>(sourceModel());
|
||||
if (sourceRow < 0 || sourceRow >= dataModel->GetComponents().size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const AZ::SerializeContext::ClassData* classData = dataModel->GetComponents()[sourceRow];
|
||||
if (!classData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get Category
|
||||
if (!m_selectedCategory.empty())
|
||||
{
|
||||
AZStd::string currentCateogry = ComponentDataModel::GetCategory(classData);
|
||||
|
||||
if (AzFramework::StringFunc::Find(currentCateogry.c_str(), m_selectedCategory.c_str()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (filterRegExp().isValid())
|
||||
{
|
||||
QString componentName = QString::fromUtf8(classData->m_editData->m_name);
|
||||
return componentName.contains(filterRegExp());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ComponentDataProxyModel::SetSelectedCategory(const AZStd::string& category)
|
||||
{
|
||||
m_selectedCategory = category;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void ComponentDataProxyModel::ClearSelectedCategory()
|
||||
{
|
||||
m_selectedCategory.clear();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
#include "UI/ComponentPalette/moc_ComponentDataModel.cpp"
|
||||
-128
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QAbstractTableModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/std/containers/set.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#include <AzQtComponents/Buses/DragAndDrop.h>
|
||||
#endif
|
||||
|
||||
namespace ComponentDataUtilities
|
||||
{
|
||||
// Given a list of selected components, use the provided model to get the components to add to any selected entities.
|
||||
void AddComponentsToSelectedEntities(const QModelIndexList& selectedComponents, QAbstractItemModel* model);
|
||||
}
|
||||
|
||||
class CViewport;
|
||||
|
||||
//! ComponentDataModel
|
||||
//! Holds the data required to display components in a table, this includes component name, categories, icons.
|
||||
class ComponentDataModel
|
||||
: public QAbstractTableModel
|
||||
, protected AzQtComponents::DragAndDropEventsBus::Handler // its okay if more than one of these is installed, the first one gets it.
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ComponentDataModel, AZ::SystemAllocator, 0);
|
||||
|
||||
using ComponentClassList = AZStd::vector<const AZ::SerializeContext::ClassData*>;
|
||||
using ComponentCategorySet = AZStd::set<AZStd::string>;
|
||||
using ComponentClassMap = AZStd::unordered_map<AZStd::string, AZStd::vector<const AZ::SerializeContext::ClassData*>>;
|
||||
using ComponentIconMap = AZStd::unordered_map<AZ::Uuid, QIcon>;
|
||||
|
||||
enum ColumnIndex
|
||||
{
|
||||
Icon,
|
||||
Category,
|
||||
Name,
|
||||
Count
|
||||
};
|
||||
|
||||
enum CustomRoles
|
||||
{
|
||||
ClassDataRole = Qt::UserRole + 1
|
||||
};
|
||||
|
||||
ComponentDataModel(QObject* parent = nullptr);
|
||||
~ComponentDataModel() override;
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
QMimeData* mimeData(const QModelIndexList& indexes) const override;
|
||||
|
||||
const AZ::SerializeContext::ClassData* GetClassData(const QModelIndex&) const;
|
||||
|
||||
AZ::EntityId NewEntityFromSelection(const QModelIndexList& selection);
|
||||
|
||||
static const char* GetCategory(const AZ::SerializeContext::ClassData* classData);
|
||||
|
||||
ComponentClassList& GetComponents() { return m_componentList; }
|
||||
ComponentCategorySet& GetCategories() { return m_categories; }
|
||||
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzQtComponents::DragAndDropEventsBus::Handler
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DragEnter(QDragEnterEvent* event, AzQtComponents::DragAndDropContextBase& context) override;
|
||||
void DragMove(QDragMoveEvent* event, AzQtComponents::DragAndDropContextBase& context) override;
|
||||
void DragLeave(QDragLeaveEvent* event) override;
|
||||
void Drop(QDropEvent* event, AzQtComponents::DragAndDropContextBase& context) override;
|
||||
bool CanAcceptDragAndDropEvent(QDropEvent* event, AzQtComponents::DragAndDropContextBase& context) const;
|
||||
|
||||
ComponentClassList m_componentList;
|
||||
ComponentClassMap m_componentMap;
|
||||
ComponentIconMap m_componentIcons;
|
||||
ComponentCategorySet m_categories;
|
||||
};
|
||||
|
||||
//! ComponentDataProxyModel
|
||||
//! FilterProxy for the ComponentDataModel is used along with the search criteria to filter the
|
||||
//! list of components based on tags and/or selected category.
|
||||
class ComponentDataProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ComponentDataProxyModel, AZ::SystemAllocator, 0);
|
||||
|
||||
ComponentDataProxyModel(QObject* parent = nullptr)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{}
|
||||
|
||||
// Creates a new entity and adds the selected components to it.
|
||||
// It is specialized here to ensure it uses the correct indices according to the sorted data.
|
||||
AZ::EntityId NewEntityFromSelection(const QModelIndexList& selection);
|
||||
|
||||
// Filters rows according to the specifed tags and/or selected category
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
||||
// Set the category to filter by.
|
||||
void SetSelectedCategory(const AZStd::string& category);
|
||||
void ClearSelectedCategory();
|
||||
|
||||
protected:
|
||||
|
||||
AZStd::string m_selectedCategory;
|
||||
};
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ComponentPaletteWindow.h"
|
||||
#include "ComponentDataModel.h"
|
||||
#include "FavoriteComponentList.h"
|
||||
#include "FilteredComponentList.h"
|
||||
#include "CategoriesList.h"
|
||||
|
||||
#include <LyViewPaneNames.h>
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
#include <AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.hxx>
|
||||
#include <AzToolsFramework/ToolsComponents/ComponentMimeData.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/ViewPaneOptions.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QKeyEvent>
|
||||
|
||||
ComponentPaletteWindow::ComponentPaletteWindow(QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
void ComponentPaletteWindow::Init()
|
||||
{
|
||||
layout()->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
QHBoxLayout* gridLayout = new QHBoxLayout(nullptr);
|
||||
gridLayout->setSizeConstraint(QLayout::SetMaximumSize);
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->setSpacing(0);
|
||||
|
||||
m_filterWidget = new AzToolsFramework::SearchCriteriaWidget(this);
|
||||
|
||||
QStringList tags;
|
||||
tags << tr("name");
|
||||
m_filterWidget->SetAcceptedTags(tags, tags[0]);
|
||||
layout->addLayout(gridLayout, 1);
|
||||
|
||||
// Left Panel
|
||||
QVBoxLayout* leftPaneLayout = new QVBoxLayout(this);
|
||||
|
||||
// Favorites
|
||||
leftPaneLayout->addWidget(new QLabel(tr("Favorites")));
|
||||
leftPaneLayout->addWidget(new QLabel(tr("Drag components here to add favorites.")));
|
||||
FavoritesList* favorites = new FavoritesList();
|
||||
favorites->Init();
|
||||
leftPaneLayout->addWidget(favorites);
|
||||
|
||||
// Categories
|
||||
m_categoryListWidget = new ComponentCategoryList();
|
||||
m_categoryListWidget->Init();
|
||||
leftPaneLayout->addWidget(m_categoryListWidget);
|
||||
gridLayout->addLayout(leftPaneLayout);
|
||||
|
||||
// Right Panel
|
||||
QVBoxLayout* rightPanelLayout = new QVBoxLayout(this);
|
||||
gridLayout->addLayout(rightPanelLayout);
|
||||
|
||||
// Component list
|
||||
m_componentListWidget = new FilteredComponentList(this);
|
||||
m_componentListWidget->Init();
|
||||
|
||||
rightPanelLayout->addWidget(new QLabel(tr("Components")));
|
||||
rightPanelLayout->addWidget(m_filterWidget, 0, Qt::AlignTop);
|
||||
rightPanelLayout->addWidget(m_componentListWidget);
|
||||
|
||||
// The main window
|
||||
QWidget* window = new QWidget();
|
||||
window->setLayout(layout);
|
||||
setCentralWidget(window);
|
||||
|
||||
connect(m_categoryListWidget, &ComponentCategoryList::OnCategoryChange, m_componentListWidget, &FilteredComponentList::SetCategory);
|
||||
connect(m_filterWidget, &AzToolsFramework::SearchCriteriaWidget::SearchCriteriaChanged, m_componentListWidget, &FilteredComponentList::SearchCriteriaChanged);
|
||||
|
||||
}
|
||||
|
||||
void ComponentPaletteWindow::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->modifiers().testFlag(Qt::ControlModifier) && event->key() == Qt::Key_F)
|
||||
{
|
||||
m_filterWidget->SelectTextEntryBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMainWindow::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentPaletteWindow::RegisterViewClass()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
ViewPaneOptions options;
|
||||
options.canHaveMultipleInstances = true;
|
||||
RegisterViewPane<ComponentPaletteWindow>("Component Palette", LyViewPane::CategoryOther, options);
|
||||
}
|
||||
|
||||
#include <UI/ComponentPalette/moc_ComponentPaletteWindow.cpp>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user