Merge branch 'development' into 3495_preferences_panel_update
This commit is contained in:
@@ -3,8 +3,6 @@ Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
|
||||
Fixture for clearing out 'MoveOutput' folders from \dev and \dev\PROJECT
|
||||
"""
|
||||
|
||||
# Import builtin libraries
|
||||
|
||||
+6
-6
@@ -169,17 +169,17 @@ class TestsAssetRelocator_WindowsAndMac(object):
|
||||
|
||||
@pytest.mark.test_case_id("C21968388")
|
||||
@pytest.mark.assetpipeline
|
||||
def test_WindowsMacPlatforms_MoveCorruptedSliceFile_MoveSuccess(self, request, workspace, ap_setup_fixture,
|
||||
def test_WindowsMacPlatforms_MoveCorruptedPrefabFile_MoveSuccess(self, request, workspace, ap_setup_fixture,
|
||||
asset_processor):
|
||||
"""
|
||||
Asset with UUID/AssetId reference in non-standard format is
|
||||
successfully scanned and relocated to the MoveOutput folder.
|
||||
This test uses a pre-corrupted .slice file.
|
||||
This test uses a pre-corrupted .prefab file.
|
||||
|
||||
Test Steps:
|
||||
1. Create temporary testing environment with a corrupted slice
|
||||
2. Attempt to move the corrupted slice
|
||||
3. Verify that corrupted slice was moved successfully
|
||||
1. Create temporary testing environment with a corrupted prefab
|
||||
2. Attempt to move the corrupted prefab
|
||||
3. Verify that corrupted prefab was moved successfully
|
||||
"""
|
||||
|
||||
env = ap_setup_fixture
|
||||
@@ -187,7 +187,7 @@ class TestsAssetRelocator_WindowsAndMac(object):
|
||||
asset_folder = "C21968388"
|
||||
source_dir, _ = asset_processor.prepare_test_environment(env["tests_dir"], asset_folder)
|
||||
|
||||
filename = "DependencyScannerAsset.slice"
|
||||
filename = "DependencyScannerAsset.prefab"
|
||||
file_path = os.path.join(source_dir, filename)
|
||||
dst_rel_path = os.path.join("MoveOutput", filename)
|
||||
dst_full_path = os.path.join(source_dir, dst_rel_path)
|
||||
|
||||
+908
@@ -0,0 +1,908 @@
|
||||
{
|
||||
"ContainerEntity": {
|
||||
"Id": "ContainerEntity",
|
||||
"Name": "DependencyScannerAsset",
|
||||
"Components": {
|
||||
"Component_[10182366347512475253]": {
|
||||
"$type": "EditorPrefabComponent",
|
||||
"Id": 10182366347512475253
|
||||
},
|
||||
"Component_[12917798267488243668]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 12917798267488243668
|
||||
},
|
||||
"Component_[3261249813163778338]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3261249813163778338
|
||||
},
|
||||
"Component_[3837204912784440039]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 3837204912784440039
|
||||
},
|
||||
"Component_[4272963378099646759]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 4272963378099646759,
|
||||
"Parent Entity": ""
|
||||
},
|
||||
"Component_[4848458548047175816]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 4848458548047175816
|
||||
},
|
||||
"Component_[5787060997243919943]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5787060997243919943
|
||||
},
|
||||
"Component_[7804170251266531779]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 7804170251266531779
|
||||
},
|
||||
"Component_[7874177159288365422]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 7874177159288365422
|
||||
},
|
||||
"Component_[8018146290632383969]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8018146290632383969
|
||||
},
|
||||
"Component_[8452360690590857075]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 8452360690590857075
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entities": {
|
||||
"Entity_[274004659287]": {
|
||||
"Id": "Entity_[274004659287]",
|
||||
"Name": "DependencyScannerAsset",
|
||||
"Components": {
|
||||
"Component_[10849460799799271301]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 10849460799799271301
|
||||
},
|
||||
"Component_[11098142762746045658]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 11098142762746045658
|
||||
},
|
||||
"Component_[11154538629717040387]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 11154538629717040387,
|
||||
"Child Entity Order": [
|
||||
"Entity_[305822185575]",
|
||||
"Entity_[278299626583]",
|
||||
"Entity_[282594593879]",
|
||||
"Entity_[286889561175]",
|
||||
"Entity_[291184528471]"
|
||||
]
|
||||
},
|
||||
"Component_[1365196255752273753]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 1365196255752273753
|
||||
},
|
||||
"Component_[280906579560376421]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 280906579560376421
|
||||
},
|
||||
"Component_[4629965429001113748]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 4629965429001113748
|
||||
},
|
||||
"Component_[4876910656129741263]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 4876910656129741263
|
||||
},
|
||||
"Component_[5763306492614623496]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5763306492614623496,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 7514977506847036117
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[7327709568605458460]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 7327709568605458460
|
||||
},
|
||||
"Component_[7514977506847036117]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 7514977506847036117,
|
||||
"Parent Entity": "ContainerEntity"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[278299626583]": {
|
||||
"Id": "Entity_[278299626583]",
|
||||
"Name": "AssetIDMatch",
|
||||
"Components": {
|
||||
"Component_[10285740519857855186]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10285740519857855186
|
||||
},
|
||||
"Component_[11273731016303624898]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 11273731016303624898,
|
||||
"Parent Entity": "Entity_[274004659287]"
|
||||
},
|
||||
"Component_[1136790983026972010]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 1136790983026972010
|
||||
},
|
||||
"Component_[12777313618328131055]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 12777313618328131055
|
||||
},
|
||||
"Component_[13256044902558773795]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 13256044902558773795
|
||||
},
|
||||
"Component_[15834551022302435776]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 15834551022302435776,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 11273731016303624898
|
||||
},
|
||||
{
|
||||
"ComponentId": 9671522714018290727,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[16345420368214930095]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 16345420368214930095
|
||||
},
|
||||
"Component_[5309075942188429052]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 5309075942188429052
|
||||
},
|
||||
"Component_[8639731896786645938]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8639731896786645938
|
||||
},
|
||||
"Component_[9844585173698551415]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 9844585173698551415
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[282594593879]": {
|
||||
"Id": "Entity_[282594593879]",
|
||||
"Name": "UUIDMatch",
|
||||
"Components": {
|
||||
"Component_[10379494986254888760]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10379494986254888760
|
||||
},
|
||||
"Component_[10932830014545295552]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10932830014545295552
|
||||
},
|
||||
"Component_[16077882919902242532]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 16077882919902242532
|
||||
},
|
||||
"Component_[2150375322459274584]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2150375322459274584
|
||||
},
|
||||
"Component_[2645455411436465820]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 2645455411436465820
|
||||
},
|
||||
"Component_[5422214869037468733]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 5422214869037468733
|
||||
},
|
||||
"Component_[7238126895911071330]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7238126895911071330,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 8407607000804893064
|
||||
},
|
||||
{
|
||||
"ComponentId": 12952323341649885242,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[7981670269715131988]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 7981670269715131988
|
||||
},
|
||||
"Component_[8407607000804893064]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 8407607000804893064,
|
||||
"Parent Entity": "Entity_[274004659287]"
|
||||
},
|
||||
"Component_[8567641786004090803]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 8567641786004090803
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[286889561175]": {
|
||||
"Id": "Entity_[286889561175]",
|
||||
"Name": "RelativeProductMatch",
|
||||
"Components": {
|
||||
"Component_[10180645282669228972]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 10180645282669228972,
|
||||
"Parent Entity": "Entity_[274004659287]"
|
||||
},
|
||||
"Component_[10200807690182688147]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10200807690182688147
|
||||
},
|
||||
"Component_[11014661873645081316]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 11014661873645081316,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 10180645282669228972
|
||||
},
|
||||
{
|
||||
"ComponentId": 12869852248016369650,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[12869852248016369650]": {
|
||||
"$type": "{77CDE991-EC1A-B7C1-B112-7456ABAC81A1} EditorSpawnerComponent",
|
||||
"Id": 12869852248016369650,
|
||||
"Slice": {
|
||||
"assetId": {
|
||||
"guid": "{29F14025-3BD2-5CA9-A9DE-B8B349268C2F}",
|
||||
"subId": 2
|
||||
},
|
||||
"assetHint": "slices/bullet.dynamicslice"
|
||||
}
|
||||
},
|
||||
"Component_[15136448544716183259]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 15136448544716183259
|
||||
},
|
||||
"Component_[15966001894874626764]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 15966001894874626764
|
||||
},
|
||||
"Component_[16167982631516160155]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 16167982631516160155
|
||||
},
|
||||
"Component_[16672905198052847867]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 16672905198052847867
|
||||
},
|
||||
"Component_[4506946122562404190]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 4506946122562404190
|
||||
},
|
||||
"Component_[6836304267269231429]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 6836304267269231429
|
||||
},
|
||||
"Component_[8756593519140349183]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 8756593519140349183
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[291184528471]": {
|
||||
"Id": "Entity_[291184528471]",
|
||||
"Name": "RelativeSourceMatch",
|
||||
"Components": {
|
||||
"Component_[11694027325905361034]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 11694027325905361034
|
||||
},
|
||||
"Component_[13891029613307790064]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 13891029613307790064
|
||||
},
|
||||
"Component_[15933511034411930900]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 15933511034411930900,
|
||||
"Parent Entity": "Entity_[274004659287]"
|
||||
},
|
||||
"Component_[17540827492846961803]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 17540827492846961803
|
||||
},
|
||||
"Component_[2850297705939373458]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2850297705939373458
|
||||
},
|
||||
"Component_[4809103331004345812]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 4809103331004345812
|
||||
},
|
||||
"Component_[5654779331777839943]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5654779331777839943,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 15933511034411930900
|
||||
},
|
||||
{
|
||||
"ComponentId": 10284025539900054207,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[6097019179005900386]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 6097019179005900386
|
||||
},
|
||||
"Component_[7748387730313625157]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 7748387730313625157
|
||||
},
|
||||
"Component_[9822265453841229082]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 9822265453841229082
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[297232250983]": {
|
||||
"Id": "Entity_[297232250983]",
|
||||
"Name": "1151F14D38A65579888ABE3139882E68:[0]",
|
||||
"Components": {
|
||||
"Component_[11936148741777754959]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 11936148741777754959
|
||||
},
|
||||
"Component_[12610073699988743015]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 12610073699988743015,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[1603205169722765279]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 1603205169722765279
|
||||
},
|
||||
"Component_[17691206348057560715]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 17691206348057560715
|
||||
},
|
||||
"Component_[2711821203680330048]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2711821203680330048
|
||||
},
|
||||
"Component_[3887480309311474860]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 3887480309311474860
|
||||
},
|
||||
"Component_[5853968883842282450]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 5853968883842282450
|
||||
},
|
||||
"Component_[7679080692843343453]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 7679080692843343453,
|
||||
"Configuration": "Asset ID that matches an existing dependency of this asset (am_grass1.mtl)"
|
||||
},
|
||||
"Component_[8024752235278898687]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 8024752235278898687
|
||||
},
|
||||
"Component_[8373296084678231042]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 8373296084678231042
|
||||
},
|
||||
"Component_[9782967158965587831]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 9782967158965587831,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 12610073699988743015
|
||||
},
|
||||
{
|
||||
"ComponentId": 7679080692843343453,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[301527218279]": {
|
||||
"Id": "Entity_[301527218279]",
|
||||
"Name": "Slices/bullet.dynamicslice",
|
||||
"Components": {
|
||||
"Component_[15613078542630153866]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 15613078542630153866,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 2483032678718995164
|
||||
},
|
||||
{
|
||||
"ComponentId": 9734604379060902193,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[16098942854900817264]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 16098942854900817264
|
||||
},
|
||||
"Component_[16720139961856477500]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 16720139961856477500
|
||||
},
|
||||
"Component_[2483032678718995164]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 2483032678718995164,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[2502984783426127018]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 2502984783426127018
|
||||
},
|
||||
"Component_[46714013890147210]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 46714013890147210
|
||||
},
|
||||
"Component_[4907474530744780429]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 4907474530744780429
|
||||
},
|
||||
"Component_[5420332829198300813]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 5420332829198300813
|
||||
},
|
||||
"Component_[7683578164681693579]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 7683578164681693579
|
||||
},
|
||||
"Component_[8312115250363172310]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 8312115250363172310
|
||||
},
|
||||
"Component_[9734604379060902193]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 9734604379060902193,
|
||||
"Configuration": "Relative product path that matches an existing dependency of this asset"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[305822185575]": {
|
||||
"Id": "Entity_[305822185575]",
|
||||
"Name": "AssetReferences",
|
||||
"Components": {
|
||||
"Component_[13422135993444528172]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 13422135993444528172
|
||||
},
|
||||
"Component_[13988015667379021413]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 13988015667379021413
|
||||
},
|
||||
"Component_[14885956487876614434]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 14885956487876614434
|
||||
},
|
||||
"Component_[15550715415947731915]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15550715415947731915
|
||||
},
|
||||
"Component_[2576266145980379805]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 2576266145980379805,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 3176911836967955668
|
||||
},
|
||||
{
|
||||
"ComponentId": 836721549453007197,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[3176911836967955668]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 3176911836967955668,
|
||||
"Parent Entity": "Entity_[274004659287]"
|
||||
},
|
||||
"Component_[5613459137294642234]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 5613459137294642234
|
||||
},
|
||||
"Component_[6400873582148097152]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 6400873582148097152
|
||||
},
|
||||
"Component_[684670817803453913]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 684670817803453913,
|
||||
"Child Entity Order": [
|
||||
"Entity_[323002054759]",
|
||||
"Entity_[327297022055]",
|
||||
"Entity_[301527218279]",
|
||||
"Entity_[318707087463]",
|
||||
"Entity_[297232250983]",
|
||||
"Entity_[314412120167]",
|
||||
"Entity_[331591989351]",
|
||||
"Entity_[310117152871]"
|
||||
]
|
||||
},
|
||||
"Component_[8118206464926826097]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 8118206464926826097
|
||||
},
|
||||
"Component_[836721549453007197]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 836721549453007197,
|
||||
"Configuration": "Entity names are used to trigger the missing dependency scanner. Comments are stripped from dynamic slices."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[310117152871]": {
|
||||
"Id": "Entity_[310117152871]",
|
||||
"Name": "Materials/FakeMaterial.mtl",
|
||||
"Components": {
|
||||
"Component_[10593857511582714674]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 10593857511582714674,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 11797216659359478300
|
||||
},
|
||||
{
|
||||
"ComponentId": 13816702107134233983,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[11797216659359478300]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 11797216659359478300,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[13816702107134233983]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 13816702107134233983,
|
||||
"Configuration": "Invalid path that does not match an existing dependency of this asset"
|
||||
},
|
||||
"Component_[14868583012186337705]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 14868583012186337705
|
||||
},
|
||||
"Component_[14965348027145283648]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 14965348027145283648
|
||||
},
|
||||
"Component_[15075774238648121688]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 15075774238648121688
|
||||
},
|
||||
"Component_[16157883709857447266]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 16157883709857447266
|
||||
},
|
||||
"Component_[17712080510249108208]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 17712080510249108208
|
||||
},
|
||||
"Component_[2247408514677946398]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2247408514677946398
|
||||
},
|
||||
"Component_[5565369976544134481]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 5565369976544134481
|
||||
},
|
||||
"Component_[6044814215558788086]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 6044814215558788086
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[314412120167]": {
|
||||
"Id": "Entity_[314412120167]",
|
||||
"Name": "88888888-4444-4444-4444-CCCCCCCCCCCC",
|
||||
"Components": {
|
||||
"Component_[10072177500579430176]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 10072177500579430176
|
||||
},
|
||||
"Component_[10853215476279564671]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 10853215476279564671,
|
||||
"Configuration": "UUID that does not exist"
|
||||
},
|
||||
"Component_[13413154971272749631]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 13413154971272749631
|
||||
},
|
||||
"Component_[15316173756367163440]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 15316173756367163440,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 3266728630359207653
|
||||
},
|
||||
{
|
||||
"ComponentId": 10853215476279564671,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[15809307959802829291]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 15809307959802829291
|
||||
},
|
||||
"Component_[17649652752752487081]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 17649652752752487081
|
||||
},
|
||||
"Component_[2130036493438440377]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2130036493438440377
|
||||
},
|
||||
"Component_[3266728630359207653]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 3266728630359207653,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[5892125564582966187]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 5892125564582966187
|
||||
},
|
||||
"Component_[597602776660257245]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 597602776660257245
|
||||
},
|
||||
"Component_[8238652007701465495]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 8238652007701465495
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[318707087463]": {
|
||||
"Id": "Entity_[318707087463]",
|
||||
"Name": "BBA1A5494C73578894BF0692CDA5FC33",
|
||||
"Components": {
|
||||
"Component_[10222455787643359341]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 10222455787643359341
|
||||
},
|
||||
"Component_[11487845392038268864]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 11487845392038268864
|
||||
},
|
||||
"Component_[12135534290310046764]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 12135534290310046764
|
||||
},
|
||||
"Component_[14412623226519978498]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 14412623226519978498
|
||||
},
|
||||
"Component_[14516371382857751872]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 14516371382857751872
|
||||
},
|
||||
"Component_[16011611743122468576]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 16011611743122468576,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 4157328932578509254
|
||||
},
|
||||
{
|
||||
"ComponentId": 8524796860605854850,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[3813931698067937301]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3813931698067937301
|
||||
},
|
||||
"Component_[4157328932578509254]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 4157328932578509254,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[8524796860605854850]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 8524796860605854850,
|
||||
"Configuration": "UUID that matches an existing dependency of this asset (lumbertank_body.cgf)"
|
||||
},
|
||||
"Component_[8660819596448699427]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 8660819596448699427
|
||||
},
|
||||
"Component_[8768262795169819026]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 8768262795169819026
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[323002054759]": {
|
||||
"Id": "Entity_[323002054759]",
|
||||
"Name": "Materials/am_rockground.mtl",
|
||||
"Components": {
|
||||
"Component_[13459503224133892836]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 13459503224133892836
|
||||
},
|
||||
"Component_[1346698328271204385]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 1346698328271204385
|
||||
},
|
||||
"Component_[13662830241397426219]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 13662830241397426219
|
||||
},
|
||||
"Component_[14169735046939083706]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 14169735046939083706,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 833157791612452820
|
||||
},
|
||||
{
|
||||
"ComponentId": 3573928838741352115,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[16049700338512950477]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 16049700338512950477
|
||||
},
|
||||
"Component_[16191253524853449302]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 16191253524853449302
|
||||
},
|
||||
"Component_[1737139665005484521]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 1737139665005484521
|
||||
},
|
||||
"Component_[17562284119637289685]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 17562284119637289685
|
||||
},
|
||||
"Component_[3573928838741352115]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 3573928838741352115,
|
||||
"Configuration": "Relative source path that matches an existing dependency of this asset"
|
||||
},
|
||||
"Component_[485401015869338526]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 485401015869338526
|
||||
},
|
||||
"Component_[833157791612452820]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 833157791612452820,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[327297022055]": {
|
||||
"Id": "Entity_[327297022055]",
|
||||
"Name": "Config/Game.xml",
|
||||
"Components": {
|
||||
"Component_[11848260632907964142]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 11848260632907964142,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 497869813123895830
|
||||
},
|
||||
{
|
||||
"ComponentId": 5248857300320701553,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[12842864953492512672]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 12842864953492512672
|
||||
},
|
||||
"Component_[16656501539883791157]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 16656501539883791157
|
||||
},
|
||||
"Component_[17365661125603122123]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 17365661125603122123
|
||||
},
|
||||
"Component_[2967487135389707052]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 2967487135389707052
|
||||
},
|
||||
"Component_[3356294263684362888]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3356294263684362888
|
||||
},
|
||||
"Component_[497869813123895830]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 497869813123895830,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[5248857300320701553]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 5248857300320701553,
|
||||
"Configuration": "Valid path that does not match an existing dependency of this asset. Should report as a missing dependency"
|
||||
},
|
||||
"Component_[746309483212393367]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 746309483212393367
|
||||
},
|
||||
"Component_[8319831469290771470]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 8319831469290771470
|
||||
},
|
||||
"Component_[9369067377618608622]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 9369067377618608622
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[331591989351]": {
|
||||
"Id": "Entity_[331591989351]",
|
||||
"Name": "1151F14D38A65579888ABE3139882E68:[333]",
|
||||
"Components": {
|
||||
"Component_[104857639379046106]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 104857639379046106,
|
||||
"Parent Entity": "Entity_[305822185575]"
|
||||
},
|
||||
"Component_[1061601983221247493]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 1061601983221247493
|
||||
},
|
||||
"Component_[11028443253330664986]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 11028443253330664986
|
||||
},
|
||||
"Component_[13806275118632081006]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 13806275118632081006
|
||||
},
|
||||
"Component_[13922573109551604801]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 13922573109551604801
|
||||
},
|
||||
"Component_[17027032709917108335]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 17027032709917108335
|
||||
},
|
||||
"Component_[17030988165269698825]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 17030988165269698825
|
||||
},
|
||||
"Component_[2294579021665535860]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2294579021665535860
|
||||
},
|
||||
"Component_[5863078697041048226]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5863078697041048226,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 104857639379046106
|
||||
},
|
||||
{
|
||||
"ComponentId": 9466290982672370664,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[7608263859116142496]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 7608263859116142496
|
||||
},
|
||||
"Component_[9466290982672370664]": {
|
||||
"$type": "EditorCommentComponent",
|
||||
"Id": 9466290982672370664,
|
||||
"Configuration": "Asset ID that does not exist (am_grass1.mtl UUID, no matching product ID)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -23,7 +23,7 @@ def output_test_data(scene):
|
||||
# Just write something to the file, but the filename is the main information
|
||||
# used for the test.
|
||||
f.write(f"scene.sourceFilename: {scene.sourceFilename}\n")
|
||||
return True
|
||||
return ''
|
||||
|
||||
mySceneJobHandler = None
|
||||
|
||||
|
||||
@@ -0,0 +1,705 @@
|
||||
{
|
||||
"ContainerEntity": {
|
||||
"Id": "ContainerEntity",
|
||||
"Name": "Hermanubis",
|
||||
"Components": {
|
||||
"Component_[10182366347512475253]": {
|
||||
"$type": "EditorPrefabComponent",
|
||||
"Id": 10182366347512475253
|
||||
},
|
||||
"Component_[12917798267488243668]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 12917798267488243668
|
||||
},
|
||||
"Component_[3261249813163778338]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3261249813163778338
|
||||
},
|
||||
"Component_[3837204912784440039]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 3837204912784440039
|
||||
},
|
||||
"Component_[4272963378099646759]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 4272963378099646759,
|
||||
"Parent Entity": ""
|
||||
},
|
||||
"Component_[4848458548047175816]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 4848458548047175816
|
||||
},
|
||||
"Component_[5787060997243919943]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5787060997243919943
|
||||
},
|
||||
"Component_[7804170251266531779]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 7804170251266531779
|
||||
},
|
||||
"Component_[7874177159288365422]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 7874177159288365422
|
||||
},
|
||||
"Component_[8018146290632383969]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8018146290632383969
|
||||
},
|
||||
"Component_[8452360690590857075]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 8452360690590857075
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entities": {
|
||||
"Entity_[250006174949]": {
|
||||
"Id": "Entity_[250006174949]",
|
||||
"Name": "WorldOrigin",
|
||||
"Components": {
|
||||
"Component_[13379444112629774116]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 13379444112629774116
|
||||
},
|
||||
"Component_[13797113876161133062]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 13797113876161133062,
|
||||
"Parent Entity": "ContainerEntity"
|
||||
},
|
||||
"Component_[16382506042739704306]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 16382506042739704306,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 13797113876161133062
|
||||
},
|
||||
{
|
||||
"ComponentId": 8816319458242680670,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[2147729086581105478]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 2147729086581105478
|
||||
},
|
||||
"Component_[2433100672102773575]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2433100672102773575
|
||||
},
|
||||
"Component_[4832829387489613630]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 4832829387489613630
|
||||
},
|
||||
"Component_[5585931842723227683]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 5585931842723227683,
|
||||
"Child Entity Order": [
|
||||
"Entity_[254301142245]"
|
||||
]
|
||||
},
|
||||
"Component_[7088004383223117498]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 7088004383223117498
|
||||
},
|
||||
"Component_[7856264459806503732]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 7856264459806503732
|
||||
},
|
||||
"Component_[8816319458242680670]": {
|
||||
"$type": "AZ::Render::EditorGridComponent",
|
||||
"Id": 8816319458242680670
|
||||
},
|
||||
"Component_[930042309700959235]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 930042309700959235
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[254301142245]": {
|
||||
"Id": "Entity_[254301142245]",
|
||||
"Name": "GlobalSkylight",
|
||||
"Components": {
|
||||
"Component_[10076500561520682485]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 10076500561520682485,
|
||||
"Parent Entity": "Entity_[250006174949]"
|
||||
},
|
||||
"Component_[12626877995248630950]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 12626877995248630950,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 10076500561520682485
|
||||
},
|
||||
{
|
||||
"ComponentId": 8158442301445120126,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 7260006984216245935,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[13040837632921717329]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 13040837632921717329
|
||||
},
|
||||
"Component_[1390505494369101864]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 1390505494369101864
|
||||
},
|
||||
"Component_[6733278858932131836]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 6733278858932131836
|
||||
},
|
||||
"Component_[7260006984216245935]": {
|
||||
"$type": "AZ::Render::EditorImageBasedLightComponent",
|
||||
"Id": 7260006984216245935,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"diffuseImageAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3B78EA69-7CF0-56A7-A49A-110B88412666}",
|
||||
"subId": 3000
|
||||
},
|
||||
"assetHint": "lightingpresets/greenwich_park_02_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
|
||||
},
|
||||
"specularImageAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3B78EA69-7CF0-56A7-A49A-110B88412666}",
|
||||
"subId": 2000
|
||||
},
|
||||
"assetHint": "lightingpresets/greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[7944006745008331817]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 7944006745008331817
|
||||
},
|
||||
"Component_[8158442301445120126]": {
|
||||
"$type": "AZ::Render::EditorHDRiSkyboxComponent",
|
||||
"Id": 8158442301445120126,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"CubemapAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3B78EA69-7CF0-56A7-A49A-110B88412666}",
|
||||
"subId": 1000
|
||||
},
|
||||
"assetHint": "lightingpresets/greenwich_park_02_4k_iblskyboxcm.exr.streamingimage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[8255370213772594097]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 8255370213772594097
|
||||
},
|
||||
"Component_[8551180373364097938]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 8551180373364097938
|
||||
},
|
||||
"Component_[8852330656608249928]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 8852330656608249928
|
||||
},
|
||||
"Component_[8913694496991926693]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8913694496991926693
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[258596109541]": {
|
||||
"Id": "Entity_[258596109541]",
|
||||
"Name": "Hermanubis_stone",
|
||||
"Components": {
|
||||
"Component_[1026780512255775175]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1026780512255775175
|
||||
},
|
||||
"Component_[10882452951986489612]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10882452951986489612
|
||||
},
|
||||
"Component_[12454042755417175050]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 12454042755417175050,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{1F650917-AA74-5107-9C49-648C957B33DA}",
|
||||
"subId": 275904906
|
||||
},
|
||||
"assetHint": "materialeditor/viewportmodels/hermanubis.azmodel"
|
||||
},
|
||||
"LodOverride": 255
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[13691807045809495479]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 13691807045809495479,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"materials": {
|
||||
"{}": {
|
||||
"MaterialAsset": {
|
||||
"assetId": {
|
||||
"guid": "{FF6412B6-F86E-54C8-835C-04F08190D81B}"
|
||||
},
|
||||
"assetHint": "objects/hermanubis/hermanubis_stone.azmaterial"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"materialSlotsByLodEnabled": true
|
||||
},
|
||||
"Component_[14490373655742304057]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 14490373655742304057
|
||||
},
|
||||
"Component_[15248132570755287431]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15248132570755287431
|
||||
},
|
||||
"Component_[16950375358457415777]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16950375358457415777
|
||||
},
|
||||
"Component_[17852268252813268496]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 17852268252813268496,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
1.1189539432525635,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3867610358542973898]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3867610358542973898
|
||||
},
|
||||
"Component_[7717372065847089412]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 7717372065847089412
|
||||
},
|
||||
"Component_[7783943040473764331]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7783943040473764331,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 17852268252813268496
|
||||
},
|
||||
{
|
||||
"ComponentId": 12454042755417175050,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 13691807045809495479,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[833407121913837256]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 833407121913837256
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[262891076837]": {
|
||||
"Id": "Entity_[262891076837]",
|
||||
"Name": "Hermanubis_brass",
|
||||
"Components": {
|
||||
"Component_[1026780512255775175]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1026780512255775175
|
||||
},
|
||||
"Component_[10882452951986489612]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10882452951986489612
|
||||
},
|
||||
"Component_[12454042755417175050]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 12454042755417175050,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{1F650917-AA74-5107-9C49-648C957B33DA}",
|
||||
"subId": 275904906
|
||||
},
|
||||
"assetHint": "materialeditor/viewportmodels/hermanubis.azmodel"
|
||||
},
|
||||
"LodOverride": 255
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[13691807045809495479]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 13691807045809495479,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"materials": {
|
||||
"{}": {
|
||||
"MaterialAsset": {
|
||||
"assetId": {
|
||||
"guid": "{B3AC2305-1DE6-54AA-AAD5-5E77C75E5BB5}"
|
||||
},
|
||||
"assetHint": "objects/hermanubis/hermanubis_brass.azmaterial"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"materialSlotsByLodEnabled": true
|
||||
},
|
||||
"Component_[14490373655742304057]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 14490373655742304057
|
||||
},
|
||||
"Component_[15248132570755287431]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15248132570755287431
|
||||
},
|
||||
"Component_[16950375358457415777]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16950375358457415777
|
||||
},
|
||||
"Component_[17852268252813268496]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 17852268252813268496,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-1.4824472665786743,
|
||||
-0.034557100385427475,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3867610358542973898]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3867610358542973898
|
||||
},
|
||||
"Component_[7717372065847089412]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 7717372065847089412
|
||||
},
|
||||
"Component_[7783943040473764331]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7783943040473764331,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 17852268252813268496
|
||||
},
|
||||
{
|
||||
"ComponentId": 12454042755417175050,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 13691807045809495479,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[833407121913837256]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 833407121913837256
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[267186044133]": {
|
||||
"Id": "Entity_[267186044133]",
|
||||
"Name": "SphereLight",
|
||||
"Components": {
|
||||
"Component_[10922228943444131599]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10922228943444131599
|
||||
},
|
||||
"Component_[11625534306113165068]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 11625534306113165068,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
0.2636711895465851,
|
||||
2.2845842838287354,
|
||||
0.22468790411949158
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[12372418243816154216]": {
|
||||
"$type": "EditorSphereShapeComponent",
|
||||
"Id": 12372418243816154216,
|
||||
"ShapeColor": [
|
||||
0.3289234936237335,
|
||||
0.7307698130607605,
|
||||
0.14859239757061005,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
"Component_[12579170654872581897]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 12579170654872581897
|
||||
},
|
||||
"Component_[12844637542561882557]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 12844637542561882557
|
||||
},
|
||||
"Component_[13087890528096920855]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 13087890528096920855,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 11625534306113165068
|
||||
},
|
||||
{
|
||||
"ComponentId": 13427905514841050195,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 12372418243816154216,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[13427905514841050195]": {
|
||||
"$type": "AZ::Render::EditorAreaLightComponent",
|
||||
"Id": 13427905514841050195,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"LightType": 1,
|
||||
"Color": [
|
||||
0.3289234936237335,
|
||||
0.7307698130607605,
|
||||
0.14859239757061005
|
||||
],
|
||||
"IntensityMode": 1,
|
||||
"Intensity": 676.7677001953125,
|
||||
"AttenuationRadius": 226.51287841796875
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[15364092815744365073]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 15364092815744365073
|
||||
},
|
||||
"Component_[2481373975540551564]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2481373975540551564
|
||||
},
|
||||
"Component_[4101167782224846352]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 4101167782224846352
|
||||
},
|
||||
"Component_[8664715119660216219]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 8664715119660216219
|
||||
},
|
||||
"Component_[8952093761729701957]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 8952093761729701957,
|
||||
"VisibilityFlag": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[275775978725]": {
|
||||
"Id": "Entity_[275775978725]",
|
||||
"Name": "TubeLight",
|
||||
"Components": {
|
||||
"Component_[10922228943444131599]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10922228943444131599,
|
||||
"DisabledComponents": [
|
||||
{
|
||||
"$type": "EditorSphereShapeComponent",
|
||||
"Id": 12372418243816154216,
|
||||
"ShapeColor": [
|
||||
0.3289234936237335,
|
||||
0.7307698130607605,
|
||||
0.14859239757061005,
|
||||
1.0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[11625534306113165068]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 11625534306113165068,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-4.275930881500244,
|
||||
0.5104026794433594,
|
||||
2.3807857036590576
|
||||
],
|
||||
"Rotate": [
|
||||
270.0043029785156,
|
||||
0.16617189347743988,
|
||||
268.51611328125
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[12579170654872581897]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 12579170654872581897
|
||||
},
|
||||
"Component_[12844637542561882557]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 12844637542561882557
|
||||
},
|
||||
"Component_[13087890528096920855]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 13087890528096920855,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 11625534306113165068
|
||||
},
|
||||
{
|
||||
"ComponentId": 13427905514841050195,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 12372418243816154216,
|
||||
"SortIndex": 2
|
||||
},
|
||||
{
|
||||
"ComponentId": 2193911499802409037,
|
||||
"SortIndex": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[13427905514841050195]": {
|
||||
"$type": "AZ::Render::EditorAreaLightComponent",
|
||||
"Id": 13427905514841050195,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"LightType": 3,
|
||||
"Color": [
|
||||
0.8521705865859985,
|
||||
0.7865872979164124,
|
||||
0.6079347133636475
|
||||
],
|
||||
"IntensityMode": 1,
|
||||
"Intensity": 10000.0,
|
||||
"AttenuationRadius": 21608.193359375
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[15364092815744365073]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 15364092815744365073
|
||||
},
|
||||
"Component_[2193911499802409037]": {
|
||||
"$type": "EditorCapsuleShapeComponent",
|
||||
"Id": 2193911499802409037,
|
||||
"ShapeColor": [
|
||||
0.8521705865859985,
|
||||
0.7865872979164124,
|
||||
0.6079347133636475,
|
||||
1.0
|
||||
],
|
||||
"CapsuleShape": {
|
||||
"Configuration": {
|
||||
"Height": 5.0,
|
||||
"Radius": 0.10000000149011612
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[2481373975540551564]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2481373975540551564
|
||||
},
|
||||
"Component_[4101167782224846352]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 4101167782224846352
|
||||
},
|
||||
"Component_[8664715119660216219]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 8664715119660216219
|
||||
},
|
||||
"Component_[8952093761729701957]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 8952093761729701957,
|
||||
"VisibilityFlag": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[482743502241]": {
|
||||
"Id": "Entity_[482743502241]",
|
||||
"Name": "Camera1",
|
||||
"Components": {
|
||||
"Component_[10672707967016183310]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10672707967016183310
|
||||
},
|
||||
"Component_[13520081755303040361]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 13520081755303040361
|
||||
},
|
||||
"Component_[13650522584195762912]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 13650522584195762912
|
||||
},
|
||||
"Component_[14204465933176839167]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 14204465933176839167
|
||||
},
|
||||
"Component_[14509697511269710983]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 14509697511269710983
|
||||
},
|
||||
"Component_[271930369355383880]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 271930369355383880
|
||||
},
|
||||
"Component_[5015186380056948439]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5015186380056948439
|
||||
},
|
||||
"Component_[6297637832938894772]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 6297637832938894772,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-0.0018702250672504306,
|
||||
2.9982283115386963,
|
||||
3.0017592906951904
|
||||
],
|
||||
"Rotate": [
|
||||
20.080352783203125,
|
||||
-0.020488755777478218,
|
||||
179.92381286621094
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[6611378759823339947]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 6611378759823339947
|
||||
},
|
||||
"Component_[8475839846509409509]": {
|
||||
"$type": "{CA11DA46-29FF-4083-B5F6-E02C3A8C3A3D} EditorCameraComponent",
|
||||
"Id": 8475839846509409509,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"Field of View": 90.00020599365234,
|
||||
"EditorEntityId": 478448534945
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[9659542522325095386]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 9659542522325095386
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,943 @@
|
||||
{
|
||||
"ContainerEntity": {
|
||||
"Id": "ContainerEntity",
|
||||
"Name": "hermanubis_high",
|
||||
"Components": {
|
||||
"Component_[10182366347512475253]": {
|
||||
"$type": "EditorPrefabComponent",
|
||||
"Id": 10182366347512475253
|
||||
},
|
||||
"Component_[12917798267488243668]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 12917798267488243668
|
||||
},
|
||||
"Component_[3261249813163778338]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3261249813163778338
|
||||
},
|
||||
"Component_[3837204912784440039]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 3837204912784440039
|
||||
},
|
||||
"Component_[4272963378099646759]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 4272963378099646759,
|
||||
"Parent Entity": ""
|
||||
},
|
||||
"Component_[4848458548047175816]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 4848458548047175816
|
||||
},
|
||||
"Component_[5787060997243919943]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 5787060997243919943
|
||||
},
|
||||
"Component_[7804170251266531779]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 7804170251266531779
|
||||
},
|
||||
"Component_[7874177159288365422]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 7874177159288365422,
|
||||
"Child Entity Order": [
|
||||
"Entity_[243647107259]",
|
||||
"Entity_[247179151093]",
|
||||
"Entity_[262891076837]",
|
||||
"Entity_[242884183797]",
|
||||
"Entity_[258596109541]",
|
||||
"Entity_[267186044133]",
|
||||
"Entity_[275775978725]",
|
||||
"Entity_[250006174949]"
|
||||
]
|
||||
},
|
||||
"Component_[8018146290632383969]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8018146290632383969
|
||||
},
|
||||
"Component_[8452360690590857075]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 8452360690590857075
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entities": {
|
||||
"Entity_[242884183797]": {
|
||||
"Id": "Entity_[242884183797]",
|
||||
"Name": "Hermanubis_stone",
|
||||
"Components": {
|
||||
"Component_[1026780512255775175]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1026780512255775175
|
||||
},
|
||||
"Component_[10882452951986489612]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10882452951986489612
|
||||
},
|
||||
"Component_[12454042755417175050]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 12454042755417175050,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{35A45F31-F1C1-5076-8B51-FF599E2EEBAA}",
|
||||
"subId": 274433667
|
||||
},
|
||||
"assetHint": "objects/hermanubis/hermanubis_high.azmodel"
|
||||
},
|
||||
"LodOverride": 255
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[13691807045809495479]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 13691807045809495479,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"materials": {
|
||||
"{}": {
|
||||
"MaterialAsset": {
|
||||
"assetId": {
|
||||
"guid": "{A78EA2FC-688B-5E3A-A7F6-DB413D11D4CF}"
|
||||
},
|
||||
"assetHint": "materials/presets/pbr/metal_chrome_matte.azmaterial"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"materialSlotsByLodEnabled": true
|
||||
},
|
||||
"Component_[14490373655742304057]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 14490373655742304057
|
||||
},
|
||||
"Component_[15248132570755287431]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15248132570755287431
|
||||
},
|
||||
"Component_[16950375358457415777]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16950375358457415777
|
||||
},
|
||||
"Component_[17852268252813268496]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 17852268252813268496,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
3.810185432434082,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3867610358542973898]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3867610358542973898
|
||||
},
|
||||
"Component_[7717372065847089412]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 7717372065847089412
|
||||
},
|
||||
"Component_[7783943040473764331]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7783943040473764331,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 17852268252813268496
|
||||
},
|
||||
{
|
||||
"ComponentId": 12454042755417175050,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 13691807045809495479,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[833407121913837256]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 833407121913837256
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[243647107259]": {
|
||||
"Id": "Entity_[243647107259]",
|
||||
"Name": "Camera1",
|
||||
"Components": {
|
||||
"Component_[11276153162797125616]": {
|
||||
"$type": "GenericComponentWrapper",
|
||||
"Id": 11276153162797125616,
|
||||
"m_template": {
|
||||
"$type": "FlyCameraInputComponent"
|
||||
}
|
||||
},
|
||||
"Component_[11484120648160206262]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 11484120648160206262
|
||||
},
|
||||
"Component_[14251459960897306807]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 14251459960897306807,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-0.10533800721168518,
|
||||
-4.001697063446045,
|
||||
3.061025619506836
|
||||
],
|
||||
"Rotate": [
|
||||
-19.998117446899414,
|
||||
0.01881762035191059,
|
||||
-0.051706261932849884
|
||||
],
|
||||
"Scale": [
|
||||
0.9999998807907104,
|
||||
1.0,
|
||||
1.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[149351061984148634]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 149351061984148634
|
||||
},
|
||||
"Component_[15121925351155689107]": {
|
||||
"$type": "{CA11DA46-29FF-4083-B5F6-E02C3A8C3A3D} EditorCameraComponent",
|
||||
"Id": 15121925351155689107,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"EditorEntityId": 243647107259
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[15327903729148812780]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 15327903729148812780
|
||||
},
|
||||
"Component_[17667820301809320373]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 17667820301809320373
|
||||
},
|
||||
"Component_[17708351813187009272]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 17708351813187009272
|
||||
},
|
||||
"Component_[17941668830905411554]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 17941668830905411554
|
||||
},
|
||||
"Component_[48451466091772435]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 48451466091772435
|
||||
},
|
||||
"Component_[6163614082436403601]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 6163614082436403601,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 14251459960897306807
|
||||
},
|
||||
{
|
||||
"ComponentId": 15121925351155689107,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 11935019334576395684,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[8660334631968180943]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 8660334631968180943
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[247179151093]": {
|
||||
"Id": "Entity_[247179151093]",
|
||||
"Name": "Hermanubis_brass",
|
||||
"Components": {
|
||||
"Component_[1026780512255775175]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1026780512255775175
|
||||
},
|
||||
"Component_[10882452951986489612]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10882452951986489612
|
||||
},
|
||||
"Component_[12454042755417175050]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 12454042755417175050,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{35A45F31-F1C1-5076-8B51-FF599E2EEBAA}",
|
||||
"subId": 274433667
|
||||
},
|
||||
"assetHint": "objects/hermanubis/hermanubis_high.azmodel"
|
||||
},
|
||||
"LodOverride": 255
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[13691807045809495479]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 13691807045809495479,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"materials": {
|
||||
"{}": {
|
||||
"MaterialAsset": {
|
||||
"assetId": {
|
||||
"guid": "{80E0F2A7-1EE4-597F-80EF-985C65BCE2EB}"
|
||||
},
|
||||
"assetHint": "materials/presets/pbr/metal_brass.azmaterial"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"materialSlotsByLodEnabled": true
|
||||
},
|
||||
"Component_[14490373655742304057]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 14490373655742304057
|
||||
},
|
||||
"Component_[15248132570755287431]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15248132570755287431
|
||||
},
|
||||
"Component_[16950375358457415777]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16950375358457415777
|
||||
},
|
||||
"Component_[17852268252813268496]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 17852268252813268496,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-4.019397258758545,
|
||||
-0.034557100385427475,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3867610358542973898]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3867610358542973898
|
||||
},
|
||||
"Component_[7717372065847089412]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 7717372065847089412
|
||||
},
|
||||
"Component_[7783943040473764331]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7783943040473764331,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 17852268252813268496
|
||||
},
|
||||
{
|
||||
"ComponentId": 12454042755417175050,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 13691807045809495479,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[833407121913837256]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 833407121913837256
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[250006174949]": {
|
||||
"Id": "Entity_[250006174949]",
|
||||
"Name": "WorldOrigin",
|
||||
"Components": {
|
||||
"Component_[13379444112629774116]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 13379444112629774116
|
||||
},
|
||||
"Component_[13797113876161133062]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 13797113876161133062,
|
||||
"Parent Entity": "ContainerEntity"
|
||||
},
|
||||
"Component_[16382506042739704306]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 16382506042739704306,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 13797113876161133062
|
||||
},
|
||||
{
|
||||
"ComponentId": 8816319458242680670,
|
||||
"SortIndex": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[2147729086581105478]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 2147729086581105478
|
||||
},
|
||||
"Component_[2433100672102773575]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2433100672102773575
|
||||
},
|
||||
"Component_[4832829387489613630]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 4832829387489613630
|
||||
},
|
||||
"Component_[5585931842723227683]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 5585931842723227683,
|
||||
"Child Entity Order": [
|
||||
"Entity_[254301142245]"
|
||||
]
|
||||
},
|
||||
"Component_[7088004383223117498]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 7088004383223117498
|
||||
},
|
||||
"Component_[7856264459806503732]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 7856264459806503732
|
||||
},
|
||||
"Component_[8816319458242680670]": {
|
||||
"$type": "AZ::Render::EditorGridComponent",
|
||||
"Id": 8816319458242680670
|
||||
},
|
||||
"Component_[930042309700959235]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 930042309700959235
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[254301142245]": {
|
||||
"Id": "Entity_[254301142245]",
|
||||
"Name": "GlobalSkylight",
|
||||
"Components": {
|
||||
"Component_[10076500561520682485]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 10076500561520682485,
|
||||
"Parent Entity": "Entity_[250006174949]"
|
||||
},
|
||||
"Component_[12626877995248630950]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 12626877995248630950,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 10076500561520682485
|
||||
},
|
||||
{
|
||||
"ComponentId": 8158442301445120126,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 7260006984216245935,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[13040837632921717329]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 13040837632921717329
|
||||
},
|
||||
"Component_[1390505494369101864]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 1390505494369101864
|
||||
},
|
||||
"Component_[6733278858932131836]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 6733278858932131836
|
||||
},
|
||||
"Component_[7260006984216245935]": {
|
||||
"$type": "AZ::Render::EditorImageBasedLightComponent",
|
||||
"Id": 7260006984216245935,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"diffuseImageAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3B78EA69-7CF0-56A7-A49A-110B88412666}",
|
||||
"subId": 3000
|
||||
},
|
||||
"assetHint": "lightingpresets/greenwich_park_02_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
|
||||
},
|
||||
"specularImageAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3B78EA69-7CF0-56A7-A49A-110B88412666}",
|
||||
"subId": 2000
|
||||
},
|
||||
"assetHint": "lightingpresets/greenwich_park_02_4k_iblskyboxcm_iblspecular.exr.streamingimage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[7944006745008331817]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 7944006745008331817
|
||||
},
|
||||
"Component_[8158442301445120126]": {
|
||||
"$type": "AZ::Render::EditorHDRiSkyboxComponent",
|
||||
"Id": 8158442301445120126,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"CubemapAsset": {
|
||||
"assetId": {
|
||||
"guid": "{3B78EA69-7CF0-56A7-A49A-110B88412666}",
|
||||
"subId": 1000
|
||||
},
|
||||
"assetHint": "lightingpresets/greenwich_park_02_4k_iblskyboxcm.exr.streamingimage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[8255370213772594097]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 8255370213772594097
|
||||
},
|
||||
"Component_[8551180373364097938]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 8551180373364097938
|
||||
},
|
||||
"Component_[8852330656608249928]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 8852330656608249928
|
||||
},
|
||||
"Component_[8913694496991926693]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8913694496991926693
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[258596109541]": {
|
||||
"Id": "Entity_[258596109541]",
|
||||
"Name": "Hermanubis_stone",
|
||||
"Components": {
|
||||
"Component_[1026780512255775175]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1026780512255775175
|
||||
},
|
||||
"Component_[10882452951986489612]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10882452951986489612
|
||||
},
|
||||
"Component_[12454042755417175050]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 12454042755417175050,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{35A45F31-F1C1-5076-8B51-FF599E2EEBAA}",
|
||||
"subId": 274433667
|
||||
},
|
||||
"assetHint": "objects/hermanubis/hermanubis_high.azmodel"
|
||||
},
|
||||
"LodOverride": 255
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[13691807045809495479]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 13691807045809495479,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"materials": {
|
||||
"{}": {
|
||||
"MaterialAsset": {
|
||||
"assetId": {
|
||||
"guid": "{B7C712DC-4839-58BB-B522-A4F120084CF5}"
|
||||
},
|
||||
"assetHint": "materials/presets/pbr/metal_chrome.azmaterial"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"materialSlotsByLodEnabled": true
|
||||
},
|
||||
"Component_[14490373655742304057]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 14490373655742304057
|
||||
},
|
||||
"Component_[15248132570755287431]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15248132570755287431
|
||||
},
|
||||
"Component_[16950375358457415777]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16950375358457415777
|
||||
},
|
||||
"Component_[17852268252813268496]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 17852268252813268496,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
1.1189539432525635,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3867610358542973898]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3867610358542973898
|
||||
},
|
||||
"Component_[7717372065847089412]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 7717372065847089412
|
||||
},
|
||||
"Component_[7783943040473764331]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7783943040473764331,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 17852268252813268496
|
||||
},
|
||||
{
|
||||
"ComponentId": 12454042755417175050,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 13691807045809495479,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[833407121913837256]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 833407121913837256
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[262891076837]": {
|
||||
"Id": "Entity_[262891076837]",
|
||||
"Name": "Hermanubis_brass",
|
||||
"Components": {
|
||||
"Component_[1026780512255775175]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 1026780512255775175
|
||||
},
|
||||
"Component_[10882452951986489612]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10882452951986489612
|
||||
},
|
||||
"Component_[12454042755417175050]": {
|
||||
"$type": "AZ::Render::EditorMeshComponent",
|
||||
"Id": 12454042755417175050,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"ModelAsset": {
|
||||
"assetId": {
|
||||
"guid": "{35A45F31-F1C1-5076-8B51-FF599E2EEBAA}",
|
||||
"subId": 274433667
|
||||
},
|
||||
"assetHint": "objects/hermanubis/hermanubis_high.azmodel"
|
||||
},
|
||||
"LodOverride": 255
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[13691807045809495479]": {
|
||||
"$type": "EditorMaterialComponent",
|
||||
"Id": 13691807045809495479,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"materials": {
|
||||
"{}": {
|
||||
"MaterialAsset": {
|
||||
"assetId": {
|
||||
"guid": "{CAF50181-3384-5DF2-9304-C6E48E83C72D}"
|
||||
},
|
||||
"assetHint": "materials/presets/pbr/metal_chrome_polished.azmaterial"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"materialSlotsByLodEnabled": true
|
||||
},
|
||||
"Component_[14490373655742304057]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 14490373655742304057
|
||||
},
|
||||
"Component_[15248132570755287431]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 15248132570755287431
|
||||
},
|
||||
"Component_[16950375358457415777]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 16950375358457415777
|
||||
},
|
||||
"Component_[17852268252813268496]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 17852268252813268496,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-1.4824472665786743,
|
||||
-0.034557100385427475,
|
||||
0.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3867610358542973898]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3867610358542973898
|
||||
},
|
||||
"Component_[7717372065847089412]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 7717372065847089412
|
||||
},
|
||||
"Component_[7783943040473764331]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 7783943040473764331,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 17852268252813268496
|
||||
},
|
||||
{
|
||||
"ComponentId": 12454042755417175050,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 13691807045809495479,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[833407121913837256]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 833407121913837256
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[267186044133]": {
|
||||
"Id": "Entity_[267186044133]",
|
||||
"Name": "SphereLight",
|
||||
"Components": {
|
||||
"Component_[10922228943444131599]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10922228943444131599
|
||||
},
|
||||
"Component_[11625534306113165068]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 11625534306113165068,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
0.2636711895465851,
|
||||
2.2845842838287354,
|
||||
0.22468790411949158
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[12372418243816154216]": {
|
||||
"$type": "EditorSphereShapeComponent",
|
||||
"Id": 12372418243816154216,
|
||||
"ShapeColor": [
|
||||
0.3289234936237335,
|
||||
0.7307698130607605,
|
||||
0.14859239757061005,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
"Component_[12579170654872581897]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 12579170654872581897
|
||||
},
|
||||
"Component_[12844637542561882557]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 12844637542561882557
|
||||
},
|
||||
"Component_[13087890528096920855]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 13087890528096920855,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 11625534306113165068
|
||||
},
|
||||
{
|
||||
"ComponentId": 13427905514841050195,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 12372418243816154216,
|
||||
"SortIndex": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[13427905514841050195]": {
|
||||
"$type": "AZ::Render::EditorAreaLightComponent",
|
||||
"Id": 13427905514841050195,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"LightType": 1,
|
||||
"Color": [
|
||||
0.3289234936237335,
|
||||
0.7307698130607605,
|
||||
0.14859239757061005
|
||||
],
|
||||
"IntensityMode": 1,
|
||||
"Intensity": 676.7677001953125,
|
||||
"AttenuationRadius": 226.51287841796875
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[15364092815744365073]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 15364092815744365073
|
||||
},
|
||||
"Component_[2481373975540551564]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2481373975540551564
|
||||
},
|
||||
"Component_[4101167782224846352]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 4101167782224846352
|
||||
},
|
||||
"Component_[8664715119660216219]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 8664715119660216219
|
||||
},
|
||||
"Component_[8952093761729701957]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 8952093761729701957,
|
||||
"VisibilityFlag": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"Entity_[275775978725]": {
|
||||
"Id": "Entity_[275775978725]",
|
||||
"Name": "TubeLight",
|
||||
"Components": {
|
||||
"Component_[10922228943444131599]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 10922228943444131599,
|
||||
"DisabledComponents": [
|
||||
{
|
||||
"$type": "EditorSphereShapeComponent",
|
||||
"Id": 12372418243816154216,
|
||||
"ShapeColor": [
|
||||
0.3289234936237335,
|
||||
0.7307698130607605,
|
||||
0.14859239757061005,
|
||||
1.0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[11625534306113165068]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 11625534306113165068,
|
||||
"Parent Entity": "ContainerEntity",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
-4.275930881500244,
|
||||
0.5104026794433594,
|
||||
2.3807857036590576
|
||||
],
|
||||
"Rotate": [
|
||||
270.0043029785156,
|
||||
0.16617189347743988,
|
||||
268.51611328125
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[12579170654872581897]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 12579170654872581897
|
||||
},
|
||||
"Component_[12844637542561882557]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 12844637542561882557
|
||||
},
|
||||
"Component_[13087890528096920855]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 13087890528096920855,
|
||||
"ComponentOrderEntryArray": [
|
||||
{
|
||||
"ComponentId": 11625534306113165068
|
||||
},
|
||||
{
|
||||
"ComponentId": 13427905514841050195,
|
||||
"SortIndex": 1
|
||||
},
|
||||
{
|
||||
"ComponentId": 12372418243816154216,
|
||||
"SortIndex": 2
|
||||
},
|
||||
{
|
||||
"ComponentId": 2193911499802409037,
|
||||
"SortIndex": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"Component_[13427905514841050195]": {
|
||||
"$type": "AZ::Render::EditorAreaLightComponent",
|
||||
"Id": 13427905514841050195,
|
||||
"Controller": {
|
||||
"Configuration": {
|
||||
"LightType": 3,
|
||||
"Color": [
|
||||
0.8521705865859985,
|
||||
0.7865872979164124,
|
||||
0.6079347133636475
|
||||
],
|
||||
"IntensityMode": 1,
|
||||
"Intensity": 10000.0,
|
||||
"AttenuationRadius": 21608.193359375
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[15364092815744365073]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 15364092815744365073
|
||||
},
|
||||
"Component_[2193911499802409037]": {
|
||||
"$type": "EditorCapsuleShapeComponent",
|
||||
"Id": 2193911499802409037,
|
||||
"ShapeColor": [
|
||||
0.8521705865859985,
|
||||
0.7865872979164124,
|
||||
0.6079347133636475,
|
||||
1.0
|
||||
],
|
||||
"CapsuleShape": {
|
||||
"Configuration": {
|
||||
"Height": 5.0,
|
||||
"Radius": 0.10000000149011612
|
||||
}
|
||||
}
|
||||
},
|
||||
"Component_[2481373975540551564]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 2481373975540551564
|
||||
},
|
||||
"Component_[4101167782224846352]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 4101167782224846352
|
||||
},
|
||||
"Component_[8664715119660216219]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 8664715119660216219
|
||||
},
|
||||
"Component_[8952093761729701957]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 8952093761729701957,
|
||||
"VisibilityFlag": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -28,7 +28,7 @@ def update_manifest(scene):
|
||||
meshGroup = sceneManifest.add_mesh_group(chunkName)
|
||||
meshGroup['id'] = '{' + str(uuid.uuid5(uuid.NAMESPACE_DNS, scene.sourceFilename + chunkName)) + '}'
|
||||
sceneManifest.mesh_group_add_comment(meshGroup, 'auto generated by test_chunks_builder')
|
||||
sceneManifest.mesh_group_set_origin(meshGroup, None, 0, 0, 0, 1.0)
|
||||
sceneManifest.mesh_group_add_advanced_coordinate_system(meshGroup)
|
||||
for meshIndex in range(len(chunkNameList)):
|
||||
if (activeMeshIndex == meshIndex):
|
||||
sceneManifest.mesh_group_select_node(meshGroup, chunkNameList[meshIndex])
|
||||
|
||||
@@ -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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "AnimationBipedBoneNames.h"
|
||||
|
||||
namespace EditorAnimationBones::Biped
|
||||
{
|
||||
const char* Pelvis = "Bip01 Pelvis";
|
||||
const char* Head = "Bip01 Head";
|
||||
const char* Weapon = "weapon_bone";
|
||||
|
||||
const char* LeftEye = "eye_bone_left";
|
||||
const char* RightEye = "eye_bone_right";
|
||||
|
||||
const char* Spine[5] = { "Bip01 Spine", "Bip01 Spine1", "Bip01 Spine2", "Bip01 Spine3", "Bip01 Spine4" };
|
||||
const char* Neck[2] = { "Bip01 Neck", "Bip01 Neck1" };
|
||||
|
||||
const char* LeftHeel = "Bip01 L Heel";
|
||||
const char* LeftToe[2] = { "Bip01 L Toe0", "Bip01 L Toe1" };
|
||||
|
||||
const char* RightHeel = "Bip01 R Heel";
|
||||
const char* RightToe[2] = { "Bip01 R Toe0", "Bip01 R Toe1" };
|
||||
} // namespace EditorAnimationBones::Biped
|
||||
@@ -1,34 +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_ANIMATION_ANIMATIONBIPEDBONENAMES_H
|
||||
#define CRYINCLUDE_EDITOR_ANIMATION_ANIMATIONBIPEDBONENAMES_H
|
||||
#pragma once
|
||||
|
||||
namespace EditorAnimationBones
|
||||
{
|
||||
namespace Biped
|
||||
{
|
||||
extern const char* Pelvis;
|
||||
extern const char* Head;
|
||||
extern const char* Weapon;
|
||||
|
||||
extern const char* Spine[5];
|
||||
extern const char* Neck[2];
|
||||
|
||||
extern const char* LeftEye;
|
||||
extern const char* RightEye;
|
||||
|
||||
extern const char* LeftHeel;
|
||||
extern const char* RightHeel;
|
||||
extern const char* LeftToe[2];
|
||||
extern const char* RightToe[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ANIMATION_ANIMATIONBIPEDBONENAMES_H
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:58ef978b31b31df9aaf715a0e9b006fde414a17a3ff15a3bf680eaad7418867a
|
||||
size 364
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:98a681ec3d89ee57c5d1057fe984dcf8ad45721f47ae4df57fa358fbee85e616
|
||||
size 385
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:24a2b2c9242a841c20e7815dab0d80a575844055328aea413d28b7283b65a92e
|
||||
size 386
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ce23a276fec849b8f832fab96d3b738793335c27d37ae3813158387f3415b508
|
||||
size 377
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c03befab41765200f4f28dbf1e0b2a702d2244bfa79b0d463f5d58d0a26095fc
|
||||
size 386
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:418c3f0f27854b3795841359014d87686a7bf94daf2568d9cfd3ffac22675f69
|
||||
size 386
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d3a831f34ac53c9b1f20037290e8a2b62a3cfb8a4f86467591f44fd2a0e3c15b
|
||||
size 379
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4267102ca7a889c34eff905480a68878d4d56e15bc723a5b0575cd472e259f5d
|
||||
size 389
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a0df013dd102b87348fba18b4da5443591309e9c40166d27ae928636924154ea
|
||||
size 388
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e713076ab5abbbb2cf28da431a339e9905acc790e35295f025aa2e79e1c04141
|
||||
size 376
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9e5af9d62ceafc3b8a1dfc36772350cd623fcc86c68711b299e143ff133f79b6
|
||||
size 387
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:17c5fb3d7b87ea87a98934954c721573c641bc44005a34f1e16589d7f39b71e8
|
||||
size 409
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6f5c78d9f764b62fb7dcf400c91c1edea9d7f88a426ba513fbf70825c6bcd2ac
|
||||
size 383
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:376b549602afffca407525b77c1a9821bf6a0e279792ae2e52fe0a4f7c3c5bd4
|
||||
size 364
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e7dc48f8d324b7563b168f27ebde1e00ee2bd11ba462f114a05b297913e285c5
|
||||
size 374
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:66b73afbd6dba1caaedfaae161b277b460b5198f7fc00bec414530116c567276
|
||||
size 375
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ae6e6714acf495246f4e59f6e5640f3a4417ea50100d37a116950d2b859aed0c
|
||||
size 417
|
||||
@@ -1,111 +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_CONTROLS_CONSOLESCBMFC_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_CONSOLESCBMFC_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
#include "ConsoleSCB.h"
|
||||
#endif
|
||||
|
||||
class QMenu;
|
||||
class ConsoleWidget;
|
||||
class QFocusEvent;
|
||||
|
||||
namespace Ui {
|
||||
class ConsoleMFC;
|
||||
}
|
||||
|
||||
namespace MFC
|
||||
{
|
||||
|
||||
struct ConsoleLine
|
||||
{
|
||||
QString text;
|
||||
bool newLine;
|
||||
};
|
||||
typedef std::deque<ConsoleLine> Lines;
|
||||
|
||||
class ConsoleLineEdit
|
||||
: public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConsoleLineEdit(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* ev) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent* ev) override;
|
||||
void keyPressEvent(QKeyEvent* ev) override;
|
||||
bool event(QEvent* ev) override;
|
||||
|
||||
signals:
|
||||
void variableEditorRequested();
|
||||
void setWindowTitle(const QString&);
|
||||
|
||||
private:
|
||||
void DisplayHistory(bool bForward);
|
||||
QStringList m_history;
|
||||
unsigned int m_historyIndex;
|
||||
bool m_bReusedHistory;
|
||||
};
|
||||
|
||||
class ConsoleTextEdit
|
||||
: public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConsoleTextEdit(QWidget* parent = nullptr);
|
||||
};
|
||||
|
||||
class CConsoleSCB
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CConsoleSCB(QWidget* parent = nullptr);
|
||||
~CConsoleSCB();
|
||||
|
||||
static void RegisterViewClass();
|
||||
void SetInputFocus();
|
||||
void AddToConsole(const QString& text, bool bNewLine);
|
||||
void FlushText();
|
||||
void showPopupAndSetTitle();
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
static CConsoleSCB* GetCreatedInstance();
|
||||
|
||||
static void AddToPendingLines(const QString& text, bool bNewLine); // call this function instead of AddToConsole() until an instance of CConsoleSCB exists to prevent messages from getting lost
|
||||
|
||||
public Q_SLOTS:
|
||||
void OnStyleSettingsChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void showVariableEditor();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::ConsoleMFC> ui;
|
||||
int m_richEditTextLength;
|
||||
|
||||
Lines m_lines;
|
||||
static Lines s_pendingLines;
|
||||
|
||||
QList<QColor> m_colorTable;
|
||||
SEditorSettings::ConsoleColorTheme m_backgroundTheme;
|
||||
};
|
||||
|
||||
} // namespace MFC
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_CONSOLESCB_H
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConsoleMFC</class>
|
||||
<widget class="QWidget" name="Console">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Console</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="container2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="button">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="MFC::ConsoleLineEdit" name="lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MFC::ConsoleLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ConsoleSCBMFC.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="ConsoleSCB.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,48 +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 "HotTrackingTreeCtrl.h"
|
||||
|
||||
// Qt
|
||||
#include <QMouseEvent>
|
||||
|
||||
|
||||
CHotTrackingTreeCtrl::CHotTrackingTreeCtrl(QWidget* parent)
|
||||
: QTreeWidget(parent)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
m_hHoverItem = nullptr;
|
||||
}
|
||||
|
||||
void CHotTrackingTreeCtrl::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
QTreeWidgetItem* hItem = itemAt(event->pos());
|
||||
|
||||
if (m_hHoverItem != nullptr)
|
||||
{
|
||||
QFont font = m_hHoverItem->font(0);
|
||||
font.setBold(false);
|
||||
m_hHoverItem->setFont(0, font);
|
||||
m_hHoverItem = nullptr;
|
||||
}
|
||||
|
||||
if (hItem != nullptr)
|
||||
{
|
||||
QFont font = hItem->font(0);
|
||||
font.setBold(true);
|
||||
hItem->setFont(0, font);
|
||||
m_hHoverItem = hItem;
|
||||
}
|
||||
|
||||
QTreeWidget::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
#include <Controls/moc_HotTrackingTreeCtrl.cpp>
|
||||
@@ -1,33 +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_CONTROLS_HOTTRACKINGTREECTRL_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_HOTTRACKINGTREECTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QTreeWidget>
|
||||
#endif
|
||||
|
||||
class CHotTrackingTreeCtrl
|
||||
: public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CHotTrackingTreeCtrl(QWidget* parent = 0);
|
||||
virtual ~CHotTrackingTreeCtrl(){};
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
QTreeWidgetItem* m_hHoverItem;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_HOTTRACKINGTREECTRL_H
|
||||
@@ -1,567 +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 "ImageListCtrl.h"
|
||||
|
||||
// Qt
|
||||
#include <QPainter>
|
||||
#include <QScrollBar>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CImageListCtrl::CImageListCtrl(QWidget* parent)
|
||||
: QAbstractItemView(parent)
|
||||
, m_itemSize(60, 60)
|
||||
, m_borderSize(4, 4)
|
||||
, m_style(DefaultStyle)
|
||||
{
|
||||
setItemDelegate(new QImageListDelegate(this));
|
||||
setAutoFillBackground(false);
|
||||
|
||||
QPalette p = palette();
|
||||
p.setColor(QPalette::Highlight, QColor(255, 55, 50));
|
||||
setPalette(p);
|
||||
|
||||
horizontalScrollBar()->setRange(0, 0);
|
||||
verticalScrollBar()->setRange(0, 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CImageListCtrl::~CImageListCtrl()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CImageListCtrl::ListStyle CImageListCtrl::Style() const
|
||||
{
|
||||
return m_style;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::SetStyle(ListStyle style)
|
||||
{
|
||||
m_style = style;
|
||||
scheduleDelayedItemsLayout();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const QSize& CImageListCtrl::ItemSize() const
|
||||
{
|
||||
return m_itemSize;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::SetItemSize(QSize size)
|
||||
{
|
||||
Q_ASSERT(size.isValid());
|
||||
m_itemSize = size;
|
||||
scheduleDelayedItemsLayout();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const QSize& CImageListCtrl::BorderSize() const
|
||||
{
|
||||
return m_borderSize;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::SetBorderSize(QSize size)
|
||||
{
|
||||
Q_ASSERT(size.isValid());
|
||||
m_borderSize = size;
|
||||
scheduleDelayedItemsLayout();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QModelIndexList CImageListCtrl::ItemsInRect(const QRect& rect) const
|
||||
{
|
||||
QModelIndexList list;
|
||||
|
||||
if (!model())
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
QHash<int, QRect>::const_iterator i;
|
||||
QHash<int, QRect>::const_iterator c = m_geometry.cend();
|
||||
for (i = m_geometry.cbegin(); i != c; ++i)
|
||||
{
|
||||
if (i.value().intersects(rect))
|
||||
{
|
||||
list << model()->index(i.key(), 0, rootIndex());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QAbstractItemView::paintEvent(event);
|
||||
|
||||
if (!model())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int rowCount = model()->rowCount();
|
||||
|
||||
if (m_geometry.isEmpty() && rowCount)
|
||||
{
|
||||
updateGeometries();
|
||||
}
|
||||
|
||||
QPainter painter(viewport());
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
painter.setBackground(palette().window());
|
||||
painter.setFont(font());
|
||||
|
||||
QStyleOptionViewItem option;
|
||||
option.palette = palette();
|
||||
option.font = font();
|
||||
option.fontMetrics = fontMetrics();
|
||||
option.decorationAlignment = Qt::AlignCenter;
|
||||
|
||||
const QRect visibleRect(QPoint(horizontalOffset(), verticalOffset()), viewport()->contentsRect().size());
|
||||
|
||||
painter.translate(-horizontalOffset(), -verticalOffset());
|
||||
|
||||
for (int r = 0; r < rowCount; ++r)
|
||||
{
|
||||
const QModelIndex& index = model()->index(r, 0, rootIndex());
|
||||
|
||||
option.rect = m_geometry.value(r);
|
||||
if (!option.rect.intersects(visibleRect))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
option.state = QStyle::State_None;
|
||||
|
||||
if (selectionModel()->isSelected(index))
|
||||
{
|
||||
option.state |= QStyle::State_Selected;
|
||||
}
|
||||
|
||||
if (currentIndex() == index)
|
||||
{
|
||||
option.state |= QStyle::State_HasFocus;
|
||||
}
|
||||
|
||||
QAbstractItemDelegate* idt = itemDelegate(index);
|
||||
idt->paint(&painter, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::rowsInserted(const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
QAbstractItemView::rowsInserted(parent, start, end);
|
||||
|
||||
if (isVisible())
|
||||
{
|
||||
scheduleDelayedItemsLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::updateGeometries()
|
||||
{
|
||||
ClearItemGeometries();
|
||||
|
||||
if (!model())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int rowCount = model()->rowCount();
|
||||
|
||||
const int nPageHorz = viewport()->width();
|
||||
const int nPageVert = viewport()->height();
|
||||
|
||||
if (nPageHorz == 0 || nPageVert == 0 || rowCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int x = m_borderSize.width();
|
||||
int y = m_borderSize.height();
|
||||
|
||||
const int nItemWidth = m_itemSize.width() + m_borderSize.width();
|
||||
|
||||
if (m_style == HorizontalStyle)
|
||||
{
|
||||
for (int row = 0; row < rowCount; ++row)
|
||||
{
|
||||
m_geometry.insert(row, QRect(QPoint(x, y), m_itemSize));
|
||||
x += nItemWidth;
|
||||
}
|
||||
|
||||
horizontalScrollBar()->setPageStep(viewport()->width());
|
||||
horizontalScrollBar()->setRange(0, x - viewport()->width());
|
||||
}
|
||||
else
|
||||
{
|
||||
const int nTextHeight = fontMetrics().height();
|
||||
const int nItemHeight = m_itemSize.height() + m_borderSize.height() + nTextHeight;
|
||||
|
||||
int nNumOfHorzItems = nPageHorz / nItemWidth;
|
||||
if (nNumOfHorzItems <= 0)
|
||||
{
|
||||
nNumOfHorzItems = 1;
|
||||
}
|
||||
|
||||
for (int row = 0; row < rowCount; ++row)
|
||||
{
|
||||
m_geometry.insert(row, QRect(QPoint(x, y), m_itemSize));
|
||||
|
||||
if ((row + 1) % nNumOfHorzItems == 0)
|
||||
{
|
||||
y += nItemHeight;
|
||||
x = m_borderSize.width();
|
||||
}
|
||||
else
|
||||
{
|
||||
x += nItemWidth;
|
||||
}
|
||||
}
|
||||
|
||||
verticalScrollBar()->setPageStep(viewport()->height());
|
||||
verticalScrollBar()->setRange(0, (y + nItemHeight) - viewport()->height());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QModelIndex CImageListCtrl::indexAt(const QPoint& point) const
|
||||
{
|
||||
if (!model())
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
const QPoint p = point +
|
||||
QPoint(horizontalOffset(), verticalOffset());
|
||||
|
||||
QHash<int, QRect>::const_iterator i;
|
||||
QHash<int, QRect>::const_iterator c = m_geometry.cend();
|
||||
for (i = m_geometry.cbegin(); i != c; ++i)
|
||||
{
|
||||
if (i.value().contains(p))
|
||||
{
|
||||
return model()->index(i.key(), 0, rootIndex());
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::scrollTo(const QModelIndex& index, ScrollHint hint)
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRect rect = m_geometry.value(index.row());
|
||||
|
||||
switch (hint)
|
||||
{
|
||||
case EnsureVisible:
|
||||
if (horizontalOffset() > rect.right())
|
||||
{
|
||||
horizontalScrollBar()->setValue(rect.left());
|
||||
}
|
||||
else if ((horizontalOffset() + viewport()->width()) < rect.left())
|
||||
{
|
||||
horizontalScrollBar()->setValue(rect.right() - viewport()->width());
|
||||
}
|
||||
|
||||
if (verticalOffset() > rect.bottom())
|
||||
{
|
||||
verticalScrollBar()->setValue(rect.top());
|
||||
}
|
||||
else if ((verticalOffset() + viewport()->height()) < rect.top())
|
||||
{
|
||||
verticalScrollBar()->setValue(rect.bottom() - viewport()->height());
|
||||
}
|
||||
break;
|
||||
|
||||
case PositionAtTop:
|
||||
horizontalScrollBar()->setValue(rect.left());
|
||||
verticalScrollBar()->setValue(rect.top());
|
||||
break;
|
||||
|
||||
case PositionAtBottom:
|
||||
horizontalScrollBar()->setValue(rect.right() - viewport()->width());
|
||||
verticalScrollBar()->setValue(rect.bottom() - viewport()->height());
|
||||
break;
|
||||
|
||||
case PositionAtCenter:
|
||||
horizontalScrollBar()->setValue(rect.center().x() - (viewport()->width() / 2));
|
||||
verticalScrollBar()->setValue(rect.center().y() - (viewport()->height() / 2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QRect CImageListCtrl::visualRect(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return QRect();
|
||||
}
|
||||
|
||||
|
||||
if (!m_geometry.contains(index.row()))
|
||||
{
|
||||
return QRect();
|
||||
}
|
||||
|
||||
return m_geometry.value(index.row())
|
||||
.translated(-horizontalOffset(), -verticalOffset());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QRect CImageListCtrl::ItemGeometry(const QModelIndex& index) const
|
||||
{
|
||||
Q_ASSERT(index.model() == model());
|
||||
Q_ASSERT(m_geometry.contains(index.row()));
|
||||
|
||||
return m_geometry.value(index.row());
|
||||
}
|
||||
|
||||
void CImageListCtrl::SetItemGeometry(const QModelIndex& index, const QRect& rect)
|
||||
{
|
||||
Q_ASSERT(index.model() == model());
|
||||
m_geometry.insert(index.row(), rect);
|
||||
update(rect);
|
||||
}
|
||||
|
||||
void CImageListCtrl::ClearItemGeometries()
|
||||
{
|
||||
m_geometry.clear();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CImageListCtrl::horizontalOffset() const
|
||||
{
|
||||
return horizontalScrollBar()->value();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CImageListCtrl::verticalOffset() const
|
||||
{
|
||||
return verticalScrollBar()->value();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CImageListCtrl::isIndexHidden([[maybe_unused]] const QModelIndex& index) const
|
||||
{
|
||||
return false; /* not supported */
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QModelIndex CImageListCtrl::moveCursor(CursorAction cursorAction, [[maybe_unused]] Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
if (!model())
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
const int rowCount = model()->rowCount();
|
||||
|
||||
if (0 == rowCount)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
switch (cursorAction)
|
||||
{
|
||||
case MoveHome:
|
||||
return model()->index(0, 0, rootIndex());
|
||||
|
||||
case MoveEnd:
|
||||
return model()->index(rowCount - 1, 0, rootIndex());
|
||||
|
||||
case MovePrevious:
|
||||
{
|
||||
QModelIndex current = currentIndex();
|
||||
if (current.isValid())
|
||||
{
|
||||
return model()->index((current.row() - 1) % rowCount, 0, rootIndex());
|
||||
}
|
||||
} break;
|
||||
|
||||
case MoveNext:
|
||||
{
|
||||
QModelIndex current = currentIndex();
|
||||
if (current.isValid())
|
||||
{
|
||||
return model()->index((current.row() + 1) % rowCount, 0, rootIndex());
|
||||
}
|
||||
} break;
|
||||
|
||||
case MoveUp:
|
||||
case MoveDown:
|
||||
case MoveLeft:
|
||||
case MoveRight:
|
||||
case MovePageUp:
|
||||
case MovePageDown:
|
||||
/* TODO */
|
||||
break;
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CImageListCtrl::setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags)
|
||||
{
|
||||
if (!model())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QRect lrect =
|
||||
rect.translated(horizontalOffset(), verticalOffset());
|
||||
|
||||
QHash<int, QRect>::const_iterator i;
|
||||
QHash<int, QRect>::const_iterator c = m_geometry.cend();
|
||||
for (i = m_geometry.cbegin(); i != c; ++i)
|
||||
{
|
||||
if (i.value().intersects(lrect))
|
||||
{
|
||||
selectionModel()->select(model()->index(i.key(), 0, rootIndex()), flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QRegion CImageListCtrl::visualRegionForSelection(const QItemSelection& selection) const
|
||||
{
|
||||
QRegion region;
|
||||
|
||||
foreach(const QModelIndex &index, selection.indexes())
|
||||
{
|
||||
region += visualRect(index);
|
||||
}
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QImageListDelegate::QImageListDelegate(QObject* parent)
|
||||
: QAbstractItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void QImageListDelegate::paint(QPainter* painter,
|
||||
const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
painter->save();
|
||||
|
||||
painter->setFont(option.font);
|
||||
|
||||
if (option.rect.isValid())
|
||||
{
|
||||
painter->setClipRect(option.rect);
|
||||
}
|
||||
|
||||
QRect innerRect = option.rect.adjusted(1, 1, -1, -1);
|
||||
|
||||
QRect textRect(innerRect.left(), innerRect.bottom() - option.fontMetrics.height(),
|
||||
innerRect.width(), option.fontMetrics.height() + 1);
|
||||
|
||||
/* fill item background */
|
||||
|
||||
painter->fillRect(option.rect, option.palette.color(QPalette::Base));
|
||||
|
||||
/* draw image */
|
||||
|
||||
if (index.data(Qt::DecorationRole).isValid())
|
||||
{
|
||||
const QPixmap& p = index.data(Qt::DecorationRole).value<QPixmap>();
|
||||
if (p.isNull() || p.size() == QSize(1, 1))
|
||||
{
|
||||
emit InvalidPixmapGenerated(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->drawPixmap(innerRect, p);
|
||||
}
|
||||
}
|
||||
|
||||
/* draw text */
|
||||
|
||||
const QColor trColor = option.palette.color(QPalette::Shadow);
|
||||
painter->fillRect(textRect, (option.state & QStyle::State_Selected) ?
|
||||
trColor.lighter() : trColor);
|
||||
|
||||
if (option.state & QStyle::State_Selected)
|
||||
{
|
||||
painter->setPen(QPen(option.palette.color(QPalette::HighlightedText)));
|
||||
|
||||
QFont f = painter->font();
|
||||
f.setBold(true);
|
||||
painter->setFont(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen(QPen(option.palette.color(QPalette::Text)));
|
||||
}
|
||||
|
||||
painter->drawText(textRect, index.data(Qt::DisplayRole).toString(),
|
||||
QTextOption(option.decorationAlignment));
|
||||
|
||||
painter->setPen(QPen(option.palette.color(QPalette::Shadow)));
|
||||
painter->drawRect(textRect);
|
||||
|
||||
/* draw border */
|
||||
|
||||
if (option.state & QStyle::State_Selected)
|
||||
{
|
||||
QPen pen(option.palette.color(QPalette::Highlight));
|
||||
pen.setWidth(2);
|
||||
painter->setPen(pen);
|
||||
painter->drawRect(innerRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen(QPen(option.palette.color(QPalette::Shadow)));
|
||||
painter->drawRect(option.rect);
|
||||
}
|
||||
|
||||
if (option.state & QStyle::State_HasFocus)
|
||||
{
|
||||
QPen pen(Qt::DotLine);
|
||||
pen.setColor(option.palette.color(QPalette::AlternateBase));
|
||||
painter->setPen(pen);
|
||||
painter->drawRect(option.rect);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QSize QImageListDelegate::sizeHint(const QStyleOptionViewItem& option,
|
||||
[[maybe_unused]] const QModelIndex& index) const
|
||||
{
|
||||
return option.rect.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QVector<int> QImageListDelegate::paintingRoles() const
|
||||
{
|
||||
return QVector<int>() << Qt::DecorationRole << Qt::DisplayRole;
|
||||
}
|
||||
|
||||
#include <Controls/moc_ImageListCtrl.cpp>
|
||||
@@ -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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_CONTROLS_IMAGELISTCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_IMAGELISTCTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QAbstractItemView>
|
||||
|
||||
#include <QHash>
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Custom control to display list of images.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CImageListCtrl
|
||||
: public QAbstractItemView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum ListStyle
|
||||
{
|
||||
DefaultStyle,
|
||||
HorizontalStyle
|
||||
};
|
||||
|
||||
public:
|
||||
CImageListCtrl(QWidget* parent = nullptr);
|
||||
~CImageListCtrl();
|
||||
|
||||
ListStyle Style() const;
|
||||
void SetStyle(ListStyle style);
|
||||
|
||||
const QSize& ItemSize() const;
|
||||
void SetItemSize(QSize size);
|
||||
|
||||
const QSize& BorderSize() const;
|
||||
void SetBorderSize(QSize size);
|
||||
|
||||
// Get all items inside specified rectangle.
|
||||
QModelIndexList ItemsInRect(const QRect& rect) const;
|
||||
|
||||
QModelIndex indexAt(const QPoint& point) const override;
|
||||
void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible) override;
|
||||
QRect visualRect(const QModelIndex& index) const override;
|
||||
|
||||
protected:
|
||||
QRect ItemGeometry(const QModelIndex& index) const;
|
||||
void SetItemGeometry(const QModelIndex& index, const QRect& rect);
|
||||
void ClearItemGeometries();
|
||||
|
||||
int horizontalOffset() const override;
|
||||
int verticalOffset() const override;
|
||||
bool isIndexHidden(const QModelIndex& index) const override;
|
||||
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
|
||||
void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags) override;
|
||||
QRegion visualRegionForSelection(const QItemSelection& selection) const override;
|
||||
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void rowsInserted(const QModelIndex& parent, int start, int end) override;
|
||||
|
||||
void updateGeometries() override;
|
||||
|
||||
private:
|
||||
QHash<int, QRect> m_geometry;
|
||||
QSize m_itemSize;
|
||||
QSize m_borderSize;
|
||||
ListStyle m_style;
|
||||
};
|
||||
|
||||
class QImageListDelegate
|
||||
: public QAbstractItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void InvalidPixmapGenerated(const QModelIndex& index) const;
|
||||
public:
|
||||
QImageListDelegate(QObject* parent = nullptr);
|
||||
|
||||
void paint(QPainter* painter,
|
||||
const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override;
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override;
|
||||
|
||||
QVector<int> paintingRoles() const override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_IMAGELISTCTRL_H
|
||||
@@ -1,67 +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 "MultiMonHelper.h"
|
||||
|
||||
// Qt
|
||||
#include <QScreen>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void ClipOrCenterRectToMonitor(QRect *prc, const UINT flags)
|
||||
{
|
||||
const QScreen* currentScreen = nullptr;
|
||||
QRect rc;
|
||||
|
||||
Q_ASSERT(prc);
|
||||
|
||||
const auto screens = qApp->screens();
|
||||
for (auto screen : screens)
|
||||
{
|
||||
if (screen->geometry().contains(prc->center()))
|
||||
{
|
||||
currentScreen = screen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentScreen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int w = prc->width();
|
||||
const int h = prc->height();
|
||||
|
||||
if (flags & MONITOR_WORKAREA)
|
||||
{
|
||||
rc = currentScreen->availableGeometry();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = currentScreen->geometry();
|
||||
}
|
||||
|
||||
// center or clip the passed rect to the monitor rect
|
||||
if (flags & MONITOR_CENTER)
|
||||
{
|
||||
prc->setLeft(rc.left() + (rc.right() - rc.left() - w) / 2);
|
||||
prc->setTop(rc.top() + (rc.bottom() - rc.top() - h) / 2);
|
||||
prc->setRight(prc->left() + w);
|
||||
prc->setBottom(prc->top() + h);
|
||||
}
|
||||
else
|
||||
{
|
||||
prc->setLeft(qMax(rc.left(), qMin(rc.right() - w, prc->left())));
|
||||
prc->setTop(qMax(rc.top(), qMin(rc.bottom() - h, prc->top())));
|
||||
prc->setRight(prc->left() + w);
|
||||
prc->setBottom(prc->top() + h);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +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_CONTROLS_MULTIMONHELPER_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_MULTIMONHELPER_H
|
||||
#pragma once
|
||||
|
||||
// Taken from: http://msdn.microsoft.com/en-us/library/dd162826(v=vs.85).aspx
|
||||
#define MONITOR_CENTER 0x0001 // center rect to monitor
|
||||
#define MONITOR_CLIP 0x0000 // clip rect to monitor
|
||||
#define MONITOR_WORKAREA 0x0002 // use monitor work area
|
||||
#define MONITOR_AREA 0x0000 // use monitor entire area
|
||||
|
||||
//
|
||||
// ClipOrCenterRectToMonitor
|
||||
//
|
||||
// The most common problem apps have when running on a
|
||||
// multimonitor system is that they "clip" or "pin" windows
|
||||
// based on the SM_CXSCREEN and SM_CYSCREEN system metrics.
|
||||
// Because of app compatibility reasons these system metrics
|
||||
// return the size of the primary monitor.
|
||||
//
|
||||
// This shows how you use the multi-monitor functions
|
||||
// to do the same thing.
|
||||
//
|
||||
// params:
|
||||
// prc : pointer to QRect to modify
|
||||
// flags : some combination of the MONITOR_* flags above
|
||||
//
|
||||
// example:
|
||||
//
|
||||
// ClipOrCenterRectToMonitor(&aRect, MONITOR_CLIP | MONITOR_WORKAREA);
|
||||
//
|
||||
// Takes parameter pointer to RECT "aRect" and flags MONITOR_CLIP | MONITOR_WORKAREA
|
||||
// This will modify aRect without resizing it so that it remains within the on-screen boundaries.
|
||||
void ClipOrCenterRectToMonitor(QRect *prc, const UINT flags);
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_MULTIMONHELPER_H
|
||||
@@ -1,143 +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 "NumberCtrl.h"
|
||||
|
||||
|
||||
QNumberCtrl::QNumberCtrl(QWidget* parent)
|
||||
: QDoubleSpinBox(parent)
|
||||
, m_bMouseDown(false)
|
||||
, m_bDragged(false)
|
||||
, m_bUndoEnabled(false)
|
||||
, m_prevValue(0)
|
||||
{
|
||||
connect(this, &QAbstractSpinBox::editingFinished, this, &QNumberCtrl::onEditingFinished);
|
||||
}
|
||||
|
||||
void QNumberCtrl::changeEvent(QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::EnabledChange)
|
||||
{
|
||||
setButtonSymbols(isEnabled() ? UpDownArrows : NoButtons);
|
||||
}
|
||||
|
||||
QDoubleSpinBox::changeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void QNumberCtrl::SetRange(double newMin, double newMax)
|
||||
{
|
||||
// Avoid setting this value if its close to the current value, because otherwise qt will pump events into the queue to redraw/etc.
|
||||
if ( (!AZ::IsClose(this->minimum(), newMin, DBL_EPSILON)) || (!AZ::IsClose(this->maximum(), newMax, DBL_EPSILON)) )
|
||||
{
|
||||
setRange(newMin, newMax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QNumberCtrl::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit mousePressed();
|
||||
|
||||
m_bMouseDown = true;
|
||||
m_bDragged = false;
|
||||
m_mousePos = event->pos();
|
||||
|
||||
if (m_bUndoEnabled && !CUndo::IsRecording())
|
||||
{
|
||||
GetIEditor()->BeginUndo();
|
||||
}
|
||||
|
||||
emit dragStarted();
|
||||
|
||||
grabMouse();
|
||||
}
|
||||
|
||||
QDoubleSpinBox::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QNumberCtrl::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
QDoubleSpinBox::mouseReleaseEvent(event);
|
||||
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
m_bMouseDown = m_bDragged = false;
|
||||
|
||||
emit valueUpdated();
|
||||
emit valueChanged();
|
||||
|
||||
if (m_bUndoEnabled && CUndo::IsRecording())
|
||||
{
|
||||
GetIEditor()->AcceptUndo(m_undoText);
|
||||
}
|
||||
|
||||
emit dragFinished();
|
||||
|
||||
releaseMouse();
|
||||
|
||||
m_prevValue = value();
|
||||
|
||||
emit mouseReleased();
|
||||
}
|
||||
}
|
||||
|
||||
void QNumberCtrl::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
QDoubleSpinBox::mousePressEvent(event);
|
||||
|
||||
if (m_bMouseDown)
|
||||
{
|
||||
m_bDragged = true;
|
||||
|
||||
int dy = event->pos().y() - m_mousePos.y();
|
||||
setValue(value() - singleStep() * dy);
|
||||
|
||||
emit valueUpdated();
|
||||
|
||||
m_mousePos = event->pos();
|
||||
}
|
||||
}
|
||||
|
||||
void QNumberCtrl::EnableUndo(const QString& undoText)
|
||||
{
|
||||
m_undoText = undoText;
|
||||
m_bUndoEnabled = true;
|
||||
}
|
||||
|
||||
void QNumberCtrl::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
m_prevValue = value();
|
||||
QDoubleSpinBox::focusInEvent(event);
|
||||
}
|
||||
|
||||
void QNumberCtrl::onEditingFinished()
|
||||
{
|
||||
bool undo = m_bUndoEnabled && !CUndo::IsRecording() && m_prevValue != value();
|
||||
if (undo)
|
||||
{
|
||||
GetIEditor()->BeginUndo();
|
||||
}
|
||||
|
||||
emit valueUpdated();
|
||||
emit valueChanged();
|
||||
|
||||
if (undo)
|
||||
{
|
||||
GetIEditor()->AcceptUndo(m_undoText);
|
||||
}
|
||||
|
||||
m_prevValue = value();
|
||||
}
|
||||
|
||||
#include <Controls/moc_NumberCtrl.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 CRYINCLUDE_EDITOR_CONTROLS_NUMBERCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_NUMBERCTRL_H
|
||||
#pragma once
|
||||
|
||||
// NumberCtrl.h : header file
|
||||
//
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDoubleSpinBox>
|
||||
#endif
|
||||
|
||||
class QNumberCtrl
|
||||
: public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QNumberCtrl(QWidget* parent = nullptr);
|
||||
|
||||
bool IsDragging() const { return m_bDragged; }
|
||||
|
||||
//! If called will enable undo with given text when control is modified.
|
||||
void EnableUndo(const QString& undoText);
|
||||
void SetRange(double newMin, double maxRange);
|
||||
|
||||
Q_SIGNALS:
|
||||
void dragStarted();
|
||||
void dragFinished();
|
||||
|
||||
void valueUpdated();
|
||||
void valueChanged();
|
||||
|
||||
void mouseReleased();
|
||||
void mousePressed();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent* event) override;
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
void onEditingFinished();
|
||||
void onValueChanged(double d);
|
||||
|
||||
bool m_bMouseDown;
|
||||
bool m_bDragged;
|
||||
QPoint m_mousePos;
|
||||
bool m_bUndoEnabled;
|
||||
double m_prevValue;
|
||||
QString m_undoText;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_NUMBERCTRL_H
|
||||
@@ -1,93 +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 "TextEditorCtrl.h"
|
||||
|
||||
|
||||
// CTextEditorCtrl
|
||||
CTextEditorCtrl::CTextEditorCtrl(QWidget* pParent)
|
||||
: QTextEdit(pParent)
|
||||
{
|
||||
m_bModified = true;
|
||||
|
||||
QFont font;
|
||||
font.setFamily("Courier New");
|
||||
font.setFixedPitch(true);
|
||||
font.setPointSize(10);
|
||||
setFont(font);
|
||||
|
||||
setLineWrapMode(NoWrap);
|
||||
|
||||
connect(this, &QTextEdit::textChanged, this, &CTextEditorCtrl::OnChange);
|
||||
}
|
||||
|
||||
CTextEditorCtrl::~CTextEditorCtrl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// CTextEditorCtrl message handlers
|
||||
|
||||
void CTextEditorCtrl::LoadFile(const QString& sFileName)
|
||||
{
|
||||
if (m_filename == sFileName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_filename = sFileName;
|
||||
|
||||
clear();
|
||||
|
||||
CCryFile file(sFileName.toUtf8().data(), "rb");
|
||||
if (file.Open(sFileName.toUtf8().data(), "rb"))
|
||||
{
|
||||
size_t length = file.GetLength();
|
||||
|
||||
QByteArray text;
|
||||
text.resize(static_cast<int>(length));
|
||||
file.ReadRaw(text.data(), length);
|
||||
|
||||
setPlainText(text);
|
||||
}
|
||||
|
||||
m_bModified = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTextEditorCtrl::SaveFile(const QString& sFileName)
|
||||
{
|
||||
if (sFileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CFileUtil::OverwriteFile(sFileName.toUtf8().data()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(sFileName);
|
||||
file.open(QFile::WriteOnly);
|
||||
|
||||
file.write(toPlainText().toUtf8());
|
||||
|
||||
m_bModified = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTextEditorCtrl::OnChange()
|
||||
{
|
||||
|
||||
m_bModified = true;
|
||||
}
|
||||
|
||||
#include <Controls/moc_TextEditorCtrl.cpp>
|
||||
@@ -1,42 +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_CONTROLS_TEXTEDITORCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_TEXTEDITORCTRL_H
|
||||
#pragma once
|
||||
|
||||
// CTextEditorCtrl
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QTextEdit>
|
||||
#endif
|
||||
|
||||
class CTextEditorCtrl
|
||||
: public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CTextEditorCtrl(QWidget* pParent = nullptr);
|
||||
virtual ~CTextEditorCtrl();
|
||||
|
||||
void LoadFile(const QString& sFileName);
|
||||
void SaveFile(const QString& sFileName);
|
||||
QString GetFilename() const { return m_filename; }
|
||||
|
||||
bool IsModified() const { return m_bModified; }
|
||||
|
||||
//! Must be called after OnChange message.
|
||||
void OnChange();
|
||||
|
||||
protected:
|
||||
QString m_filename;
|
||||
bool m_bModified;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_TEXTEDITORCTRL_H
|
||||
@@ -1,322 +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_CONTROLS_TREECTRLUTILS_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_TREECTRLUTILS_H
|
||||
#pragma once
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace TreeCtrlUtils
|
||||
{
|
||||
template <typename P>
|
||||
class TreeItemIterator
|
||||
: public P
|
||||
{
|
||||
public:
|
||||
typedef P Traits;
|
||||
|
||||
//iterator traits, required by STL
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef HTREEITEM value_type;
|
||||
typedef HTREEITEM* pointer;
|
||||
typedef HTREEITEM& reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
TreeItemIterator()
|
||||
: pCtrl(0)
|
||||
, hItem(0) {}
|
||||
explicit TreeItemIterator(const P& traits)
|
||||
: P(traits)
|
||||
, pCtrl(0)
|
||||
, hItem(0) {}
|
||||
TreeItemIterator(const TreeItemIterator& other)
|
||||
: P(other)
|
||||
, pCtrl(other.pCtrl)
|
||||
, hItem(other.hItem) {}
|
||||
TreeItemIterator(CTreeCtrl* pCtrl, HTREEITEM hItem)
|
||||
: pCtrl(pCtrl)
|
||||
, hItem(hItem) {}
|
||||
TreeItemIterator(CTreeCtrl* pCtrl, HTREEITEM hItem, const P& traits)
|
||||
: P(traits)
|
||||
, pCtrl(pCtrl)
|
||||
, hItem(hItem) {}
|
||||
|
||||
HTREEITEM operator*() {return hItem; }
|
||||
bool operator==(const TreeItemIterator& other) const {return pCtrl == other.pCtrl && hItem == other.hItem; }
|
||||
bool operator!=(const TreeItemIterator& other) const {return pCtrl != other.pCtrl || hItem != other.hItem; }
|
||||
|
||||
TreeItemIterator& operator++()
|
||||
{
|
||||
HTREEITEM hNextItem = 0;
|
||||
if (RecurseToChildren(hItem))
|
||||
{
|
||||
hNextItem = (pCtrl ? pCtrl->GetChildItem(hItem) : 0);
|
||||
}
|
||||
while (pCtrl && hItem && !hNextItem)
|
||||
{
|
||||
hNextItem = pCtrl->GetNextSiblingItem(hItem);
|
||||
if (!hNextItem)
|
||||
{
|
||||
hItem = pCtrl->GetParentItem(hItem);
|
||||
}
|
||||
}
|
||||
hItem = hNextItem;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TreeItemIterator operator++(int) {TreeItemIterator old = *this; ++(*this); return old; }
|
||||
|
||||
CTreeCtrl* pCtrl;
|
||||
HTREEITEM hItem;
|
||||
};
|
||||
|
||||
class NonRecursiveTreeItemIteratorTraits
|
||||
{
|
||||
public:
|
||||
bool RecurseToChildren(HTREEITEM hItem) {return false; }
|
||||
};
|
||||
typedef TreeItemIterator<NonRecursiveTreeItemIteratorTraits> NonRecursiveTreeItemIterator;
|
||||
|
||||
class RecursiveTreeItemIteratorTraits
|
||||
{
|
||||
public:
|
||||
bool RecurseToChildren(HTREEITEM hItem) {return true; }
|
||||
};
|
||||
typedef TreeItemIterator<RecursiveTreeItemIteratorTraits> RecursiveTreeItemIterator;
|
||||
|
||||
inline RecursiveTreeItemIterator BeginTreeItemsRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
if (hItem == 0)
|
||||
{
|
||||
hItem = (pCtrl ? pCtrl->GetRootItem() : 0);
|
||||
}
|
||||
return RecursiveTreeItemIterator(pCtrl, hItem);
|
||||
}
|
||||
|
||||
inline RecursiveTreeItemIterator EndTreeItemsRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
HTREEITEM hEndItem = 0;
|
||||
HTREEITEM hParent = hItem;
|
||||
do
|
||||
{
|
||||
if (hParent)
|
||||
{
|
||||
hEndItem = pCtrl->GetNextSiblingItem(hParent);
|
||||
}
|
||||
hParent = (pCtrl && hParent ? pCtrl->GetParentItem(hParent) : 0);
|
||||
}
|
||||
while (hParent && !hEndItem);
|
||||
return RecursiveTreeItemIterator(pCtrl, hEndItem);
|
||||
}
|
||||
|
||||
inline NonRecursiveTreeItemIterator BeginTreeItemsNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
if (hItem == 0)
|
||||
{
|
||||
hItem = (pCtrl ? pCtrl->GetRootItem() : 0);
|
||||
}
|
||||
if (hItem)
|
||||
{
|
||||
hItem = pCtrl->GetChildItem(hItem);
|
||||
}
|
||||
return NonRecursiveTreeItemIterator(pCtrl, hItem);
|
||||
}
|
||||
|
||||
inline NonRecursiveTreeItemIterator EndTreeItemsNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
HTREEITEM hEndItem = 0;
|
||||
HTREEITEM hParent = 0;
|
||||
while (hParent && !hEndItem)
|
||||
{
|
||||
hParent = (pCtrl && hItem ? pCtrl->GetParentItem(hItem) : 0);
|
||||
if (hParent)
|
||||
{
|
||||
hEndItem = pCtrl->GetNextSiblingItem(hParent);
|
||||
}
|
||||
}
|
||||
return NonRecursiveTreeItemIterator(pCtrl, hEndItem);
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
class TreeItemDataIterator
|
||||
{
|
||||
public:
|
||||
typedef T Type;
|
||||
typedef TreeItemIterator<P> InternalIterator;
|
||||
|
||||
//iterator traits, required by STL
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef Type* value_type;
|
||||
typedef Type** pointer;
|
||||
typedef Type*& reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
TreeItemDataIterator() {}
|
||||
TreeItemDataIterator(const TreeItemDataIterator& other)
|
||||
: iterator(other.iterator) {AdvanceToValidIterator(); }
|
||||
explicit TreeItemDataIterator(const InternalIterator& iterator)
|
||||
: iterator(iterator) {AdvanceToValidIterator(); }
|
||||
|
||||
Type* operator*() {return reinterpret_cast<Type*>(iterator.pCtrl->GetItemData(iterator.hItem)); }
|
||||
bool operator==(const TreeItemDataIterator& other) const {return iterator == other.iterator; }
|
||||
bool operator!=(const TreeItemDataIterator& other) const {return iterator != other.iterator; }
|
||||
|
||||
HTREEITEM GetTreeItem() {return iterator.hItem; }
|
||||
|
||||
TreeItemDataIterator& operator++()
|
||||
{
|
||||
++iterator;
|
||||
AdvanceToValidIterator();
|
||||
return *this;
|
||||
}
|
||||
|
||||
TreeItemDataIterator operator++(int) {TreeItemDataIterator old = *this; ++(*this); return old; }
|
||||
|
||||
private:
|
||||
void AdvanceToValidIterator()
|
||||
{
|
||||
while (iterator.pCtrl && iterator.hItem && !iterator.pCtrl->GetItemData(iterator.hItem))
|
||||
{
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
|
||||
InternalIterator iterator;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class RecursiveItemDataIteratorType
|
||||
{
|
||||
public: typedef TreeItemDataIterator<T, RecursiveTreeItemIteratorTraits> type;
|
||||
};
|
||||
template <typename T>
|
||||
inline TreeItemDataIterator<T, RecursiveTreeItemIteratorTraits> BeginTreeItemDataRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
return TreeItemDataIterator<T, RecursiveTreeItemIteratorTraits>(BeginTreeItemsRecursive(pCtrl, hItem));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline TreeItemDataIterator<T, RecursiveTreeItemIteratorTraits> EndTreeItemDataRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
return TreeItemDataIterator<T, RecursiveTreeItemIteratorTraits>(EndTreeItemsRecursive(pCtrl, hItem));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class NonRecursiveItemDataIteratorType
|
||||
{
|
||||
typedef TreeItemDataIterator<T, NonRecursiveTreeItemIteratorTraits> type;
|
||||
};
|
||||
template <typename T>
|
||||
inline TreeItemDataIterator<T, NonRecursiveTreeItemIteratorTraits> BeginTreeItemDataNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
return TreeItemDataIterator<T, NonRecursiveTreeItemIteratorTraits>(BeginTreeItemsNonRecursive(pCtrl, hItem));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline TreeItemDataIterator<T, NonRecursiveTreeItemIteratorTraits> EndTreeItemDataNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0)
|
||||
{
|
||||
return TreeItemDataIterator<T, NonRecursiveTreeItemIteratorTraits>(EndTreeItemsNonRecursive(pCtrl, hItem));
|
||||
}
|
||||
|
||||
class SelectedTreeItemIterator
|
||||
{
|
||||
public:
|
||||
SelectedTreeItemIterator()
|
||||
: pCtrl(0)
|
||||
, hItem(0) {}
|
||||
SelectedTreeItemIterator(const SelectedTreeItemIterator& other)
|
||||
: pCtrl(other.pCtrl)
|
||||
, hItem(other.hItem) {}
|
||||
SelectedTreeItemIterator(CXTTreeCtrl* pCtrl, HTREEITEM hItem)
|
||||
: pCtrl(pCtrl)
|
||||
, hItem(hItem) {}
|
||||
|
||||
HTREEITEM operator*() {return hItem; }
|
||||
bool operator==(const SelectedTreeItemIterator& other) const {return pCtrl == other.pCtrl && hItem == other.hItem; }
|
||||
bool operator!=(const SelectedTreeItemIterator& other) const {return pCtrl != other.pCtrl || hItem != other.hItem; }
|
||||
|
||||
SelectedTreeItemIterator& operator++()
|
||||
{
|
||||
hItem = (pCtrl ? pCtrl->GetNextSelectedItem(hItem) : 0);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelectedTreeItemIterator operator++(int) {SelectedTreeItemIterator old = *this; ++(*this); return old; }
|
||||
|
||||
CXTTreeCtrl* pCtrl;
|
||||
HTREEITEM hItem;
|
||||
};
|
||||
|
||||
SelectedTreeItemIterator BeginSelectedTreeItems(CXTTreeCtrl* pCtrl)
|
||||
{
|
||||
return SelectedTreeItemIterator(pCtrl, (pCtrl ? pCtrl->GetFirstSelectedItem() : 0));
|
||||
}
|
||||
|
||||
SelectedTreeItemIterator EndSelectedTreeItems(CXTTreeCtrl* pCtrl)
|
||||
{
|
||||
return SelectedTreeItemIterator(pCtrl, 0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class SelectedTreeItemDataIterator
|
||||
{
|
||||
public:
|
||||
typedef T Type;
|
||||
typedef SelectedTreeItemIterator InternalIterator;
|
||||
|
||||
SelectedTreeItemDataIterator() {}
|
||||
SelectedTreeItemDataIterator(const SelectedTreeItemDataIterator& other)
|
||||
: iterator(other.iterator) {AdvanceToValidIterator(); }
|
||||
explicit SelectedTreeItemDataIterator(const InternalIterator& iterator)
|
||||
: iterator(iterator) {AdvanceToValidIterator(); }
|
||||
|
||||
Type* operator*() {return reinterpret_cast<Type*>(iterator.pCtrl->GetItemData(iterator.hItem)); }
|
||||
bool operator==(const SelectedTreeItemDataIterator& other) const {return iterator == other.iterator; }
|
||||
bool operator!=(const SelectedTreeItemDataIterator& other) const {return iterator != other.iterator; }
|
||||
|
||||
HTREEITEM GetTreeItem() {return iterator.hItem; }
|
||||
|
||||
SelectedTreeItemDataIterator& operator++()
|
||||
{
|
||||
++iterator;
|
||||
AdvanceToValidIterator();
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelectedTreeItemDataIterator operator++(int) {SelectedTreeItemDataIterator old = *this; ++(*this); return old; }
|
||||
|
||||
private:
|
||||
void AdvanceToValidIterator()
|
||||
{
|
||||
while (iterator.pCtrl && iterator.hItem && !iterator.pCtrl->GetItemData(iterator.hItem))
|
||||
{
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
|
||||
InternalIterator iterator;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
SelectedTreeItemDataIterator<T> BeginSelectedTreeItemData(CXTTreeCtrl* pCtrl)
|
||||
{
|
||||
return SelectedTreeItemDataIterator<T>(BeginSelectedTreeItems(pCtrl));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
SelectedTreeItemDataIterator<T> EndSelectedTreeItemData(CXTTreeCtrl* pCtrl)
|
||||
{
|
||||
return SelectedTreeItemDataIterator<T>(EndSelectedTreeItems(pCtrl));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_TREECTRLUTILS_H
|
||||
@@ -1,138 +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 "DeepSelection.h"
|
||||
|
||||
// Editor
|
||||
#include "Objects/BaseObject.h"
|
||||
|
||||
|
||||
//! Functor for sorting selected objects on deep selection mode.
|
||||
struct NearDistance
|
||||
{
|
||||
NearDistance(){}
|
||||
bool operator()(const CDeepSelection::RayHitObject& lhs, const CDeepSelection::RayHitObject& rhs) const
|
||||
{
|
||||
return lhs.distance < rhs.distance;
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CDeepSelection::CDeepSelection()
|
||||
: m_Mode(DSM_NONE)
|
||||
, m_previousMode(DSM_NONE)
|
||||
, m_CandidateObjectCount(0)
|
||||
, m_CurrentSelectedPos(-1)
|
||||
{
|
||||
m_LastPickPoint = QPoint(-1, -1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CDeepSelection::~CDeepSelection()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDeepSelection::Reset(bool bResetLastPick)
|
||||
{
|
||||
for (int i = 0; i < m_CandidateObjectCount; ++i)
|
||||
{
|
||||
m_RayHitObjects[i].object->ClearFlags(OBJFLAG_NO_HITTEST);
|
||||
}
|
||||
|
||||
m_CandidateObjectCount = 0;
|
||||
m_CurrentSelectedPos = -1;
|
||||
|
||||
m_RayHitObjects.clear();
|
||||
|
||||
if (bResetLastPick)
|
||||
{
|
||||
m_LastPickPoint = QPoint(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDeepSelection::AddObject(float distance, CBaseObject* pObj)
|
||||
{
|
||||
m_RayHitObjects.push_back(RayHitObject(distance, pObj));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDeepSelection::OnCycling (const QPoint& pt)
|
||||
{
|
||||
QPoint diff = m_LastPickPoint - pt;
|
||||
LONG epsilon = 2;
|
||||
m_LastPickPoint = pt;
|
||||
|
||||
if (abs(diff.x()) < epsilon && abs(diff.y()) < epsilon)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDeepSelection::ExcludeHitTest(int except)
|
||||
{
|
||||
int nExcept = except % m_CandidateObjectCount;
|
||||
|
||||
for (int i = 0; i < m_CandidateObjectCount; ++i)
|
||||
{
|
||||
m_RayHitObjects[i].object->SetFlags(OBJFLAG_NO_HITTEST);
|
||||
}
|
||||
|
||||
m_RayHitObjects[nExcept].object->ClearFlags(OBJFLAG_NO_HITTEST);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDeepSelection::CollectCandidate(float fMinDistance, float fRange)
|
||||
{
|
||||
m_CandidateObjectCount = 0;
|
||||
|
||||
if (!m_RayHitObjects.empty())
|
||||
{
|
||||
std::sort(m_RayHitObjects.begin(), m_RayHitObjects.end(), NearDistance());
|
||||
|
||||
for (std::vector<CDeepSelection::RayHitObject>::iterator itr = m_RayHitObjects.begin();
|
||||
itr != m_RayHitObjects.end(); ++itr)
|
||||
{
|
||||
if (itr->distance - fMinDistance < fRange)
|
||||
{
|
||||
++m_CandidateObjectCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_CandidateObjectCount;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CBaseObject* CDeepSelection::GetCandidateObject(int index)
|
||||
{
|
||||
m_CurrentSelectedPos = index % m_CandidateObjectCount;
|
||||
|
||||
return m_RayHitObjects[m_CurrentSelectedPos].object;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//!
|
||||
void CDeepSelection::SetMode(EDeepSelectionMode mode)
|
||||
{
|
||||
m_previousMode = m_Mode;
|
||||
m_Mode = mode;
|
||||
}
|
||||
@@ -1,87 +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 : Deep Selection Header
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
|
||||
#define CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
|
||||
#pragma once
|
||||
|
||||
class CBaseObject;
|
||||
|
||||
//! Deep Selection
|
||||
//! Additional output information of HitContext on using "deep selection mode".
|
||||
//! At the deep selection mode, it supports second selection pass for easy
|
||||
//! selection on crowded area with two different method.
|
||||
//! One is to show pop menu of candidate objects list. Another is the cyclic
|
||||
//! selection on pick clicking.
|
||||
class CDeepSelection
|
||||
: public _i_reference_target_t
|
||||
{
|
||||
public:
|
||||
//! Deep Selection Mode Definition
|
||||
enum EDeepSelectionMode
|
||||
{
|
||||
DSM_NONE = 0, // Not using deep selection.
|
||||
DSM_POP = 1, // Deep selection mode with pop context menu.
|
||||
DSM_CYCLE = 2 // Deep selection mode with cyclic selection on each clinking same point.
|
||||
};
|
||||
|
||||
//! Subclass for container of the selected object with hit distance.
|
||||
struct RayHitObject
|
||||
{
|
||||
RayHitObject(float dist, CBaseObject* pObj)
|
||||
: distance(dist)
|
||||
, object(pObj)
|
||||
{
|
||||
}
|
||||
|
||||
float distance;
|
||||
CBaseObject* object;
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CDeepSelection();
|
||||
virtual ~CDeepSelection();
|
||||
|
||||
void Reset(bool bResetLastPick = false);
|
||||
void AddObject(float distance, CBaseObject* pObj);
|
||||
//! Check if clicking point is same position with last position,
|
||||
//! to decide whether to continue cycling mode.
|
||||
bool OnCycling (const QPoint& pt);
|
||||
//! All objects in list are excluded for hitting test except one, current selection.
|
||||
void ExcludeHitTest(int except);
|
||||
void SetMode(EDeepSelectionMode mode);
|
||||
inline EDeepSelectionMode GetMode() const { return m_Mode; }
|
||||
inline EDeepSelectionMode GetPreviousMode() const { return m_previousMode; }
|
||||
//! Collect object in the deep selection range. The distance from the minimum
|
||||
//! distance is less than deep selection range.
|
||||
int CollectCandidate(float fMinDistance, float fRange);
|
||||
//! Return the candidate object in index position, then it is to be current
|
||||
//! selection position.
|
||||
CBaseObject* GetCandidateObject(int index);
|
||||
//! Return the current selection position that is update in "GetCandidateObject"
|
||||
//! function call.
|
||||
inline int GetCurrentSelectPos() const { return m_CurrentSelectedPos; }
|
||||
//! Return the number of objects in the deep selection range.
|
||||
inline int GetCandidateObjectCount() const { return m_CandidateObjectCount; }
|
||||
|
||||
private:
|
||||
//! Current mode
|
||||
EDeepSelectionMode m_Mode;
|
||||
EDeepSelectionMode m_previousMode;
|
||||
//! Last picking point to check whether cyclic selection continue.
|
||||
QPoint m_LastPickPoint;
|
||||
//! List of the selected objects with ray hitting
|
||||
std::vector<RayHitObject> m_RayHitObjects;
|
||||
int m_CandidateObjectCount;
|
||||
int m_CurrentSelectedPos;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
|
||||
@@ -1,542 +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 "EditorPanelUtils.h"
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
// Qt
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
// Editor
|
||||
#include "IEditorPanelUtils.h"
|
||||
#include "Objects/EntityObject.h"
|
||||
#include "CryEditDoc.h"
|
||||
#include "ViewManager.h"
|
||||
#include "Controls/QToolTipWidget.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
|
||||
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323f
|
||||
#endif
|
||||
|
||||
|
||||
struct ToolTip
|
||||
{
|
||||
bool isValid;
|
||||
QString title;
|
||||
QString content;
|
||||
QString specialContent;
|
||||
QString disabledContent;
|
||||
};
|
||||
|
||||
// internal implementation for better compile times - should also never be used externally, use IParticleEditorUtils interface for that.
|
||||
class CEditorPanelUtils_Impl
|
||||
: public IEditorPanelUtils
|
||||
{
|
||||
public:
|
||||
void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
|
||||
{
|
||||
for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
|
||||
{
|
||||
GetIEditor()->GetViewManager()->GetView(i)->SetGlobalDropCallback(dropCallback, custom);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
|
||||
{
|
||||
CRY_ASSERT(settings);
|
||||
return settings->GetDebugFlags();
|
||||
}
|
||||
|
||||
void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override
|
||||
{
|
||||
CRY_ASSERT(settings);
|
||||
settings->SetDebugFlags(flags);
|
||||
}
|
||||
|
||||
protected:
|
||||
QVector<HotKey> hotkeys;
|
||||
bool m_hotkeysAreEnabled;
|
||||
public:
|
||||
|
||||
bool HotKey_Import() override
|
||||
{
|
||||
QVector<QPair<QString, QString> > keys;
|
||||
QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
|
||||
QString(), "HotKey Config Files (*.hkxml)");
|
||||
QFile file(filepath);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
QXmlStreamReader stream(&file);
|
||||
bool result = true;
|
||||
|
||||
while (!stream.isEndDocument())
|
||||
{
|
||||
if (stream.isStartElement())
|
||||
{
|
||||
if (stream.name() == "HotKey")
|
||||
{
|
||||
QPair<QString, QString> key;
|
||||
QXmlStreamAttributes att = stream.attributes();
|
||||
for (QXmlStreamAttribute attr : att)
|
||||
{
|
||||
if (attr.name().compare(QLatin1String("path"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
key.first = attr.value().toString();
|
||||
}
|
||||
if (attr.name().compare(QLatin1String("sequence"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
key.second = attr.value().toString();
|
||||
}
|
||||
}
|
||||
if (!key.first.isEmpty())
|
||||
{
|
||||
keys.push_back(key); // we allow blank key sequences for unassigned shortcuts
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false; //but not blank paths!
|
||||
}
|
||||
}
|
||||
}
|
||||
stream.readNext();
|
||||
}
|
||||
file.close();
|
||||
|
||||
if (result)
|
||||
{
|
||||
HotKey_BuildDefaults();
|
||||
for (QPair<QString, QString> key : keys)
|
||||
{
|
||||
for (int j = 0; j < hotkeys.count(); j++)
|
||||
{
|
||||
if (hotkeys[j].path.compare(key.first, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
hotkeys[j].SetPath(key.first.toStdString().c_str());
|
||||
hotkeys[j].SetSequenceFromString(key.second.toStdString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void HotKey_Export() override
|
||||
{
|
||||
auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
|
||||
QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
|
||||
QFile file(filepath);
|
||||
if (!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QXmlStreamWriter stream(&file);
|
||||
stream.setAutoFormatting(true);
|
||||
stream.writeStartDocument();
|
||||
stream.writeStartElement("HotKeys");
|
||||
|
||||
for (HotKey key : hotkeys)
|
||||
{
|
||||
stream.writeStartElement("HotKey");
|
||||
stream.writeAttribute("path", key.path);
|
||||
stream.writeAttribute("sequence", key.sequence.toString());
|
||||
stream.writeEndElement();
|
||||
}
|
||||
stream.writeEndElement();
|
||||
stream.writeEndDocument();
|
||||
file.close();
|
||||
}
|
||||
|
||||
QKeySequence HotKey_GetShortcut(const char* path) override
|
||||
{
|
||||
for (HotKey combo : hotkeys)
|
||||
{
|
||||
if (combo.IsMatch(path))
|
||||
{
|
||||
return combo.sequence;
|
||||
}
|
||||
}
|
||||
return QKeySequence();
|
||||
}
|
||||
|
||||
bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
unsigned int keyInt = 0;
|
||||
//Capture any modifiers
|
||||
Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
|
||||
if (modifiers & Qt::ShiftModifier)
|
||||
{
|
||||
keyInt += Qt::SHIFT;
|
||||
}
|
||||
if (modifiers & Qt::ControlModifier)
|
||||
{
|
||||
keyInt += Qt::CTRL;
|
||||
}
|
||||
if (modifiers & Qt::AltModifier)
|
||||
{
|
||||
keyInt += Qt::ALT;
|
||||
}
|
||||
if (modifiers & Qt::MetaModifier)
|
||||
{
|
||||
keyInt += Qt::META;
|
||||
}
|
||||
//Capture any key
|
||||
keyInt += event->key();
|
||||
|
||||
QString t0 = QKeySequence(keyInt).toString();
|
||||
QString t1 = HotKey_GetShortcut(path).toString();
|
||||
|
||||
//if strings match then shortcut is pressed
|
||||
if (t1.compare(t0, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString t0 = event->key().toString();
|
||||
QString t1 = HotKey_GetShortcut(path).toString();
|
||||
|
||||
//if strings match then shortcut is pressed
|
||||
if (t1.compare(t0, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HotKey_LoadExisting() override
|
||||
{
|
||||
QSettings settings("O3DE", "O3DE");
|
||||
QString group = "Hotkeys/";
|
||||
|
||||
HotKey_BuildDefaults();
|
||||
|
||||
int size = settings.beginReadArray(group);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
settings.setArrayIndex(i);
|
||||
QPair<QString, QString> hotkey;
|
||||
hotkey.first = settings.value("name").toString();
|
||||
hotkey.second = settings.value("keySequence").toString();
|
||||
if (!hotkey.first.isEmpty())
|
||||
{
|
||||
for (int j = 0; j < hotkeys.count(); j++)
|
||||
{
|
||||
if (hotkeys[j].path.compare(hotkey.first, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
hotkeys[j].SetPath(hotkey.first.toStdString().c_str());
|
||||
hotkeys[j].SetSequenceFromString(hotkey.second.toStdString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
settings.endArray();
|
||||
if (hotkeys.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void HotKey_SaveCurrent() override
|
||||
{
|
||||
QSettings settings("O3DE", "O3DE");
|
||||
QString group = "Hotkeys/";
|
||||
settings.remove("Hotkeys/");
|
||||
settings.sync();
|
||||
settings.beginWriteArray(group);
|
||||
int saveIndex = 0;
|
||||
for (HotKey key : hotkeys)
|
||||
{
|
||||
if (!key.path.isEmpty())
|
||||
{
|
||||
settings.setArrayIndex(saveIndex++);
|
||||
settings.setValue("name", key.path);
|
||||
settings.setValue("keySequence", key.sequence.toString());
|
||||
}
|
||||
}
|
||||
settings.endArray();
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
void HotKey_BuildDefaults() override
|
||||
{
|
||||
m_hotkeysAreEnabled = true;
|
||||
QVector<QPair<QString, QString> > keys;
|
||||
while (hotkeys.count() > 0)
|
||||
{
|
||||
hotkeys.takeAt(0);
|
||||
}
|
||||
|
||||
//MENU SELECTION SHORTCUTS////////////////////////////////////////////////
|
||||
keys.push_back(QPair<QString, QString>("Menus.File Menu", "Alt+F"));
|
||||
keys.push_back(QPair<QString, QString>("Menus.Edit Menu", "Alt+E"));
|
||||
keys.push_back(QPair<QString, QString>("Menus.View Menu", "Alt+V"));
|
||||
//FILE MENU SHORTCUTS/////////////////////////////////////////////////////
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Create new emitter", "Ctrl+N"));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Create new library", "Ctrl+Shift+N"));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Create new folder", ""));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Import", "Ctrl+I"));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Import level library", "Ctrl+Shift+I"));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Save", "Ctrl+S"));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Close", "Ctrl+Q"));
|
||||
//EDIT MENU SHORTCUTS/////////////////////////////////////////////////////
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Copy", "Ctrl+C"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Paste", "Ctrl+V"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Duplicate", "Ctrl+D"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Undo", "Ctrl+Z"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Redo", "Ctrl+Shift+Z"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Group", "Ctrl+Alt+O"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Ungroup", "Ctrl+Alt+P"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Rename", "Ctrl+R"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Reset", ""));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Edit Hotkeys", ""));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Assign to selected", "Ctrl+Space"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Insert Comment", "Ctrl+Alt+M"));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Enable/Disable Emitter", "Ctrl+E"));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Enable All", ""));
|
||||
keys.push_back(QPair<QString, QString>("File Menu.Disable All", ""));
|
||||
keys.push_back(QPair<QString, QString>("Edit Menu.Delete", "Del"));
|
||||
//VIEW MENU SHORTCUTS/////////////////////////////////////////////////////
|
||||
keys.push_back(QPair<QString, QString>("View Menu.Reset Layout", ""));
|
||||
//PLAYBACK CONTROL////////////////////////////////////////////////////////
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Play/Pause Toggle", "Space"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Step forward through time", "c"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Loop Toggle", "z"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Reset Playback", "x"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Focus", "Ctrl+F"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Zoom In", "w"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Zoom Out", "s"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Pan Left", "a"));
|
||||
keys.push_back(QPair<QString, QString>("Previewer.Pan Right", "d"));
|
||||
|
||||
for (QPair<QString, QString> key : keys)
|
||||
{
|
||||
unsigned int index = hotkeys.count();
|
||||
hotkeys.push_back(HotKey());
|
||||
hotkeys[index].SetPath(key.first.toStdString().c_str());
|
||||
hotkeys[index].SetSequenceFromString(key.second.toStdString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void HotKey_SetKeys(QVector<HotKey> keys) override
|
||||
{
|
||||
hotkeys = keys;
|
||||
}
|
||||
|
||||
QVector<HotKey> HotKey_GetKeys() override
|
||||
{
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
for (HotKey key : hotkeys)
|
||||
{
|
||||
if (HotKey_IsPressed(event, key.path.toUtf8()))
|
||||
{
|
||||
return key.path;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
for (HotKey key : hotkeys)
|
||||
{
|
||||
if (HotKey_IsPressed(event, key.path.toUtf8()))
|
||||
{
|
||||
return key.path;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
//building the default hotkey list re-enables hotkeys
|
||||
//do not use this when rebuilding the default list is a possibility.
|
||||
void HotKey_SetEnabled(bool val) override
|
||||
{
|
||||
m_hotkeysAreEnabled = val;
|
||||
}
|
||||
|
||||
bool HotKey_IsEnabled() const override
|
||||
{
|
||||
return m_hotkeysAreEnabled;
|
||||
}
|
||||
|
||||
protected:
|
||||
QMap<QString, ToolTip> m_tooltips;
|
||||
|
||||
void ToolTip_ParseNode(XmlNodeRef node)
|
||||
{
|
||||
if (QString(node->getTag()).compare("tooltip", Qt::CaseInsensitive) != 0)
|
||||
{
|
||||
unsigned int childCount = node->getChildCount();
|
||||
|
||||
for (unsigned int i = 0; i < childCount; i++)
|
||||
{
|
||||
ToolTip_ParseNode(node->getChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
QString title = node->getAttr("title");
|
||||
QString content = node->getAttr("content");
|
||||
QString specialContent = node->getAttr("special_content");
|
||||
QString disabledContent = node->getAttr("disabled_content");
|
||||
|
||||
QMap<QString, ToolTip>::iterator itr = m_tooltips.insert(node->getAttr("path"), ToolTip());
|
||||
itr->isValid = true;
|
||||
itr->title = title;
|
||||
itr->content = content;
|
||||
itr->specialContent = specialContent;
|
||||
itr->disabledContent = disabledContent;
|
||||
|
||||
unsigned int childCount = node->getChildCount();
|
||||
|
||||
for (unsigned int i = 0; i < childCount; i++)
|
||||
{
|
||||
ToolTip_ParseNode(node->getChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip GetToolTip(QString path)
|
||||
{
|
||||
if (m_tooltips.contains(path))
|
||||
{
|
||||
return m_tooltips[path];
|
||||
}
|
||||
ToolTip temp;
|
||||
temp.isValid = false;
|
||||
return temp;
|
||||
}
|
||||
|
||||
public:
|
||||
void ToolTip_LoadConfigXML(QString filepath) override
|
||||
{
|
||||
XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
|
||||
ToolTip_ParseNode(node);
|
||||
}
|
||||
|
||||
void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override
|
||||
{
|
||||
AZ_Assert(tooltip, "tooltip cannot be null");
|
||||
|
||||
QString title = ToolTip_GetTitle(path, option);
|
||||
QString content = ToolTip_GetContent(path, option);
|
||||
QString specialContent = ToolTip_GetSpecialContentType(path, option);
|
||||
QString disabledContent = ToolTip_GetDisabledContent(path, option);
|
||||
|
||||
// Even if these items are empty, we set them anyway to clear out any data that was left over from when the tooltip was used for a different object.
|
||||
tooltip->SetTitle(title);
|
||||
tooltip->SetContent(content);
|
||||
|
||||
//this only handles simple creation...if you need complex call this then add specials separate
|
||||
if (!specialContent.contains("::"))
|
||||
{
|
||||
tooltip->AddSpecialContent(specialContent, optionalData);
|
||||
}
|
||||
|
||||
if (!isEnabled) // If disabled, add disabled value
|
||||
{
|
||||
tooltip->AppendContent(disabledContent);
|
||||
}
|
||||
}
|
||||
|
||||
QString ToolTip_GetTitle(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
return GetToolTip(path + "." + option).title;
|
||||
}
|
||||
if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
|
||||
{
|
||||
return GetToolTip("Options." + option).title;
|
||||
}
|
||||
return GetToolTip(path).title;
|
||||
}
|
||||
|
||||
QString ToolTip_GetContent(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
return GetToolTip(path + "." + option).content;
|
||||
}
|
||||
if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
|
||||
{
|
||||
return GetToolTip("Options." + option).content;
|
||||
}
|
||||
return GetToolTip(path).content;
|
||||
}
|
||||
|
||||
QString ToolTip_GetSpecialContentType(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
return GetToolTip(path + "." + option).specialContent;
|
||||
}
|
||||
if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
|
||||
{
|
||||
return GetToolTip("Options." + option).specialContent;
|
||||
}
|
||||
return GetToolTip(path).specialContent;
|
||||
}
|
||||
|
||||
QString ToolTip_GetDisabledContent(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
return GetToolTip(path + "." + option).disabledContent;
|
||||
}
|
||||
if (!option.isEmpty() && GetToolTip("Options." + option).isValid)
|
||||
{
|
||||
return GetToolTip("Options." + option).disabledContent;
|
||||
}
|
||||
return GetToolTip(path).disabledContent;
|
||||
}
|
||||
};
|
||||
|
||||
IEditorPanelUtils* CreateEditorPanelUtils()
|
||||
{
|
||||
return new CEditorPanelUtils_Impl();
|
||||
}
|
||||
|
||||
@@ -1,16 +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
|
||||
*
|
||||
*/
|
||||
// Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
#ifndef CRYINCLUDE_CRYEDITOR_EDITORPANELUTILS_H
|
||||
#define CRYINCLUDE_CRYEDITOR_EDITORPANELUTILS_H
|
||||
#pragma once
|
||||
|
||||
struct IEditorPanelUtils;
|
||||
IEditorPanelUtils* CreateEditorPanelUtils();
|
||||
|
||||
#endif
|
||||
@@ -1,587 +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 "TriMesh.h"
|
||||
|
||||
// Editor
|
||||
#include "Util/fastlib.h"
|
||||
#include "Objects/SubObjSelection.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh::CTriMesh()
|
||||
{
|
||||
pFaces = nullptr;
|
||||
pVertices = nullptr;
|
||||
pWSVertices = nullptr;
|
||||
pUV = nullptr;
|
||||
pColors = nullptr;
|
||||
pEdges = nullptr;
|
||||
pWeights = nullptr;
|
||||
|
||||
nFacesCount = 0;
|
||||
nVertCount = 0;
|
||||
nUVCount = 0;
|
||||
nEdgeCount = 0;
|
||||
|
||||
selectionType = SO_ELEM_NONE;
|
||||
|
||||
memset(m_streamSize, 0, sizeof(m_streamSize));
|
||||
memset(m_streamSel, 0, sizeof(m_streamSel));
|
||||
streamSelMask = 0;
|
||||
|
||||
m_streamSel[VERTICES] = &vertSel;
|
||||
m_streamSel[EDGES] = &edgeSel;
|
||||
m_streamSel[FACES] = &faceSel;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh::~CTriMesh()
|
||||
{
|
||||
free(pFaces);
|
||||
free(pEdges);
|
||||
free(pVertices);
|
||||
free(pUV);
|
||||
free(pColors);
|
||||
free(pWSVertices);
|
||||
free(pWeights);
|
||||
}
|
||||
|
||||
// Set stream size.
|
||||
void CTriMesh::ReallocStream(int stream, int nNewCount)
|
||||
{
|
||||
assert(stream >= 0 && stream < LAST_STREAM);
|
||||
if (stream < 0 || stream >= LAST_STREAM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_streamSize[stream] == nNewCount)
|
||||
{
|
||||
return; // Stream already have required size.
|
||||
}
|
||||
void* pStream = nullptr;
|
||||
int nElementSize = 0;
|
||||
GetStreamInfo(stream, pStream, nElementSize);
|
||||
pStream = ReAllocElements(pStream, nNewCount, nElementSize);
|
||||
m_streamSize[stream] = nNewCount;
|
||||
|
||||
switch (stream)
|
||||
{
|
||||
case VERTICES:
|
||||
pVertices = (CTriVertex*)pStream;
|
||||
nVertCount = nNewCount;
|
||||
vertSel.resize(nNewCount);
|
||||
break;
|
||||
case FACES:
|
||||
pFaces = (CTriFace*)pStream;
|
||||
nFacesCount = nNewCount;
|
||||
faceSel.resize(nNewCount);
|
||||
break;
|
||||
case EDGES:
|
||||
pEdges = (CTriEdge*)pStream;
|
||||
nEdgeCount = nNewCount;
|
||||
edgeSel.resize(nNewCount);
|
||||
break;
|
||||
case TEXCOORDS:
|
||||
pUV = (SMeshTexCoord*)pStream;
|
||||
nUVCount = nNewCount;
|
||||
break;
|
||||
case COLORS:
|
||||
pColors = (SMeshColor*)pStream;
|
||||
break;
|
||||
case WEIGHTS:
|
||||
pWeights = (float*)pStream;
|
||||
break;
|
||||
case LINES:
|
||||
pLines = (CTriLine*)pStream;
|
||||
break;
|
||||
case WS_POSITIONS:
|
||||
pWSVertices = (Vec3*)pStream;
|
||||
break;
|
||||
default:
|
||||
assert(0); // unknown stream.
|
||||
}
|
||||
m_streamSize[stream] = nNewCount;
|
||||
}
|
||||
|
||||
// Set stream size.
|
||||
void CTriMesh::GetStreamInfo(int stream, void*& pStream, int& nElementSize) const
|
||||
{
|
||||
assert(stream >= 0 && stream < LAST_STREAM);
|
||||
switch (stream)
|
||||
{
|
||||
case VERTICES:
|
||||
pStream = pVertices;
|
||||
nElementSize = sizeof(CTriVertex);
|
||||
break;
|
||||
case FACES:
|
||||
pStream = pFaces;
|
||||
nElementSize = sizeof(CTriFace);
|
||||
break;
|
||||
case EDGES:
|
||||
pStream = pEdges;
|
||||
nElementSize = sizeof(CTriEdge);
|
||||
break;
|
||||
case TEXCOORDS:
|
||||
pStream = pUV;
|
||||
nElementSize = sizeof(SMeshTexCoord);
|
||||
break;
|
||||
case COLORS:
|
||||
pStream = pColors;
|
||||
nElementSize = sizeof(SMeshColor);
|
||||
break;
|
||||
case WEIGHTS:
|
||||
pStream = pWeights;
|
||||
nElementSize = sizeof(float);
|
||||
break;
|
||||
case LINES:
|
||||
pStream = pLines;
|
||||
nElementSize = sizeof(CTriLine);
|
||||
break;
|
||||
case WS_POSITIONS:
|
||||
pStream = pWSVertices;
|
||||
nElementSize = sizeof(Vec3);
|
||||
break;
|
||||
default:
|
||||
assert(0); // unknown stream.
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void* CTriMesh::ReAllocElements(void* old_ptr, int new_elem_num, int size_of_element)
|
||||
{
|
||||
return realloc(old_ptr, new_elem_num * size_of_element);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
inline int FindVertexInHash(const Vec3& vPosToFind, const CTriVertex* pVectors, std::vector<int>& hash, float fEpsilon)
|
||||
{
|
||||
for (uint32 i = 0; i < hash.size(); i++)
|
||||
{
|
||||
const Vec3& v0 = pVectors[hash[i]].pos;
|
||||
const Vec3& v1 = vPosToFind;
|
||||
if (fabsf(v0.y - v1.y) < fEpsilon && fabsf(v0.x - v1.x) < fEpsilon && fabsf(v0.z - v1.z) < fEpsilon)
|
||||
{
|
||||
return hash[i];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
inline int FindTexCoordInHash(const SMeshTexCoord& coordToFind, const SMeshTexCoord* pCoords, std::vector<int>& hash, float fEpsilon)
|
||||
{
|
||||
for (uint32 i = 0; i < hash.size(); i++)
|
||||
{
|
||||
const SMeshTexCoord& t0 = pCoords[hash[i]];
|
||||
const SMeshTexCoord& t1 = coordToFind;
|
||||
|
||||
if (t0.IsEquivalent(t1, fEpsilon))
|
||||
{
|
||||
return hash[i];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::SharePositions()
|
||||
{
|
||||
float fEpsilon = 0.0001f;
|
||||
float fHashScale = 256.0f / MAX(bbox.GetSize().GetLength(), fEpsilon);
|
||||
std::vector<int> arrHashTable[256];
|
||||
|
||||
CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()];
|
||||
SMeshColor* pNewColors = nullptr;
|
||||
if (pColors)
|
||||
{
|
||||
pNewColors = new SMeshColor[GetVertexCount()];
|
||||
}
|
||||
|
||||
int nLastIndex = 0;
|
||||
for (int f = 0; f < GetFacesCount(); f++)
|
||||
{
|
||||
CTriFace& face = pFaces[f];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const Vec3& v = pVertices[face.v[i]].pos;
|
||||
uint8 nHash = static_cast<uint8>(RoundFloatToInt((v.x + v.y + v.z) * fHashScale));
|
||||
|
||||
int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon);
|
||||
if (find < 0)
|
||||
{
|
||||
pNewVerts[nLastIndex] = pVertices[face.v[i]];
|
||||
if (pColors)
|
||||
{
|
||||
pNewColors[nLastIndex] = pColors[face.v[i]];
|
||||
}
|
||||
face.v[i] = nLastIndex;
|
||||
// Reserve some space already.
|
||||
arrHashTable[nHash].reserve(100);
|
||||
arrHashTable[nHash].push_back(nLastIndex);
|
||||
nLastIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
face.v[i] = find;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetVertexCount(nLastIndex);
|
||||
memcpy(pVertices, pNewVerts, nLastIndex * sizeof(CTriVertex));
|
||||
delete []pNewVerts;
|
||||
|
||||
if (pColors)
|
||||
{
|
||||
SetColorsCount(nLastIndex);
|
||||
memcpy(pColors, pNewColors, nLastIndex * sizeof(SMeshColor));
|
||||
delete []pNewColors;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::ShareUV()
|
||||
{
|
||||
float fEpsilon = 0.0001f;
|
||||
float fHashScale = 256.0f;
|
||||
std::vector<int> arrHashTable[256];
|
||||
|
||||
SMeshTexCoord* pNewUV = new SMeshTexCoord[GetUVCount()];
|
||||
|
||||
int nLastIndex = 0;
|
||||
for (int f = 0; f < GetFacesCount(); f++)
|
||||
{
|
||||
CTriFace& face = pFaces[f];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const Vec2 uv = pUV[face.uv[i]].GetUV();
|
||||
uint8 nHash = static_cast<uint8>(RoundFloatToInt((uv.x + uv.y) * fHashScale));
|
||||
|
||||
int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon);
|
||||
if (find < 0)
|
||||
{
|
||||
pNewUV[nLastIndex] = pUV[face.uv[i]];
|
||||
face.uv[i] = nLastIndex;
|
||||
arrHashTable[nHash].reserve(100);
|
||||
arrHashTable[nHash].push_back(nLastIndex);
|
||||
nLastIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
face.uv[i] = find;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetUVCount(nLastIndex);
|
||||
memcpy(pUV, pNewUV, nLastIndex * sizeof(SMeshTexCoord));
|
||||
delete []pNewUV;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::CalcFaceNormals()
|
||||
{
|
||||
for (int i = 0; i < nFacesCount; i++)
|
||||
{
|
||||
CTriFace& face = pFaces[i];
|
||||
Vec3 p1 = pVertices[face.v[0]].pos;
|
||||
Vec3 p2 = pVertices[face.v[1]].pos;
|
||||
Vec3 p3 = pVertices[face.v[2]].pos;
|
||||
face.normal = (p2 - p1).Cross(p3 - p1);
|
||||
face.normal.Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
#define TEX_EPS 0.001f
|
||||
#define VER_EPS 0.001f
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
|
||||
{
|
||||
void* pTrgStream = nullptr;
|
||||
void* pSrcStream = nullptr;
|
||||
int nElemSize = 0;
|
||||
fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize);
|
||||
if (pSrcStream)
|
||||
{
|
||||
ReallocStream(stream, fromMesh.GetStreamSize(stream));
|
||||
GetStreamInfo(stream, pTrgStream, nElemSize);
|
||||
memcpy(pTrgStream, pSrcStream, nElemSize * fromMesh.GetStreamSize(stream));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::Copy(CTriMesh& fromMesh, int nCopyFlags)
|
||||
{
|
||||
streamSelMask = fromMesh.streamSelMask;
|
||||
|
||||
if (nCopyFlags & COPY_VERTICES)
|
||||
{
|
||||
CopyStream(fromMesh, VERTICES);
|
||||
}
|
||||
if (nCopyFlags & COPY_FACES)
|
||||
{
|
||||
CopyStream(fromMesh, FACES);
|
||||
}
|
||||
if (nCopyFlags & COPY_EDGES)
|
||||
{
|
||||
CopyStream(fromMesh, EDGES);
|
||||
}
|
||||
if (nCopyFlags & COPY_TEXCOORDS)
|
||||
{
|
||||
CopyStream(fromMesh, TEXCOORDS);
|
||||
}
|
||||
if (nCopyFlags & COPY_COLORS)
|
||||
{
|
||||
CopyStream(fromMesh, COLORS);
|
||||
}
|
||||
if (nCopyFlags & COPY_WEIGHTS)
|
||||
{
|
||||
CopyStream(fromMesh, WEIGHTS);
|
||||
}
|
||||
if (nCopyFlags & COPY_LINES)
|
||||
{
|
||||
CopyStream(fromMesh, LINES);
|
||||
}
|
||||
|
||||
if (nCopyFlags & COPY_VERT_SEL)
|
||||
{
|
||||
vertSel = fromMesh.vertSel;
|
||||
}
|
||||
if (nCopyFlags & COPY_EDGE_SEL)
|
||||
{
|
||||
edgeSel = fromMesh.edgeSel;
|
||||
}
|
||||
if (nCopyFlags & COPY_FACE_SEL)
|
||||
{
|
||||
faceSel = fromMesh.faceSel;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::UpdateEdges()
|
||||
{
|
||||
SetEdgeCount(GetFacesCount() * 3);
|
||||
|
||||
std::map<CTriEdge, int> edgemap;
|
||||
|
||||
int nEdges = 0;
|
||||
for (int i = 0; i < GetFacesCount(); i++)
|
||||
{
|
||||
CTriFace& face = pFaces[i];
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
int v0 = j;
|
||||
int v1 = (j != 2) ? j + 1 : 0;
|
||||
CTriEdge edge;
|
||||
edge.flags = 0;
|
||||
|
||||
// First vertex index must always be smaller.
|
||||
if (face.v[v0] < face.v[v1])
|
||||
{
|
||||
edge.v[0] = face.v[v0];
|
||||
edge.v[1] = face.v[v1];
|
||||
}
|
||||
else
|
||||
{
|
||||
edge.v[0] = face.v[v1];
|
||||
edge.v[1] = face.v[v0];
|
||||
}
|
||||
edge.face[0] = i;
|
||||
edge.face[1] = -1;
|
||||
int nedge = stl::find_in_map(edgemap, edge, -1);
|
||||
if (nedge >= 0)
|
||||
{
|
||||
// Assign this face as a second member of the edge.
|
||||
if (pEdges[nedge].face[1] < 0)
|
||||
{
|
||||
pEdges[nedge].face[1] = i;
|
||||
}
|
||||
|
||||
face.edge[j] = nedge;
|
||||
}
|
||||
else
|
||||
{
|
||||
edgemap[edge] = nEdges;
|
||||
pEdges[nEdges] = edge;
|
||||
face.edge[j] = nEdges;
|
||||
nEdges++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetEdgeCount(nEdges);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::SoftSelection(const SSubObjSelOptions& options)
|
||||
{
|
||||
int i;
|
||||
int nVerts = GetVertexCount();
|
||||
CTriVertex* pVerts = pVertices;
|
||||
|
||||
for (i = 0; i < nVerts; i++)
|
||||
{
|
||||
if (pWeights[i] == 1.0f)
|
||||
{
|
||||
const Vec3& vp = pVerts[i].pos;
|
||||
for (int j = 0; j < nVerts; j++)
|
||||
{
|
||||
if (pWeights[j] != 1.0f)
|
||||
{
|
||||
if (vp.IsEquivalent(pVerts[j].pos, options.fSoftSelFalloff))
|
||||
{
|
||||
float fDist = vp.GetDistance(pVerts[j].pos);
|
||||
if (fDist < options.fSoftSelFalloff)
|
||||
{
|
||||
float fWeight = 1.0f - (fDist / options.fSoftSelFalloff);
|
||||
if (fWeight > pWeights[j])
|
||||
{
|
||||
pWeights[j] = fWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CTriMesh::UpdateSelection()
|
||||
{
|
||||
bool bAnySelected = false;
|
||||
if (selectionType == SO_ELEM_VERTEX)
|
||||
{
|
||||
for (int i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
if (vertSel[i])
|
||||
{
|
||||
bAnySelected = true;
|
||||
pWeights[i] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selectionType == SO_ELEM_EDGE)
|
||||
{
|
||||
// Clear weights.
|
||||
for (int i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetEdgeCount(); i++)
|
||||
{
|
||||
if (edgeSel[i])
|
||||
{
|
||||
bAnySelected = true;
|
||||
CTriEdge& edge = pEdges[i];
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
pWeights[edge.v[j]] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (selectionType == SO_ELEM_FACE)
|
||||
{
|
||||
// Clear weights.
|
||||
for (int i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetFacesCount(); i++)
|
||||
{
|
||||
if (faceSel[i])
|
||||
{
|
||||
bAnySelected = true;
|
||||
CTriFace& face = pFaces[i];
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
pWeights[face.v[j]] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bAnySelected;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CTriMesh::ClearSelection()
|
||||
{
|
||||
bool bWasSelected = false;
|
||||
// Remove all selections.
|
||||
int i;
|
||||
for (i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
streamSelMask = 0;
|
||||
for (int ii = 0; ii < LAST_STREAM; ii++)
|
||||
{
|
||||
if (m_streamSel[ii] && !m_streamSel[ii]->is_zero())
|
||||
{
|
||||
bWasSelected = true;
|
||||
m_streamSel[ii]->clear();
|
||||
}
|
||||
}
|
||||
return bWasSelected;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outEdges)
|
||||
{
|
||||
// Brute force algorithm using binary search.
|
||||
// for every edge check if edge vertex is inside inVertices array.
|
||||
std::sort(inVertices.begin(), inVertices.end());
|
||||
for (int i = 0; i < GetEdgeCount(); i++)
|
||||
{
|
||||
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[0])) != inVertices.end())
|
||||
{
|
||||
outEdges.push_back(i);
|
||||
}
|
||||
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[1])) != inVertices.end())
|
||||
{
|
||||
outEdges.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outFaces)
|
||||
{
|
||||
// Brute force algorithm using binary search.
|
||||
// for every face check if face vertex is inside inVertices array.
|
||||
std::sort(inVertices.begin(), inVertices.end());
|
||||
for (int i = 0; i < GetFacesCount(); i++)
|
||||
{
|
||||
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[0])) != inVertices.end())
|
||||
{
|
||||
outFaces.push_back(i);
|
||||
}
|
||||
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[1])) != inVertices.end())
|
||||
{
|
||||
outFaces.push_back(i);
|
||||
}
|
||||
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[2])) != inVertices.end())
|
||||
{
|
||||
outFaces.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,238 +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_GEOMETRY_TRIMESH_H
|
||||
#define CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
|
||||
#pragma once
|
||||
|
||||
#include <IIndexedMesh.h>
|
||||
#include "Util/bitarray.h"
|
||||
|
||||
struct SSubObjSelOptions;
|
||||
|
||||
typedef std::vector<int> MeshElementsArray;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vertex used in the TriMesh.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriVertex
|
||||
{
|
||||
Vec3 pos;
|
||||
//float weight; // Selection weight in 0-1 range.
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Triangle face used by the Triangle mesh.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriFace
|
||||
{
|
||||
uint32 v[3]; // Indices to vertices array.
|
||||
uint32 uv[3]; // Indices to texture coordinates array.
|
||||
Vec3 n[3]; // Vertex normals at face vertices.
|
||||
Vec3 normal; // Face normal.
|
||||
uint32 edge[3]; // Indices to the face edges.
|
||||
unsigned char MatID; // Index of face sub material.
|
||||
unsigned char flags; // see ETriMeshFlags
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Mesh edge.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriEdge
|
||||
{
|
||||
uint32 v[2]; // Indices to edge vertices.
|
||||
int face[2]; // Indices to edge faces (-1 if no face).
|
||||
uint32 flags; // see ETriMeshFlags
|
||||
|
||||
CTriEdge() {}
|
||||
bool operator==(const CTriEdge& edge) const
|
||||
{
|
||||
if ((v[0] == edge.v[0] && v[1] == edge.v[1]) ||
|
||||
(v[0] == edge.v[1] && v[1] == edge.v[0]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool operator!=(const CTriEdge& edge) const { return !(*this == edge); }
|
||||
bool operator<(const CTriEdge& edge) const { return (*(uint64*)v < *(uint64*)edge.v); }
|
||||
bool operator>(const CTriEdge& edge) const { return (*(uint64*)v > *(uint64*)edge.v); }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Mesh line.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriLine
|
||||
{
|
||||
uint32 v[2]; // Indices to edge vertices.
|
||||
|
||||
CTriLine() {}
|
||||
bool operator==(const CTriLine& edge) const
|
||||
{
|
||||
if ((v[0] == edge.v[0] && v[1] == edge.v[1]) ||
|
||||
(v[0] == edge.v[1] && v[1] == edge.v[0]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool operator!=(const CTriLine& edge) const { return !(*this == edge); }
|
||||
bool operator<(const CTriLine& edge) const { return (*(uint64*)v < *(uint64*)edge.v); }
|
||||
bool operator>(const CTriLine& edge) const { return (*(uint64*)v > *(uint64*)edge.v); }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriMeshPoly
|
||||
{
|
||||
std::vector<uint32> v; // Indices to vertices array.
|
||||
std::vector<uint32> uv; // Indices to texture coordinates array.
|
||||
std::vector<Vec3> n; // Vertex normals at face vertices.
|
||||
Vec3 normal; // Polygon normal.
|
||||
uint32 edge[3]; // Indices to the face edges.
|
||||
unsigned char MatID; // Index of face sub material.
|
||||
unsigned char flags; // optional flags.
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CTriMesh is used in the Editor as a general purpose editable triangle mesh.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CTriMesh
|
||||
{
|
||||
public:
|
||||
enum EStream
|
||||
{
|
||||
VERTICES,
|
||||
FACES,
|
||||
EDGES,
|
||||
TEXCOORDS,
|
||||
COLORS,
|
||||
WEIGHTS,
|
||||
LINES,
|
||||
WS_POSITIONS,
|
||||
LAST_STREAM,
|
||||
};
|
||||
enum ECopyFlags
|
||||
{
|
||||
COPY_VERTICES = BIT(1),
|
||||
COPY_FACES = BIT(2),
|
||||
COPY_EDGES = BIT(3),
|
||||
COPY_TEXCOORDS = BIT(4),
|
||||
COPY_COLORS = BIT(5),
|
||||
COPY_VERT_SEL = BIT(6),
|
||||
COPY_EDGE_SEL = BIT(7),
|
||||
COPY_FACE_SEL = BIT(8),
|
||||
COPY_WEIGHTS = BIT(9),
|
||||
COPY_LINES = BIT(10),
|
||||
COPY_ALL = 0xFFFF,
|
||||
};
|
||||
// geometry data
|
||||
CTriFace* pFaces;
|
||||
CTriEdge* pEdges;
|
||||
CTriVertex* pVertices;
|
||||
SMeshTexCoord* pUV;
|
||||
SMeshColor* pColors; // If allocated same size as pVerts array.
|
||||
Vec3* pWSVertices; // World space vertices.
|
||||
float* pWeights;
|
||||
CTriLine* pLines;
|
||||
|
||||
int nFacesCount;
|
||||
int nVertCount;
|
||||
int nUVCount;
|
||||
int nEdgeCount;
|
||||
int nLinesCount;
|
||||
|
||||
AABB bbox;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Selections.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBitArray vertSel;
|
||||
CBitArray edgeSel;
|
||||
CBitArray faceSel;
|
||||
// Every bit of the selection mask correspond to a stream, if bit is set this stream have some elements selected
|
||||
int streamSelMask;
|
||||
|
||||
// Selection element type.
|
||||
// see ESubObjElementType
|
||||
int selectionType;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vertices of the front facing triangles.
|
||||
CBitArray frontFacingVerts;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Functions.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh();
|
||||
~CTriMesh();
|
||||
|
||||
int GetFacesCount() const { return nFacesCount; }
|
||||
int GetVertexCount() const { return nVertCount; }
|
||||
int GetUVCount() const { return nUVCount; }
|
||||
int GetEdgeCount() const { return nEdgeCount; }
|
||||
int GetLinesCount() const { return nLinesCount; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetFacesCount(int nNewCount) { ReallocStream(FACES, nNewCount); }
|
||||
void SetVertexCount(int nNewCount)
|
||||
{
|
||||
ReallocStream(VERTICES, nNewCount);
|
||||
if (pColors)
|
||||
{
|
||||
ReallocStream(COLORS, nNewCount);
|
||||
}
|
||||
ReallocStream(WEIGHTS, nNewCount);
|
||||
}
|
||||
void SetColorsCount(int nNewCount) { ReallocStream(COLORS, nNewCount); }
|
||||
void SetUVCount(int nNewCount) { ReallocStream(TEXCOORDS, nNewCount); }
|
||||
void SetEdgeCount(int nNewCount) { ReallocStream(EDGES, nNewCount); }
|
||||
void SetLinesCount(int nNewCount) { ReallocStream(LINES, nNewCount); }
|
||||
|
||||
void ReallocStream(int stream, int nNewCount);
|
||||
void GetStreamInfo(int stream, void*& pStream, int& nElementSize) const;
|
||||
int GetStreamSize(int stream) const { return m_streamSize[stream]; };
|
||||
|
||||
// Calculate per face normal.
|
||||
void CalcFaceNormals();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Welding functions.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SharePositions();
|
||||
void ShareUV();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Recreate edges of the mesh.
|
||||
void UpdateEdges();
|
||||
|
||||
void Copy(CTriMesh& fromMesh, int nCopyFlags = COPY_ALL);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Sub-object selection specific methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Return true if something is selected.
|
||||
bool UpdateSelection();
|
||||
// Clear all selections, return true if something was selected.
|
||||
bool ClearSelection();
|
||||
void SoftSelection(const SSubObjSelOptions& options);
|
||||
CBitArray* GetStreamSelection(int nStream) { return m_streamSel[nStream]; };
|
||||
// Returns true if specified stream have any selected elements.
|
||||
bool StreamHaveSelection(int nStream) { return streamSelMask & (1 << nStream); }
|
||||
void GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outEdges);
|
||||
void GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outFaces);
|
||||
|
||||
private:
|
||||
void* ReAllocElements(void* old_ptr, int new_elem_num, int size_of_element);
|
||||
void CopyStream(CTriMesh& fromMesh, int stream);
|
||||
|
||||
// For internal use.
|
||||
int m_streamSize[LAST_STREAM];
|
||||
CBitArray* m_streamSel[LAST_STREAM];
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
|
||||
@@ -69,7 +69,6 @@ class CSelectionTreeManager;
|
||||
struct SEditorSettings;
|
||||
class CGameExporter;
|
||||
class IAWSResourceManager;
|
||||
struct IEditorPanelUtils;
|
||||
|
||||
namespace WinWidget
|
||||
{
|
||||
@@ -526,8 +525,6 @@ struct IEditor
|
||||
virtual IEditorMaterialManager* GetIEditorMaterialManager() = 0; // Vladimir@Conffx
|
||||
//! Returns IconManager.
|
||||
virtual IIconManager* GetIconManager() = 0;
|
||||
//! Get Panel Editor Utilities
|
||||
virtual IEditorPanelUtils* GetEditorPanelUtils() = 0;
|
||||
//! Get Music Manager.
|
||||
virtual CMusicManager* GetMusicManager() = 0;
|
||||
virtual float GetTerrainElevation(float x, float y) = 0;
|
||||
|
||||
@@ -81,9 +81,6 @@ AZ_POP_DISABLE_WARNING
|
||||
// AWSNativeSDK
|
||||
#include <AWSNativeSDKInit/AWSNativeSDKInit.h>
|
||||
|
||||
#include "IEditorPanelUtils.h"
|
||||
#include "EditorPanelUtils.h"
|
||||
|
||||
#include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication
|
||||
|
||||
static CCryEditDoc * theDocument;
|
||||
@@ -143,7 +140,6 @@ CEditorImpl::CEditorImpl()
|
||||
, m_QtApplication(static_cast<Editor::EditorQtApplication*>(qApp))
|
||||
, m_pImageUtil(nullptr)
|
||||
, m_pLogFile(nullptr)
|
||||
, m_panelEditorUtils(nullptr)
|
||||
{
|
||||
// note that this is a call into EditorCore.dll, which stores the g_pEditorPointer for all shared modules that share EditorCore.dll
|
||||
// this means that they don't need to do SetIEditor(...) themselves and its available immediately
|
||||
@@ -167,8 +163,6 @@ CEditorImpl::CEditorImpl()
|
||||
m_pDisplaySettings->LoadRegistry();
|
||||
m_pPluginManager = new CPluginManager;
|
||||
|
||||
m_panelEditorUtils = CreateEditorPanelUtils();
|
||||
|
||||
m_pObjectManager = new CObjectManager;
|
||||
m_pViewManager = new CViewManager;
|
||||
m_pIconManager = new CIconManager;
|
||||
@@ -301,8 +295,6 @@ CEditorImpl::~CEditorImpl()
|
||||
SAFE_DELETE(m_pViewManager)
|
||||
SAFE_DELETE(m_pObjectManager) // relies on prefab manager
|
||||
|
||||
SAFE_DELETE(m_panelEditorUtils);
|
||||
|
||||
// some plugins may be exporter - this must be above plugin manager delete.
|
||||
SAFE_DELETE(m_pExportManager);
|
||||
|
||||
@@ -1658,8 +1650,3 @@ void CEditorImpl::DestroyQMimeData(QMimeData* data) const
|
||||
{
|
||||
delete data;
|
||||
}
|
||||
|
||||
IEditorPanelUtils* CEditorImpl::GetEditorPanelUtils()
|
||||
{
|
||||
return m_panelEditorUtils;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,6 @@ public:
|
||||
IEditorMaterialManager* GetIEditorMaterialManager() override; // Vladimir@Conffx
|
||||
IImageUtil* GetImageUtil() override; // Vladimir@conffx
|
||||
SEditorSettings* GetEditorSettings() override;
|
||||
IEditorPanelUtils* GetEditorPanelUtils() override;
|
||||
ILogFile* GetLogFile() override { return m_pLogFile; }
|
||||
|
||||
void UnloadPlugins() override;
|
||||
@@ -356,7 +355,6 @@ protected:
|
||||
CErrorsDlg* m_pErrorsDlg;
|
||||
//! Source control interface.
|
||||
ISourceControl* m_pSourceControl;
|
||||
IEditorPanelUtils* m_panelEditorUtils;
|
||||
|
||||
CSelectionTreeManager* m_pSelectionTreeManager;
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
#ifndef CRYINCLUDE_CRYEDITOR_IPANELEDITORUTILS_H
|
||||
#define CRYINCLUDE_CRYEDITOR_IPANELEDITORUTILS_H
|
||||
#pragma once
|
||||
|
||||
#include "Cry_Vector3.h"
|
||||
|
||||
#include "DisplaySettings.h"
|
||||
#include "Include/IDisplayViewport.h"
|
||||
#include "Include/IIconManager.h"
|
||||
#include <qstringlist.h>
|
||||
#include <qkeysequence.h>
|
||||
#include <qevent.h>
|
||||
#include <QShortcutEvent>
|
||||
|
||||
class CBaseObject;
|
||||
class CViewport;
|
||||
class IQToolTip;
|
||||
|
||||
struct HotKey
|
||||
{
|
||||
HotKey()
|
||||
: path("")
|
||||
, sequence(QKeySequence())
|
||||
{
|
||||
}
|
||||
void CopyFrom(const HotKey& other)
|
||||
{
|
||||
path = other.path;
|
||||
sequence = other.sequence;
|
||||
}
|
||||
void SetPath(const char* _path)
|
||||
{
|
||||
path = QString(_path);
|
||||
}
|
||||
void SetSequenceFromString(const char* _sequence)
|
||||
{
|
||||
sequence = QKeySequence::fromString(_sequence);
|
||||
}
|
||||
void SetSequence(const QKeySequence& other)
|
||||
{
|
||||
sequence = other;
|
||||
}
|
||||
bool IsMatch(QString _path)
|
||||
{
|
||||
return path.compare(_path, Qt::CaseInsensitive) == 0;
|
||||
}
|
||||
bool IsMatch(QKeySequence _sequence)
|
||||
{
|
||||
return sequence.matches(_sequence);
|
||||
}
|
||||
bool operator < (const HotKey& other) const
|
||||
{
|
||||
//split the paths into lists compare per level
|
||||
QStringList m_categories = path.split('.');
|
||||
QStringList o_categories = other.path.split('.');
|
||||
int m_catSize = m_categories.size();
|
||||
int o_catSize = o_categories.size();
|
||||
int size = (m_catSize < o_catSize) ? m_catSize : o_catSize;
|
||||
|
||||
//sort categories to keep them together
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (m_categories[i] < o_categories[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (m_categories[i] > o_categories[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//if comparing a category and a item in that category the category is < item
|
||||
return m_catSize > o_catSize;
|
||||
}
|
||||
QKeySequence sequence;
|
||||
QString path;
|
||||
};
|
||||
|
||||
struct IEditorPanelUtils
|
||||
{
|
||||
virtual ~IEditorPanelUtils() {}
|
||||
virtual void SetViewportDragOperation(void(*)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) = 0;
|
||||
|
||||
//PREVIEW WINDOW UTILS////////////////////////////////////////////////////
|
||||
virtual int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) = 0;
|
||||
virtual void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) = 0;
|
||||
|
||||
//HOTKEY UTILS////////////////////////////////////////////////////////////
|
||||
virtual bool HotKey_Import() = 0;
|
||||
virtual void HotKey_Export() = 0;
|
||||
virtual QKeySequence HotKey_GetShortcut(const char* path) = 0;
|
||||
virtual bool HotKey_IsPressed(const QKeyEvent* event, const char* path) = 0;
|
||||
virtual bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) = 0;
|
||||
virtual bool HotKey_LoadExisting() = 0;
|
||||
virtual void HotKey_SaveCurrent() = 0;
|
||||
virtual void HotKey_BuildDefaults() = 0;
|
||||
virtual void HotKey_SetKeys(QVector<HotKey> keys) = 0;
|
||||
virtual QVector<HotKey> HotKey_GetKeys() = 0;
|
||||
virtual QString HotKey_GetPressedHotkey(const QKeyEvent* event) = 0;
|
||||
virtual QString HotKey_GetPressedHotkey(const QShortcutEvent* event) = 0;
|
||||
virtual void HotKey_SetEnabled(bool val) = 0;
|
||||
virtual bool HotKey_IsEnabled() const = 0;
|
||||
|
||||
//TOOLTIP UTILS///////////////////////////////////////////////////////////
|
||||
|
||||
//! Loads a table of tooltip configuration data from an xml file.
|
||||
virtual void ToolTip_LoadConfigXML(QString filepath) = 0;
|
||||
|
||||
//! Initializes a QToolTipWidget from loaded configuration data (see ToolTip_LoadConfigXML())
|
||||
//! \param tooltip Will be initialized using loaded configuration data
|
||||
//! \param path Variable serialization path. Will be used as the key for looking up data in the configuration table. (ex: "Rotation.Rotation_Rate_X")
|
||||
//! \param option Name of a sub-option of the variable specified by "path". (ex: "Emitter_Strength" will look up the tooltip data for "Rotation.Rotation_Rate_X.Emitter_Strength")
|
||||
//! \param optionalData The argument to be used with "special_content" feature. See ToolTip_GetSpecialContentType() and QToolTipWidget::AddSpecialContent().
|
||||
//! \param isEnabled If false, the tooltip will indicate the reason why the widget is disabled.
|
||||
virtual void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) = 0;
|
||||
|
||||
virtual QString ToolTip_GetTitle(QString path, QString option = "") = 0;
|
||||
virtual QString ToolTip_GetContent(QString path, QString option = "") = 0;
|
||||
virtual QString ToolTip_GetSpecialContentType(QString path, QString option = "") = 0;
|
||||
virtual QString ToolTip_GetDisabledContent(QString path, QString option = "") = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,6 @@
|
||||
class CGizmo;
|
||||
class CBaseObject;
|
||||
struct IDisplayViewport;
|
||||
class CDeepSelection;
|
||||
struct AABB;
|
||||
|
||||
#include <QRect>
|
||||
@@ -105,8 +104,6 @@ struct HitContext
|
||||
CBaseObject* object;
|
||||
//! gizmo object that have been hit.
|
||||
CGizmo* gizmo;
|
||||
//! for deep selection mode
|
||||
CDeepSelection* pDeepSelection;
|
||||
//! For linking tool
|
||||
const char* name;
|
||||
//! true if this hit was from the object icon
|
||||
@@ -131,7 +128,6 @@ struct HitContext
|
||||
bIgnoreAxis = false;
|
||||
bOnlyGizmo = false;
|
||||
bUseSelectionHelpers = false;
|
||||
pDeepSelection = 0;
|
||||
name = nullptr;
|
||||
iconHit = false;
|
||||
}
|
||||
|
||||
@@ -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_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
#pragma once
|
||||
|
||||
struct IAnimationCompressionManager
|
||||
{
|
||||
virtual bool IsEnabled() const = 0;
|
||||
virtual void UpdateLocalAnimations() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
@@ -1,433 +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 : Standard interface for asset display in the asset browser,
|
||||
// this header should be used to create plugins.
|
||||
// The method Release of this interface should NOT be called.
|
||||
// Instead, the FreeData from the database (from IAssetItemDatabase) should
|
||||
// be used as it will safely release all the items from the database.
|
||||
// It is still possible to call the release method, but this is not the
|
||||
// recomended method, specially for usage outside of the plugins because there
|
||||
// is no guarantee that a the asset will be properly removed from the database
|
||||
// manager.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
#pragma once
|
||||
|
||||
struct IAssetItemDatabase;
|
||||
|
||||
namespace AssetViewer
|
||||
{
|
||||
// Used in GetAssetFieldValue for each asset type to check if field name is the right one
|
||||
inline bool IsFieldName(const char* pIncomingFieldName, const char* pFieldName)
|
||||
{
|
||||
return !strncmp(pIncomingFieldName, pFieldName, strlen(pIncomingFieldName));
|
||||
}
|
||||
}
|
||||
|
||||
// Description:
|
||||
// This interface allows the programmer to extend asset display types visible in the asset browser.
|
||||
struct IAssetItem
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x04F20346, 0x2EC3, 0x43f2, 0xBD, 0xA1, 0x2C, 0x0B, 0x97, 0x76, 0xF3, 0x84);
|
||||
|
||||
// The supported asset flags
|
||||
enum EAssetFlags
|
||||
{
|
||||
// asset is visible in the database for filtering and sorting (not asset view control related)
|
||||
eFlag_Visible = BIT(0),
|
||||
// the asset is loaded
|
||||
eFlag_Loaded = BIT(1),
|
||||
// the asset is loaded
|
||||
eFlag_Cached = BIT(2),
|
||||
// the asset is selected in a selection set
|
||||
eFlag_Selected = BIT(3),
|
||||
// this asset is invalid, no thumb is shown/available
|
||||
eFlag_Invalid = BIT(4),
|
||||
// this asset has some errors/warnings, in the asset browser it will show some blinking/red elements
|
||||
// and the user can check out the errors. Error text will be fetched using GetAssetFieldValue( "errors", &someStringVar )
|
||||
eFlag_HasErrors = BIT(5),
|
||||
// this flag is set when the asset is rendering its contents using GDI, and not the engine's rendering capabilities
|
||||
// (this flags is used as hint for the preview tool, which will use a double-buffer canvas if this flag is set,
|
||||
// and send a memory HDC to the OnBeginPreview method, for drawing of the asset)
|
||||
eFlag_UseGdiRendering = BIT(6),
|
||||
// set if this asset is draggable into the render viewports, and can be created there
|
||||
eFlag_CanBeDraggedInViewports = BIT(7),
|
||||
// set if this asset can be moved after creation, otherwise the asset instance will just be created where user clicked
|
||||
eFlag_CanBeMovedAfterDroppedIntoViewport = BIT(8),
|
||||
// the asset thumbnail image is loaded
|
||||
eFlag_ThumbnailLoaded = BIT(9),
|
||||
// the asset thumbnail image is loaded
|
||||
eFlag_UsedInLevel = BIT(10)
|
||||
};
|
||||
|
||||
// Asset field name and field values map
|
||||
typedef std::map < QString/*fieldName*/, QString/*value*/ > TAssetFieldValuesMap;
|
||||
// Dependency category names and corresponding files map, example: "Textures"=>{ "foam.dds","water.dds","normal.dds" }
|
||||
typedef std::map < QString/*dependencyCategory*/, std::set<QString>/*dependency filenames*/ > TAssetDependenciesMap;
|
||||
|
||||
virtual ~IAssetItem() {
|
||||
}
|
||||
|
||||
// Description:
|
||||
// Get the hash number/key used for database thumbnail and info records management
|
||||
virtual uint32 GetHash() const = 0;
|
||||
// Description:
|
||||
// Set the hash number/key used for database thumbnail and info records management
|
||||
virtual void SetHash(uint32 hash) = 0;
|
||||
// Description:
|
||||
// Get the owner database for this asset
|
||||
// Return Value:
|
||||
// The owner database for this asset
|
||||
// See Also:
|
||||
// SetOwnerDatabase()
|
||||
virtual IAssetItemDatabase* GetOwnerDatabase() const = 0;
|
||||
// Description:
|
||||
// Set the owner database for this asset
|
||||
// Arguments:
|
||||
// piOwnerDisplayDatabase - the owner database
|
||||
// See Also:
|
||||
// GetOwnerDatabase()
|
||||
virtual void SetOwnerDatabase(IAssetItemDatabase* pOwnerDisplayDatabase) = 0;
|
||||
// Description:
|
||||
// Get the asset's dependency files / objects
|
||||
// Return Value:
|
||||
// The vector with filenames which this asset is dependent upon, ex.: ["Textures"].(vector of textures)
|
||||
virtual const TAssetDependenciesMap& GetDependencies() const = 0;
|
||||
// Description:
|
||||
// Set the file size of this asset in bytes
|
||||
// Arguments:
|
||||
// aSize - size of the file in bytes
|
||||
// See Also:
|
||||
// GetFileSize()
|
||||
virtual void SetFileSize(quint64 aSize) = 0;
|
||||
// Description:
|
||||
// Get the file size of this asset in bytes
|
||||
// Return Value:
|
||||
// The file size of this asset in bytes
|
||||
// See Also:
|
||||
// SetFileSize()
|
||||
virtual quint64 GetFileSize() const = 0;
|
||||
// Description:
|
||||
// Set asset filename (extension included and no path)
|
||||
// Arguments:
|
||||
// pName - the asset filename (extension included and no path)
|
||||
// See Also:
|
||||
// GetFilename()
|
||||
virtual void SetFilename(const char* pName) = 0;
|
||||
// Description:
|
||||
// Get asset filename (extension included and no path)
|
||||
// Return Value:
|
||||
// The asset filename (extension included and no path)
|
||||
// See Also:
|
||||
// SetFilename()
|
||||
virtual QString GetFilename() const = 0;
|
||||
// Description:
|
||||
// Set the asset's relative path
|
||||
// Arguments:
|
||||
// pName - file's relative path
|
||||
// See Also:
|
||||
// GetRelativePath()
|
||||
virtual void SetRelativePath(const char* pName) = 0;
|
||||
// Description:
|
||||
// Get the asset's relative path
|
||||
// Return Value:
|
||||
// The asset's relative path
|
||||
// See Also:
|
||||
// SetRelativePath()
|
||||
virtual QString GetRelativePath() const = 0;
|
||||
// Description:
|
||||
// Set the file extension ( dot(s) must be included )
|
||||
// Arguments:
|
||||
// pExt - the file's extension
|
||||
// See Also:
|
||||
// GetFileExtension()
|
||||
virtual void SetFileExtension(const char* pExt) = 0;
|
||||
// Description:
|
||||
// Get the file extension ( dot(s) included )
|
||||
// Return Value:
|
||||
// The file extension ( dot(s) included )
|
||||
// See Also:
|
||||
// SetFileExtension()
|
||||
virtual QString GetFileExtension() const = 0;
|
||||
// Description:
|
||||
// Get the asset flags, with values from IAssetItem::EAssetFlags
|
||||
// Return Value:
|
||||
// The asset flags, with values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// SetFlags(), SetFlag(), IsFlagSet()
|
||||
virtual UINT GetFlags() const = 0;
|
||||
// Description:
|
||||
// Set the asset flags
|
||||
// Arguments:
|
||||
// aFlags - flags, OR-ed values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// GetFlags(), SetFlag(), IsFlagSet()
|
||||
virtual void SetFlags(UINT aFlags) = 0;
|
||||
// Description:
|
||||
// Set/clear a single flag bit for the asset
|
||||
// Arguments:
|
||||
// aFlag - the flag to set/clear, with values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// GetFlags(), SetFlags(), IsFlagSet()
|
||||
virtual void SetFlag(EAssetFlags aFlag, bool bSet = true) = 0;
|
||||
// Description:
|
||||
// Check if a specified flag is set
|
||||
// Arguments:
|
||||
// aFlag - the flag to check, with values from IAssetItem::EAssetFlags
|
||||
// Return Value:
|
||||
// True if the flag is set
|
||||
// See Also:
|
||||
// GetFlags(), SetFlags(), SetFlag()
|
||||
virtual bool IsFlagSet(EAssetFlags aFlag) const = 0;
|
||||
// Description:
|
||||
// Set this asset's index; used in sorting, selections, and to know where an asset is in the current list
|
||||
// Arguments:
|
||||
// aIndex - the asset's index
|
||||
// See Also:
|
||||
// GetIndex()
|
||||
virtual void SetIndex(UINT aIndex) = 0;
|
||||
// Description:
|
||||
// Get the asset's index in the current list
|
||||
// Return Value:
|
||||
// The asset's index in the current list
|
||||
// See Also:
|
||||
// SetIndex()
|
||||
virtual UINT GetIndex() const = 0;
|
||||
// Description:
|
||||
// Get the asset's field raw data value into a user location, you must check the field's type ( from asset item's owner database )
|
||||
// before using this function and send the correct pointer to destination according to the type ( int8, float32, string, etc. )
|
||||
// Arguments:
|
||||
// pFieldName - the asset field name to query the value for
|
||||
// pDest - the destination variable address, must be the same type as the field type
|
||||
// Return Value:
|
||||
// True if the asset field name is found and the value is returned correctly
|
||||
// See Also:
|
||||
// SetAssetFieldValue()
|
||||
virtual QVariant GetAssetFieldValue(const char* pFieldName) const = 0;
|
||||
// Description:
|
||||
// Set the asset's field raw data value from a user location, you must check the field's type ( from asset item's owner database )
|
||||
// before using this function and send the correct pointer to source according to the type ( int8, float32, string, etc. )
|
||||
// Arguments:
|
||||
// pFieldName - the asset field name to set the value for
|
||||
// pSrc - the source variable address, must be the same type as the field type
|
||||
// Return Value:
|
||||
// True if the asset field name is found and the value is set correctly
|
||||
// See Also:
|
||||
// GetAssetFieldValue()
|
||||
virtual bool SetAssetFieldValue(const char* pFieldName, void* pSrc) = 0;
|
||||
// Description:
|
||||
// Get the drawing rectangle for the asset's thumb ( absolute viewer canvas location )
|
||||
// Arguments:
|
||||
// rstDrawingRectangle - destination location to set with the asset's thumbnail rectangle location
|
||||
// See Also:
|
||||
// SetDrawingRectangle()
|
||||
virtual void GetDrawingRectangle(QRect& rstDrawingRectangle) const = 0;
|
||||
// Description:
|
||||
// Set the drawing rectangle for the asset's thumb ( absolute viewer canvas location )
|
||||
// Arguments:
|
||||
// crstDrawingRectangle - source to set the asset's thumbnail rectangle
|
||||
// See Also:
|
||||
// GetDrawingRectangle()
|
||||
virtual void SetDrawingRectangle(const QRect& crstDrawingRectangle) = 0;
|
||||
// Description:
|
||||
// Checks if the given 2D point is inside the asset's thumb rectangle
|
||||
// Arguments:
|
||||
// nX - mouse pointer position on X axis, relative to the asset viewer control
|
||||
// nY - mouse pointer position on Y axis, relative to the asset viewer control
|
||||
// Return Value:
|
||||
// True if the given 2D point is inside the asset's thumb rectangle
|
||||
// See Also:
|
||||
// HitTest(CRect)
|
||||
virtual bool HitTest(int nX, int nY) const = 0;
|
||||
// Description:
|
||||
// Checks if the given rectangle intersects the asset thumb's rectangle
|
||||
// Arguments:
|
||||
// nX - mouse pointer position on X axis, relative to the asset viewer control
|
||||
// nY - mouse pointer position on Y axis, relative to the asset viewer control
|
||||
// Return Value:
|
||||
// True if the given rectangle intersects the asset thumb's rectangle
|
||||
// See Also:
|
||||
// HitTest(int nX,int nY)
|
||||
virtual bool HitTest(const QRect& roTestRect) const = 0;
|
||||
// Description:
|
||||
// When user drags this asset item into a viewport, this method is called when the dragging operation ends
|
||||
// and the mouse button is released, for the asset to return an instance of the asset object to be placed in the level
|
||||
// Arguments:
|
||||
// aX - instance's X position component in world coordinates
|
||||
// aY - instance's Y position component in world coordinates
|
||||
// aZ - instance's Z position component in world coordinates
|
||||
// Return Value:
|
||||
// The newly created asset instance (Example: BrushObject*)
|
||||
// See Also:
|
||||
// MoveInstanceInViewport()
|
||||
virtual void* CreateInstanceInViewport(float aX, float aY, float aZ) = 0;
|
||||
// Description:
|
||||
// When the mouse button is released after level object creation, the user now can move the mouse
|
||||
// and move the asset instance in the 3D world
|
||||
// Arguments:
|
||||
// pDraggedObject - the actual entity or brush object (CBaseObject* usually) to be moved around with the mouse
|
||||
// returned by the CreateInstanceInViewport()
|
||||
// aNewX - the new X world coordinates of the asset instance
|
||||
// aNewY - the new Y world coordinates of the asset instance
|
||||
// aNewZ - the new Z world coordinates of the asset instance
|
||||
// Return Value:
|
||||
// True if asset instance was moved properly
|
||||
// See Also:
|
||||
// CreateInstanceInViewport()
|
||||
virtual bool MoveInstanceInViewport(const void* pDraggedObject, float aNewX, float aNewY, float aNewZ) = 0;
|
||||
// Description:
|
||||
// This will be called when the user presses ESCAPE key when dragging the asset in the viewport, you must delete the given object
|
||||
// because the creation was aborted
|
||||
// Arguments:
|
||||
// pDraggedObject - the asset instance to be deleted ( you must cast to the needed type, and delete it properly )
|
||||
// See Also:
|
||||
// CreateInstanceInViewport()
|
||||
virtual void AbortCreateInstanceInViewport(const void* pDraggedObject) = 0;
|
||||
// Description:
|
||||
// This method is used to cache/load asset's data, so it can be previewed/rendered
|
||||
// Return Value:
|
||||
// True if the asset was successfully cached
|
||||
// See Also:
|
||||
// UnCache()
|
||||
virtual bool Cache() = 0;
|
||||
// Description:
|
||||
// This method is used to force cache/load asset's data, so it can be previewed/rendered
|
||||
// Return Value:
|
||||
// True if the asset was successfully forced cached
|
||||
// See Also:
|
||||
// UnCache(), Cache()
|
||||
virtual bool ForceCache() = 0;
|
||||
// Description:
|
||||
// This method is used to load the thumbnail image of the asset
|
||||
// Return Value:
|
||||
// True if thumb loaded ok
|
||||
// See Also:
|
||||
// UnloadThumbnail()
|
||||
virtual bool LoadThumbnail() = 0;
|
||||
// Description:
|
||||
// This method is used to unload the thumbnail image of the asset
|
||||
// See Also:
|
||||
// LoadThumbnail()
|
||||
virtual void UnloadThumbnail() = 0;
|
||||
// Description:
|
||||
// This is called when the asset starts to be previewed in full detail, so here you can load the whole asset, in fine detail
|
||||
// ( textures are fully loaded, models etc. ). It is called once, when the Preview dialog is shown
|
||||
// Arguments:
|
||||
// hPreviewWnd - the window handle of the quick preview dialog
|
||||
// hMemDC - the memory DC used to render assets that can render themselves in the DC, otherwise they will render in the dialog's HWND
|
||||
// See Also:
|
||||
// OnEndPreview(), GetCustomPreviewPanelHeader()
|
||||
virtual void OnBeginPreview(QWidget* hPreviewWnd) = 0;
|
||||
// Description:
|
||||
// Called when the Preview dialog is closed, you may release the detail asset data here
|
||||
// See Also:
|
||||
// OnBeginPreview(), GetCustomPreviewPanelHeader()
|
||||
virtual void OnEndPreview() = 0;
|
||||
// Description:
|
||||
// If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window
|
||||
// otherwise it can return nullptr, if no panel is available
|
||||
// Arguments:
|
||||
// pParentWnd - a valid CDialog*, or nullptr
|
||||
// Return Value:
|
||||
// A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window,
|
||||
// otherwise it can return nullptr, if no panel is available
|
||||
// See Also:
|
||||
// OnBeginPreview(), OnEndPreview()
|
||||
virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0;
|
||||
virtual QWidget* GetCustomPreviewPanelFooter(QWidget* pParentWnd) = 0;
|
||||
// Description:
|
||||
// Used when dragging/rotate/zoom a model, or other asset that can support preview
|
||||
// Arguments:
|
||||
// hRenderWindow - the rendering window handle
|
||||
// rstViewport - the viewport rectangle
|
||||
// aMouseX - the render window relative mouse pointer X coordinate
|
||||
// aMouseY - the render window relative mouse pointer Y coordinate
|
||||
// aMouseDeltaX - the X coordinate delta between two mouse movements
|
||||
// aMouseDeltaY - the Y coordinate delta between two mouse movements
|
||||
// aMouseWheelDelta - the mouse wheel scroll delta/step
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONUP
|
||||
// See Also:
|
||||
// OnPreviewRenderKeyEvent()
|
||||
virtual void PreviewRender(
|
||||
QWidget* hRenderWindow,
|
||||
const QRect& rstViewport,
|
||||
int aMouseX = 0, int aMouseY = 0,
|
||||
int aMouseDeltaX = 0, int aMouseDeltaY = 0,
|
||||
int aMouseWheelDelta = 0, UINT aKeyFlags = 0) = 0;
|
||||
// Description:
|
||||
// This is called when the user manipulates the assets in interactive render and a key is pressed ( with down or up state )
|
||||
// Arguments:
|
||||
// bKeyDown - true if this is a WM_KEYDOWN event, else it is a WM_KEYUP event
|
||||
// aChar - the char/key code pressed/released
|
||||
// aKeyFlags - the key flags, compatible with WM_KEYDOWN/UP events
|
||||
// See Also:
|
||||
// InteractiveRender()
|
||||
virtual void OnPreviewRenderKeyEvent(bool bKeyDown, UINT aChar, UINT aKeyFlags) = 0;
|
||||
// Description:
|
||||
// Called when user clicked once on the thumb image
|
||||
// Arguments:
|
||||
// point - mouse coordinates relative to the thumbnail rectangle
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONDOWN
|
||||
// See Also:
|
||||
// OnThumbDblClick()
|
||||
virtual void OnThumbClick(const QPoint& point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) = 0;
|
||||
// Description:
|
||||
// Called when user double clicked on the thumb image
|
||||
// Arguments:
|
||||
// point - mouse coordinates relative to the thumbnail rectangle
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONDOWN
|
||||
// See Also:
|
||||
// OnThumbClick()
|
||||
//! called when user clicked twice on the thumb image
|
||||
virtual void OnThumbDblClick(const QPoint& point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) = 0;
|
||||
// Description:
|
||||
// Draw the cached thumb bitmap only, if any, no other kind of rendering
|
||||
// Arguments:
|
||||
// hDC - the destination DC, where to draw the thumb
|
||||
// rRect - the destination rectangle
|
||||
// Return Value:
|
||||
// True if drawing of the thumbnail was done OK
|
||||
// See Also:
|
||||
// Render()
|
||||
virtual bool DrawThumbImage(QPainter* painter, const QRect& rRect) = 0;
|
||||
// Description:
|
||||
// Writes asset info to a XML node.
|
||||
// This is needed to save cached info as a persistent XML file for the next run of the editor.
|
||||
// Arguments:
|
||||
// node - An XML node to contain the info
|
||||
// See Also:
|
||||
// FromXML()
|
||||
virtual void ToXML(XmlNodeRef& node) const = 0;
|
||||
// Description:
|
||||
// Gets asset info from a XML node.
|
||||
// This is needed to get the asset info from previous runs of the editor without re-caching it.
|
||||
// Arguments:
|
||||
// node - An XML node that contains info for this asset
|
||||
// See Also:
|
||||
// ToXML()
|
||||
virtual void FromXML(const XmlNodeRef& node) = 0;
|
||||
|
||||
// From IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] const IID& riid, [[maybe_unused]] void** ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
@@ -1,259 +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 : Standard interface for asset database creators used to
|
||||
// create an asset plugin for the asset browser
|
||||
// The category of the plugin must be Asset Item DB
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
#pragma once
|
||||
struct IAssetItem;
|
||||
struct IAssetViewer;
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
// Description:
|
||||
// This struct keeps the info, filter and sorting settings for an asset field
|
||||
struct SAssetField
|
||||
{
|
||||
// the condition for the current filter on the field
|
||||
enum EAssetFilterCondition
|
||||
{
|
||||
eCondition_Any = 0,
|
||||
// string conditions
|
||||
// this also supports '*' and '?' as wildcards inside text
|
||||
eCondition_Contains,
|
||||
// this filter will search the target for at least one of the words specified
|
||||
// ( ex: filter: "water car moon" , field value : "the_great_moon.dds", this will pass the test
|
||||
// it also supports '*' and '?' as wildcards inside words text
|
||||
eCondition_ContainsOneOfTheWords,
|
||||
eCondition_StartsWith,
|
||||
eCondition_EndsWith,
|
||||
// string & numerical conditions
|
||||
eCondition_Equal,
|
||||
eCondition_Greater,
|
||||
eCondition_Less,
|
||||
eCondition_GreaterOrEqual,
|
||||
eCondition_LessOrEqual,
|
||||
eCondition_Not,
|
||||
eCondition_InsideRange
|
||||
};
|
||||
|
||||
// the asset field type
|
||||
enum EAssetFieldType
|
||||
{
|
||||
eType_None = 0,
|
||||
eType_Bool,
|
||||
eType_Int8,
|
||||
eType_Int16,
|
||||
eType_Int32,
|
||||
eType_Int64,
|
||||
eType_Float,
|
||||
eType_Double,
|
||||
eType_String
|
||||
};
|
||||
|
||||
// used when a field can have different specific values
|
||||
typedef QStringList TFieldEnumValues;
|
||||
|
||||
SAssetField(
|
||||
const char* pFieldName = "",
|
||||
const char* pDisplayName = "Unnamed field",
|
||||
EAssetFieldType aFieldType = eType_None,
|
||||
UINT aColumnWidth = 50,
|
||||
bool bVisibleInUI = true,
|
||||
bool bReadOnly = true)
|
||||
{
|
||||
m_fieldName = pFieldName;
|
||||
m_displayName = pDisplayName;
|
||||
m_fieldType = aFieldType;
|
||||
m_filterCondition = eCondition_Equal;
|
||||
m_bUseEnumValues = false;
|
||||
m_bReadOnly = bReadOnly;
|
||||
m_listColumnWidth = aColumnWidth;
|
||||
m_bFieldVisibleInUI = bVisibleInUI;
|
||||
m_bPostFilter = false;
|
||||
|
||||
SetupEnumValues();
|
||||
}
|
||||
|
||||
void SetupEnumValues()
|
||||
{
|
||||
m_bUseEnumValues = true;
|
||||
|
||||
if (m_fieldType == eType_Bool)
|
||||
{
|
||||
m_enumValues.clear();
|
||||
m_enumValues.push_back("Yes");
|
||||
m_enumValues.push_back("No");
|
||||
}
|
||||
}
|
||||
|
||||
// the field's display name, used in UI
|
||||
QString m_displayName,
|
||||
// the field internal name, used in C++ code
|
||||
m_fieldName,
|
||||
// the current filter value, if its empty "" then no filter is applied
|
||||
m_filterValue,
|
||||
// the field's max value, valid when the field's filter condition is eAssertFilterCondition_InsideRange
|
||||
m_maxFilterValue,
|
||||
// the name of the database holding this field, used in Asset Browser preset editor, if its "" then the field
|
||||
// is common to all current databases
|
||||
m_parentDatabaseName;
|
||||
// is this field visible in the UI ?
|
||||
bool m_bFieldVisibleInUI,
|
||||
// if true, then you cannot modify this field of an asset item, only use it
|
||||
m_bReadOnly,
|
||||
// this field filter is applied after the other filters
|
||||
m_bPostFilter;
|
||||
// the field data type
|
||||
EAssetFieldType m_fieldType;
|
||||
// the filter's condition
|
||||
EAssetFilterCondition m_filterCondition;
|
||||
// use the enum list values to choose a value for the field ?
|
||||
bool m_bUseEnumValues;
|
||||
// this map is used when asset field has m_bUseEnumValues on true,
|
||||
// choose a value for the field from this list in the UI
|
||||
TFieldEnumValues m_enumValues;
|
||||
// recommended list column width
|
||||
unsigned int m_listColumnWidth;
|
||||
};
|
||||
|
||||
struct SFieldFiltersPreset
|
||||
{
|
||||
QString presetName2;
|
||||
QStringList checkedDatabaseNames;
|
||||
bool bUsedInLevel;
|
||||
std::vector<SAssetField> fields;
|
||||
};
|
||||
|
||||
// Description:
|
||||
// This interface allows the programmer to extend asset display types
|
||||
// visible in the asset browser.
|
||||
struct IAssetItemDatabase
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0xFB09B039, 0x1D9D, 0x4057, 0xA5, 0xF0, 0xAA, 0x3C, 0x7B, 0x97, 0xAE, 0xA8)
|
||||
|
||||
typedef std::vector<SAssetField> TAssetFields;
|
||||
typedef std::map < QString/*field name*/, SAssetField > TAssetFieldFiltersMap;
|
||||
typedef std::map < QString/*asset filename*/, IAssetItem* > TFilenameAssetMap;
|
||||
typedef AZStd::function<bool(const IAssetItem*)> MetaDataChangeListener;
|
||||
|
||||
// Description:
|
||||
// Refresh the database by scanning the folders/paks for files, does not load the files, only filename and filesize are fetched
|
||||
virtual void Refresh() = 0;
|
||||
// Description:
|
||||
// Fills the asset meta data from the loaded xml meta data DB.
|
||||
// Arguments:
|
||||
// db - the database XML node from where to cache the info
|
||||
virtual void PrecacheFieldsInfoFromFileDB(const XmlNodeRef& db) = 0;
|
||||
// Description:
|
||||
// Return all assets loaded/scanned by this database
|
||||
// Return Value:
|
||||
// The assets map reference (filename-asset)
|
||||
virtual TFilenameAssetMap& GetAssets() = 0;
|
||||
// Description:
|
||||
// Get an asset item by its filename
|
||||
// Return Value:
|
||||
// A single asset from the database given the filename
|
||||
virtual IAssetItem* GetAsset(const char* pAssetFilename) = 0;
|
||||
// Description:
|
||||
// Return the asset fields this database's items support
|
||||
// Return Value:
|
||||
// The asset fields vector reference
|
||||
virtual TAssetFields& GetAssetFields() = 0;
|
||||
// Description:
|
||||
// Return an asset field object pointer by the field internal name
|
||||
// Arguments:
|
||||
// pFieldName - the internal field's name (ex: "filename", "relativepath")
|
||||
// Return Value:
|
||||
// The asset field object pointer
|
||||
virtual SAssetField* GetAssetFieldByName(const char* pFieldName) = 0;
|
||||
// Description:
|
||||
// Get the database name
|
||||
// Return Value:
|
||||
// Returns the database name, ex: "Textures"
|
||||
virtual const char* GetDatabaseName() const = 0;
|
||||
// Description:
|
||||
// Get the database supported file name extension(s)
|
||||
// Return Value:
|
||||
// Returns the supported extensions, separated by comma, ex: "tga,bmp,dds"
|
||||
virtual const char* GetSupportedExtensions() const = 0;
|
||||
// Description:
|
||||
// Free the database internal data structures
|
||||
virtual void FreeData() = 0;
|
||||
// Description:
|
||||
// Apply filters to this database which will set/unset the IAssetItem::eAssetFlag_Visible of each asset, based
|
||||
// on the given field filters
|
||||
// Arguments:
|
||||
// rFieldFilters - a reference to the field filters map (fieldname-field)
|
||||
// See Also:
|
||||
// ClearFilters()
|
||||
virtual void ApplyFilters(const TAssetFieldFiltersMap& rFieldFilters) = 0;
|
||||
// Description:
|
||||
// Clear the current filters, by setting the IAssetItem::eAssetFlag_Visible of each asset to true
|
||||
// See Also:
|
||||
// ApplyFilters()
|
||||
virtual void ClearFilters() = 0;
|
||||
virtual QWidget* CreateDbFilterDialog(QWidget* pParent, IAssetViewer* pViewerCtrl) = 0;
|
||||
virtual void UpdateDbFilterDialogUI(QWidget* pDlg) = 0;
|
||||
virtual void OnAssetBrowserOpen() = 0;
|
||||
virtual void OnAssetBrowserClose() = 0;
|
||||
// Description:
|
||||
// Gets the filename for saving new cached asset info.
|
||||
// Return Value:
|
||||
// A file name to save new transactions to the persistent asset info DB
|
||||
// See Also:
|
||||
// CAssetInfoFileDB, IAssetItem::ToXML(), IAssetItem::FromXML()
|
||||
virtual const char* GetTransactionFilename() const = 0;
|
||||
// Description:
|
||||
// Adds a callback to be called when the meta data of this asset changed.
|
||||
// Arguments:
|
||||
// callBack - A functor to be added
|
||||
// Return Value:
|
||||
// True if successful, false otherwise.
|
||||
// See Also:
|
||||
// RemoveMetaDataChangeListener()
|
||||
virtual bool AddMetaDataChangeListener(MetaDataChangeListener callBack) = 0;
|
||||
// Description:
|
||||
// Removes a callback from the list of meta data change listeners.
|
||||
// Arguments:
|
||||
// callBack - A functor to be removed
|
||||
// Return Value:
|
||||
// True if successful, false otherwise.
|
||||
// See Also:
|
||||
// AddMetaDataCHangeListener()
|
||||
virtual bool RemoveMetaDataChangeListener(MetaDataChangeListener callBack) = 0;
|
||||
// Description:
|
||||
// The method that should be called when the meta data of an asset item changes to notify all listeners
|
||||
// Arguments:
|
||||
// pAssetItem - An asset item whose meta data have changed
|
||||
// See Also:
|
||||
// AddMetaDataCHangeListener(), RemoveMetaDataChangeListener()
|
||||
virtual void OnMetaDataChange(const IAssetItem* pAssetItem) = 0;
|
||||
|
||||
//! from IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] REFIID riid, [[maybe_unused]] void** ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
@@ -1,46 +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 : This file declares a control which objective is to display
|
||||
// multiple assets allowing selection and preview of such things
|
||||
// It also handles scrolling and changes in the thumbnail display size
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
#pragma once
|
||||
#include "IObservable.h"
|
||||
#include "IAssetItemDatabase.h"
|
||||
|
||||
struct IAssetItem;
|
||||
struct IAssetItemDatabase;
|
||||
|
||||
// Description:
|
||||
// Observer for the asset viewer events
|
||||
struct IAssetViewerObserver
|
||||
{
|
||||
virtual void OnChangeStatusBarInfo(UINT nSelectedItems, UINT nVisibleItems, UINT nTotalItems) {};
|
||||
virtual void OnSelectionChanged() {};
|
||||
virtual void OnChangedPreviewedAsset(IAssetItem* pAsset) {};
|
||||
virtual void OnAssetDblClick(IAssetItem* pAsset) {};
|
||||
virtual void OnAssetFilterChanged() {};
|
||||
};
|
||||
|
||||
// Description:
|
||||
// The asset viewer interface for the asset database plugins to use
|
||||
struct IAssetViewer
|
||||
{
|
||||
DEFINE_OBSERVABLE_PURE_METHODS(IAssetViewerObserver);
|
||||
|
||||
virtual HWND GetRenderWindow() = 0;
|
||||
virtual void ApplyFilters(const IAssetItemDatabase::TAssetFieldFiltersMap& rFieldFilters) = 0;
|
||||
virtual const IAssetItemDatabase::TAssetFieldFiltersMap& GetCurrentFilters() = 0;
|
||||
virtual void ClearFilters() = 0;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
@@ -116,9 +116,6 @@ struct IFileUtil
|
||||
virtual bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) = 0;
|
||||
virtual void EditTextureFile(const char* txtureFile, bool bUseGameFolder) = 0;
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
virtual bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename) = 0;
|
||||
|
||||
//! Reformat filter string for (MFC) CFileDialog style file filtering
|
||||
virtual void FormatFilterString(QString& filter) = 0;
|
||||
|
||||
|
||||
@@ -187,6 +187,5 @@ public:
|
||||
MOCK_METHOD0(UnloadPlugins, void());
|
||||
MOCK_METHOD0(LoadPlugins, void());
|
||||
MOCK_METHOD1(GetSearchPath, QString(EEditorPathName));
|
||||
MOCK_METHOD0(GetEditorPanelUtils, IEditorPanelUtils* ());
|
||||
|
||||
};
|
||||
|
||||
@@ -1,506 +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 "SimpleTriangleRasterizer.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if !defined FLT_MAX
|
||||
#define FLT_MAX 3.402823466e+38F
|
||||
#endif
|
||||
|
||||
void CSimpleTriangleRasterizer::lambertHorizlineConservative(float fx1, float fx2, int yy, IRasterizeSink* inpSink)
|
||||
{
|
||||
int x1 = (int)floorf(fx1 + 0.25f), x2 = (int)floorf(fx2 + .75f);
|
||||
|
||||
if (x1 < m_iMinX)
|
||||
{
|
||||
x1 = m_iMinX;
|
||||
}
|
||||
if (x2 > m_iMaxX + 1)
|
||||
{
|
||||
x2 = m_iMaxX + 1;
|
||||
}
|
||||
if (x1 > m_iMaxX + 1)
|
||||
{
|
||||
x1 = m_iMaxX + 1;
|
||||
}
|
||||
if (x2 < m_iMinX)
|
||||
{
|
||||
x2 = m_iMinX;
|
||||
}
|
||||
|
||||
|
||||
inpSink->Line(fx1, fx2, x1, x2, yy);
|
||||
}
|
||||
|
||||
void CSimpleTriangleRasterizer::lambertHorizlineSubpixelCorrect(float fx1, float fx2, int yy, IRasterizeSink* inpSink)
|
||||
{
|
||||
int x1 = (int)floorf(fx1 + 0.5f), x2 = (int)floorf(fx2 + 0.5f);
|
||||
// int x1=(int)floorf(fx1*1023.f/1024.f+1.f),x2=(int)floorf(fx2*1023.f/1024.f+1.f);
|
||||
|
||||
if (x1 < m_iMinX)
|
||||
{
|
||||
x1 = m_iMinX;
|
||||
}
|
||||
if (x2 > m_iMaxX)
|
||||
{
|
||||
x2 = m_iMaxX;
|
||||
}
|
||||
if (x1 > m_iMaxX)
|
||||
{
|
||||
x1 = m_iMaxX;
|
||||
}
|
||||
if (x2 < m_iMinX)
|
||||
{
|
||||
x2 = m_iMinX;
|
||||
}
|
||||
|
||||
inpSink->Line(fx1, fx2, x1, x2, yy);
|
||||
}
|
||||
|
||||
// optimizable
|
||||
void CSimpleTriangleRasterizer::CopyAndSortY(const float infX[3], const float infY[3], float outfX[3], float outfY[3])
|
||||
{
|
||||
outfX[0] = infX[0];
|
||||
outfY[0] = infY[0];
|
||||
outfX[1] = infX[1];
|
||||
outfY[1] = infY[1];
|
||||
outfX[2] = infX[2];
|
||||
outfY[2] = infY[2];
|
||||
|
||||
// Sort the coordinates, so that (x[1], y[1]) becomes the highest coord
|
||||
float tmp;
|
||||
|
||||
if (outfY[0] > outfY[1])
|
||||
{
|
||||
if (outfY[1] > outfY[2])
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
tmp = outfY[1];
|
||||
outfY[1] = outfY[2];
|
||||
outfY[2] = tmp;
|
||||
tmp = outfX[1];
|
||||
outfX[1] = outfX[2];
|
||||
outfX[2] = tmp;
|
||||
|
||||
if (outfY[0] > outfY[1])
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
|
||||
if (outfY[1] > outfY[2])
|
||||
{
|
||||
tmp = outfY[1];
|
||||
outfY[1] = outfY[2];
|
||||
outfY[2] = tmp;
|
||||
tmp = outfX[1];
|
||||
outfX[1] = outfX[2];
|
||||
outfX[2] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outfY[1] > outfY[2])
|
||||
{
|
||||
tmp = outfY[1];
|
||||
outfY[1] = outfY[2];
|
||||
outfY[2] = tmp;
|
||||
tmp = outfX[1];
|
||||
outfX[1] = outfX[2];
|
||||
outfX[2] = tmp;
|
||||
|
||||
if (outfY[0] > outfY[1])
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSimpleTriangleRasterizer::CallbackFillRectConservative(float _x[3], float _y[3], IRasterizeSink* inpSink)
|
||||
{
|
||||
inpSink->Triangle(m_iMinY);
|
||||
|
||||
float fMinX = (std::min)(_x[0], (std::min)(_x[1], _x[2]));
|
||||
float fMaxX = (std::max)(_x[0], (std::max)(_x[1], _x[2]));
|
||||
float fMinY = (std::min)(_y[0], (std::min)(_y[1], _y[2]));
|
||||
float fMaxY = (std::max)(_y[0], (std::max)(_y[1], _y[2]));
|
||||
|
||||
int iMinX = (std::max)(m_iMinX, (int)floorf(fMinX));
|
||||
int iMaxX = (std::min)(m_iMaxX + 1, (int)ceilf(fMaxX));
|
||||
int iMinY = (std::max)(m_iMinY, (int)floorf(fMinY));
|
||||
int iMaxY = (std::min)(m_iMaxY + 1, (int)ceilf(fMaxY));
|
||||
|
||||
for (int y = iMinY; y < iMaxY; y++)
|
||||
{
|
||||
inpSink->Line(fMinX, fMaxX, iMinX, iMaxX, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CSimpleTriangleRasterizer::CallbackFillConservative(float _x[3], float _y[3], IRasterizeSink* inpSink)
|
||||
{
|
||||
float x[3], y[3];
|
||||
|
||||
CopyAndSortY(_x, _y, x, y);
|
||||
|
||||
// Calculate interpolation steps
|
||||
float fX1toX2step = 0.0f;
|
||||
float fX1toX3step = 0.0f;
|
||||
float fX2toX3step = 0.0f;
|
||||
if (fabsf(y[1] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX2step = (x[1] - x[0]) / (float)(y[1] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX3step = (x[2] - x[0]) / (float)(y[2] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[1]) > FLT_EPSILON)
|
||||
{
|
||||
fX2toX3step = (x[2] - x[1]) / (float)(y[2] - y[1]);
|
||||
}
|
||||
|
||||
float fX1toX2 = x[0], fX1toX3 = x[0], fX2toX3 = x[1];
|
||||
bool bFirstLine = true;
|
||||
bool bTriangleCallDone = false;
|
||||
|
||||
// Go through the scanlines of the triangle
|
||||
int yy = (int)floorf(y[0]); // was floor
|
||||
|
||||
for (; yy <= (int)floorf(y[2]); yy++)
|
||||
// for(yy=m_iMinY; yy<=m_iMaxY; yy++) // juhu
|
||||
{
|
||||
float fSubPixelYStart = 0.0f, fSubPixelYEnd = 1.0f;
|
||||
float start, end;
|
||||
|
||||
// first line
|
||||
if (bFirstLine)
|
||||
{
|
||||
fSubPixelYStart = y[0] - floorf(y[0]);
|
||||
start = x[0];
|
||||
end = x[0];
|
||||
bFirstLine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy <= (int)floorf(y[1]))
|
||||
{
|
||||
start = (std::min)(fX1toX2, fX1toX3);
|
||||
end = (std::max)(fX1toX2, fX1toX3);
|
||||
}
|
||||
else
|
||||
{
|
||||
start = (std::min)(fX2toX3, fX1toX3);
|
||||
end = (std::max)(fX2toX3, fX1toX3);
|
||||
}
|
||||
}
|
||||
|
||||
// middle corner line
|
||||
if (yy == (int)floorf(y[1]))
|
||||
{
|
||||
fSubPixelYEnd = y[1] - floorf(y[1]);
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX1toX3);
|
||||
end = (std::max)(end, fX1toX3);
|
||||
start = (std::min)(start, x[1]);
|
||||
end = (std::max)(end, x[1]);
|
||||
|
||||
fSubPixelYStart = fSubPixelYEnd;
|
||||
fSubPixelYEnd = 1.0f;
|
||||
}
|
||||
|
||||
// last line
|
||||
if (yy == (int)floorf(y[2]))
|
||||
{
|
||||
start = (std::min)(start, x[2]);
|
||||
end = (std::max)(end, x[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy < (int)floorf(y[1]))
|
||||
{
|
||||
fX1toX2 += fX1toX2step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX1toX2);
|
||||
end = (std::max)(end, fX1toX2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fX2toX3 += fX2toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX2toX3);
|
||||
end = (std::max)(end, fX2toX3);
|
||||
}
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX1toX3);
|
||||
end = (std::max)(end, fX1toX3);
|
||||
}
|
||||
|
||||
if (yy >= m_iMinY && yy <= m_iMaxY)
|
||||
{
|
||||
if (!bTriangleCallDone)
|
||||
{
|
||||
inpSink->Triangle(yy);
|
||||
bTriangleCallDone = true;
|
||||
}
|
||||
|
||||
lambertHorizlineConservative(start, end, yy, inpSink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CSimpleTriangleRasterizer::CallbackFillSubpixelCorrect(float _x[3], float _y[3], IRasterizeSink* inpSink)
|
||||
{
|
||||
float x[3], y[3];
|
||||
|
||||
CopyAndSortY(_x, _y, x, y);
|
||||
|
||||
if (fabs(y[0] - floorf(y[0])) < FLT_EPSILON)
|
||||
{
|
||||
y[0] -= FLT_EPSILON;
|
||||
}
|
||||
|
||||
// Calculate interpolation steps
|
||||
float fX1toX2step = 0.0f;
|
||||
float fX1toX3step = 0.0f;
|
||||
float fX2toX3step = 0.0f;
|
||||
if (fabsf(y[1] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX2step = (x[1] - x[0]) / (y[1] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX3step = (x[2] - x[0]) / (y[2] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[1]) > FLT_EPSILON)
|
||||
{
|
||||
fX2toX3step = (x[2] - x[1]) / (y[2] - y[1]);
|
||||
}
|
||||
|
||||
float fX1toX2 = x[0], fX1toX3 = x[0], fX2toX3 = x[1];
|
||||
bool bFirstLine = true;
|
||||
bool bTriangleCallDone = false;
|
||||
|
||||
y[0] -= 0.5f;
|
||||
y[1] -= 0.5f;
|
||||
y[2] -= 0.5f;
|
||||
// y[0]=y[0]*1023.f/1024.f+1.f;
|
||||
// y[1]=y[1]*1023.f/1024.f+1.f;
|
||||
// y[2]=y[2]*1023.f/1024.f+1.f;
|
||||
|
||||
for (int yy = (int)floorf(y[0]); yy <= (int)floorf(y[2]); yy++)
|
||||
{
|
||||
float fSubPixelYStart = 0.0f, fSubPixelYEnd = 1.0f;
|
||||
float start, end;
|
||||
|
||||
// first line
|
||||
if (bFirstLine)
|
||||
{
|
||||
fSubPixelYStart = y[0] - floorf(y[0]);
|
||||
start = x[0];
|
||||
end = x[0];
|
||||
bFirstLine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy <= (int)floorf(y[1]))
|
||||
{
|
||||
start = (std::min)(fX1toX2, fX1toX3);
|
||||
end = (std::max)(fX1toX2, fX1toX3);
|
||||
}
|
||||
else
|
||||
{
|
||||
start = (std::min)(fX2toX3, fX1toX3);
|
||||
end = (std::max)(fX2toX3, fX1toX3);
|
||||
}
|
||||
}
|
||||
|
||||
// middle corner line
|
||||
if (yy == (int)floorf(y[1]))
|
||||
{
|
||||
fSubPixelYEnd = y[1] - floorf(y[1]);
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
|
||||
fSubPixelYStart = fSubPixelYEnd;
|
||||
fSubPixelYEnd = 1.0f;
|
||||
}
|
||||
|
||||
// last line
|
||||
if (yy != (int)floorf(y[2]))
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy < (int)floorf(y[1]))
|
||||
{
|
||||
fX1toX2 += fX1toX2step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
fX2toX3 += fX2toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
}
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
}
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
if (yy >= m_iMinY && yy <= m_iMaxY)
|
||||
{
|
||||
if (!bTriangleCallDone)
|
||||
{
|
||||
inpSink->Triangle(yy);
|
||||
bTriangleCallDone = true;
|
||||
}
|
||||
|
||||
lambertHorizlineSubpixelCorrect(start, end, yy, inpSink);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// shrink triangle by n pixel, optimizable
|
||||
void CSimpleTriangleRasterizer::ShrinkTriangle(float inoutfX[3], float inoutfY[3], float infAmount)
|
||||
{
|
||||
float fX[3] = { inoutfX[0], inoutfX[1], inoutfX[2] };
|
||||
float fY[3] = { inoutfY[0], inoutfY[1], inoutfY[2] };
|
||||
|
||||
/*
|
||||
// move edge to opposing vertex
|
||||
float dx,dy,fLength;
|
||||
|
||||
for(int a=0;a<3;a++)
|
||||
{
|
||||
int b=a+1;if(b>=3)b=0;
|
||||
int c=b+1;if(c>=3)c=0;
|
||||
|
||||
dx=fX[a]-(fX[b]+fX[c])*0.5f;
|
||||
dy=fY[a]-(fY[b]+fY[c])*0.5f;
|
||||
fLength=(float)sqrt(dx*dx+dy*dy);
|
||||
if(fLength>1.0f)
|
||||
{
|
||||
dx/=fLength;dy/=fLength;
|
||||
inoutfX[b]+=dx;inoutfY[b]+=dy;
|
||||
inoutfX[c]+=dx;inoutfY[c]+=dy;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// move vertex to opposing edge
|
||||
float dx,dy,fLength;
|
||||
|
||||
for(int a=0;a<3;a++)
|
||||
{
|
||||
int b=a+1;if(b>=3)b=0;
|
||||
int c=b+1;if(c>=3)c=0;
|
||||
|
||||
dx=fX[a]-(fX[b]+fX[c])*0.5f;
|
||||
dy=fY[a]-(fY[b]+fY[c])*0.5f;
|
||||
fLength=(float)sqrt(dx*dx+dy*dy);
|
||||
if(fLength>1.0f)
|
||||
{
|
||||
dx/=fLength;dy/=fLength;
|
||||
inoutfX[a]-=dx;inoutfY[a]-=dy;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// move vertex to get edges shifted perpendicular for 1 unit
|
||||
for (int a = 0; a < 3; a++)
|
||||
{
|
||||
float dx1, dy1, dx2, dy2, fLength;
|
||||
|
||||
int b = a + 1;
|
||||
if (b >= 3)
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
int c = b + 1;
|
||||
if (c >= 3)
|
||||
{
|
||||
c = 0;
|
||||
}
|
||||
|
||||
dx1 = fX[b] - fX[a];
|
||||
dy1 = fY[b] - fY[a];
|
||||
fLength = (float)sqrt(dx1 * dx1 + dy1 * dy1);
|
||||
if (infAmount > 0)
|
||||
{
|
||||
if (fLength < infAmount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (fLength == 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dx1 /= fLength;
|
||||
dy1 /= fLength;
|
||||
|
||||
dx2 = fX[c] - fX[a];
|
||||
dy2 = fY[c] - fY[a];
|
||||
fLength = (float)sqrt(dx2 * dx2 + dy2 * dy2);
|
||||
if (infAmount > 0)
|
||||
{
|
||||
if (fLength < infAmount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (fLength == 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dx2 /= fLength;
|
||||
dy2 /= fLength;
|
||||
|
||||
inoutfX[a] += (dx1 + dx2) * infAmount;
|
||||
inoutfY[a] += (dy1 + dy2) * infAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,181 +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_LIGHTMAPCOMPILER_SIMPLETRIANGLERASTERIZER_H
|
||||
#define CRYINCLUDE_EDITOR_LIGHTMAPCOMPILER_SIMPLETRIANGLERASTERIZER_H
|
||||
#pragma once
|
||||
|
||||
class CSimpleTriangleRasterizer
|
||||
{
|
||||
public:
|
||||
|
||||
class IRasterizeSink
|
||||
{
|
||||
public:
|
||||
|
||||
//! is called once per triangel for the first possible visible line
|
||||
//! /param iniStartY
|
||||
virtual void Triangle([[maybe_unused]] const int iniStartY)
|
||||
{
|
||||
}
|
||||
|
||||
//! callback function
|
||||
//! /param infXLeft included - not clipped against left and reight border
|
||||
//! /param infXRight excluded - not clipped against left and reight border
|
||||
//! /param iniXLeft included
|
||||
//! /param iniXRight excluded
|
||||
//! /param iniY
|
||||
virtual void Line(const float infXLeft, const float infXRight,
|
||||
const int iniXLeft, const int iniXRight, const int iniY) = 0;
|
||||
};
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
||||
//! implementation sink sample
|
||||
class CDWORDFlatFill
|
||||
: public IRasterizeSink
|
||||
{
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
CDWORDFlatFill(DWORD* inpBuffer, const DWORD indwPitchInPixels, DWORD indwValue)
|
||||
{
|
||||
m_dwValue = indwValue;
|
||||
m_pBuffer = inpBuffer;
|
||||
m_dwPitchInPixels = indwPitchInPixels;
|
||||
}
|
||||
|
||||
virtual void Triangle(const int iniY)
|
||||
{
|
||||
m_pBufferLine = &m_pBuffer[iniY * m_dwPitchInPixels];
|
||||
}
|
||||
|
||||
virtual void Line([[maybe_unused]] const float infXLeft, [[maybe_unused]] const float infXRight,
|
||||
const int iniLeft, const int iniRight, [[maybe_unused]] const int iniY)
|
||||
{
|
||||
DWORD* mem = &m_pBufferLine[iniLeft];
|
||||
|
||||
for (int x = iniLeft; x < iniRight; x++)
|
||||
{
|
||||
*mem++ = m_dwValue;
|
||||
}
|
||||
|
||||
m_pBufferLine += m_dwPitchInPixels;
|
||||
}
|
||||
|
||||
private:
|
||||
DWORD m_dwValue; //!< fill value
|
||||
DWORD* m_pBufferLine; //!< to get rid of the multiplication per line
|
||||
|
||||
DWORD m_dwPitchInPixels; //!< in DWORDS, not in Bytes
|
||||
DWORD* m_pBuffer; //!< pointer to the buffer
|
||||
};
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
||||
//! constructor
|
||||
//! /param iniWidth excluded
|
||||
//! /param iniHeight excluded
|
||||
CSimpleTriangleRasterizer(const int iniWidth, const int iniHeight)
|
||||
{
|
||||
m_iMinX = 0;
|
||||
m_iMinY = 0;
|
||||
m_iMaxX = iniWidth - 1;
|
||||
m_iMaxY = iniHeight - 1;
|
||||
}
|
||||
/*
|
||||
//! constructor
|
||||
//! /param iniMinX included
|
||||
//! /param iniMinY included
|
||||
//! /param iniMaxX included
|
||||
//! /param iniMaxY included
|
||||
CSimpleTriangleRasterizer( const int iniMinX, const int iniMinY, const int iniMaxX, const int iniMaxY )
|
||||
{
|
||||
m_iMinX=iniMinX;
|
||||
m_iMinY=iniMinY;
|
||||
m_iMaxX=iniMaxX;
|
||||
m_iMaxY=iniMaxY;
|
||||
}
|
||||
*/
|
||||
//! simple triangle filler with clipping (optimizable), not subpixel correct
|
||||
//! /param pBuffer pointer o the color buffer
|
||||
//! /param indwWidth width of the color buffer
|
||||
//! /param indwHeight height of the color buffer
|
||||
//! /param x array of the x coordiantes of the three vertices
|
||||
//! /param y array of the x coordiantes of the three vertices
|
||||
//! /param indwValue value of the triangle
|
||||
void DWORDFlatFill(DWORD* inpBuffer, const DWORD indwPitchInPixels, float x[3], float y[3], DWORD indwValue, bool inbConservative)
|
||||
{
|
||||
CDWORDFlatFill pix(inpBuffer, indwPitchInPixels, indwValue);
|
||||
|
||||
if (inbConservative)
|
||||
{
|
||||
CallbackFillConservative(x, y, &pix);
|
||||
}
|
||||
else
|
||||
{
|
||||
CallbackFillSubpixelCorrect(x, y, &pix);
|
||||
}
|
||||
}
|
||||
|
||||
// Rectangle around triangle - more stable - use for debugging purpose
|
||||
void CallbackFillRectConservative(float x[3], float y[3], IRasterizeSink * inpSink);
|
||||
|
||||
|
||||
//! subpixel correct triangle filler (conservative or not conservative)
|
||||
//! \param pBuffer pointe to the DWORD
|
||||
//! \param indwWidth width of the buffer pBuffer pointes to
|
||||
//! \param indwHeight height of the buffer pBuffer pointes to
|
||||
//! \param x array of the x coordiantes of the three vertices
|
||||
//! \param y array of the x coordiantes of the three vertices
|
||||
//! \param inpSink pointer to the sink interface (is called per triangle and per triangle line)
|
||||
void CallbackFillConservative(float x[3], float y[3], IRasterizeSink * inpSink);
|
||||
|
||||
//! subpixel correct triangle filler (conservative or not conservative)
|
||||
//! \param pBuffer pointe to the DWORD
|
||||
//! \param indwWidth width of the buffer pBuffer pointes to
|
||||
//! \param indwHeight height of the buffer pBuffer pointes to
|
||||
//! \param x array of the x coordiantes of the three vertices
|
||||
//! \param y array of the x coordiantes of the three vertices
|
||||
//! \param inpSink pointer to the sink interface (is called per triangle and per triangle line)
|
||||
void CallbackFillSubpixelCorrect(float x[3], float y[3], IRasterizeSink * inpSink);
|
||||
|
||||
//!
|
||||
//! /param inoutfX
|
||||
//! /param inoutfY
|
||||
//! /param infAmount could be positive or negative
|
||||
static void ShrinkTriangle(float inoutfX[3], float inoutfY[3], float infAmount);
|
||||
|
||||
private:
|
||||
|
||||
// Clipping Rect;
|
||||
|
||||
int m_iMinX; //!< minimum x value included
|
||||
int m_iMinY; //!< minimum y value included
|
||||
int m_iMaxX; //!< maximum x value included
|
||||
int m_iMaxY; //!< maximum x value included
|
||||
|
||||
void lambertHorizlineConservative(float fx1, float fx2, int y, IRasterizeSink* inpSink);
|
||||
void lambertHorizlineSubpixelCorrect(float fx1, float fx2, int y, IRasterizeSink* inpSink);
|
||||
void CopyAndSortY(const float infX[3], const float infY[3], float outfX[3], float outfY[3]);
|
||||
};
|
||||
|
||||
|
||||
// extension ideas:
|
||||
// * callback with coverage mask (possible non ordered sampling)
|
||||
// * z-buffer behaviour
|
||||
// * gouraud shading
|
||||
// * texture mapping with nearest/bicubic/bilinear filter
|
||||
// * further primitives: thick line, ellipse
|
||||
// * build a template version
|
||||
// *
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_LIGHTMAPCOMPILER_SIMPLETRIANGLERASTERIZER_H
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "Util/Image.h"
|
||||
#include "ObjectManagerLegacyUndo.h"
|
||||
#include "Include/HitContext.h"
|
||||
#include "EditMode/DeepSelection.h"
|
||||
#include "Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h"
|
||||
|
||||
#include <AzCore/Console/Console.h>
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#include "CheckOutDialog.h"
|
||||
#include "ISourceControl.h"
|
||||
#include "Dialogs/Generic/UserOptions.h"
|
||||
#include "IAssetItem.h"
|
||||
#include "IAssetItemDatabase.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "UsedResources.h"
|
||||
#include "Objects/BaseObject.h"
|
||||
@@ -223,106 +221,6 @@ void CFileUtil::EditTextureFile(const char* textureFile, [[maybe_unused]] bool b
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::CalculateDccFilename(const QString& assetFilename, QString& dccFilename)
|
||||
{
|
||||
if (ExtractDccFilenameFromAssetDatabase(assetFilename, dccFilename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ExtractDccFilenameUsingNamingConventions(assetFilename, dccFilename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
GetIEditor()->GetEnv()->pLog->LogError("Failed to find psd file for texture: '%s'", assetFilename.toUtf8().data());
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::ExtractDccFilenameFromAssetDatabase(const QString& assetFilename, QString& dccFilename)
|
||||
{
|
||||
IAssetItemDatabase* pCurrentDatabaseInterface = nullptr;
|
||||
std::vector<IClassDesc*> assetDatabasePlugins;
|
||||
IEditorClassFactory* pClassFactory = GetIEditor()->GetClassFactory();
|
||||
pClassFactory->GetClassesByCategory("Asset Item DB", assetDatabasePlugins);
|
||||
|
||||
for (size_t i = 0; i < assetDatabasePlugins.size(); ++i)
|
||||
{
|
||||
if (assetDatabasePlugins[i]->QueryInterface(__az_uuidof(IAssetItemDatabase), (void**)&pCurrentDatabaseInterface) == S_OK)
|
||||
{
|
||||
if (!pCurrentDatabaseInterface)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString assetDatabaseDccFilename;
|
||||
IAssetItem* pAssetItem = pCurrentDatabaseInterface->GetAsset(assetFilename.toUtf8().data());
|
||||
if (pAssetItem)
|
||||
{
|
||||
if ((pAssetItem->GetFlags() & IAssetItem::eFlag_Cached))
|
||||
{
|
||||
QVariant v = pAssetItem->GetAssetFieldValue("dccfilename");
|
||||
assetDatabaseDccFilename = v.toString();
|
||||
if (!v.isNull())
|
||||
{
|
||||
dccFilename = assetDatabaseDccFilename;
|
||||
dccFilename = Path::GetRelativePath(dccFilename, false);
|
||||
|
||||
uint32 attr = CFileUtil::GetAttributes(dccFilename.toUtf8().data());
|
||||
|
||||
if (CFileUtil::FileExists(dccFilename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (GetIEditor()->IsSourceControlAvailable() && (attr & SCC_FILE_ATTRIBUTE_MANAGED))
|
||||
{
|
||||
return CFileUtil::GetLatestFromSourceControl(dccFilename.toUtf8().data());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CFileUtil::ExtractDccFilenameUsingNamingConventions(const QString& assetFilename, QString& dccFilename)
|
||||
{
|
||||
//else to try find it by naming conventions
|
||||
QString tempStr = assetFilename;
|
||||
int foundSplit = -1;
|
||||
if ((foundSplit = tempStr.lastIndexOf('.')) > 0)
|
||||
{
|
||||
QString first = tempStr.mid(0, foundSplit);
|
||||
tempStr = first + ".psd";
|
||||
}
|
||||
if (CFileUtil::FileExists(tempStr))
|
||||
{
|
||||
dccFilename = tempStr;
|
||||
return true;
|
||||
}
|
||||
|
||||
//else try to find it by replacing post fix _<description> with .psd
|
||||
tempStr = assetFilename;
|
||||
foundSplit = -1;
|
||||
if ((foundSplit = tempStr.lastIndexOf('_')) > 0)
|
||||
{
|
||||
QString first = tempStr.mid(0, foundSplit);
|
||||
tempStr = first + ".psd";
|
||||
}
|
||||
if (CFileUtil::FileExists(tempStr))
|
||||
{
|
||||
dccFilename = tempStr;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CFileUtil::FormatFilterString(QString& filter)
|
||||
{
|
||||
|
||||
@@ -29,9 +29,6 @@ public:
|
||||
static void EditTextFile(const char* txtFile, int line = 0, IFileUtil::ETextFileType fileType = IFileUtil::FILE_TYPE_SCRIPT);
|
||||
static void EditTextureFile(const char* txtureFile, bool bUseGameFolder);
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
static bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename);
|
||||
|
||||
//! Reformat filter string for (MFC) CFileDialog style file filtering
|
||||
static void FormatFilterString(QString& filter);
|
||||
|
||||
@@ -155,9 +152,6 @@ private:
|
||||
|
||||
// Keep this variant of this method private! pIsSelected is captured in a lambda, and so requires menu use exec() and never use show()
|
||||
static void PopulateQMenu(QWidget* caller, QMenu* menu, AZStd::string_view fullGamePath, bool* pIsSelected);
|
||||
|
||||
static bool ExtractDccFilenameFromAssetDatabase(const QString& assetFilename, QString& dccFilename);
|
||||
static bool ExtractDccFilenameUsingNamingConventions(const QString& assetFilename, QString& dccFilename);
|
||||
};
|
||||
|
||||
class CAutoRestorePrimaryCDRoot
|
||||
|
||||
@@ -30,11 +30,6 @@ void CFileUtil_impl::EditTextureFile(const char* txtureFile, bool bUseGameFolder
|
||||
CFileUtil::EditTextureFile(txtureFile, bUseGameFolder);
|
||||
}
|
||||
|
||||
bool CFileUtil_impl::CalculateDccFilename(const QString& assetFilename, QString& dccFilename)
|
||||
{
|
||||
return CFileUtil::CalculateDccFilename(assetFilename, dccFilename);
|
||||
}
|
||||
|
||||
void CFileUtil_impl::FormatFilterString(QString& filter)
|
||||
{
|
||||
CFileUtil::FormatFilterString(filter);
|
||||
|
||||
@@ -39,9 +39,6 @@ public:
|
||||
bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) override;
|
||||
void EditTextureFile(const char* txtureFile, bool bUseGameFolder) override;
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename) override;
|
||||
|
||||
//! Reformat filter string for (MFC) CFileDialog style file filtering
|
||||
void FormatFilterString(QString& filter) override;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "ViewportTitleDlg.h"
|
||||
|
||||
// Qt
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QInputDialog>
|
||||
|
||||
@@ -43,6 +44,7 @@
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
|
||||
#include <AzQtComponents/Components/Widgets/CheckBox.h>
|
||||
|
||||
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
|
||||
|
||||
@@ -51,6 +53,8 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#endif //! defined(Q_MOC_RUN)
|
||||
|
||||
static constexpr int MiniumOverflowMenuWidth = 200;
|
||||
|
||||
// CViewportTitleDlg dialog
|
||||
|
||||
namespace
|
||||
@@ -257,21 +261,56 @@ void CViewportTitleDlg::SetupHelpersButton()
|
||||
|
||||
void CViewportTitleDlg::SetupOverflowMenu()
|
||||
{
|
||||
// Setup the overflow menu
|
||||
QMenu* overFlowMenu = new QMenu(this);
|
||||
// simple override of QMenu that does not respond to keyboard events
|
||||
// note: this prevents the menu from being prematurely closed
|
||||
class IgnoreKeyboardMenu : public QMenu
|
||||
{
|
||||
public:
|
||||
IgnoreKeyboardMenu(QWidget *parent = nullptr) : QMenu(parent)
|
||||
{
|
||||
}
|
||||
|
||||
m_audioMuteAction = new QAction("Mute Audio", overFlowMenu);
|
||||
private:
|
||||
void keyPressEvent(QKeyEvent* event) override
|
||||
{
|
||||
// regular escape key handling
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
{
|
||||
QMenu::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// setup the overflow menu
|
||||
auto* overflowMenu = new IgnoreKeyboardMenu(this);
|
||||
overflowMenu->setMinimumWidth(MiniumOverflowMenuWidth);
|
||||
|
||||
m_audioMuteAction = new QAction("Mute Audio", overflowMenu);
|
||||
connect(m_audioMuteAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedMuteAudio);
|
||||
overFlowMenu->addAction(m_audioMuteAction);
|
||||
overflowMenu->addAction(m_audioMuteAction);
|
||||
|
||||
overFlowMenu->addSeparator();
|
||||
overflowMenu->addSeparator();
|
||||
|
||||
m_enableGridSnappingAction = new QAction("Enable Grid Snapping", overFlowMenu);
|
||||
connect(m_enableGridSnappingAction, &QAction::triggered, this, &CViewportTitleDlg::OnGridSnappingToggled);
|
||||
m_enableGridSnappingAction->setCheckable(true);
|
||||
overFlowMenu->addAction(m_enableGridSnappingAction);
|
||||
m_enableGridSnappingCheckBox = new QCheckBox("Enable Grid Snapping", overflowMenu);
|
||||
AzQtComponents::CheckBox::applyToggleSwitchStyle(m_enableGridSnappingCheckBox);
|
||||
auto gridSnappingWidgetAction = new QWidgetAction(overflowMenu);
|
||||
gridSnappingWidgetAction->setDefaultWidget(m_enableGridSnappingCheckBox);
|
||||
connect(m_enableGridSnappingCheckBox, &QCheckBox::stateChanged, this, &CViewportTitleDlg::OnGridSnappingToggled);
|
||||
overflowMenu->addAction(gridSnappingWidgetAction);
|
||||
|
||||
m_gridSizeActionWidget = new QWidgetAction(overFlowMenu);
|
||||
m_enableGridVisualizationCheckBox = new QCheckBox("Show Grid", overflowMenu);
|
||||
AzQtComponents::CheckBox::applyToggleSwitchStyle(m_enableGridVisualizationCheckBox);
|
||||
auto gridVisualizationWidgetAction = new QWidgetAction(overflowMenu);
|
||||
gridVisualizationWidgetAction->setDefaultWidget(m_enableGridVisualizationCheckBox);
|
||||
connect(
|
||||
m_enableGridVisualizationCheckBox, &QCheckBox::stateChanged,
|
||||
[](const int state)
|
||||
{
|
||||
SandboxEditor::SetShowingGrid(state == Qt::Checked);
|
||||
});
|
||||
overflowMenu->addAction(gridVisualizationWidgetAction);
|
||||
|
||||
m_gridSizeActionWidget = new QWidgetAction(overflowMenu);
|
||||
m_gridSpinBox = new AzQtComponents::DoubleSpinBox();
|
||||
m_gridSpinBox->setValue(SandboxEditor::GridSnappingSize());
|
||||
m_gridSpinBox->setMinimum(1e-2f);
|
||||
@@ -281,31 +320,33 @@ void CViewportTitleDlg::SetupOverflowMenu()
|
||||
m_gridSpinBox, QOverload<double>::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, &CViewportTitleDlg::OnGridSpinBoxChanged);
|
||||
|
||||
m_gridSizeActionWidget->setDefaultWidget(m_gridSpinBox);
|
||||
overFlowMenu->addAction(m_gridSizeActionWidget);
|
||||
overflowMenu->addAction(m_gridSizeActionWidget);
|
||||
|
||||
overFlowMenu->addSeparator();
|
||||
overflowMenu->addSeparator();
|
||||
|
||||
m_enableAngleSnappingAction = new QAction("Enable Angle Snapping", overFlowMenu);
|
||||
connect(m_enableAngleSnappingAction, &QAction::triggered, this, &CViewportTitleDlg::OnAngleSnappingToggled);
|
||||
m_enableAngleSnappingAction->setCheckable(true);
|
||||
overFlowMenu->addAction(m_enableAngleSnappingAction);
|
||||
m_enableAngleSnappingCheckBox = new QCheckBox("Enable Angle Snapping", overflowMenu);
|
||||
AzQtComponents::CheckBox::applyToggleSwitchStyle(m_enableAngleSnappingCheckBox);
|
||||
auto angleSnappingWidgetAction = new QWidgetAction(overflowMenu);
|
||||
angleSnappingWidgetAction->setDefaultWidget(m_enableAngleSnappingCheckBox);
|
||||
connect(m_enableAngleSnappingCheckBox, &QCheckBox::stateChanged, this, &CViewportTitleDlg::OnAngleSnappingToggled);
|
||||
overflowMenu->addAction(angleSnappingWidgetAction);
|
||||
|
||||
m_angleSizeActionWidget = new QWidgetAction(overFlowMenu);
|
||||
m_angleSizeActionWidget = new QWidgetAction(overflowMenu);
|
||||
m_angleSpinBox = new AzQtComponents::DoubleSpinBox();
|
||||
m_angleSpinBox->setValue(SandboxEditor::AngleSnappingSize());
|
||||
m_angleSpinBox->setMinimum(1e-2f);
|
||||
m_angleSpinBox->setToolTip(tr("Angle Snapping"));
|
||||
m_angleSpinBox->setToolTip(tr("Angle size"));
|
||||
|
||||
QObject::connect(
|
||||
m_angleSpinBox, QOverload<double>::of(&AzQtComponents::DoubleSpinBox::valueChanged), this,
|
||||
&CViewportTitleDlg::OnAngleSpinBoxChanged);
|
||||
|
||||
m_angleSizeActionWidget->setDefaultWidget(m_angleSpinBox);
|
||||
overFlowMenu->addAction(m_angleSizeActionWidget);
|
||||
overflowMenu->addAction(m_angleSizeActionWidget);
|
||||
|
||||
m_ui->m_overflowBtn->setMenu(overFlowMenu);
|
||||
m_ui->m_overflowBtn->setMenu(overflowMenu);
|
||||
m_ui->m_overflowBtn->setPopupMode(QToolButton::InstantPopup);
|
||||
connect(overFlowMenu, &QMenu::aboutToShow, this, &CViewportTitleDlg::UpdateOverFlowMenuState);
|
||||
connect(overflowMenu, &QMenu::aboutToShow, this, &CViewportTitleDlg::UpdateOverFlowMenuState);
|
||||
|
||||
UpdateMuteActionText();
|
||||
}
|
||||
@@ -982,43 +1023,49 @@ void CViewportTitleDlg::CheckForCameraSpeedUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnGridSnappingToggled()
|
||||
void CViewportTitleDlg::OnGridSnappingToggled(const int state)
|
||||
{
|
||||
m_gridSizeActionWidget->setEnabled(m_enableGridSnappingAction->isChecked());
|
||||
m_gridSizeActionWidget->setEnabled(state == Qt::Checked);
|
||||
m_enableGridVisualizationCheckBox->setEnabled(state == Qt::Checked);
|
||||
MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->trigger();
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnAngleSnappingToggled()
|
||||
void CViewportTitleDlg::OnAngleSnappingToggled(const int state)
|
||||
{
|
||||
m_angleSizeActionWidget->setEnabled(m_enableAngleSnappingAction->isChecked());
|
||||
m_angleSizeActionWidget->setEnabled(state == Qt::Checked);
|
||||
MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->trigger();
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnGridSpinBoxChanged(double value)
|
||||
void CViewportTitleDlg::OnGridSpinBoxChanged(const double value)
|
||||
{
|
||||
SandboxEditor::SetGridSnappingSize(static_cast<float>(value));
|
||||
SandboxEditor::SetGridSnappingSize(aznumeric_cast<float>(value));
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnAngleSpinBoxChanged(double value)
|
||||
void CViewportTitleDlg::OnAngleSpinBoxChanged(const double value)
|
||||
{
|
||||
SandboxEditor::SetAngleSnappingSize(static_cast<float>(value));
|
||||
SandboxEditor::SetAngleSnappingSize(aznumeric_cast<float>(value));
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::UpdateOverFlowMenuState()
|
||||
{
|
||||
bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->isChecked();
|
||||
const bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapToGrid)->isChecked();
|
||||
{
|
||||
QSignalBlocker signalBlocker(m_enableGridSnappingAction);
|
||||
m_enableGridSnappingAction->setChecked(gridSnappingActive);
|
||||
QSignalBlocker signalBlocker(m_enableGridSnappingCheckBox);
|
||||
m_enableGridSnappingCheckBox->setChecked(gridSnappingActive);
|
||||
}
|
||||
m_gridSizeActionWidget->setEnabled(gridSnappingActive);
|
||||
|
||||
bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->isChecked();
|
||||
const bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(AzToolsFramework::SnapAngle)->isChecked();
|
||||
{
|
||||
QSignalBlocker signalBlocker(m_enableAngleSnappingAction);
|
||||
m_enableAngleSnappingAction->setChecked(angleSnappingActive);
|
||||
QSignalBlocker signalBlocker(m_enableAngleSnappingCheckBox);
|
||||
m_enableAngleSnappingCheckBox->setChecked(angleSnappingActive);
|
||||
}
|
||||
m_angleSizeActionWidget->setEnabled(angleSnappingActive);
|
||||
|
||||
{
|
||||
QSignalBlocker signalBlocker(m_enableGridVisualizationCheckBox);
|
||||
m_enableGridVisualizationCheckBox->setChecked(SandboxEditor::ShowingGrid());
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
@@ -140,8 +140,8 @@ protected:
|
||||
|
||||
void CheckForCameraSpeedUpdate();
|
||||
|
||||
void OnGridSnappingToggled();
|
||||
void OnAngleSnappingToggled();
|
||||
void OnGridSnappingToggled(int state);
|
||||
void OnAngleSnappingToggled(int state);
|
||||
|
||||
void OnGridSpinBoxChanged(double value);
|
||||
void OnAngleSpinBoxChanged(double value);
|
||||
@@ -160,8 +160,9 @@ protected:
|
||||
QAction* m_fullInformationAction = nullptr;
|
||||
QAction* m_compactInformationAction = nullptr;
|
||||
QAction* m_audioMuteAction = nullptr;
|
||||
QAction* m_enableGridSnappingAction = nullptr;
|
||||
QAction* m_enableAngleSnappingAction = nullptr;
|
||||
QCheckBox* m_enableGridSnappingCheckBox = nullptr;
|
||||
QCheckBox* m_enableGridVisualizationCheckBox = nullptr;
|
||||
QCheckBox* m_enableAngleSnappingCheckBox = nullptr;
|
||||
QComboBox* m_cameraSpeed = nullptr;
|
||||
AzQtComponents::DoubleSpinBox* m_gridSpinBox = nullptr;
|
||||
AzQtComponents::DoubleSpinBox* m_angleSpinBox = nullptr;
|
||||
@@ -175,7 +176,7 @@ protected:
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
//! A component to reflect scriptable commands for the Editor
|
||||
//! A component to reflect scriptable commands for the Editor.
|
||||
class ViewportTitleDlgPythonFuncsHandler
|
||||
: public AZ::Component
|
||||
{
|
||||
|
||||
@@ -269,9 +269,6 @@ set(FILES
|
||||
LevelTreeModel.h
|
||||
Include/Command.h
|
||||
Include/HitContext.h
|
||||
Include/IAnimationCompressionManager.h
|
||||
Include/IAssetItem.h
|
||||
Include/IAssetItemDatabase.h
|
||||
Include/ICommandManager.h
|
||||
Include/IConsoleConnectivity.h
|
||||
Include/IDataBaseItem.h
|
||||
@@ -297,8 +294,6 @@ set(FILES
|
||||
Util/AffineParts.cpp
|
||||
Objects/BaseObject.cpp
|
||||
Objects/BaseObject.h
|
||||
Animation/AnimationBipedBoneNames.cpp
|
||||
Animation/AnimationBipedBoneNames.h
|
||||
AnimationContext.cpp
|
||||
AnimationContext.h
|
||||
AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
|
||||
@@ -336,23 +331,12 @@ set(FILES
|
||||
Controls/ConsoleSCB.qrc
|
||||
Controls/FolderTreeCtrl.cpp
|
||||
Controls/FolderTreeCtrl.h
|
||||
Controls/HotTrackingTreeCtrl.cpp
|
||||
Controls/HotTrackingTreeCtrl.h
|
||||
Controls/ImageHistogramCtrl.cpp
|
||||
Controls/ImageHistogramCtrl.h
|
||||
Controls/ImageListCtrl.cpp
|
||||
Controls/ImageListCtrl.h
|
||||
Controls/MultiMonHelper.cpp
|
||||
Controls/MultiMonHelper.h
|
||||
Controls/NumberCtrl.cpp
|
||||
Controls/NumberCtrl.h
|
||||
Controls/NumberCtrl.h
|
||||
Controls/SplineCtrl.cpp
|
||||
Controls/SplineCtrl.h
|
||||
Controls/SplineCtrlEx.cpp
|
||||
Controls/SplineCtrlEx.h
|
||||
Controls/TextEditorCtrl.cpp
|
||||
Controls/TextEditorCtrl.h
|
||||
Controls/TimelineCtrl.cpp
|
||||
Controls/TimelineCtrl.h
|
||||
Controls/WndGridHelper.h
|
||||
@@ -470,18 +454,14 @@ set(FILES
|
||||
GameResourcesExporter.cpp
|
||||
GameExporter.h
|
||||
GameResourcesExporter.h
|
||||
Geometry/TriMesh.cpp
|
||||
Geometry/TriMesh.h
|
||||
AboutDialog.h
|
||||
AboutDialog.ui
|
||||
DocMultiArchive.h
|
||||
EditMode/DeepSelection.h
|
||||
FBXExporterDialog.h
|
||||
FileTypeUtils.h
|
||||
GridUtils.h
|
||||
IObservable.h
|
||||
IPostRenderer.h
|
||||
LightmapCompiler/SimpleTriangleRasterizer.h
|
||||
ToolBox.h
|
||||
TrackViewNewSequenceDialog.h
|
||||
UndoConfigSpec.h
|
||||
@@ -572,11 +552,9 @@ set(FILES
|
||||
AboutDialog.cpp
|
||||
ErrorReportTableModel.h
|
||||
ErrorReportTableModel.cpp
|
||||
EditMode/DeepSelection.cpp
|
||||
FBXExporterDialog.cpp
|
||||
FBXExporterDialog.ui
|
||||
FileTypeUtils.cpp
|
||||
LightmapCompiler/SimpleTriangleRasterizer.cpp
|
||||
ToolBox.cpp
|
||||
TrackViewNewSequenceDialog.cpp
|
||||
TrackViewNewSequenceDialog.ui
|
||||
@@ -798,9 +776,6 @@ set(FILES
|
||||
ViewportTitleDlg.h
|
||||
EditorEnvironment.cpp
|
||||
EditorEnvironment.h
|
||||
IEditorPanelUtils.h
|
||||
EditorPanelUtils.h
|
||||
EditorPanelUtils.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace AZ
|
||||
|
||||
AZ_MATH_INLINE Plane Plane::CreateFromNormalAndDistance(const Vector3& normal, float dist)
|
||||
{
|
||||
AZ_MATH_ASSERT(normal.IsNormalized(), "This normal is not normalized");
|
||||
Plane result;
|
||||
result.Set(normal, dist);
|
||||
return result;
|
||||
@@ -35,7 +34,6 @@ namespace AZ
|
||||
|
||||
AZ_MATH_INLINE Plane Plane::CreateFromCoefficients(const float a, const float b, const float c, const float d)
|
||||
{
|
||||
AZ_MATH_ASSERT(Vector3(a, b, c).IsNormalized(), "This normal is notormalized");
|
||||
Plane result;
|
||||
result.Set(a, b, c, d);
|
||||
return result;
|
||||
@@ -68,21 +66,21 @@ namespace AZ
|
||||
|
||||
AZ_MATH_INLINE void Plane::Set(const Vector3& normal, float d)
|
||||
{
|
||||
AZ_MATH_ASSERT(normal.IsNormalized(), "This normal is notormalized");
|
||||
AZ_MATH_ASSERT(normal.IsNormalized(), "This normal is not normalized");
|
||||
m_plane.Set(normal, d);
|
||||
}
|
||||
|
||||
|
||||
AZ_MATH_INLINE void Plane::Set(float a, float b, float c, float d)
|
||||
{
|
||||
AZ_MATH_ASSERT(Vector3(a, b, c).IsNormalized(), "This normal is notormalized");
|
||||
AZ_MATH_ASSERT(Vector3(a, b, c).IsNormalized(), "This normal is not normalized");
|
||||
m_plane.Set(a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
AZ_MATH_INLINE void Plane::SetNormal(const Vector3& normal)
|
||||
{
|
||||
AZ_MATH_ASSERT(normal.IsNormalized(), "This normal is notormalized");
|
||||
AZ_MATH_ASSERT(normal.IsNormalized(), "This normal is not normalized");
|
||||
m_plane.SetX(normal.GetX());
|
||||
m_plane.SetY(normal.GetY());
|
||||
m_plane.SetZ(normal.GetZ());
|
||||
|
||||
@@ -6,8 +6,155 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Memory/AllocatorManager.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/Memory/AllocatorManager.h>
|
||||
|
||||
#define RECORDING_ENABLED 0
|
||||
|
||||
#if RECORDING_ENABLED
|
||||
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/parallel/mutex.h>
|
||||
#include <AzCore/std/parallel/scoped_lock.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class DebugAllocator
|
||||
{
|
||||
public:
|
||||
using pointer_type = void*;
|
||||
using size_type = AZStd::size_t;
|
||||
using difference_type = AZStd::ptrdiff_t;
|
||||
using allow_memory_leaks = AZStd::false_type; ///< Regular allocators should not leak.
|
||||
|
||||
AZ_FORCE_INLINE pointer_type allocate(size_t byteSize, size_t alignment, int = 0)
|
||||
{
|
||||
return AZ_OS_MALLOC(byteSize, alignment);
|
||||
}
|
||||
AZ_FORCE_INLINE size_type resize(pointer_type, size_type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
AZ_FORCE_INLINE void deallocate(pointer_type ptr, size_type, size_type)
|
||||
{
|
||||
AZ_OS_FREE(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct alignas(1) AllocatorOperation
|
||||
{
|
||||
enum OperationType : size_t
|
||||
{
|
||||
ALLOCATE,
|
||||
DEALLOCATE
|
||||
};
|
||||
OperationType m_type: 1;
|
||||
size_t m_size : 28; // Can represent up to 256Mb requests
|
||||
size_t m_alignment : 7; // Can represent up to 128 alignment
|
||||
size_t m_recordId : 28; // Can represent up to 256M simultaneous requests, we reuse ids
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(AllocatorOperation) == 8);
|
||||
|
||||
static AZStd::mutex s_operationsMutex = {};
|
||||
|
||||
static constexpr size_t s_maxNumberOfAllocationsToRecord = 16384;
|
||||
static size_t s_numberOfAllocationsRecorded = 0;
|
||||
static constexpr size_t s_allocationOperationCount = 5 * 1024;
|
||||
static AZStd::array<AllocatorOperation, s_allocationOperationCount> s_operations = {};
|
||||
static uint64_t s_operationCounter = 0;
|
||||
|
||||
static unsigned int s_nextRecordId = 1;
|
||||
using AllocatorOperationByAddress = AZStd::unordered_map<void*, AllocatorOperation, AZStd::less<void*>, DebugAllocator>;
|
||||
static AllocatorOperationByAddress s_allocatorOperationByAddress;
|
||||
using AvailableRecordIds = AZStd::vector<unsigned int, DebugAllocator>;
|
||||
AvailableRecordIds s_availableRecordIds;
|
||||
|
||||
void RecordAllocatorOperation(AllocatorOperation::OperationType type, void* ptr, size_t size = 0, size_t alignment = 0)
|
||||
{
|
||||
AZStd::scoped_lock<AZStd::mutex> lock(s_operationsMutex);
|
||||
if (s_operationCounter == s_allocationOperationCount)
|
||||
{
|
||||
AZ::IO::SystemFile file;
|
||||
int mode = AZ::IO::SystemFile::OpenMode::SF_OPEN_APPEND | AZ::IO::SystemFile::OpenMode::SF_OPEN_WRITE_ONLY;
|
||||
if (!file.Exists("memoryrecordings.bin"))
|
||||
{
|
||||
mode |= AZ::IO::SystemFile::OpenMode::SF_OPEN_CREATE;
|
||||
}
|
||||
file.Open("memoryrecordings.bin", mode);
|
||||
if (file.IsOpen())
|
||||
{
|
||||
file.Write(&s_operations, sizeof(AllocatorOperation) * s_allocationOperationCount);
|
||||
file.Close();
|
||||
}
|
||||
s_operationCounter = 0;
|
||||
}
|
||||
AllocatorOperation& operation = s_operations[s_operationCounter++];
|
||||
operation.m_type = type;
|
||||
if (type == AllocatorOperation::OperationType::ALLOCATE)
|
||||
{
|
||||
if (s_numberOfAllocationsRecorded > s_maxNumberOfAllocationsToRecord)
|
||||
{
|
||||
// reached limit of allocations, dont record anymore
|
||||
--s_operationCounter;
|
||||
return;
|
||||
}
|
||||
++s_numberOfAllocationsRecorded;
|
||||
operation.m_size = size;
|
||||
operation.m_alignment = alignment;
|
||||
unsigned int recordId = 0;
|
||||
if (!s_availableRecordIds.empty())
|
||||
{
|
||||
recordId = s_availableRecordIds.back();
|
||||
s_availableRecordIds.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
recordId = s_nextRecordId;
|
||||
++s_nextRecordId;
|
||||
}
|
||||
operation.m_recordId = recordId;
|
||||
auto it = s_allocatorOperationByAddress.emplace(ptr, operation);
|
||||
if (!it.second)
|
||||
{
|
||||
// double alloc or resize, leave the current record and return the id
|
||||
operation = it.first->second;
|
||||
s_availableRecordIds.emplace_back(recordId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
// common scenario, just record the operation
|
||||
operation.m_size = 0;
|
||||
operation.m_alignment = 0;
|
||||
operation.m_recordId = 0; // recordId = 0 will flag this case
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = s_allocatorOperationByAddress.find(ptr);
|
||||
if (it != s_allocatorOperationByAddress.end())
|
||||
{
|
||||
operation.m_size = it->second.m_size;
|
||||
operation.m_alignment = it->second.m_alignment;
|
||||
operation.m_recordId = it->second.m_recordId;
|
||||
s_availableRecordIds.push_back(it->second.m_recordId);
|
||||
s_allocatorOperationByAddress.erase(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
// just dont record this operation
|
||||
--s_operationCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -150,6 +297,10 @@ namespace AZ
|
||||
records->RegisterAllocation(ptr, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#if RECORDING_ENABLED
|
||||
RecordAllocatorOperation(AllocatorOperation::ALLOCATE, ptr, byteSize, alignment);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AllocatorBase::ProfileDeallocation(void* ptr, size_t byteSize, size_t alignment, Debug::AllocationInfo* info)
|
||||
@@ -162,6 +313,9 @@ namespace AZ
|
||||
records->UnregisterAllocation(ptr, byteSize, alignment, info);
|
||||
}
|
||||
}
|
||||
#if RECORDING_ENABLED
|
||||
RecordAllocatorOperation(AllocatorOperation::DEALLOCATE, ptr, byteSize, alignment);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AllocatorBase::ProfileReallocationBegin([[maybe_unused]] void* ptr, [[maybe_unused]] size_t newSize)
|
||||
@@ -176,6 +330,10 @@ namespace AZ
|
||||
ProfileDeallocation(ptr, 0, 0, &info);
|
||||
ProfileAllocation(newPtr, newSize, newAlignment, info.m_name, info.m_fileName, info.m_lineNum, 0);
|
||||
}
|
||||
#if RECORDING_ENABLED
|
||||
RecordAllocatorOperation(AllocatorOperation::DEALLOCATE, ptr);
|
||||
RecordAllocatorOperation(AllocatorOperation::ALLOCATE, newPtr, newSize, newAlignment);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AllocatorBase::ProfileReallocation(void* ptr, void* newPtr, size_t newSize, size_t newAlignment)
|
||||
@@ -193,6 +351,9 @@ namespace AZ
|
||||
records->ResizeAllocation(ptr, newSize);
|
||||
}
|
||||
}
|
||||
#if RECORDING_ENABLED
|
||||
RecordAllocatorOperation(AllocatorOperation::ALLOCATE, ptr, newSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool AllocatorBase::OnOutOfMemory(size_t byteSize, size_t alignment, int flags, const char* name, const char* fileName, int lineNum)
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace AZ
|
||||
m_ownMemoryBlock[i] = false;
|
||||
}
|
||||
|
||||
AZ_Assert(m_desc.m_numMemoryBlocks > 0, "At least one memory block is required");
|
||||
for (int i = 0; i < m_desc.m_numMemoryBlocks; ++i)
|
||||
{
|
||||
if (m_desc.m_memoryBlocks[i] == nullptr) // Allocate memory block if requested!
|
||||
@@ -131,17 +132,6 @@ namespace AZ
|
||||
|
||||
m_capacity += m_desc.m_memoryBlocksByteSize[i];
|
||||
}
|
||||
|
||||
if (m_desc.m_numMemoryBlocks == 0)
|
||||
{
|
||||
// Create default memory space if we can to serve for default allocations
|
||||
m_memSpaces[0] = AZDLMalloc::create_mspace(0, m_desc.m_isMultithreadAlloc);
|
||||
if (m_memSpaces[0])
|
||||
{
|
||||
AZDLMalloc::mspace_az_set_expandable(m_memSpaces[0], true);
|
||||
m_capacity = Platform::GetHeapCapacity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HeapSchema::~HeapSchema()
|
||||
|
||||
@@ -32,17 +32,11 @@ namespace AZ
|
||||
*/
|
||||
struct Descriptor
|
||||
{
|
||||
Descriptor()
|
||||
: m_numMemoryBlocks(0)
|
||||
, m_isMultithreadAlloc(true)
|
||||
{}
|
||||
|
||||
static const int m_memoryBlockAlignment = 64 * 1024;
|
||||
static const int m_maxNumBlocks = 5;
|
||||
int m_numMemoryBlocks; ///< Number of memory blocks to use.
|
||||
void* m_memoryBlocks[m_maxNumBlocks]; ///< Pointers to provided memory blocks or NULL if you want the system to allocate them for you with the System Allocator.
|
||||
size_t m_memoryBlocksByteSize[m_maxNumBlocks]; ///< Sizes of different memory blocks, if m_memoryBlock is 0 the block will be allocated for you with the System Allocator.
|
||||
bool m_isMultithreadAlloc; ///< Set to true to enable multi threading safe allocation.
|
||||
int m_numMemoryBlocks = 1; ///< Number of memory blocks to use.
|
||||
void* m_memoryBlocks[m_maxNumBlocks] = {}; ///< Pointers to provided memory blocks or NULL if you want the system to allocate them for you with the System Allocator.
|
||||
size_t m_memoryBlocksByteSize[m_maxNumBlocks] = {4 * 1024}; ///< Sizes of different memory blocks, if m_memoryBlock is 0 the block will be allocated for you with the System Allocator.
|
||||
bool m_isMultithreadAlloc = true; ///< Set to true to enable multi threading safe allocation.
|
||||
};
|
||||
|
||||
HeapSchema(const Descriptor& desc);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#define AZCORE_SYSTEM_ALLOCATOR_HPHA 1
|
||||
#define AZCORE_SYSTEM_ALLOCATOR_MALLOC 2
|
||||
#define AZCORE_SYSTEM_ALLOCATOR_HEAP 3
|
||||
|
||||
#if !defined(AZCORE_SYSTEM_ALLOCATOR)
|
||||
// define the default
|
||||
@@ -29,8 +28,6 @@
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
#include <AzCore/Memory/MallocSchema.h>
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
#include <AzCore/Memory/HeapSchema.h>
|
||||
#else
|
||||
#error "Invalid allocator selected for SystemAllocator"
|
||||
#endif
|
||||
@@ -44,8 +41,6 @@ namespace AZ
|
||||
static AZStd::aligned_storage<sizeof(HphaSchema), AZStd::alignment_of<HphaSchema>::value>::type g_systemSchema;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
static AZStd::aligned_storage<sizeof(MallocSchema), AZStd::alignment_of<MallocSchema>::value>::type g_systemSchema;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
static AZStd::aligned_storage<sizeof(HeapSchema), AZStd::alignment_of<HeapSchema>::value>::type g_systemSchema;
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -118,11 +113,6 @@ namespace AZ
|
||||
heapDesc.m_systemChunkSize = desc.m_heap.m_systemChunkSize;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
MallocSchema::Descriptor heapDesc;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
HeapSchema::Descriptor heapDesc;
|
||||
memcpy(heapDesc.m_memoryBlocks, desc.m_heap.m_memoryBlocks, sizeof(heapDesc.m_memoryBlocks));
|
||||
memcpy(heapDesc.m_memoryBlocksByteSize, desc.m_heap.m_memoryBlocksByteSize, sizeof(heapDesc.m_memoryBlocksByteSize));
|
||||
heapDesc.m_numMemoryBlocks = desc.m_heap.m_numMemoryBlocks;
|
||||
#endif
|
||||
if (&AllocatorInstance<SystemAllocator>::Get() == this) // if we are the system allocator
|
||||
{
|
||||
@@ -132,8 +122,6 @@ namespace AZ
|
||||
m_allocator = new (&g_systemSchema) HphaSchema(heapDesc);
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
m_allocator = new (&g_systemSchema) MallocSchema(heapDesc);
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
m_allocator = new (&g_systemSchema) HeapSchema(heapDesc);
|
||||
#endif
|
||||
g_isSystemSchemaUsed = true;
|
||||
isReady = true;
|
||||
@@ -149,8 +137,6 @@ namespace AZ
|
||||
m_allocator = azcreate(HphaSchema, (heapDesc), SystemAllocator);
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
m_allocator = azcreate(MallocSchema, (heapDesc), SystemAllocator);
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
m_allocator = azcreate(HeapSchema, (heapDesc), SystemAllocator);
|
||||
#endif
|
||||
if (m_allocator == nullptr)
|
||||
{
|
||||
@@ -186,8 +172,6 @@ namespace AZ
|
||||
static_cast<HphaSchema*>(m_allocator)->~HphaSchema();
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
static_cast<MallocSchema*>(m_allocator)->~MallocSchema();
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
static_cast<HeapSchema*>(m_allocator)->~HeapSchema();
|
||||
#endif
|
||||
g_isSystemSchemaUsed = false;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,8 @@ namespace AZ
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializerMap::const_iterator serializerIter = m_jsonSerializers.find(typeId);
|
||||
AZ_Assert(serializerIter != m_jsonSerializers.end(), "Attempting to unregister a serializer that has not been registered yet with typeid %s", typeId.ToString<AZStd::string>().c_str());
|
||||
m_jsonSerializers.erase(serializerIter);
|
||||
[[maybe_unused]] size_t erased = m_jsonSerializers.erase(typeId);
|
||||
AZ_Assert(erased == 1, "Attempting to unregister a serializer that has not been registered yet with typeid %s", typeId.ToString<AZStd::string>().c_str());
|
||||
return SerializerBuilder(this, m_jsonSerializers.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,11 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
VALUES AZCORETEST_DLL_NAME=\"$<TARGET_FILE_NAME:AzCore.Tests>\"
|
||||
)
|
||||
ly_add_target_files(
|
||||
TARGETS AzCore.Tests
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/Tests/Memory/AllocatorBenchmarkRecordings.bin
|
||||
OUTPUT_SUBDIRECTORY Tests/AzCore/Memory
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
|
||||
#if AZ_DEBUG_BUILD
|
||||
#define AZ_MATH_TEST_START_TRACE_SUPPRESSION AZ_TEST_START_TRACE_SUPPRESSION
|
||||
#define AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(x) AZ_TEST_STOP_TRACE_SUPPRESSION(x)
|
||||
#else
|
||||
#define AZ_MATH_TEST_START_TRACE_SUPPRESSION
|
||||
#define AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(x)
|
||||
#endif
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Vector4.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <Math/MathTest.h>
|
||||
|
||||
using namespace AZ;
|
||||
|
||||
@@ -47,7 +48,9 @@ namespace UnitTest
|
||||
TEST(MATH_Plane, TestSet)
|
||||
{
|
||||
Plane pl;
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
pl.Set(12.0f, 13.0f, 14.0f, 15.0f);
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
AZ_TEST_ASSERT_FLOAT_CLOSE(pl.GetDistance(), 15.0f);
|
||||
AZ_TEST_ASSERT_FLOAT_CLOSE(pl.GetNormal().GetX(), 12.0f);
|
||||
AZ_TEST_ASSERT_FLOAT_CLOSE(pl.GetNormal().GetY(), 13.0f);
|
||||
@@ -57,7 +60,9 @@ namespace UnitTest
|
||||
TEST(MATH_Plane, TestSetVector3)
|
||||
{
|
||||
Plane pl;
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
pl.Set(Vector3(22.0f, 23.0f, 24.0f), 25.0f);
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
AZ_TEST_ASSERT_FLOAT_CLOSE(pl.GetDistance(), 25.0f);
|
||||
AZ_TEST_ASSERT_FLOAT_CLOSE(pl.GetNormal().GetX(), 22.0f);
|
||||
AZ_TEST_ASSERT_FLOAT_CLOSE(pl.GetNormal().GetY(), 23.0f);
|
||||
@@ -177,17 +182,21 @@ namespace UnitTest
|
||||
pl.Set(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
AZ_TEST_ASSERT(pl.IsFinite());
|
||||
const float infinity = std::numeric_limits<float>::infinity();
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
pl.Set(infinity, infinity, infinity, infinity);
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
AZ_TEST_ASSERT(!pl.IsFinite());
|
||||
}
|
||||
|
||||
TEST(MATH_Plane, CreateFromVectorCoefficients_IsEquivalentToCreateFromCoefficients)
|
||||
{
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
Plane planeFromCoefficients = Plane::CreateFromCoefficients(1.0, 2.0, 3.0, 4.0);
|
||||
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
Vector4 coefficients(1.0, 2.0, 3.0, 4.0);
|
||||
Plane planeFromVectorCoefficients = Plane::CreateFromVectorCoefficients(coefficients);
|
||||
|
||||
|
||||
EXPECT_EQ(planeFromVectorCoefficients, planeFromCoefficients);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:281ba03e79ecba90b313a0b17bdba87c57d76b504b6e38d579b5eabd995902cc
|
||||
size 245760
|
||||
@@ -0,0 +1,591 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(HAVE_BENCHMARK)
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/Memory/BestFitExternalMapAllocator.h>
|
||||
#include <AzCore/Memory/HeapSchema.h>
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
#include <AzCore/Memory/MallocSchema.h>
|
||||
#include <AzCore/Memory/OSAllocator.h>
|
||||
#include <AzCore/Memory/PoolSchema.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#include <benchmark/benchmark.h>
|
||||
|
||||
namespace Benchmark
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
size_t GetProcessMemoryUsageBytes();
|
||||
size_t GetMemorySize(void* memory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test allocator wrapper that redirects the calls to the passed TAllocator by using AZ::AllocatorInstance.
|
||||
/// It also creates/destroys the TAllocator type (to reflect what happens at runtime)
|
||||
/// </summary>
|
||||
/// <typeparam name="TAllocator">Allocator type to wrap</typeparam>
|
||||
template<typename TAllocator>
|
||||
class TestAllocatorWrapper
|
||||
{
|
||||
public:
|
||||
static void SetUp()
|
||||
{
|
||||
AZ::AllocatorInstance<TAllocator>::Create();
|
||||
}
|
||||
|
||||
static void TearDown()
|
||||
{
|
||||
AZ::AllocatorInstance<TAllocator>::Destroy();
|
||||
}
|
||||
|
||||
static void* Allocate(size_t byteSize, size_t alignment)
|
||||
{
|
||||
return AZ::AllocatorInstance<TAllocator>::Get().Allocate(byteSize, alignment);
|
||||
}
|
||||
|
||||
static void DeAllocate(void* ptr, size_t byteSize = 0)
|
||||
{
|
||||
AZ::AllocatorInstance<TAllocator>::Get().DeAllocate(ptr, byteSize);
|
||||
}
|
||||
|
||||
static void* ReAllocate(void* ptr, size_t newSize, size_t newAlignment)
|
||||
{
|
||||
return AZ::AllocatorInstance<TAllocator>::Get().ReAllocate(ptr, newSize, newAlignment);
|
||||
}
|
||||
|
||||
static size_t Resize(void* ptr, size_t newSize)
|
||||
{
|
||||
return AZ::AllocatorInstance<TAllocator>::Get().Resize(ptr, newSize);
|
||||
}
|
||||
|
||||
static void GarbageCollect()
|
||||
{
|
||||
AZ::AllocatorInstance<TAllocator>::Get().GarbageCollect();
|
||||
}
|
||||
|
||||
static size_t NumAllocatedBytes()
|
||||
{
|
||||
return AZ::AllocatorInstance<TAllocator>::Get().NumAllocatedBytes() +
|
||||
AZ::AllocatorInstance<TAllocator>::Get().GetUnAllocatedMemory();
|
||||
}
|
||||
|
||||
static size_t GetSize(void* ptr)
|
||||
{
|
||||
return AZ::AllocatorInstance<TAllocator>::Get().AllocationSize(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Basic allocator used as a baseline. This allocator is the most basic allocation possible with the OS (AZ_OS_MALLOC).
|
||||
/// MallocSchema cannot be used here because it has extra logic that we don't want to use as a baseline.
|
||||
/// </summary>
|
||||
class RawMallocAllocator {};
|
||||
|
||||
template<>
|
||||
class TestAllocatorWrapper<RawMallocAllocator>
|
||||
{
|
||||
public:
|
||||
TestAllocatorWrapper()
|
||||
{
|
||||
s_numAllocatedBytes = 0;
|
||||
}
|
||||
|
||||
static void SetUp()
|
||||
{
|
||||
s_numAllocatedBytes = 0;
|
||||
}
|
||||
|
||||
static void TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
// IAllocatorAllocate
|
||||
static void* Allocate(size_t byteSize, size_t)
|
||||
{
|
||||
s_numAllocatedBytes += byteSize;
|
||||
// Don't pass an alignment since we wont be able to get the memory size without also passing the alignment
|
||||
return AZ_OS_MALLOC(byteSize, 1);
|
||||
}
|
||||
|
||||
static void DeAllocate(void* ptr, size_t = 0)
|
||||
{
|
||||
s_numAllocatedBytes -= Platform::GetMemorySize(ptr);
|
||||
AZ_OS_FREE(ptr);
|
||||
}
|
||||
|
||||
static void* ReAllocate(void* ptr, size_t newSize, size_t)
|
||||
{
|
||||
s_numAllocatedBytes -= Platform::GetMemorySize(ptr);
|
||||
AZ_OS_FREE(ptr);
|
||||
|
||||
s_numAllocatedBytes += newSize;
|
||||
return AZ_OS_MALLOC(newSize, 1);
|
||||
}
|
||||
|
||||
static size_t Resize(void* ptr, size_t newSize)
|
||||
{
|
||||
AZ_UNUSED(ptr);
|
||||
AZ_UNUSED(newSize);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void GarbageCollect() {}
|
||||
|
||||
static size_t NumAllocatedBytes()
|
||||
{
|
||||
return s_numAllocatedBytes;
|
||||
}
|
||||
|
||||
static size_t GetSize(void* ptr)
|
||||
{
|
||||
return Platform::GetMemorySize(ptr);
|
||||
}
|
||||
|
||||
private:
|
||||
static size_t s_numAllocatedBytes;
|
||||
};
|
||||
|
||||
size_t TestAllocatorWrapper<RawMallocAllocator>::s_numAllocatedBytes = 0;
|
||||
|
||||
// Some allocator are not fully declared, those we simply setup from the schema
|
||||
class MallocSchemaAllocator : public AZ::SimpleSchemaAllocator<AZ::MallocSchema>
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(MallocSchemaAllocator, "{3E68224F-E676-402C-8276-CE4B49C05E89}");
|
||||
|
||||
MallocSchemaAllocator()
|
||||
: AZ::SimpleSchemaAllocator<AZ::MallocSchema>("MallocSchemaAllocator", "")
|
||||
{}
|
||||
};
|
||||
|
||||
// We use both this HphaSchemaAllocator and the SystemAllocator configured with Hpha because the SystemAllocator
|
||||
// has extra things
|
||||
class HphaSchemaAllocator : public AZ::SimpleSchemaAllocator<AZ::HphaSchema>
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(HphaSchemaAllocator, "{6563AB4B-A68E-4499-8C98-D61D640D1F7F}");
|
||||
|
||||
HphaSchemaAllocator()
|
||||
: AZ::SimpleSchemaAllocator<AZ::HphaSchema>("TestHphaSchemaAllocator", "")
|
||||
{}
|
||||
};
|
||||
|
||||
// For the SystemAllocator we inherit so we have a different stack. The SystemAllocator is used globally so we dont want
|
||||
// to get that data affecting the benchmark
|
||||
class TestSystemAllocator : public AZ::SystemAllocator
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(TestSystemAllocator, "{360D4DAA-D65D-4D5C-A6FA-1A4C5261C35C}");
|
||||
|
||||
TestSystemAllocator()
|
||||
: AZ::SystemAllocator()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// Allocated bytes reported by the allocator
|
||||
static const char* s_counterAllocatorMemory = "Allocator_Memory";
|
||||
|
||||
// Allocated bytes as counted by the benchmark
|
||||
static const char* s_counterBenchmarkMemory = "Benchmark_Memory";
|
||||
|
||||
enum AllocationSize
|
||||
{
|
||||
SMALL,
|
||||
BIG,
|
||||
MIXED,
|
||||
COUNT
|
||||
};
|
||||
|
||||
static const size_t s_kiloByte = 1024;
|
||||
static const size_t s_megaByte = s_kiloByte * s_kiloByte;
|
||||
using AllocationSizeArray = AZStd::array<size_t, 10>;
|
||||
static const AZStd::array<AllocationSizeArray, COUNT> s_allocationSizes = {
|
||||
/* SMALL */ AllocationSizeArray{ 2, 16, 20, 59, 100, 128, 160, 250, 300, 512 },
|
||||
/* BIG */ AllocationSizeArray{ 513, s_kiloByte, 2 * s_kiloByte, 4 * s_kiloByte, 10 * s_kiloByte, 64 * s_kiloByte, 128 * s_kiloByte, 200 * s_kiloByte, s_megaByte, 2 * s_megaByte },
|
||||
/* MIXED */ AllocationSizeArray{ 2, s_kiloByte, 59, 4 * s_kiloByte, 128, 200 * s_kiloByte, 250, s_megaByte, 512, 2 * s_megaByte }
|
||||
};
|
||||
|
||||
template <typename TAllocator>
|
||||
class AllocatorBenchmarkFixture
|
||||
: public ::benchmark::Fixture
|
||||
{
|
||||
protected:
|
||||
using TestAllocatorType = TestAllocatorWrapper<TAllocator>;
|
||||
|
||||
virtual void internalSetUp(const ::benchmark::State& state)
|
||||
{
|
||||
if (state.thread_index == 0) // Only setup in the first thread
|
||||
{
|
||||
TestAllocatorType::SetUp();
|
||||
|
||||
m_allocations.resize(state.threads);
|
||||
for (auto& perThreadAllocations : m_allocations)
|
||||
{
|
||||
perThreadAllocations.resize(state.range(0), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void internalTearDown(const ::benchmark::State& state)
|
||||
{
|
||||
if (state.thread_index == 0) // Only setup in the first thread
|
||||
{
|
||||
m_allocations.clear();
|
||||
m_allocations.shrink_to_fit();
|
||||
|
||||
TestAllocatorType::TearDown();
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::vector<void*>& GetPerThreadAllocations(size_t threadIndex)
|
||||
{
|
||||
return m_allocations[threadIndex];
|
||||
}
|
||||
|
||||
public:
|
||||
void SetUp(const ::benchmark::State& state) override
|
||||
{
|
||||
internalSetUp(state);
|
||||
}
|
||||
void SetUp(::benchmark::State& state) override
|
||||
{
|
||||
internalSetUp(state);
|
||||
}
|
||||
|
||||
void TearDown(const ::benchmark::State& state) override
|
||||
{
|
||||
internalTearDown(state);
|
||||
}
|
||||
void TearDown(::benchmark::State& state) override
|
||||
{
|
||||
internalTearDown(state);
|
||||
}
|
||||
|
||||
private:
|
||||
AZStd::vector<AZStd::vector<void*>> m_allocations;
|
||||
};
|
||||
|
||||
template <typename TAllocator, AllocationSize TAllocationSize>
|
||||
class AllocationBenchmarkFixture
|
||||
: public AllocatorBenchmarkFixture<TAllocator>
|
||||
{
|
||||
using base = AllocatorBenchmarkFixture<TAllocator>;
|
||||
using TestAllocatorType = typename base::TestAllocatorType;
|
||||
|
||||
public:
|
||||
void Benchmark(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
state.PauseTiming();
|
||||
|
||||
AZStd::vector<void*>& perThreadAllocations = base::GetPerThreadAllocations(state.thread_index);
|
||||
const size_t numberOfAllocations = perThreadAllocations.size();
|
||||
size_t totalAllocationSize = 0;
|
||||
for (size_t allocationIndex = 0; allocationIndex < numberOfAllocations; ++allocationIndex)
|
||||
{
|
||||
const AllocationSizeArray& allocationArray = s_allocationSizes[TAllocationSize];
|
||||
const size_t allocationSize = allocationArray[allocationIndex % allocationArray.size()];
|
||||
totalAllocationSize += allocationSize;
|
||||
|
||||
state.ResumeTiming();
|
||||
perThreadAllocations[allocationIndex] = TestAllocatorType::Allocate(allocationSize, 0);
|
||||
state.PauseTiming();
|
||||
}
|
||||
|
||||
state.counters[s_counterAllocatorMemory] = benchmark::Counter(static_cast<double>(TestAllocatorType::NumAllocatedBytes()), benchmark::Counter::kDefaults);
|
||||
state.counters[s_counterBenchmarkMemory] = benchmark::Counter(static_cast<double>(totalAllocationSize), benchmark::Counter::kDefaults);
|
||||
|
||||
for (size_t allocationIndex = 0; allocationIndex < numberOfAllocations; ++allocationIndex)
|
||||
{
|
||||
const AllocationSizeArray& allocationArray = s_allocationSizes[TAllocationSize];
|
||||
const size_t allocationSize = allocationArray[allocationIndex % allocationArray.size()];
|
||||
TestAllocatorType::DeAllocate(perThreadAllocations[allocationIndex], allocationSize);
|
||||
perThreadAllocations[allocationIndex] = nullptr;
|
||||
}
|
||||
TestAllocatorType::GarbageCollect();
|
||||
|
||||
state.SetItemsProcessed(numberOfAllocations);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename TAllocator, AllocationSize TAllocationSize>
|
||||
class DeAllocationBenchmarkFixture
|
||||
: public AllocatorBenchmarkFixture<TAllocator>
|
||||
{
|
||||
using base = AllocatorBenchmarkFixture<TAllocator>;
|
||||
using TestAllocatorType = typename base::TestAllocatorType;
|
||||
|
||||
public:
|
||||
void Benchmark(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
state.PauseTiming();
|
||||
AZStd::vector<void*>& perThreadAllocations = base::GetPerThreadAllocations(state.thread_index);
|
||||
|
||||
const size_t numberOfAllocations = perThreadAllocations.size();
|
||||
size_t totalAllocationSize = 0;
|
||||
for (size_t allocationIndex = 0; allocationIndex < numberOfAllocations; ++allocationIndex)
|
||||
{
|
||||
const AllocationSizeArray& allocationArray = s_allocationSizes[TAllocationSize];
|
||||
const size_t allocationSize = allocationArray[allocationIndex % allocationArray.size()];
|
||||
totalAllocationSize += allocationSize;
|
||||
perThreadAllocations[allocationIndex] = TestAllocatorType::Allocate(allocationSize, 0);
|
||||
}
|
||||
|
||||
for (size_t allocationIndex = 0; allocationIndex < numberOfAllocations; ++allocationIndex)
|
||||
{
|
||||
const AllocationSizeArray& allocationArray = s_allocationSizes[TAllocationSize];
|
||||
const size_t allocationSize = allocationArray[allocationIndex % allocationArray.size()];
|
||||
state.ResumeTiming();
|
||||
TestAllocatorType::DeAllocate(perThreadAllocations[allocationIndex], allocationSize);
|
||||
state.PauseTiming();
|
||||
perThreadAllocations[allocationIndex] = nullptr;
|
||||
}
|
||||
|
||||
state.counters[s_counterAllocatorMemory] = benchmark::Counter(static_cast<double>(TestAllocatorType::NumAllocatedBytes()), benchmark::Counter::kDefaults);
|
||||
state.counters[s_counterBenchmarkMemory] = benchmark::Counter(static_cast<double>(totalAllocationSize), benchmark::Counter::kDefaults);
|
||||
|
||||
state.SetItemsProcessed(numberOfAllocations);
|
||||
|
||||
TestAllocatorType::GarbageCollect();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TAllocator>
|
||||
class RecordedAllocationBenchmarkFixture : public ::benchmark::Fixture
|
||||
{
|
||||
using TestAllocatorType = TestAllocatorWrapper<TAllocator>;
|
||||
|
||||
virtual void internalSetUp()
|
||||
{
|
||||
TestAllocatorType::SetUp();
|
||||
}
|
||||
|
||||
void internalTearDown()
|
||||
{
|
||||
TestAllocatorType::TearDown();
|
||||
}
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct alignas(1) AllocatorOperation
|
||||
{
|
||||
enum OperationType : size_t
|
||||
{
|
||||
ALLOCATE,
|
||||
DEALLOCATE
|
||||
};
|
||||
OperationType m_type : 1;
|
||||
size_t m_size : 28; // Can represent up to 256Mb requests
|
||||
size_t m_alignment : 7; // Can represent up to 128 alignment
|
||||
size_t m_recordId : 28; // Can represent up to 256M simultaneous requests, we reuse ids
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(AllocatorOperation) == 8);
|
||||
|
||||
public:
|
||||
void SetUp(const ::benchmark::State&) override
|
||||
{
|
||||
internalSetUp();
|
||||
}
|
||||
void SetUp(::benchmark::State&) override
|
||||
{
|
||||
internalSetUp();
|
||||
}
|
||||
|
||||
void TearDown(const ::benchmark::State&) override
|
||||
{
|
||||
internalTearDown();
|
||||
}
|
||||
void TearDown(::benchmark::State&) override
|
||||
{
|
||||
internalTearDown();
|
||||
}
|
||||
|
||||
void Benchmark(benchmark::State& state)
|
||||
{
|
||||
for (auto _ : state)
|
||||
{
|
||||
state.PauseTiming();
|
||||
|
||||
AZStd::unordered_map<size_t, void*> pointerRemapping;
|
||||
constexpr size_t allocationOperationCount = 5 * 1024;
|
||||
AZStd::array<AllocatorOperation, allocationOperationCount> m_operations = {};
|
||||
[[maybe_unused]] const size_t operationSize = sizeof(AllocatorOperation);
|
||||
|
||||
size_t totalAllocationSize = 0;
|
||||
size_t itemsProcessed = 0;
|
||||
|
||||
for (size_t i = 0; i < 100; ++i) // play the recording multiple times to get a good stable sample, this way we can keep a smaller recording
|
||||
{
|
||||
AZ::IO::SystemFile file;
|
||||
AZ::IO::FixedMaxPathString filePath = AZ::Utils::GetExecutableDirectory();
|
||||
filePath += "/Tests/AzCore/Memory/AllocatorBenchmarkRecordings.bin";
|
||||
if (!file.Open(filePath.c_str(), AZ::IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
size_t elementsRead =
|
||||
file.Read(sizeof(AllocatorOperation) * allocationOperationCount, &m_operations) / sizeof(AllocatorOperation);
|
||||
itemsProcessed += elementsRead;
|
||||
|
||||
while (elementsRead > 0)
|
||||
{
|
||||
for (size_t operationIndex = 0; operationIndex < elementsRead; ++operationIndex)
|
||||
{
|
||||
const AllocatorOperation& operation = m_operations[operationIndex];
|
||||
if (operation.m_type == AllocatorOperation::ALLOCATE)
|
||||
{
|
||||
const auto it = pointerRemapping.emplace(operation.m_recordId, nullptr);
|
||||
if (it.second) // otherwise already allocated
|
||||
{
|
||||
state.ResumeTiming();
|
||||
void* ptr = TestAllocatorType::Allocate(operation.m_size, operation.m_alignment);
|
||||
state.PauseTiming();
|
||||
totalAllocationSize += operation.m_size;
|
||||
it.first->second = ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Doing a resize, dont account for this memory change, this operation is rare and we dont have
|
||||
// the size of the previous allocation
|
||||
state.ResumeTiming();
|
||||
TestAllocatorType::Resize(it.first->second, operation.m_size);
|
||||
state.PauseTiming();
|
||||
}
|
||||
}
|
||||
else // AllocatorOperation::DEALLOCATE:
|
||||
{
|
||||
if (operation.m_recordId)
|
||||
{
|
||||
const auto ptrIt = pointerRemapping.find(operation.m_recordId);
|
||||
if (ptrIt != pointerRemapping.end())
|
||||
{
|
||||
totalAllocationSize -= operation.m_size;
|
||||
state.ResumeTiming();
|
||||
TestAllocatorType::DeAllocate(
|
||||
ptrIt->second,
|
||||
/*operation.m_size*/ 0); // size is not correct after a resize, a 0 size deals with it
|
||||
state.PauseTiming();
|
||||
pointerRemapping.erase(ptrIt);
|
||||
}
|
||||
}
|
||||
else // deallocate(nullptr) are recorded
|
||||
{
|
||||
// Just to account of the call of deallocate(nullptr);
|
||||
state.ResumeTiming();
|
||||
TestAllocatorType::DeAllocate(nullptr, /*operation.m_size*/ 0);
|
||||
state.PauseTiming();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elementsRead =
|
||||
file.Read(sizeof(AllocatorOperation) * allocationOperationCount, &m_operations) / sizeof(AllocatorOperation);
|
||||
itemsProcessed += elementsRead;
|
||||
}
|
||||
file.Close();
|
||||
|
||||
// Deallocate the remainder (since we stopped the recording middle-game)(there are leaks as well)
|
||||
for (const auto& pointerMapping : pointerRemapping)
|
||||
{
|
||||
state.ResumeTiming();
|
||||
TestAllocatorType::DeAllocate(pointerMapping.second);
|
||||
state.PauseTiming();
|
||||
}
|
||||
itemsProcessed += pointerRemapping.size();
|
||||
pointerRemapping.clear();
|
||||
}
|
||||
|
||||
state.counters[s_counterAllocatorMemory] = benchmark::Counter(static_cast<double>(TestAllocatorType::NumAllocatedBytes()), benchmark::Counter::kDefaults);
|
||||
state.counters[s_counterBenchmarkMemory] = benchmark::Counter(static_cast<double>(totalAllocationSize), benchmark::Counter::kDefaults);
|
||||
|
||||
state.SetItemsProcessed(itemsProcessed);
|
||||
|
||||
TestAllocatorType::GarbageCollect();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// For non-threaded ranges, run 100, 400, 1600 amounts
|
||||
static void RunRanges(benchmark::internal::Benchmark* b)
|
||||
{
|
||||
for (int i = 0; i < 6; i += 2)
|
||||
{
|
||||
b->Arg((1 << i) * 100);
|
||||
}
|
||||
}
|
||||
static void RecordedRunRanges(benchmark::internal::Benchmark* b)
|
||||
{
|
||||
b->Iterations(1);
|
||||
}
|
||||
|
||||
// For threaded ranges, run just 200, multi-threaded will already multiply by thread
|
||||
static void ThreadedRunRanges(benchmark::internal::Benchmark* b)
|
||||
{
|
||||
b->Arg(100);
|
||||
}
|
||||
|
||||
// Test under and over-subscription of threads vs the amount of CPUs available
|
||||
static const unsigned int MaxThreadRange = 2 * AZStd::thread::hardware_concurrency();
|
||||
|
||||
#define BM_REGISTER_TEMPLATE(FIXTURE, TESTNAME, ...) \
|
||||
BENCHMARK_TEMPLATE_DEFINE_F(FIXTURE, TESTNAME, __VA_ARGS__)(benchmark::State& state) { Benchmark(state); } \
|
||||
BENCHMARK_REGISTER_F(FIXTURE, TESTNAME)
|
||||
|
||||
// We test small/big/mixed allocations in single-threaded environments. For multi-threaded environments, we test mixed since
|
||||
// the multi threaded fixture will run multiple passes (1, 2, 4, ... until 2*hardware_concurrency)
|
||||
#define BM_REGISTER_SIZE_FIXTURES(FIXTURE, TESTNAME, ALLOCATORTYPE) \
|
||||
BM_REGISTER_TEMPLATE(FIXTURE, TESTNAME##_SMALL, ALLOCATORTYPE, SMALL)->Apply(RunRanges); \
|
||||
BM_REGISTER_TEMPLATE(FIXTURE, TESTNAME##_BIG, ALLOCATORTYPE, BIG)->Apply(RunRanges); \
|
||||
BM_REGISTER_TEMPLATE(FIXTURE, TESTNAME##_MIXED, ALLOCATORTYPE, MIXED)->Apply(RunRanges); \
|
||||
BM_REGISTER_TEMPLATE(FIXTURE, TESTNAME##_MIXED_THREADED, ALLOCATORTYPE, MIXED)->ThreadRange(2, MaxThreadRange)->Apply(ThreadedRunRanges);
|
||||
|
||||
#define BM_REGISTER_ALLOCATOR(TESTNAME, ALLOCATORTYPE) \
|
||||
namespace BM_##TESTNAME \
|
||||
{ \
|
||||
BM_REGISTER_SIZE_FIXTURES(AllocationBenchmarkFixture, TESTNAME, ALLOCATORTYPE); \
|
||||
BM_REGISTER_SIZE_FIXTURES(DeAllocationBenchmarkFixture, TESTNAME, ALLOCATORTYPE); \
|
||||
BM_REGISTER_TEMPLATE(RecordedAllocationBenchmarkFixture, TESTNAME, ALLOCATORTYPE)->Apply(RecordedRunRanges); \
|
||||
}
|
||||
|
||||
/// Warm up benchmark used to prepare the OS for allocations. Most OS keep allocations for a process somehow
|
||||
/// reserved. So the first allocations run always get a bigger impact in a process. This warm up allocator runs
|
||||
/// all the benchmarks and is just used for the the next allocators to report more consistent results.
|
||||
BM_REGISTER_ALLOCATOR(WarmUpAllocator, RawMallocAllocator);
|
||||
|
||||
BM_REGISTER_ALLOCATOR(RawMallocAllocator, RawMallocAllocator);
|
||||
BM_REGISTER_ALLOCATOR(MallocSchemaAllocator, MallocSchemaAllocator);
|
||||
BM_REGISTER_ALLOCATOR(HphaSchemaAllocator, HphaSchemaAllocator);
|
||||
BM_REGISTER_ALLOCATOR(SystemAllocator, TestSystemAllocator);
|
||||
|
||||
//BM_REGISTER_ALLOCATOR(BestFitExternalMapAllocator, BestFitExternalMapAllocator); // Requires to pre-allocate blocks and cannot work as a general-purpose allocator
|
||||
//BM_REGISTER_ALLOCATOR(HeapSchemaAllocator, TestHeapSchemaAllocator); // Requires to pre-allocate blocks and cannot work as a general-purpose allocator
|
||||
//BM_REGISTER_SCHEMA(PoolSchema); // Requires special alignment requests while allocating
|
||||
|
||||
#undef BM_REGISTER_ALLOCATOR
|
||||
#undef BM_REGISTER_SIZE_FIXTURES
|
||||
#undef BM_REGISTER_TEMPLATE
|
||||
|
||||
} // Benchmark
|
||||
|
||||
#endif // HAVE_BENCHMARK
|
||||
@@ -10,10 +10,6 @@
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#if defined(HAVE_BENCHMARK)
|
||||
#include <benchmark/benchmark.h>
|
||||
#endif // HAVE_BENCHMARK
|
||||
|
||||
class HphaSchema_TestAllocator
|
||||
: public AZ::SimpleSchemaAllocator<AZ::HphaSchema>
|
||||
{
|
||||
@@ -112,87 +108,3 @@ namespace UnitTest
|
||||
HphaSchemaTestFixture,
|
||||
::testing::ValuesIn(s_mixedInstancesParameters));
|
||||
}
|
||||
|
||||
|
||||
#if defined(HAVE_BENCHMARK)
|
||||
namespace Benchmark
|
||||
{
|
||||
class HphaSchemaBenchmarkFixture
|
||||
: public ::benchmark::Fixture
|
||||
{
|
||||
void internalSetUp()
|
||||
{
|
||||
AZ::AllocatorInstance<HphaSchema_TestAllocator>::Create();
|
||||
}
|
||||
|
||||
void internalTearDown()
|
||||
{
|
||||
AZ::AllocatorInstance<HphaSchema_TestAllocator>::Destroy();
|
||||
}
|
||||
|
||||
public:
|
||||
void SetUp(const benchmark::State&) override
|
||||
{
|
||||
internalSetUp();
|
||||
}
|
||||
void SetUp(benchmark::State&) override
|
||||
{
|
||||
internalSetUp();
|
||||
}
|
||||
void TearDown(const benchmark::State&) override
|
||||
{
|
||||
internalTearDown();
|
||||
}
|
||||
void TearDown(benchmark::State&) override
|
||||
{
|
||||
internalTearDown();
|
||||
}
|
||||
|
||||
static void BM_Allocations(benchmark::State& state, const AllocationSizeArray& allocationArray)
|
||||
{
|
||||
AZStd::vector<void*> allocations;
|
||||
while (state.KeepRunning())
|
||||
{
|
||||
state.PauseTiming();
|
||||
const size_t allocationIndex = allocations.size();
|
||||
const size_t allocationSize = allocationArray[allocationIndex % allocationArray.size()];
|
||||
|
||||
state.ResumeTiming();
|
||||
void* allocation = AZ::AllocatorInstance<HphaSchema_TestAllocator>::Get().Allocate(allocationSize, 0);
|
||||
|
||||
state.PauseTiming();
|
||||
allocations.emplace_back(allocation);
|
||||
|
||||
state.ResumeTiming();
|
||||
}
|
||||
|
||||
const size_t numberOfAllocations = allocations.size();
|
||||
state.SetItemsProcessed(numberOfAllocations);
|
||||
|
||||
for (size_t allocationIndex = 0; allocationIndex < numberOfAllocations; ++allocationIndex)
|
||||
{
|
||||
AZ::AllocatorInstance<HphaSchema_TestAllocator>::Get().DeAllocate(allocations[allocationIndex], allocationArray[allocationIndex % allocationArray.size()]);
|
||||
}
|
||||
AZ::AllocatorInstance<HphaSchema_TestAllocator>::Get().GarbageCollect();
|
||||
}
|
||||
};
|
||||
|
||||
// Small allocations, these are allocations that are going to end up in buckets in the HphaSchema
|
||||
BENCHMARK_F(HphaSchemaBenchmarkFixture, SmallAllocations)(benchmark::State& state)
|
||||
{
|
||||
BM_Allocations(state, s_smallAllocationSizes);
|
||||
}
|
||||
|
||||
BENCHMARK_F(HphaSchemaBenchmarkFixture, BigAllocations)(benchmark::State& state)
|
||||
{
|
||||
BM_Allocations(state, s_bigAllocationSizes);
|
||||
}
|
||||
|
||||
BENCHMARK_F(HphaSchemaBenchmarkFixture, MixedAllocations)(benchmark::State& state)
|
||||
{
|
||||
BM_Allocations(state, s_mixedAllocationSizes);
|
||||
}
|
||||
|
||||
|
||||
} // Benchmark
|
||||
#endif // HAVE_BENCHMARK
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
namespace Benchmark
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
size_t GetProcessMemoryUsageBytes()
|
||||
{
|
||||
struct rusage rusage;
|
||||
getrusage(RUSAGE_SELF, &rusage);
|
||||
return rusage.ru_maxrss * 1024L;
|
||||
}
|
||||
|
||||
size_t GetMemorySize(void* memory)
|
||||
{
|
||||
return memory ? malloc_usable_size(memory) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,5 @@
|
||||
|
||||
set(FILES
|
||||
Tests/UtilsTests_Android.cpp
|
||||
Tests/Memory/AllocatorBenchmarks_Android.cpp
|
||||
)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
namespace Benchmark
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
size_t GetProcessMemoryUsageBytes()
|
||||
{
|
||||
struct rusage rusage;
|
||||
getrusage(RUSAGE_SELF, &rusage);
|
||||
return rusage.ru_maxrss * 1024L;
|
||||
}
|
||||
|
||||
size_t GetMemorySize(void* memory)
|
||||
{
|
||||
return memory ? malloc_usable_size(memory) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,5 @@
|
||||
set(FILES
|
||||
Tests/UtilsTests_Linux.cpp
|
||||
../Common/UnixLike/Tests/UtilsTests_UnixLike.cpp
|
||||
Tests/Memory/AllocatorBenchmarks_Linux.cpp
|
||||
)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
|
||||
#include <malloc/malloc.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
namespace Benchmark
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
size_t GetProcessMemoryUsageBytes()
|
||||
{
|
||||
struct rusage rusage;
|
||||
getrusage(RUSAGE_SELF, &rusage);
|
||||
return rusage.ru_maxrss;
|
||||
}
|
||||
|
||||
size_t GetMemorySize(void* memory)
|
||||
{
|
||||
return memory ? malloc_size(memory) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,5 @@
|
||||
set(FILES
|
||||
../Common/Apple/Tests/UtilsTests_Apple.cpp
|
||||
../Common/UnixLike/Tests/UtilsTests_UnixLike.cpp
|
||||
Tests/Memory/AllocatorBenchmarks_Mac.cpp
|
||||
)
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <psapi.h>
|
||||
|
||||
namespace Benchmark
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
size_t GetProcessMemoryUsageBytes()
|
||||
{
|
||||
EmptyWorkingSet(GetCurrentProcess());
|
||||
|
||||
size_t memoryUsage = 0;
|
||||
MEMORY_BASIC_INFORMATION mbi = { 0 };
|
||||
unsigned char* pEndRegion = nullptr;
|
||||
while (sizeof(mbi) == VirtualQuery(pEndRegion, &mbi, sizeof(mbi))) {
|
||||
pEndRegion += mbi.RegionSize;
|
||||
if ((mbi.AllocationProtect & PAGE_READWRITE) && (mbi.State & MEM_COMMIT)) {
|
||||
memoryUsage += mbi.RegionSize;
|
||||
}
|
||||
}
|
||||
return memoryUsage;
|
||||
}
|
||||
|
||||
size_t GetMemorySize(void* memory)
|
||||
{
|
||||
return memory ? _aligned_msize(memory, 1, 0) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
set(FILES
|
||||
../Common/WinAPI/Tests/UtilsTests_WinAPI.cpp
|
||||
Tests/IO/Streamer/StorageDriveTests_Windows.cpp
|
||||
Tests/Memory/AllocatorBenchmarks_Windows.cpp
|
||||
Tests/Memory/OverrunDetectionAllocator_Windows.cpp
|
||||
Tests/Serialization_Windows.cpp
|
||||
)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <AzCore/Math/Obb.h>
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
|
||||
#include <Math/MathTest.h>
|
||||
|
||||
using namespace AZ;
|
||||
|
||||
namespace UnitTest
|
||||
@@ -1409,13 +1411,17 @@ namespace UnitTest
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().y,-1)");
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().z,0)");
|
||||
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
script->Execute("pl:Set(12, 13, 14, 15)");
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetDistance(), 15)");
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().x, 12)");
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().y, 13)");
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().z, 14)");
|
||||
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
script->Execute("pl:Set(Vector3(22, 23, 24), 25)");
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetDistance(), 25)");
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().x, 22)");
|
||||
script->Execute("AZTestAssertFloatClose(pl:GetNormal().y, 23)");
|
||||
@@ -1493,7 +1499,9 @@ namespace UnitTest
|
||||
|
||||
script->Execute("pl:Set(1, 0, 0, 0)");
|
||||
script->Execute("AZTestAssert(pl:IsFinite())");
|
||||
AZ_MATH_TEST_START_TRACE_SUPPRESSION;
|
||||
script->Execute("pl:Set(math.huge, math.huge, math.huge, math.huge)");
|
||||
AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
script->Execute("AZTestAssert( not pl:IsFinite())");
|
||||
}
|
||||
|
||||
|
||||
@@ -327,17 +327,13 @@ namespace JsonSerializationTests
|
||||
SerializerWithOneType::Unreflect(m_jsonRegistrationContext.get());
|
||||
}
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
using JsonSerializationDeathTests = JsonRegistrationContextTests;
|
||||
TEST_F(JsonSerializationDeathTests, DoubleUnregisterSerializer_Asserts)
|
||||
TEST_F(JsonRegistrationContextTests, DoubleUnregisterSerializer_Asserts)
|
||||
{
|
||||
ASSERT_DEATH({
|
||||
SerializerWithOneType::Reflect(m_jsonRegistrationContext.get());
|
||||
SerializerWithOneType::Unreflect(m_jsonRegistrationContext.get());
|
||||
SerializerWithOneType::Unreflect(m_jsonRegistrationContext.get());
|
||||
}, ".*"
|
||||
);
|
||||
SerializerWithOneType::Reflect(m_jsonRegistrationContext.get());
|
||||
SerializerWithOneType::Unreflect(m_jsonRegistrationContext.get());
|
||||
AZ_TEST_START_ASSERTTEST;
|
||||
SerializerWithOneType::Unreflect(m_jsonRegistrationContext.get());
|
||||
AZ_TEST_STOP_ASSERTTEST(1);
|
||||
}
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
} //namespace JsonSerializationTests
|
||||
|
||||
@@ -148,6 +148,7 @@ set(FILES
|
||||
Math/Matrix4x4PerformanceTests.cpp
|
||||
Math/Matrix4x4Tests.cpp
|
||||
Math/MatrixUtilsTests.cpp
|
||||
Math/MathTest.h
|
||||
Math/MathTestData.h
|
||||
Math/ObbPerformanceTests.cpp
|
||||
Math/ObbTests.cpp
|
||||
@@ -170,6 +171,7 @@ set(FILES
|
||||
Math/Vector3Tests.cpp
|
||||
Math/Vector4PerformanceTests.cpp
|
||||
Math/Vector4Tests.cpp
|
||||
Memory/AllocatorBenchmarks.cpp
|
||||
Memory/AllocatorManager.cpp
|
||||
Memory/HphaSchema.cpp
|
||||
Memory/HphaSchemaErrorDetection.cpp
|
||||
|
||||
@@ -270,8 +270,6 @@ set(FILES
|
||||
Physics/WindBus.h
|
||||
Process/ProcessCommunicator.cpp
|
||||
Process/ProcessCommunicator.h
|
||||
Process/ProcessWatcher.cpp
|
||||
Process/ProcessWatcher.h
|
||||
Process/ProcessCommon_fwd.h
|
||||
Process/ProcessCommunicator.h
|
||||
Process/ProcessWatcher.cpp
|
||||
|
||||
+5
@@ -83,4 +83,9 @@ namespace AzFramework
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AZStd::string ProcessLauncher::ProcessLaunchInfo::GetCommandLineParametersAsString() const
|
||||
{
|
||||
return AZStd::string{};
|
||||
}
|
||||
} //namespace AzFramework
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
||||
|
||||
#include <AzCore/PlatformDef.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4996, "-Wunknown-warning-option")
|
||||
#include <aws/core/utils/logging/LogSystemInterface.h>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
||||
#include <aws/core/utils/memory/MemorySystemInterface.h>
|
||||
#else
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <AzCore/Module/Environment.h>
|
||||
|
||||
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
// The AWS Native SDK AWSAllocator triggers a warning due to accessing members of std::allocator directly.
|
||||
// AWSAllocator.h(70): warning C4996: 'std::allocator<T>::pointer': warning STL4010: Various members of std::allocator are deprecated in C++17.
|
||||
// Use std::allocator_traits instead of accessing these members directly.
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <AssetBuilderInfo.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <Entity/EntityUtilityComponent.h>
|
||||
#include <AssetBuilderStatic.h>
|
||||
|
||||
namespace AssetBuilder
|
||||
{
|
||||
@@ -165,6 +166,7 @@ void AssetBuilderApplication::StartCommon(AZ::Entity* systemEntity)
|
||||
|
||||
AssetBuilderSDK::InitializeSerializationContext();
|
||||
AssetBuilderSDK::InitializeBehaviorContext();
|
||||
AssetBuilder::InitializeSerializationContext();
|
||||
// the asset builder app never writes source files, only assets, so there is no need to do any kind of asset upgrading
|
||||
AZ::Data::AssetManager::Instance().SetAssetInfoUpgradingEnabled(false);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzFramework/Asset/AssetSystemComponent.h>
|
||||
#include <ToolsComponents/ToolsAssetCatalogComponent.h>
|
||||
#include <AssetBuilderStatic.h>
|
||||
|
||||
// Command-line parameter options:
|
||||
static const char* const s_paramHelp = "help"; // Print help information.
|
||||
@@ -51,10 +52,10 @@ static const char* const s_paramDebugCreate = "debug_create"; // Debug mode for
|
||||
static const char* const s_paramDebugProcess = "debug_process"; // Debug mode for the process job of the specified file.
|
||||
static const char* const s_paramPlatformTags = "tags"; // Additional list of tags to add platform tag list.
|
||||
static const char* const s_paramPlatform = "platform"; // Platform to use
|
||||
static const char* const s_paramRegisterBuilders = "register"; // Indicates the AP is starting up and requesting a list of registered builders
|
||||
|
||||
// Task modes:
|
||||
static const char* const s_taskResident = "resident"; // stays up and running indefinitely, accepting jobs via network connection
|
||||
static const char* const s_taskRegisterBuilder = "register"; // outputs all the builder descriptors
|
||||
static const char* const s_taskCreateJob = "create"; // runs a builders createJobs function
|
||||
static const char* const s_taskProcessJob = "process"; // runs processJob function
|
||||
static const char* const s_taskDebug = "debug"; // runs a one shot job in a fake environment for a specified file.
|
||||
@@ -204,6 +205,40 @@ void AssetBuilderComponent::Reflect(AZ::ReflectContext* context)
|
||||
}
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::DoHelloPing()
|
||||
{
|
||||
using namespace AssetBuilder;
|
||||
|
||||
BuilderHelloRequest request;
|
||||
BuilderHelloResponse response;
|
||||
|
||||
AZStd::string id;
|
||||
|
||||
if (!GetParameter(s_paramId, id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
request.m_uuid = AZ::Uuid::CreateString(id.c_str());
|
||||
|
||||
AZ_TracePrintf(
|
||||
"AssetBuilderComponent", "RunInResidentMode: Pinging asset processor with the builder UUID %s\n",
|
||||
request.m_uuid.ToString<AZStd::string>().c_str());
|
||||
|
||||
bool result = AzFramework::AssetSystem::SendRequest(request, response);
|
||||
|
||||
AZ_Error("AssetBuilder", result, "Failed to send hello request to Asset Processor");
|
||||
// This error is only shown if we successfully got a response AND the response explicitly indicates the AP rejected the builder
|
||||
AZ_Error("AssetBuilder", !result || response.m_accepted, "Asset Processor rejected connection request");
|
||||
|
||||
if (result)
|
||||
{
|
||||
AZ_TracePrintf("AssetBuilder", "Builder ID: %s\n", response.m_uuid.ToString<AZStd::string>().c_str());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::Run()
|
||||
{
|
||||
AZ_TracePrintf("AssetBuilderComponent", "Run: Parsing command line.\n");
|
||||
@@ -217,8 +252,8 @@ bool AssetBuilderComponent::Run()
|
||||
}
|
||||
|
||||
AZStd::string task;
|
||||
|
||||
AZStd::string debugFile;
|
||||
|
||||
if (GetParameter(s_paramDebug, debugFile, false))
|
||||
{
|
||||
task = s_taskDebug;
|
||||
@@ -256,11 +291,13 @@ bool AssetBuilderComponent::Run()
|
||||
AZ_TracePrintf("AssetBuilderComponent", "Run: Connecting back to Asset Processor...\n");
|
||||
bool connectedToAssetProcessor = ConnectToAssetProcessor();
|
||||
//AP connection is required to access the asset catalog
|
||||
AZ_Error("AssetBuilder", connectedToAssetProcessor, "Failed to establish a network connection to the AssetProcessor. Use -help for options.");;
|
||||
AZ_Error("AssetBuilder", connectedToAssetProcessor, "Failed to establish a network connection to the AssetProcessor. Use -help for options.");
|
||||
|
||||
bool registerBuilders = commandLine->GetNumSwitchValues(s_paramRegisterBuilders) > 0;
|
||||
|
||||
IBuilderApplication* builderApplication = AZ::Interface<IBuilderApplication>::Get();
|
||||
|
||||
if(!builderApplication)
|
||||
if (!builderApplication)
|
||||
{
|
||||
AZ_Error("AssetBuilder", false, "Failed to retreive IBuilderApplication interface");
|
||||
return false;
|
||||
@@ -274,7 +311,7 @@ bool AssetBuilderComponent::Run()
|
||||
{
|
||||
if (task == s_taskResident)
|
||||
{
|
||||
result = RunInResidentMode();
|
||||
result = RunInResidentMode(registerBuilders);
|
||||
}
|
||||
else if (task == s_taskDebug)
|
||||
{
|
||||
@@ -370,43 +407,46 @@ bool AssetBuilderComponent::ConnectToAssetProcessor()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool AssetBuilderComponent::RunInResidentMode()
|
||||
bool AssetBuilderComponent::SendRegisteredBuildersToAp()
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
AssetBuilder::BuilderRegistrationRequest registrationRequest;
|
||||
|
||||
for (const auto& [uuid, desc] : m_assetBuilderDescMap)
|
||||
{
|
||||
AssetBuilder::BuilderRegistration registration;
|
||||
|
||||
registration.m_name = desc->m_name;
|
||||
registration.m_analysisFingerprint = desc->m_analysisFingerprint;
|
||||
registration.m_flags = desc->m_flags;
|
||||
registration.m_flagsByJobKey = desc->m_flagsByJobKey;
|
||||
registration.m_version = desc->m_version;
|
||||
registration.m_busId = desc->m_busId;
|
||||
registration.m_patterns = desc->m_patterns;
|
||||
registration.m_productsToKeepOnFailure = desc->m_productsToKeepOnFailure;
|
||||
|
||||
registrationRequest.m_builders.push_back(AZStd::move(registration));
|
||||
}
|
||||
|
||||
bool result = SendRequest(registrationRequest);
|
||||
|
||||
AZ_Error("AssetBuilder", result, "Failed to send builder registration request to Asset Processor");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::RunInResidentMode(bool sendRegistration)
|
||||
{
|
||||
using namespace AssetBuilder;
|
||||
using namespace AZStd::placeholders;
|
||||
|
||||
AZ_TracePrintf("AssetBuilderComponent", "RunInResidentMode: Starting resident mode (waiting for commands to arrive)\n");
|
||||
|
||||
AZStd::string port, id, builderFolder;
|
||||
|
||||
if (!GetParameter(s_paramId, id)
|
||||
|| !GetParameter(s_paramModule, builderFolder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!LoadBuilders(builderFolder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AzFramework::SocketConnection::GetInstance()->AddMessageHandler(CreateJobsNetRequest::MessageType(), AZStd::bind(&AssetBuilderComponent::CreateJobsResidentHandler, this, _1, _2, _3, _4));
|
||||
AzFramework::SocketConnection::GetInstance()->AddMessageHandler(ProcessJobNetRequest::MessageType(), AZStd::bind(&AssetBuilderComponent::ProcessJobResidentHandler, this, _1, _2, _3, _4));
|
||||
|
||||
BuilderHelloRequest request;
|
||||
BuilderHelloResponse response;
|
||||
bool result = DoHelloPing() && ((sendRegistration && SendRegisteredBuildersToAp()) || !sendRegistration);
|
||||
|
||||
request.m_uuid = AZ::Uuid::CreateString(id.c_str());
|
||||
|
||||
AZ_TracePrintf("AssetBuilderComponent", "RunInResidentMode: Pinging asset processor with the builder UUID %s\n", request.m_uuid.ToString<AZStd::string>().c_str());
|
||||
|
||||
bool result = AzFramework::AssetSystem::SendRequest(request, response);
|
||||
|
||||
AZ_Error("AssetBuilder", result, "Failed to send hello request to Asset Processor");
|
||||
// This error is only shown if we successfully got a response AND the response explicitly indicates the AP rejected the builder
|
||||
AZ_Error("AssetBuilder", !result || response.m_accepted, "Asset Processor rejected connection request");
|
||||
|
||||
if (result && response.m_accepted)
|
||||
if (result)
|
||||
{
|
||||
m_running = true;
|
||||
|
||||
@@ -415,7 +455,6 @@ bool AssetBuilderComponent::RunInResidentMode()
|
||||
|
||||
AzFramework::EngineConnectionEvents::Bus::Handler::BusConnect(); // Listen for disconnects
|
||||
|
||||
AZ_TracePrintf("AssetBuilder", "Builder ID: %s\n", response.m_uuid.ToString<AZStd::string>().c_str());
|
||||
AZ_TracePrintf("AssetBuilder", "Resident mode ready\n");
|
||||
m_mainEvent.acquire();
|
||||
AZ_TracePrintf("AssetBuilder", "Shutting down\n");
|
||||
@@ -736,11 +775,7 @@ bool AssetBuilderComponent::RunOneShotTask(const AZStd::string& task)
|
||||
|
||||
AZ::StringFunc::Path::Normalize(inputFilePath);
|
||||
AZ::StringFunc::Path::Normalize(outputFilePath);
|
||||
if (task == s_taskRegisterBuilder)
|
||||
{
|
||||
return HandleRegisterBuilder(inputFilePath, outputFilePath);
|
||||
}
|
||||
else if (task == s_taskCreateJob)
|
||||
if (task == s_taskCreateJob)
|
||||
{
|
||||
auto func = [this](const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response)
|
||||
{
|
||||
@@ -896,7 +931,7 @@ void AssetBuilderComponent::JobThread()
|
||||
{
|
||||
case JobType::Create:
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
auto* netRequest = azrtti_cast<CreateJobsNetRequest*>(job->m_netRequest.get());
|
||||
auto* netResponse = azrtti_cast<CreateJobsNetResponse*>(job->m_netResponse.get());
|
||||
@@ -922,7 +957,7 @@ void AssetBuilderComponent::JobThread()
|
||||
}
|
||||
case JobType::Process:
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
AZ_TracePrintf("AssetBuilder", "Running processJob task\n");
|
||||
|
||||
@@ -981,14 +1016,14 @@ void AssetBuilderComponent::JobThread()
|
||||
|
||||
void AssetBuilderComponent::CreateJobsResidentHandler(AZ::u32 /*typeId*/, AZ::u32 serial, const void* data, AZ::u32 dataLength)
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
ResidentJobHandler<CreateJobsNetRequest, CreateJobsNetResponse>(serial, data, dataLength, JobType::Create);
|
||||
}
|
||||
|
||||
void AssetBuilderComponent::ProcessJobResidentHandler(AZ::u32 /*typeId*/, AZ::u32 serial, const void* data, AZ::u32 dataLength)
|
||||
{
|
||||
using namespace AssetBuilderSDK;
|
||||
using namespace AssetBuilder;
|
||||
|
||||
ResidentJobHandler<ProcessJobNetRequest, ProcessJobNetResponse>(serial, data, dataLength, JobType::Process);
|
||||
}
|
||||
@@ -1018,18 +1053,6 @@ bool AssetBuilderComponent::HandleTask(const AZStd::string& inputFilePath, const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetBuilderComponent::HandleRegisterBuilder(const AZStd::string& /*inputFilePath*/, const AZStd::string& outputFilePath) const
|
||||
{
|
||||
AssetBuilderSDK::RegisterBuilderResponse response;
|
||||
|
||||
for (const auto& pair : m_assetBuilderDescMap)
|
||||
{
|
||||
response.m_assetBuilderDescList.push_back(*pair.second);
|
||||
}
|
||||
|
||||
return AZ::Utils::SaveObjectToFile(outputFilePath, AZ::DataStream::ST_XML, &response);
|
||||
}
|
||||
|
||||
void AssetBuilderComponent::UpdateResultCode(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const
|
||||
{
|
||||
if (request.m_jobDescription.m_failOnError)
|
||||
|
||||
@@ -46,6 +46,7 @@ class AssetBuilderComponent
|
||||
public:
|
||||
AZ_COMPONENT(AssetBuilderComponent, "{04332899-5d73-4d41-86b7-b1017d349673}")
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
bool DoHelloPing();
|
||||
|
||||
AssetBuilderComponent() = default;
|
||||
~AssetBuilderComponent() override = default;
|
||||
@@ -64,7 +65,7 @@ public:
|
||||
|
||||
void RegisterBuilderInformation(const AssetBuilderSDK::AssetBuilderDesc& builderDesc) override;
|
||||
void RegisterComponentDescriptor(AZ::ComponentDescriptor* descriptor) override;
|
||||
|
||||
|
||||
//EngineConnectionEvents Handler
|
||||
void Disconnected(AzFramework::SocketConnection* connection) override;
|
||||
|
||||
@@ -98,12 +99,13 @@ protected:
|
||||
static const char* GetLibraryExtension();
|
||||
|
||||
bool ConnectToAssetProcessor();
|
||||
bool SendRegisteredBuildersToAp();
|
||||
bool LoadBuilders(const AZStd::string& builderFolder);
|
||||
bool LoadBuilder(const AZStd::string& filePath);
|
||||
void UnloadBuilders();
|
||||
|
||||
//! Hooks up net job request handling and keeps the AssetBuilder running indefinitely
|
||||
bool RunInResidentMode();
|
||||
bool RunInResidentMode(bool sendRegistration);
|
||||
bool RunDebugTask(AZStd::string&& debugFile, bool runCreateJobs, bool runProcessJob);
|
||||
bool RunOneShotTask(const AZStd::string& task);
|
||||
|
||||
@@ -120,9 +122,6 @@ protected:
|
||||
|
||||
void ProcessJob(const AssetBuilderSDK::ProcessJobFunction& job, const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& outResponse);
|
||||
|
||||
//! Handles a builder registration request
|
||||
bool HandleRegisterBuilder(const AZStd::string& inputFilePath, const AZStd::string& outputFilePath) const;
|
||||
|
||||
//! If needed looks at collected data and updates the result code from the job accordingly.
|
||||
void UpdateResultCode(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const;
|
||||
|
||||
@@ -141,7 +140,7 @@ protected:
|
||||
|
||||
//! Currently loading builder
|
||||
AssetBuilder::ExternalModuleAssetBuilderInfo* m_currentAssetBuilder = nullptr;
|
||||
|
||||
|
||||
//! Thread for running a job, so we don't block the network thread while doing work
|
||||
AZStd::thread_desc m_jobThreadDesc;
|
||||
AZStd::thread m_jobThread;
|
||||
@@ -153,7 +152,7 @@ protected:
|
||||
AZStd::binary_semaphore m_mainEvent;
|
||||
//! Use to signal a new job is ready to be processed
|
||||
AZStd::binary_semaphore m_jobEvent;
|
||||
|
||||
|
||||
//! Lock for m_queuedJob
|
||||
AZStd::mutex m_jobMutex;
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* 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 <AssetBuilderStatic.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
|
||||
namespace AssetBuilder
|
||||
{
|
||||
void Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
BuilderRegistrationRequest::Reflect(context);
|
||||
|
||||
BuilderHelloRequest::Reflect(context);
|
||||
BuilderHelloResponse::Reflect(context);
|
||||
CreateJobsNetRequest::Reflect(context);
|
||||
CreateJobsNetResponse::Reflect(context);
|
||||
ProcessJobNetRequest::Reflect(context);
|
||||
ProcessJobNetResponse::Reflect(context);
|
||||
}
|
||||
|
||||
void InitializeSerializationContext()
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
|
||||
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
|
||||
AZ_Assert(serializeContext, "Unable to retrieve serialize context.");
|
||||
|
||||
Reflect(serializeContext);
|
||||
}
|
||||
|
||||
void BuilderHelloRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderHelloRequest>()->Version(1)->Field("UUID", &BuilderHelloRequest::m_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BuilderHelloRequest::MessageType()
|
||||
{
|
||||
static unsigned int messageType = AZ_CRC("AssetBuilderSDK::BuilderHelloRequest", 0x213a7248);
|
||||
|
||||
return messageType;
|
||||
}
|
||||
|
||||
unsigned int BuilderHelloRequest::GetMessageType() const
|
||||
{
|
||||
return MessageType();
|
||||
}
|
||||
|
||||
void BuilderHelloResponse::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderHelloResponse>()
|
||||
->Version(1)
|
||||
->Field("Accepted", &BuilderHelloResponse::m_accepted)
|
||||
->Field("UUID", &BuilderHelloResponse::m_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BuilderHelloResponse::GetMessageType() const
|
||||
{
|
||||
return BuilderHelloRequest::MessageType();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CreateJobsNetRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<CreateJobsNetRequest>()->Version(1)->Field("Request", &CreateJobsNetRequest::m_request);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CreateJobsNetRequest::MessageType()
|
||||
{
|
||||
static unsigned int messageType = AZ_CRC("AssetBuilderSDK::CreateJobsNetRequest", 0xc48209c0);
|
||||
|
||||
return messageType;
|
||||
}
|
||||
|
||||
unsigned int CreateJobsNetRequest::GetMessageType() const
|
||||
{
|
||||
return MessageType();
|
||||
}
|
||||
|
||||
void CreateJobsNetResponse::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<CreateJobsNetResponse>()->Version(1)->Field("Response", &CreateJobsNetResponse::m_response);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CreateJobsNetResponse::GetMessageType() const
|
||||
{
|
||||
return CreateJobsNetRequest::MessageType();
|
||||
}
|
||||
|
||||
void ProcessJobNetRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<ProcessJobNetRequest>()->Version(1)->Field("Request", &ProcessJobNetRequest::m_request);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ProcessJobNetRequest::MessageType()
|
||||
{
|
||||
static unsigned int messageType = AZ_CRC("AssetBuilderSDK::ProcessJobNetRequest", 0x479f340f);
|
||||
|
||||
return messageType;
|
||||
}
|
||||
|
||||
unsigned int ProcessJobNetRequest::GetMessageType() const
|
||||
{
|
||||
return MessageType();
|
||||
}
|
||||
|
||||
void ProcessJobNetResponse::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<ProcessJobNetResponse>()->Version(1)->Field("Response", &ProcessJobNetResponse::m_response);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ProcessJobNetResponse::GetMessageType() const
|
||||
{
|
||||
return ProcessJobNetRequest::MessageType();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
void BuilderRegistration::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderRegistration>()
|
||||
->Version(1)
|
||||
->Field("Name", &BuilderRegistration::m_name)
|
||||
->Field("Patterns", &BuilderRegistration::m_patterns)
|
||||
->Field("BusId", &BuilderRegistration::m_busId)
|
||||
->Field("Version", &BuilderRegistration::m_version)
|
||||
->Field("AnalysisFingerprint", &BuilderRegistration::m_analysisFingerprint)
|
||||
->Field("Flags", &BuilderRegistration::m_flags)
|
||||
->Field("FlagsByJobKey", &BuilderRegistration::m_flagsByJobKey)
|
||||
->Field("ProductsToKeepOnFailure", &BuilderRegistration::m_productsToKeepOnFailure);
|
||||
}
|
||||
}
|
||||
|
||||
void BuilderRegistrationRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
BuilderRegistration::Reflect(context);
|
||||
|
||||
auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<BuilderRegistrationRequest, BaseAssetProcessorMessage>()->Version(1)->Field(
|
||||
"Builders", &BuilderRegistrationRequest::m_builders);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BuilderRegistrationRequest::GetMessageType() const
|
||||
{
|
||||
return BuilderRegistrationRequest::MessageType;
|
||||
}
|
||||
|
||||
} // namespace AssetBuilder
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user