Merge branch 'development' of https://github.com/o3de/o3de into jckand/EditorPrefabTests

Signed-off-by: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com>
This commit is contained in:
jckand-amzn
2022-01-04 16:23:16 -06:00
167 changed files with 2416 additions and 1238 deletions
@@ -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
@@ -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)
@@ -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,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
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58ef978b31b31df9aaf715a0e9b006fde414a17a3ff15a3bf680eaad7418867a
size 364
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:98a681ec3d89ee57c5d1057fe984dcf8ad45721f47ae4df57fa358fbee85e616
size 385
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:24a2b2c9242a841c20e7815dab0d80a575844055328aea413d28b7283b65a92e
size 386
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce23a276fec849b8f832fab96d3b738793335c27d37ae3813158387f3415b508
size 377
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c03befab41765200f4f28dbf1e0b2a702d2244bfa79b0d463f5d58d0a26095fc
size 386
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:418c3f0f27854b3795841359014d87686a7bf94daf2568d9cfd3ffac22675f69
size 386
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3a831f34ac53c9b1f20037290e8a2b62a3cfb8a4f86467591f44fd2a0e3c15b
size 379
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4267102ca7a889c34eff905480a68878d4d56e15bc723a5b0575cd472e259f5d
size 389
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a0df013dd102b87348fba18b4da5443591309e9c40166d27ae928636924154ea
size 388
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e713076ab5abbbb2cf28da431a339e9905acc790e35295f025aa2e79e1c04141
size 376
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9e5af9d62ceafc3b8a1dfc36772350cd623fcc86c68711b299e143ff133f79b6
size 387
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:17c5fb3d7b87ea87a98934954c721573c641bc44005a34f1e16589d7f39b71e8
size 409
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6f5c78d9f764b62fb7dcf400c91c1edea9d7f88a426ba513fbf70825c6bcd2ac
size 383
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:376b549602afffca407525b77c1a9821bf6a0e279792ae2e52fe0a4f7c3c5bd4
size 364
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e7dc48f8d324b7563b168f27ebde1e00ee2bd11ba462f114a05b297913e285c5
size 374
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66b73afbd6dba1caaedfaae161b277b460b5198f7fc00bec414530116c567276
size 375
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae6e6714acf495246f4e59f6e5640f3a4417ea50100d37a116950d2b859aed0c
size 417
-2
View File
@@ -297,8 +297,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
@@ -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
@@ -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
@@ -0,0 +1,140 @@
/*
* 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 <AzFramework/Asset/AssetProcessorMessages.h>
#include <AssetBuilderSDK/AssetBuilderSDK.h>
namespace AssetBuilder
{
void Reflect(AZ::ReflectContext* context);
void InitializeSerializationContext();
//! BuilderHelloRequest is sent by an AssetBuilder that is attempting to connect to the AssetProcessor to register itself as a worker
class BuilderHelloRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(BuilderHelloRequest, AZ::OSAllocator, 0);
AZ_RTTI(BuilderHelloRequest, "{5fab5962-a1d8-42a5-bf7a-fb1a8c5a9588}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static unsigned int MessageType();
unsigned int GetMessageType() const override;
//! Unique ID assigned to this builder to identify it
AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
};
//! BuilderHelloResponse contains the AssetProcessor's response to a builder connection attempt, indicating if it is accepted and the ID
//! that it was assigned
class BuilderHelloResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(BuilderHelloResponse, AZ::OSAllocator, 0);
AZ_RTTI(BuilderHelloResponse, "{5f3d7c11-6639-4c6f-980a-32be546903c2}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
unsigned int GetMessageType() const override;
//! Indicates if the builder was accepted by the AP
bool m_accepted = false;
//! Unique ID assigned to the builder. If the builder isn't a local process, this is the ID assigned by the AP
AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
};
class CreateJobsNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(CreateJobsNetRequest, AZ::OSAllocator, 0);
AZ_RTTI(CreateJobsNetRequest, "{97fa717d-3a09-4d21-95c6-b2eafd773f1c}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static unsigned int MessageType();
unsigned int GetMessageType() const override;
AssetBuilderSDK::CreateJobsRequest m_request;
};
class CreateJobsNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(CreateJobsNetResponse, AZ::OSAllocator, 0);
AZ_RTTI(CreateJobsNetResponse, "{b2c7c2d3-b60e-4b27-b699-43e0ba991c33}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
unsigned int GetMessageType() const override;
AssetBuilderSDK::CreateJobsResponse m_response;
};
class ProcessJobNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(ProcessJobNetRequest, AZ::OSAllocator, 0);
AZ_RTTI(ProcessJobNetRequest, "{05288de1-020b-48db-b9de-715f17284efa}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static unsigned int MessageType();
unsigned int GetMessageType() const override;
AssetBuilderSDK::ProcessJobRequest m_request;
};
class ProcessJobNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(ProcessJobNetResponse, AZ::OSAllocator, 0);
AZ_RTTI(ProcessJobNetResponse, "{26ddf882-246c-4cfb-912f-9b8e389df4f6}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
unsigned int GetMessageType() const override;
AssetBuilderSDK::ProcessJobResponse m_response;
};
//////////////////////////////////////////////////////////////////////////
struct BuilderRegistration
{
AZ_CLASS_ALLOCATOR(BuilderRegistration, AZ::OSAllocator, 0);
AZ_TYPE_INFO(BuilderRegistration, "{36E785C3-5046-4568-870A-336C8249E453}");
static void Reflect(AZ::ReflectContext* context);
AZStd::string m_name;
AZStd::vector<AssetBuilderSDK::AssetBuilderPattern> m_patterns;
AZ::Uuid m_busId;
int m_version = 0;
AZStd::string m_analysisFingerprint;
AZ::u8 m_flags = 0;
AZStd::unordered_map<AZStd::string, AZ::u8> m_flagsByJobKey;
AZStd::unordered_map<AZStd::string, AZStd::unordered_set<AZ::u32>> m_productsToKeepOnFailure;
};
class BuilderRegistrationRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(BuilderRegistrationRequest, AZ::OSAllocator, 0);
AZ_RTTI(BuilderRegistrationRequest, "{FA9CF2D5-C847-47F3-979D-6C3AE061715C}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static constexpr unsigned int MessageType = AZ_CRC_CE("AssetSystem::BuilderRegistrationRequest");
BuilderRegistrationRequest() = default;
unsigned int GetMessageType() const override;
AZStd::vector<BuilderRegistration> m_builders;
};
} // namespace AssetBuilder
@@ -6,6 +6,22 @@
#
#
ly_add_target(
NAME AssetBuilder.Static STATIC
NAMESPACE AZ
FILES_CMAKE
asset_builder_static_files.cmake
INCLUDE_DIRECTORIES
PUBLIC
.
BUILD_DEPENDENCIES
PUBLIC
AZ::AzCore
AZ::AzFramework
AZ::AzToolsFramework
AZ::AssetBuilderSDK
)
ly_add_target(
NAME AssetBuilder EXECUTABLE
NAMESPACE AZ
@@ -17,6 +33,7 @@ ly_add_target(
.
BUILD_DEPENDENCIES
PRIVATE
AssetBuilder.Static
3rdParty::Qt::Core
3rdParty::Qt::Gui
3rdParty::Qt::Network
@@ -0,0 +1,12 @@
#
# 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
#
#
set(FILES
AssetBuilderStatic.h
AssetBuilderStatic.cpp
)
@@ -1172,19 +1172,10 @@ namespace AssetBuilderSDK
JobProduct::Reflect(context);
AssetBuilderDesc::Reflect(context);
RegisterBuilderRequest::Reflect(context);
RegisterBuilderResponse::Reflect(context);
CreateJobsRequest::Reflect(context);
CreateJobsResponse::Reflect(context);
ProcessJobRequest::Reflect(context);
ProcessJobResponse::Reflect(context);
BuilderHelloRequest::Reflect(context);
BuilderHelloResponse::Reflect(context);
CreateJobsNetRequest::Reflect(context);
CreateJobsNetResponse::Reflect(context);
ProcessJobNetRequest::Reflect(context);
ProcessJobNetResponse::Reflect(context);
}
void InitializeSerializationContext()
@@ -1263,24 +1254,6 @@ namespace AssetBuilderSDK
}
}
void RegisterBuilderRequest::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<RegisterBuilderRequest>()->
Version(1)->
Field("FilePath", &RegisterBuilderRequest::m_filePath);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<RegisterBuilderRequest>("RegisterBuilderRequest")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
->Attribute(AZ::Script::Attributes::Module, "asset.builder")
->Property("filePath", BehaviorValueProperty(&RegisterBuilderRequest::m_filePath));
}
}
void AssetBuilderDesc::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
@@ -1313,25 +1286,6 @@ namespace AssetBuilderSDK
}
}
void RegisterBuilderResponse::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<RegisterBuilderResponse>()
->Version(1)
->Field("Asset Builder Desc List", &RegisterBuilderResponse::m_assetBuilderDescList);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<RegisterBuilderResponse>("RegisterBuilderResponse")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
->Attribute(AZ::Script::Attributes::Module, "asset.builder")
->Constructor()
->Property("assetBuilderDescList", BehaviorValueProperty(&RegisterBuilderResponse::m_assetBuilderDescList));
}
}
bool CreateJobsResponse::Succeeded() const
{
return m_result == CreateJobsResultCode::Success;
@@ -1362,128 +1316,6 @@ namespace AssetBuilderSDK
}
}
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();
}
JobDependency::JobDependency(const AZStd::string& jobKey, const AZStd::string& platformIdentifier, const JobDependencyType& type, const SourceFileDependency& sourceFile)
: m_jobKey(jobKey)
, m_platformIdentifier(platformIdentifier)
@@ -464,35 +464,6 @@ namespace AssetBuilderSDK
AZStd::string m_platformIdentifier;
};
//! RegisterBuilderRequest contains input data that will be sent by the AssetProcessor to the builder during the startup registration phase
struct RegisterBuilderRequest
{
AZ_CLASS_ALLOCATOR(RegisterBuilderRequest, AZ::SystemAllocator, 0);
AZ_TYPE_INFO(RegisterBuilderRequest, "{7C6C5198-4766-42B8-9A1E-48479CE2F5EA}");
AZStd::string m_filePath;
RegisterBuilderRequest() {}
explicit RegisterBuilderRequest(const AZStd::string& filePath)
: m_filePath(filePath)
{
}
static void Reflect(AZ::ReflectContext* context);
};
//! INTERNAL USE ONLY - RegisterBuilderResponse contains registration data that will be sent by the builder to the AssetProcessor in response to RegisterBuilderRequest
struct RegisterBuilderResponse
{
AZ_CLASS_ALLOCATOR(RegisterBuilderResponse, AZ::SystemAllocator, 0);
AZ_TYPE_INFO(RegisterBuilderResponse, "{0AE5583F-C763-410E-BA7F-78BD90546C01}");
AZStd::vector<AssetBuilderDesc> m_assetBuilderDescList;
static void Reflect(AZ::ReflectContext* context);
};
/**
* This tells you about a platform in your CreateJobsRequest or your ProcessJobRequest
*/
@@ -756,99 +727,9 @@ namespace AssetBuilderSDK
static void Reflect(AZ::ReflectContext* context);
};
//! BuilderHelloRequest is sent by an AssetBuilder that is attempting to connect to the AssetProcessor to register itself as a worker
class BuilderHelloRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(BuilderHelloRequest, AZ::OSAllocator, 0);
AZ_RTTI(BuilderHelloRequest, "{5fab5962-a1d8-42a5-bf7a-fb1a8c5a9588}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static unsigned int MessageType();
unsigned int GetMessageType() const override;
//! Unique ID assigned to this builder to identify it
AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
};
//! BuilderHelloResponse contains the AssetProcessor's response to a builder connection attempt, indicating if it is accepted and the ID that it was assigned
class BuilderHelloResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(BuilderHelloResponse, AZ::OSAllocator, 0);
AZ_RTTI(BuilderHelloResponse, "{5f3d7c11-6639-4c6f-980a-32be546903c2}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
unsigned int GetMessageType() const override;
//! Indicates if the builder was accepted by the AP
bool m_accepted = false;
//! Unique ID assigned to the builder. If the builder isn't a local process, this is the ID assigned by the AP
AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
};
class CreateJobsNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(CreateJobsNetRequest, AZ::OSAllocator, 0);
AZ_RTTI(CreateJobsNetRequest, "{97fa717d-3a09-4d21-95c6-b2eafd773f1c}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static unsigned int MessageType();
unsigned int GetMessageType() const override;
CreateJobsRequest m_request;
};
class CreateJobsNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(CreateJobsNetResponse, AZ::OSAllocator, 0);
AZ_RTTI(CreateJobsNetResponse, "{b2c7c2d3-b60e-4b27-b699-43e0ba991c33}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
unsigned int GetMessageType() const override;
CreateJobsResponse m_response;
};
class ProcessJobNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(ProcessJobNetRequest, AZ::OSAllocator, 0);
AZ_RTTI(ProcessJobNetRequest, "{05288de1-020b-48db-b9de-715f17284efa}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
static unsigned int MessageType();
unsigned int GetMessageType() const override;
ProcessJobRequest m_request;
};
class ProcessJobNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
{
public:
AZ_CLASS_ALLOCATOR(ProcessJobNetResponse, AZ::OSAllocator, 0);
AZ_RTTI(ProcessJobNetResponse, "{26ddf882-246c-4cfb-912f-9b8e389df4f6}", BaseAssetProcessorMessage);
static void Reflect(AZ::ReflectContext* context);
unsigned int GetMessageType() const override;
ProcessJobResponse m_response;
};
//! JobCancelListener can be used by builders in their processJob method to listen for job cancellation request.
//! The address of this listener is the jobid which can be found in the process job request.
@@ -935,44 +816,3 @@ namespace AZ
AZ_TYPE_INFO_SPECIALIZE(AssetBuilderSDK::ProductPathDependencyType, "{EF77742B-9627-4072-B431-396AA7183C80}");
AZ_TYPE_INFO_SPECIALIZE(AssetBuilderSDK::SourceFileDependency::SourceFileDependencyType, "{BE9C8805-DB17-4500-944A-EB33FD0BE347}");
}
//! This macro should be used by every AssetBuilder to register itself,
//! AssetProcessor uses these exported function to identify whether a dll is an Asset Builder or not
//! If you want something highly custom you can do these entry points yourself instead of using the macro.
#define REGISTER_ASSETBUILDER \
extern void BuilderOnInit(); \
extern void BuilderDestroy(); \
extern void BuilderRegisterDescriptors(); \
extern void BuilderAddComponents(AZ::Entity * entity); \
extern "C" \
{ \
AZ_DLL_EXPORT int IsAssetBuilder() \
{ \
return 0; \
} \
\
AZ_DLL_EXPORT void InitializeModule(AZ::EnvironmentInstance sharedEnvironment) \
{ \
AZ::Environment::Attach(sharedEnvironment); \
BuilderOnInit(); \
} \
\
AZ_DLL_EXPORT void UninitializeModule() \
{ \
BuilderDestroy(); \
AZ::Environment::Detach(); \
} \
\
AZ_DLL_EXPORT void ModuleRegisterDescriptors() \
{ \
BuilderRegisterDescriptors(); \
} \
\
AZ_DLL_EXPORT void ModuleAddComponents(AZ::Entity * entity) \
{ \
BuilderAddComponents(entity); \
} \
}
// confusion-reducing note: above end-brace is part of the macro, not a namespace
+1
View File
@@ -42,6 +42,7 @@ ly_add_target(
AZ::AzQtComponents
AZ::AzToolsFramework
AZ::AssetBuilderSDK
AZ::AssetBuilder.Static
${additional_dependencies}
RUNTIME_DEPENDENCIES
AZ::AssetBuilder
@@ -85,7 +85,7 @@ namespace AssetProcessor
enum AssetCatalogStatus
{
RequiresSaving,
RequiresSaving,
UpToDate
};
@@ -213,11 +213,11 @@ namespace AssetProcessor
bool m_critical = false;
int m_priority = -1;
// indicates whether we need to check the server first for the outputs of this job
// indicates whether we need to check the server first for the outputs of this job
// before we start processing locally
bool m_checkServer = false;
// Indicates whether this job needs to be processed irrespective of whether its fingerprint got modified or not.
// Indicates whether this job needs to be processed irrespective of whether its fingerprint got modified or not.
bool m_autoProcessJob = false;
AssetBuilderSDK::AssetBuilderDesc m_assetBuilderDesc;
@@ -251,9 +251,9 @@ namespace AssetProcessor
JobDetails() = default;
};
//! JobDesc struct is used for identifying jobs that need to be processed again
//! because of job dependency declared on them by other jobs
//! JobDesc struct is used for identifying jobs that need to be processed again
//! because of job dependency declared on them by other jobs
struct JobDesc
{
AZStd::string m_databaseSourceName;
@@ -283,7 +283,7 @@ namespace AssetProcessor
}
};
//! JobIndentifier is an internal structure that store all the data that can uniquely identify a job
//! JobIndentifier is an internal structure that store all the data that can uniquely identify a job
struct JobIndentifier
{
JobDesc m_jobDesc;
@@ -165,7 +165,7 @@ void MainWindow::Activate()
ui->connectionTreeView->header()->resizeSection(ConnectionManager::PortColumn, 60);
ui->connectionTreeView->header()->resizeSection(ConnectionManager::PlatformColumn, 60);
ui->connectionTreeView->header()->resizeSection(ConnectionManager::AutoConnectColumn, 60);
ui->connectionTreeView->header()->setStretchLastSection(false);
connect(ui->connectionTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MainWindow::OnConnectionSelectionChanged);
@@ -189,12 +189,12 @@ void MainWindow::Activate()
ui->allowListAllowedListConnectionsListView->setModel(&m_allowedListAddresses);
connect(ui->allowedListRejectedConnectionsListView, &QListView::clicked, this, &MainWindow::OnRejectedConnectionsListViewClicked);
ui->allowedListRejectedConnectionsListView->setModel(&m_rejectedAddresses);
connect(ui->allowedListEnableCheckBox, &QCheckBox::toggled, this, &MainWindow::OnAllowedListCheckBoxToggled);
connect(ui->allowedListAddHostNameToolButton, &QToolButton::clicked, this, &MainWindow::OnAddHostNameAllowedListButtonClicked);
connect(ui->allowedListAddIPToolButton, &QPushButton::clicked, this, &MainWindow::OnAddIPAllowedListButtonClicked);
connect(ui->allowedListToAllowedListToolButton, &QPushButton::clicked, this, &MainWindow::OnToAllowedListButtonClicked);
connect(ui->allowedListToRejectedListToolButton, &QToolButton::clicked, this, &MainWindow::OnToRejectedListButtonClicked);
@@ -204,7 +204,7 @@ void MainWindow::Activate()
QRegExpValidator* hostNameValidator = new QRegExpValidator(validHostName, this);
ui->allowedListAddHostNameLineEdit->setValidator(hostNameValidator);
QRegExpValidator* ipValidator = new QRegExpValidator(validIP, this);
ui->allowedListAddIPLineEdit->setValidator(ipValidator);
@@ -235,7 +235,7 @@ void MainWindow::Activate()
m_logSortFilterProxy->setSourceModel(m_logsModel);
m_logSortFilterProxy->setFilterKeyColumn(AzToolsFramework::Logging::LogTableModel::ColumnMessage);
m_logSortFilterProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->jobLogTableView->setModel(m_logSortFilterProxy);
ui->jobLogTableView->setItemDelegate(new AzToolsFramework::Logging::LogTableItemDelegate(ui->jobLogTableView));
ui->jobLogTableView->setExpandOnSelection();
@@ -400,7 +400,7 @@ void MainWindow::Activate()
bool zeroAnalysisModeFromSettings = settings.value("EnableZeroAnalysis", QVariant(true)).toBool();
settings.endGroup();
QObject::connect(ui->modtimeSkippingCheckBox, &QCheckBox::stateChanged, this,
QObject::connect(ui->modtimeSkippingCheckBox, &QCheckBox::stateChanged, this,
[this](int newCheckState)
{
bool newOption = newCheckState == Qt::Checked ? true : false;
@@ -543,7 +543,7 @@ void MainWindow::OnAddConnection(bool /*checked*/)
m_guiApplicationManager->GetConnectionManager()->addUserConnection();
}
void MainWindow::OnAllowedListConnectionsListViewClicked()
void MainWindow::OnAllowedListConnectionsListViewClicked()
{
ui->allowedListRejectedConnectionsListView->clearSelection();
}
@@ -553,7 +553,7 @@ void MainWindow::OnRejectedConnectionsListViewClicked()
ui->allowListAllowedListConnectionsListView->clearSelection();
}
void MainWindow::OnAllowedListCheckBoxToggled()
void MainWindow::OnAllowedListCheckBoxToggled()
{
if (!ui->allowedListEnableCheckBox->isChecked())
{
@@ -588,7 +588,7 @@ void MainWindow::OnAllowedListCheckBoxToggled()
ui->allowedListToAllowedListToolButton->setEnabled(true);
ui->allowedListToRejectedListToolButton->setEnabled(true);
}
m_guiApplicationManager->GetConnectionManager()->AllowedListingEnabled(ui->allowedListEnableCheckBox->isChecked());
}
@@ -858,7 +858,7 @@ void MainWindow::OnAssetProcessorStatusChanged(const AssetProcessor::AssetProces
text = tr("Working, analyzing jobs remaining %1, processing jobs remaining %2...").arg(m_createJobCount).arg(m_processJobsCount);
ui->timerContainerWidget->setVisible(false);
ui->productAssetDetailsPanel->SetScanQueueEnabled(false);
IntervalAssetTabFilterRefresh();
}
else
@@ -877,7 +877,7 @@ void MainWindow::OnAssetProcessorStatusChanged(const AssetProcessor::AssetProces
break;
case AssetProcessorStatus::Processing_Jobs:
CheckStartProcessTimers();
m_processJobsCount = entry.m_count;
m_processJobsCount = entry.m_count;
if (m_processJobsCount + m_createJobCount > 0)
{
@@ -983,7 +983,7 @@ void MainWindow::ApplyConfig()
ui->jobLogTableView->header()->resizeSection(AzToolsFramework::Logging::LogTableModel::ColumnType, m_config.logTypeColumnWidth);
}
MainWindow::LogSortFilterProxy::LogSortFilterProxy(QObject* parentOjbect) : QSortFilterProxyModel(parentOjbect)
MainWindow::LogSortFilterProxy::LogSortFilterProxy(QObject* parentOjbect) : QSortFilterProxyModel(parentOjbect)
{
}
@@ -1302,7 +1302,7 @@ void MainWindow::ShowJobViewContextMenu(const QPoint& pos)
ui->sourceAssetDetailsPanel->GoToSource(item->m_elementId.GetInputAssetName().toUtf8().constData());
});
QString productMenuTitle(tr("View product asset..."));
QString productMenuTitle(tr("View product asset..."));
if (item->m_jobState != AzToolsFramework::AssetSystem::JobStatus::Completed)
{
QString disabledActionTooltip(tr("Only completed jobs are available in the Assets tab."));
@@ -1610,7 +1610,7 @@ void MainWindow::ShowProductAssetContextMenu(const QPoint& pos)
{
AzQtComponents::ShowFileOnDesktop(pathToProduct.GetValue());
}
});
QString fileOrFolder(cachedAsset->getChildCount() > 0 ? tr("folder") : tr("file"));
@@ -231,44 +231,6 @@ bool ApplicationManager::InitiatedShutdown() const
return m_duringShutdown;
}
void ApplicationManager::GetExternalBuilderFileList(QStringList& externalBuilderModules)
{
externalBuilderModules.clear();
static const char* builder_folder_name = "Builders";
// LY_ASSET_BUILDERS is defined by the CMakeLists.txt. The asset builders add themselves to a variable that
// is populated to allow selective building of those asset builder targets.
// This allows left over Asset builders in the output directory to not be loaded by the AssetProcessor
#if !defined(LY_ASSET_BUILDERS)
#error LY_ASSET_BUILDERS was not defined for ApplicationManager.cpp
#endif
QDir builderDir = QDir::toNativeSeparators(QString(this->m_frameworkApp.GetExecutableFolder()));
builderDir.cd(QString(builder_folder_name));
if (builderDir.exists())
{
AZStd::vector<AZStd::string> tokens;
AZ::StringFunc::Tokenize(AZStd::string_view(LY_ASSET_BUILDERS), tokens, ',');
AZStd::string builderLibrary;
for (const AZStd::string& token : tokens)
{
QString assetBuilderPath(token.c_str());
if (builderDir.exists(assetBuilderPath))
{
externalBuilderModules.push_back(builderDir.absoluteFilePath(assetBuilderPath));
}
}
}
if (externalBuilderModules.empty())
{
AZ_TracePrintf(AssetProcessor::ConsoleChannel, "AssetProcessor was unable to locate any external builders\n");
}
}
QDir ApplicationManager::GetSystemRoot() const
{
return m_systemRoot;
@@ -459,15 +421,6 @@ void ApplicationManager::PopulateApplicationDependencies()
m_filesOfInterest.push_back(dir.absoluteFilePath(pathWithPlatformExtension));
}
// Get the external builder modules to add to the files of interest
QStringList builderModuleFileList;
GetExternalBuilderFileList(builderModuleFileList);
for (const QString& builderModuleFile : builderModuleFileList)
{
m_filesOfInterest.push_back(builderModuleFile);
}
QDir assetRoot;
AssetUtilities::ComputeAssetRoot(assetRoot);
@@ -139,7 +139,7 @@ protected:
void RegisterObjectForQuit(QObject* source, bool insertInFront = false);
bool NeedRestart() const;
void addRunningThread(AssetProcessor::ThreadWorker* thread);
template<class BuilderClass>
void RegisterInternalBuilder(const QString& builderName);
@@ -151,9 +151,6 @@ protected:
bool m_duringStartup = true;
AssetProcessorAZApplication m_frameworkApp;
QCoreApplication* m_qApp = nullptr;
//! Get the list of external builder files for this asset processor
void GetExternalBuilderFileList(QStringList& externalBuilderModules);
virtual void Reflect() = 0;
virtual const char* GetLogBaseName() = 0;
@@ -25,6 +25,7 @@
#include <native/InternalBuilders/SettingsRegistryBuilder.h>
#include <AzToolsFramework/Application/Ticker.h>
#include <AzToolsFramework/ToolsFileUtils/ToolsFileUtils.h>
#include <AssetBuilder/AssetBuilderStatic.h>
#include <iostream>
@@ -32,9 +33,6 @@
#include <QElapsedTimer>
//! Amount of time to wait between checking the status of the AssetBuilder process
static const int s_MaximumSleepTimeMS = 10;
//! CreateJobs will wait up to 2 minutes before timing out
//! This shouldn't need to be so high but very large slices can take a while to process currently
//! This should be reduced down to something more reasonable after slice jobs are sped up
@@ -64,6 +62,7 @@ ApplicationManagerBase::~ApplicationManagerBase()
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
AssetProcessor::AssetBuilderRegistrationBus::Handler::BusDisconnect();
AssetBuilderSDK::AssetBuilderBus::Handler::BusDisconnect();
AssetProcessor::AssetBuilderInfoBus::Handler::BusDisconnect();
if (m_settingsRegistryBuilder)
{
@@ -192,7 +191,7 @@ void ApplicationManagerBase::InitAssetProcessorManager()
{
m_assetProcessorManager->SetEnableModtimeSkippingFeature(true);
}
if (commandLine->HasSwitch(Command_enableQueryLogging.m_switch))
{
m_assetProcessorManager->SetQueryLogging(true);
@@ -206,7 +205,7 @@ void ApplicationManagerBase::InitAssetProcessorManager()
{
m_dependencyScanPattern = commandLine->GetSwitchValue(Command_dsp.m_switch, 0).c_str();
}
m_fileDependencyScanPattern = "*";
if (commandLine->HasSwitch(Command_fileDependencyScanPattern.m_switch))
@@ -327,7 +326,7 @@ void ApplicationManagerBase::InitAssetCatalog()
AssetProcessor::AssetCatalog* catalog = new AssetCatalog(assetCatalogHelper, m_platformConfiguration);
// Using a direct connection so we know the catalog has been updated before continuing on with code might depend on the asset being in the catalog
connect(m_assetProcessorManager, &AssetProcessorManager::AssetMessage, catalog, &AssetCatalog::OnAssetMessage, Qt::DirectConnection);
connect(m_assetProcessorManager, &AssetProcessorManager::AssetMessage, catalog, &AssetCatalog::OnAssetMessage, Qt::DirectConnection);
connect(m_assetProcessorManager, &AssetProcessorManager::SourceQueued, catalog, &AssetCatalog::OnSourceQueued);
connect(m_assetProcessorManager, &AssetProcessorManager::SourceFinished, catalog, &AssetCatalog::OnSourceFinished);
connect(m_assetProcessorManager, &AssetProcessorManager::PathDependencyResolved, catalog, &AssetCatalog::OnDependencyResolved);
@@ -379,12 +378,12 @@ void ApplicationManagerBase::InitAssetScanner()
QObject::connect(m_assetScanner, &AssetScanner::FilesFound, [this](QSet<AssetFileInfo> files) { m_fileStateCache->AddInfoSet(files); });
QObject::connect(m_assetScanner, &AssetScanner::FoldersFound, [this](QSet<AssetFileInfo> files) { m_fileStateCache->AddInfoSet(files); });
QObject::connect(m_assetScanner, &AssetScanner::ExcludedFound, [this](QSet<AssetFileInfo> files) { m_fileStateCache->AddInfoSet(files); });
// file table
QObject::connect(m_assetScanner, &AssetScanner::AssetScanningStatusChanged, m_fileProcessor.get(), &FileProcessor::OnAssetScannerStatusChange);
QObject::connect(m_assetScanner, &AssetScanner::FilesFound, m_fileProcessor.get(), &FileProcessor::AssessFilesFromScanner);
QObject::connect(m_assetScanner, &AssetScanner::FoldersFound, m_fileProcessor.get(), &FileProcessor::AssessFoldersFromScanner);
}
void ApplicationManagerBase::DestroyAssetScanner()
@@ -591,6 +590,51 @@ void ApplicationManagerBase::InitConnectionManager()
}, AZStd::placeholders::_1, AZStd::placeholders::_2, AZStd::placeholders::_3, AZStd::placeholders::_4)
);
m_connectionManager->RegisterService(
AssetBuilder::BuilderRegistrationRequest::MessageType,
[this](unsigned int /*connId*/, unsigned int /*type*/, unsigned int /*serial*/, QByteArray payload, QString)
{
AssetBuilder::BuilderRegistrationRequest registrationRequest;
if (m_builderRegistrationComplete)
{
return;
}
m_builderRegistrationComplete = true;
if (AssetProcessor::UnpackMessage(payload, registrationRequest))
{
for (const auto& builder : registrationRequest.m_builders)
{
AssetBuilderSDK::AssetBuilderDesc desc;
desc.m_name = builder.m_name;
desc.m_patterns = builder.m_patterns;
desc.m_version = builder.m_version;
desc.m_analysisFingerprint = builder.m_analysisFingerprint;
desc.m_flags = builder.m_flags;
desc.m_busId = builder.m_busId;
desc.m_flagsByJobKey = builder.m_flagsByJobKey;
desc.m_productsToKeepOnFailure = builder.m_productsToKeepOnFailure;
// Builders registered this way are always external builders
desc.m_builderType = AssetBuilderSDK::AssetBuilderDesc::AssetBuilderType::External;
RegisterBuilderInformation(desc);
}
QTimer::singleShot(
0, this,
[this]()
{
if (!PostActivate())
{
QuitRequested();
}
});
}
});
//You can get Asset Processor Current State
using AzFramework::AssetSystem::RequestAssetProcessorStatus;
auto GetState = [this](unsigned int connId, unsigned int, unsigned int serial, QByteArray payload, QString)
@@ -633,11 +677,11 @@ void ApplicationManagerBase::InitConnectionManager()
AssetProcessorPlatformStatusRequest requestMessage;
if (AssetProcessor::UnpackMessage(payload, requestMessage))
{
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(responseMessage.m_isPlatformEnabled,
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(responseMessage.m_isPlatformEnabled,
&AzToolsFramework::AssetSystemRequestBus::Events::IsAssetPlatformEnabled, requestMessage.m_platform.c_str());
}
AssetProcessor::ConnectionBus::Event(connId,
AssetProcessor::ConnectionBus::Event(connId,
&AssetProcessor::ConnectionBus::Events::SendResponse, serial, responseMessage);
});
@@ -653,11 +697,11 @@ void ApplicationManagerBase::InitConnectionManager()
if (AssetProcessor::UnpackMessage(payload, requestMessage))
{
const char* platformIdentifier = requestMessage.m_platform.c_str();
responseMessage.m_numberOfPendingJobs =
responseMessage.m_numberOfPendingJobs =
GetRCController()->NumberOfPendingJobsPerPlatform(platformIdentifier);
}
AssetProcessor::ConnectionBus::Event(connId,
AssetProcessor::ConnectionBus::Event(connId,
&AssetProcessor::ConnectionBus::Events::SendResponse, serial, responseMessage);
});
}
@@ -696,7 +740,7 @@ void ApplicationManagerBase::InitAssetRequestHandler(AssetProcessor::AssetReques
QObject::connect(GetAssetProcessorManager(), &AssetProcessorManager::SendAssetExistsResponse, m_assetRequestHandler, &AssetRequestHandler::OnRequestAssetExistsResponse);
QObject::connect(GetAssetProcessorManager(), &AssetProcessorManager::FenceFileDetected, m_assetRequestHandler, &AssetRequestHandler::OnFenceFileDetected);
// connect the Asset Request Handler to RC:
QObject::connect(m_assetRequestHandler, &AssetRequestHandler::RequestCompileGroup, GetRCController(), &RCController::OnRequestCompileGroup);
QObject::connect(m_assetRequestHandler, &AssetRequestHandler::RequestEscalateAssetBySearchTerm, GetRCController(), &RCController::OnEscalateJobsBySearchTerm);
@@ -840,14 +884,6 @@ bool ApplicationManagerBase::Run()
return false;
}
bool startedSuccessfully = true;
if (!PostActivate())
{
QuitRequested();
startedSuccessfully = false;
}
AZ_Printf(AssetProcessor::ConsoleChannel, "Asset Processor Batch Processing Started.\n");
AZ_Printf(AssetProcessor::ConsoleChannel, "-----------------------------------------\n");
QElapsedTimer allAssetsProcessingTimer;
@@ -867,7 +903,7 @@ bool ApplicationManagerBase::Run()
RemoveOldTempFolders();
Destroy();
return (startedSuccessfully && FailedAssetsCount() == 0);
return FailedAssetsCount() == 0;
}
void ApplicationManagerBase::HandleFileRelocation() const
@@ -899,7 +935,7 @@ void ApplicationManagerBase::HandleFileRelocation() const
while(!m_sourceControlReady)
{
// We need to wait for source control to be ready before continuing
if (printCounter % 10 == 0)
{
AZ_TracePrintf(AssetProcessor::ConsoleChannel, "Waiting for Source Control connection\n");
@@ -1129,7 +1165,7 @@ void ApplicationManagerBase::CheckForIdle()
TryScanProductDependencies();
TryHandleFileRelocation();
// since we are shutting down, we save the registry and then we quit.
AZ_Printf(AssetProcessor::ConsoleChannel, "No assets remain in the build queue. Saving the catalog, and then shutting down.\n");
// stop accepting any further idle messages, as we will shut down - don't want this function to repeat!
@@ -1173,7 +1209,7 @@ void ApplicationManagerBase::InitBuilderManager()
{
m_builderManager->ConnectionLost(connId);
});
}
void ApplicationManagerBase::ShutdownBuilderManager()
@@ -1207,7 +1243,7 @@ void ApplicationManagerBase::ShutDownAssetDatabase()
AzToolsFramework::AssetDatabase::AssetDatabaseRequests::Bus::Handler::BusDisconnect();
}
void ApplicationManagerBase::InitFileProcessor()
void ApplicationManagerBase::InitFileProcessor()
{
AssetProcessor::ThreadController<AssetProcessor::FileProcessor>* fileProcessorHelper = new AssetProcessor::ThreadController<AssetProcessor::FileProcessor>();
@@ -1298,22 +1334,13 @@ bool ApplicationManagerBase::Activate()
}
InitBuilderConfiguration();
m_isCurrentlyLoadingGems = true;
if (!ActivateModules())
{
// ActivateModules reports any errors it encounters.
m_isCurrentlyLoadingGems = false;
return false;
}
m_isCurrentlyLoadingGems = false;
PopulateApplicationDependencies();
InitAssetProcessorManager();
AssetBuilderSDK::InitializeSerializationContext();
AssetBuilderSDK::InitializeBehaviorContext();
AssetBuilder::InitializeSerializationContext();
InitFileStateCache();
InitFileProcessor();
@@ -1341,7 +1368,7 @@ bool ApplicationManagerBase::Activate()
RegisterObjectForQuit(m_rcController);
m_connectionsToRemoveOnShutdown << QObject::connect(
m_assetProcessorManager, &AssetProcessor::AssetProcessorManager::AssetProcessorManagerIdleState,
m_assetProcessorManager, &AssetProcessor::AssetProcessorManager::AssetProcessorManagerIdleState,
this, [this](bool state)
{
if (state)
@@ -1362,7 +1389,7 @@ bool ApplicationManagerBase::Activate()
});
m_connectionsToRemoveOnShutdown << QObject::connect(
this, &ApplicationManagerBase::CheckAssetProcessorManagerIdleState,
this, &ApplicationManagerBase::CheckAssetProcessorManagerIdleState,
m_assetProcessorManager, &AssetProcessor::AssetProcessorManager::CheckAssetProcessorIdleState);
MakeActivationConnections();
@@ -1376,6 +1403,22 @@ bool ApplicationManagerBase::Activate()
return false;
}
}
AssetProcessor::AssetProcessorStatusEntry entry(AssetProcessor::AssetProcessorStatus::Initializing_Builders, 0, QString());
Q_EMIT AssetProcessorStatusChanged(entry);
AZStd::thread_desc desc;
desc.m_name = "Builder Component Registration";
AZStd::thread builderRegistrationThread(
desc,
[]()
{
AssetProcessor::BuilderRef builder;
AssetProcessor::BuilderManagerBus::BroadcastResult(builder, &AssetProcessor::BuilderManagerBus::Events::GetBuilder, true);
});
builderRegistrationThread.detach();
return true;
}
@@ -1384,11 +1427,6 @@ bool ApplicationManagerBase::PostActivate()
m_connectionManager->LoadConnections();
InitializeInternalBuilders();
if (!InitializeExternalBuilders())
{
AZ_Error("AssetProcessor", false, "AssetProcessor is closing. Failed to initialize and load all the external builders. Please ensure that Builders_Temp directory is not read-only. Please see log for more information.\n");
return false;
}
Q_EMIT OnBuildersRegistered();
@@ -1401,7 +1439,7 @@ bool ApplicationManagerBase::PostActivate()
AZ::SystemTickBus::Broadcast(&AZ::SystemTickEvents::OnSystemTick);
});
// now that everything is up and running, we start scanning. Before this, we don't want file events to start percolating through the
// now that everything is up and running, we start scanning. Before this, we don't want file events to start percolating through the
// asset system.
GetAssetScanner()->StartScan();
@@ -1425,124 +1463,20 @@ bool ApplicationManagerBase::InitializeInternalBuilders()
return result;
}
bool ApplicationManagerBase::InitializeExternalBuilders()
{
AssetProcessor::AssetProcessorStatusEntry entry(AssetProcessor::AssetProcessorStatus::Initializing_Builders);
Q_EMIT AssetProcessorStatusChanged(entry);
QCoreApplication::processEvents(QEventLoop::AllEvents);
// Get the list of external build modules (full paths)
QStringList fileList;
GetExternalBuilderFileList(fileList);
for (const QString& filePath : fileList)
{
if (QLibrary::isLibrary(filePath))
{
AssetProcessor::ExternalModuleAssetBuilderInfo* externalAssetBuilderInfo = new AssetProcessor::ExternalModuleAssetBuilderInfo(filePath);
AssetProcessor::AssetBuilderType assetBuilderType = externalAssetBuilderInfo->Load();
AZ_TracePrintf(AssetProcessor::ConsoleChannel, "AssetProcessor is loading library %s\n", filePath.toUtf8().data());
if (assetBuilderType == AssetProcessor::AssetBuilderType::None)
{
AZ_Warning(AssetProcessor::DebugChannel, false, "Non-builder DLL was found in Builders directory %s, skipping. \n", filePath.toUtf8().data());
delete externalAssetBuilderInfo;
continue;
}
if (assetBuilderType == AssetProcessor::AssetBuilderType::Invalid)
{
AZ_Warning(AssetProcessor::DebugChannel, false, "AssetProcessor was not able to load the library: %s\n", filePath.toUtf8().data());
delete externalAssetBuilderInfo;
return false;
}
AZ_TracePrintf(AssetProcessor::ConsoleChannel, "Initializing and registering builder %s\n", externalAssetBuilderInfo->GetName().toUtf8().data());
m_currentExternalAssetBuilder = externalAssetBuilderInfo;
externalAssetBuilderInfo->Initialize();
m_currentExternalAssetBuilder = nullptr;
m_externalAssetBuilders.push_back(externalAssetBuilderInfo);
}
}
// Also init external builders which may be inside of Gems
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
&AzToolsFramework::ToolsApplicationRequests::CreateAndAddEntityFromComponentTags,
AZStd::vector<AZ::Crc32>({ AssetBuilderSDK::ComponentTags::AssetBuilder }), "AssetBuilders Entity");
return true;
}
bool ApplicationManagerBase::WaitForBuilderExit(AzFramework::ProcessWatcher* processWatcher, AssetBuilderSDK::JobCancelListener* jobCancelListener, AZ::u32 processTimeoutLimitInSeconds)
{
AZ::u32 exitCode = 0;
bool finishedOK = false;
QElapsedTimer ticker;
ProcessCommunicatorTracePrinter tracer(processWatcher->GetCommunicator(), "AssetBuilder");
ticker.start();
while (!finishedOK)
{
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(s_MaximumSleepTimeMS));
tracer.Pump();
if (ticker.elapsed() > processTimeoutLimitInSeconds * 1000 || (jobCancelListener && jobCancelListener->IsCancelled()))
{
break;
}
if (!processWatcher->IsProcessRunning(&exitCode))
{
finishedOK = true; // we either cant wait for it, or it finished.
break;
}
}
tracer.Pump(); // empty whats left if possible.
if (processWatcher->IsProcessRunning(&exitCode))
{
processWatcher->TerminateProcess(1);
}
if (exitCode != 0)
{
AZ_Error(AssetProcessor::ConsoleChannel, false, "AssetBuilder exited with error code %d", exitCode);
return false;
}
else if (jobCancelListener && jobCancelListener->IsCancelled())
{
AZ_TracePrintf(AssetProcessor::DebugChannel, "AssetBuilder was terminated. There was a request to cancel the job.\n");
return false;
}
else if (!finishedOK)
{
AZ_Error(AssetProcessor::ConsoleChannel, false, "AssetBuilder failed to terminate within %d seconds", processTimeoutLimitInSeconds);
return false;
}
return true;
}
void ApplicationManagerBase::RegisterBuilderInformation(const AssetBuilderSDK::AssetBuilderDesc& builderDesc)
{
// Create Job Function validation
AZ_Error(AssetProcessor::ConsoleChannel,
builderDesc.m_createJobFunction,
"Create Job Function (m_createJobFunction) for %s builder is empty.\n",
builderDesc.m_name.c_str());
if (!builderDesc.IsExternalBuilder())
{
// Create Job Function validation
AZ_Error(
AssetProcessor::ConsoleChannel, builderDesc.m_createJobFunction,
"Create Job Function (m_createJobFunction) for %s builder is empty.\n", builderDesc.m_name.c_str());
// Process Job Function validation
AZ_Error(AssetProcessor::ConsoleChannel,
builderDesc.m_processJobFunction,
"Process Job Function (m_processJobFunction) for %s builder is empty.\n",
builderDesc.m_name.c_str());
// Process Job Function validation
AZ_Error(
AssetProcessor::ConsoleChannel, builderDesc.m_processJobFunction,
"Process Job Function (m_processJobFunction) for %s builder is empty.\n", builderDesc.m_name.c_str());
}
// Bus ID validation
AZ_Error(AssetProcessor::ConsoleChannel,
@@ -1550,67 +1484,66 @@ void ApplicationManagerBase::RegisterBuilderInformation(const AssetBuilderSDK::A
"Bus ID for %s builder is empty.\n",
builderDesc.m_name.c_str());
// This is an external builder registering, we will want to track its builder desc since it can register multiple ones
AZStd::string builderFilePath;
if (m_currentExternalAssetBuilder)
{
m_currentExternalAssetBuilder->RegisterBuilderDesc(builderDesc.m_busId);
builderFilePath = m_currentExternalAssetBuilder->GetModuleFullPath().toUtf8().data();
}
AssetBuilderSDK::AssetBuilderDesc modifiedBuilderDesc = builderDesc;
// Allow for overrides defined in a BuilderConfig.ini file to update our code defined default values
AssetProcessor::BuilderConfigurationRequestBus::Broadcast(&AssetProcessor::BuilderConfigurationRequests::UpdateBuilderDescriptor, builderDesc.m_name, modifiedBuilderDesc);
if (builderDesc.IsExternalBuilder())
{
// We're going to override the createJob function so we can run it externally in AssetBuilder, rather than having it run inside the AP
modifiedBuilderDesc.m_createJobFunction = [builderFilePath](const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response)
// We're going to override the createJob function so we can run it externally in AssetBuilder, rather than having it run
// inside the AP
modifiedBuilderDesc.m_createJobFunction =
[](const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response)
{
AssetProcessor::BuilderRef builderRef;
AssetProcessor::BuilderManagerBus::BroadcastResult(builderRef, &AssetProcessor::BuilderManagerBusTraits::GetBuilder, false);
if (builderRef)
{
AssetProcessor::BuilderRef builderRef;
AssetProcessor::BuilderManagerBus::BroadcastResult(builderRef, &AssetProcessor::BuilderManagerBusTraits::GetBuilder);
int retryCount = 0;
AssetProcessor::BuilderRunJobOutcome result;
if (builderRef)
do
{
int retryCount = 0;
AssetProcessor::BuilderRunJobOutcome result;
do
{
retryCount++;
result = builderRef->RunJob<AssetBuilderSDK::CreateJobsNetRequest, AssetBuilderSDK::CreateJobsNetResponse>(request, response, s_MaximumCreateJobsTimeSeconds, "create", builderFilePath, nullptr);
} while (result == AssetProcessor::BuilderRunJobOutcome::LostConnection && retryCount <= AssetProcessor::RetriesForJobNetworkError);
}
else
{
AZ_Error("AssetProcessor", false, "Failed to retrieve a valid builder to process job");
}
};
retryCount++;
result = builderRef->RunJob<AssetBuilder::CreateJobsNetRequest, AssetBuilder::CreateJobsNetResponse>(
request, response, s_MaximumCreateJobsTimeSeconds, "create", "", nullptr);
} while (result == AssetProcessor::BuilderRunJobOutcome::LostConnection &&
retryCount <= AssetProcessor::RetriesForJobNetworkError);
}
else
{
AZ_Error("AssetProcessor", false, "Failed to retrieve a valid builder to process job");
}
};
// Also override the processJob function to run externally
modifiedBuilderDesc.m_processJobFunction = [builderFilePath](const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response)
modifiedBuilderDesc.m_processJobFunction =
[](const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response)
{
AssetBuilderSDK::JobCancelListener jobCancelListener(request.m_jobId);
AssetProcessor::BuilderRef builderRef;
AssetProcessor::BuilderManagerBus::BroadcastResult(builderRef, &AssetProcessor::BuilderManagerBusTraits::GetBuilder, false);
if (builderRef)
{
AssetBuilderSDK::JobCancelListener jobCancelListener(request.m_jobId);
int retryCount = 0;
AssetProcessor::BuilderRunJobOutcome result;
AssetProcessor::BuilderRef builderRef;
AssetProcessor::BuilderManagerBus::BroadcastResult(builderRef, &AssetProcessor::BuilderManagerBusTraits::GetBuilder);
if (builderRef)
do
{
int retryCount = 0;
AssetProcessor::BuilderRunJobOutcome result;
do
{
retryCount++;
result = builderRef->RunJob<AssetBuilderSDK::ProcessJobNetRequest, AssetBuilderSDK::ProcessJobNetResponse>(request, response, s_MaximumProcessJobsTimeSeconds, "process", builderFilePath, &jobCancelListener, request.m_tempDirPath);
} while (result == AssetProcessor::BuilderRunJobOutcome::LostConnection && retryCount <= AssetProcessor::RetriesForJobNetworkError);
}
else
{
AZ_Error("AssetProcessor", false, "Failed to retrieve a valid builder to process job");
}
};
retryCount++;
result = builderRef->RunJob<AssetBuilder::ProcessJobNetRequest, AssetBuilder::ProcessJobNetResponse>(
request, response, s_MaximumProcessJobsTimeSeconds, "process", "", &jobCancelListener, request.m_tempDirPath);
} while (result == AssetProcessor::BuilderRunJobOutcome::LostConnection &&
retryCount <= AssetProcessor::RetriesForJobNetworkError);
}
else
{
AZ_Error("AssetProcessor", false, "Failed to retrieve a valid builder to process job");
}
};
}
if (m_builderDescMap.find(modifiedBuilderDesc.m_busId) != m_builderDescMap.end())
@@ -1768,7 +1701,7 @@ bool ApplicationManagerBase::CheckSufficientDiskSpace(const QString& savePath, q
[[maybe_unused]] bool result = AzToolsFramework::ToolsFileUtils::GetFreeDiskSpace(savePath, bytesFree);
AZ_Assert(result, "Unable to determine the amount of free space on drive containing path (%s).", savePath.toUtf8().constData());
if (bytesFree < requiredSpace + s_ReservedDiskSpaceInBytes)
{
if (shutdownIfInsufficient)
@@ -1806,8 +1739,8 @@ void ApplicationManagerBase::RemoveOldTempFolders()
return;
}
// We will remove old temp folders if either their modified time is older than the cutoff time or
// if the total number of temp folders have exceeded the maximum number of temp folders.
// We will remove old temp folders if either their modified time is older than the cutoff time or
// if the total number of temp folders have exceeded the maximum number of temp folders.
QFileInfoList entries = root.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time); // sorting by modification time
int folderCount = 0;
bool removeFolder = false;
@@ -1821,9 +1754,9 @@ void ApplicationManagerBase::RemoveOldTempFolders()
// Since we are sorting the folders list from latest to oldest, we will either be in a state where we have to delete all the remaining folders or not
// because either we have reached the folder limit or reached the cutoff date limit.
removeFolder = removeFolder || (folderCount++ >= s_MaximumTempFolders) ||
removeFolder = removeFolder || (folderCount++ >= s_MaximumTempFolders) ||
(entry.lastModified() < cutoffTime);
if (removeFolder)
{
QDir dir(entry.absoluteFilePath());
@@ -1837,8 +1770,6 @@ void ApplicationManagerBase::ConnectivityStateChanged(const AzToolsFramework::So
Q_EMIT SourceControlReady();
}
void ApplicationManagerBase::OnAssetProcessorManagerIdleState(bool isIdle)
{
// these can come in during shutdown.
@@ -149,7 +149,6 @@ protected:
void CreateQtApplication() override;
bool InitializeInternalBuilders();
bool InitializeExternalBuilders();
void InitBuilderManager();
void ShutdownBuilderManager();
bool InitAssetDatabase();
@@ -173,8 +172,6 @@ protected:
AssetProcessor::AssetCatalog* GetAssetCatalog() const { return m_assetCatalog; }
static bool WaitForBuilderExit(AzFramework::ProcessWatcher* processWatcher, AssetBuilderSDK::JobCancelListener* jobCancelListener, AZ::u32 processTimeoutLimitInSeconds);
ApplicationServer* m_applicationServer = nullptr;
ConnectionManager* m_connectionManager = nullptr;
@@ -218,6 +215,8 @@ protected:
AZStd::shared_ptr<AssetProcessor::InternalRecognizerBasedBuilder> m_internalBuilder;
AZStd::shared_ptr<AssetProcessor::SettingsRegistryBuilder> m_settingsRegistryBuilder;
bool m_builderRegistrationComplete = false;
// Builder description map based on the builder id
AZStd::unordered_map<AZ::Uuid, AssetBuilderSDK::AssetBuilderDesc> m_builderDescMap;
@@ -231,7 +230,7 @@ protected:
AZStd::list<AssetProcessor::ExternalModuleAssetBuilderInfo*> m_externalAssetBuilders;
AssetProcessor::ExternalModuleAssetBuilderInfo* m_currentExternalAssetBuilder = nullptr;
QAtomicInt m_connectionsAwaitingAssetCatalogSave = 0;
int m_remainingAPMJobs = 0;
bool m_assetProcessorManagerIsReady = false;
@@ -16,6 +16,7 @@
#include <native/utilities/AssetBuilderInfo.h>
#include <QCoreApplication>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AssetBuilder/AssetBuilderStatic.h>
namespace AssetProcessor
{
@@ -138,7 +139,7 @@ namespace AssetProcessor
}
}
bool Builder::Start()
bool Builder::Start(bool doRegistration)
{
// Get the current BinXXX folder based on the current running AP
QString applicationDir = QCoreApplication::instance()->applicationDirPath();
@@ -155,7 +156,7 @@ namespace AssetProcessor
return false;
}
const AZStd::vector<AZStd::string> params = BuildParams("resident", buildersFolder.c_str(), UuidString(), "", "");
const AZStd::vector<AZStd::string> params = BuildParams("resident", buildersFolder.c_str(), UuidString(), "", "", doRegistration);
m_processWatcher = LaunchProcess(fullExePathString.c_str(), params);
@@ -179,7 +180,7 @@ namespace AssetProcessor
return !m_processWatcher || (m_processWatcher && m_processWatcher->IsProcessRunning(exitCode));
}
AZStd::vector<AZStd::string> Builder::BuildParams(const char* task, const char* moduleFilePath, const AZStd::string& builderGuid, const AZStd::string& jobDescriptionFile, const AZStd::string& jobResponseFile) const
AZStd::vector<AZStd::string> Builder::BuildParams(const char* task, const char* moduleFilePath, const AZStd::string& builderGuid, const AZStd::string& jobDescriptionFile, const AZStd::string& jobResponseFile, bool doRegistration) const
{
QDir projectCacheRoot;
AssetUtilities::ComputeProjectCacheRoot(projectCacheRoot);
@@ -200,6 +201,11 @@ namespace AssetProcessor
params.emplace_back(AZStd::string::format(R"(-engine-path="%s")", enginePath.c_str()));
params.emplace_back(AZStd::string::format("-port=%d", portNumber));
if(doRegistration)
{
params.emplace_back("--register");
}
if (moduleFilePath && moduleFilePath[0])
{
params.emplace_back(AZStd::string::format(R"(-module="%s")", moduleFilePath));
@@ -232,7 +238,7 @@ namespace AssetProcessor
{
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
processLaunchInfo.m_processExecutableString = fullExePath;
AZStd::vector<AZStd::string> commandLineArray{ fullExePath };
commandLineArray.insert(commandLineArray.end(), params.begin(), params.end());
processLaunchInfo.m_commandlineParameters = AZStd::move(commandLineArray);
@@ -350,17 +356,19 @@ namespace AssetProcessor
BuilderManager::BuilderManager(ConnectionManager* connectionManager)
{
using namespace AZStd::placeholders;
connectionManager->RegisterService(AssetBuilderSDK::BuilderHelloRequest::MessageType(), AZStd::bind(&BuilderManager::IncomingBuilderPing, this, _1, _2, _3, _4, _5));
connectionManager->RegisterService(AssetBuilder::BuilderHelloRequest::MessageType(), AZStd::bind(&BuilderManager::IncomingBuilderPing, this, _1, _2, _3, _4, _5));
// Setup a background thread to pump the idle builders so they don't get blocked trying to output to stdout/err
m_pollingThread = AZStd::thread([this]()
AZStd::thread_desc desc;
desc.m_name = "BuilderManager Idle Pump";
m_pollingThread = AZStd::thread(desc, [this]()
{
while (!m_quitListener.WasQuitRequested())
{
while (!m_quitListener.WasQuitRequested())
{
PumpIdleBuilders();
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(s_IdleBuilderPumpingDelayMS));
}
});
PumpIdleBuilders();
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(s_IdleBuilderPumpingDelayMS));
}
});
m_quitListener.BusConnect();
BusConnect();
@@ -399,8 +407,8 @@ namespace AssetProcessor
void BuilderManager::IncomingBuilderPing(AZ::u32 connId, AZ::u32 /*type*/, AZ::u32 serial, QByteArray payload, QString platform)
{
AssetBuilderSDK::BuilderHelloRequest requestPing;
AssetBuilderSDK::BuilderHelloResponse responsePing;
AssetBuilder::BuilderHelloRequest requestPing;
AssetBuilder::BuilderHelloResponse responsePing;
if (!AZ::Utils::LoadObjectFromBufferInPlace(payload.data(), payload.length(), requestPing))
{
@@ -476,7 +484,7 @@ namespace AssetProcessor
return builder;
}
BuilderRef BuilderManager::GetBuilder()
BuilderRef BuilderManager::GetBuilder(bool doRegistration)
{
AZStd::shared_ptr<Builder> newBuilder;
BuilderRef builderRef;
@@ -484,27 +492,30 @@ namespace AssetProcessor
{
AZStd::unique_lock<AZStd::mutex> lock(m_buildersMutex);
for (auto itr = m_builders.begin(); itr != m_builders.end(); )
if (!doRegistration)
{
auto& builder = itr->second;
if (!builder->m_busy)
for (auto itr = m_builders.begin(); itr != m_builders.end();)
{
builder->PumpCommunicator();
auto& builder = itr->second;
if (builder->IsValid())
if (!builder->m_busy)
{
return BuilderRef(builder);
builder->PumpCommunicator();
if (builder->IsValid())
{
return BuilderRef(builder);
}
else
{
itr = m_builders.erase(itr);
}
}
else
{
itr = m_builders.erase(itr);
++itr;
}
}
else
{
++itr;
}
}
AZ_TracePrintf("BuilderManager", "Starting new builder for job request\n");
@@ -516,7 +527,7 @@ namespace AssetProcessor
builderRef = BuilderRef(newBuilder);
}
if (!newBuilder->Start())
if (!newBuilder->Start(doRegistration))
{
AZ_Error("BuilderManager", false, "Builder failed to start");
@@ -39,7 +39,7 @@ namespace AssetProcessor
virtual ~BuilderManagerBusTraits() = default;
//! Returns a builder for doing work
virtual BuilderRef GetBuilder() = 0;
virtual BuilderRef GetBuilder(bool doRegistration) = 0;
};
using BuilderManagerBus = AZ::EBus<BuilderManagerBusTraits>;
@@ -98,12 +98,12 @@ namespace AssetProcessor
private:
//! Starts the builder process and waits for it to connect
bool Start();
bool Start(bool doRegistration);
//! Sets the connection id and signals that the builder has connected
void SetConnection(AZ::u32 connId);
AZStd::vector<AZStd::string> BuildParams(const char* task, const char* moduleFilePath, const AZStd::string& builderGuid, const AZStd::string& jobDescriptionFile, const AZStd::string& jobResponseFile) const;
AZStd::vector<AZStd::string> BuildParams(const char* task, const char* moduleFilePath, const AZStd::string& builderGuid, const AZStd::string& jobDescriptionFile, const AZStd::string& jobResponseFile, bool doRegistration) const;
AZStd::unique_ptr<AzFramework::ProcessWatcher> LaunchProcess(const char* fullExePath, const AZStd::vector<AZStd::string>& params) const;
//! Waits for the builder exe to send the job response and pumps stdout/err
@@ -169,7 +169,7 @@ namespace AssetProcessor
void ConnectionLost(AZ::u32 connId);
//BuilderManagerBus
BuilderRef GetBuilder() override;
BuilderRef GetBuilder(bool doRegistration) override;
private:
@@ -50,7 +50,7 @@ namespace AssetProcessor
if (!netResponse.m_response.Succeeded() || s_createRequestFileForSuccessfulJob)
{
// we write the request out to disk for failure or debugging
// we write the request out to disk for failure or debugging
if (!DebugWriteRequestFile(tempFolderPath.c_str(), request, task, modulePath))
{
return BuilderRunJobOutcome::FailedToWriteDebugRequest;
@@ -83,7 +83,7 @@ namespace AssetProcessor
return false;
}
auto params = BuildParams(task.c_str(), modulePath.c_str(), "", jobRequestFile, jobResponseFile);
auto params = BuildParams(task.c_str(), modulePath.c_str(), "", jobRequestFile, jobResponseFile, false);
AZStd::string paramString;
AZ::StringFunc::Join(paramString, params.begin(), params.end(), " ");
@@ -318,16 +318,8 @@ bool GUIApplicationManager::Run()
qApp->setQuitOnLastWindowClosed(false);
QTimer::singleShot(0, this, [this]()
{
if (!PostActivate())
{
QuitRequested();
m_startedSuccessfully = false;
}
});
m_duringStartup = false;
m_startedSuccessfully = true;
int resultCode = qApp->exec(); // this blocks until the last window is closed.
@@ -483,6 +475,7 @@ bool GUIApplicationManager::PostActivate()
{
if (!ApplicationManagerBase::PostActivate())
{
m_startedSuccessfully = false;
return false;
}
@@ -284,13 +284,14 @@ namespace O3DE::ProjectManager
{
currentButton = projectButtonIter.value();
currentButton->RestoreDefaultState();
m_projectsFlowLayout->addWidget(currentButton);
}
}
// Check whether project manager has successfully built the project
if (currentButton)
{
m_projectsFlowLayout->addWidget(currentButton);
bool projectBuiltSuccessfully = false;
SettingsInterface::Get()->GetProjectBuiltSuccessfully(projectBuiltSuccessfully, project);
@@ -341,6 +342,7 @@ namespace O3DE::ProjectManager
}
m_stack->setCurrentWidget(m_projectsContent);
m_projectsFlowLayout->update();
}
ProjectManagerScreen ProjectsScreen::GetScreenEnum()
@@ -399,7 +401,6 @@ namespace O3DE::ProjectManager
{
if (ProjectUtils::AddProjectDialog(this))
{
ResetProjectsContent();
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
}
@@ -490,7 +491,6 @@ namespace O3DE::ProjectManager
// Open file dialog and choose location for copied project then register copy with O3DE
if (ProjectUtils::CopyProjectDialog(projectInfo.m_path, newProjectInfo, this))
{
ResetProjectsContent();
emit NotifyBuildProject(newProjectInfo);
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
@@ -503,7 +503,6 @@ namespace O3DE::ProjectManager
// Unregister Project from O3DE and reload projects
if (ProjectUtils::UnregisterProject(projectPath))
{
ResetProjectsContent();
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
}
+1
View File
@@ -202,6 +202,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
3rdParty::Qt::Gui
3rdParty::Qt::Widgets
AZ::AzTest
AZ::AWSNativeSDKInit
Gem::AWSCore.Static
Gem::AWSCore.Editor.Static
)
@@ -7,4 +7,4 @@
*/
#pragma once
#define AWSCORE_BACKWARD_INCOMPATIBLE_CHANGE 0
#define AWSCORE_BACKWARD_INCOMPATIBLE_CHANGE 1
@@ -19,6 +19,7 @@
#include <AzTest/AzTest.h>
#include <AWSCoreSystemComponent.h>
#include <AWSNativeSDKInit/AWSNativeSDKInit.h>
#include <Configuration/AWSCoreConfiguration.h>
#include <Credential/AWSCredentialManager.h>
#include <Framework/AWSApiJob.h>
@@ -103,6 +104,9 @@ public:
TEST_F(AWSCoreSystemComponentTest, ComponentActivateTest)
{
// Shutdown SDK which is init in fixture setup step
AWSNativeSDKInit::InitializationManager::Shutdown();
EXPECT_FALSE(m_coreSystemsComponent->IsAWSApiInitialized());
// activate component
@@ -8,7 +8,6 @@
#include <AzCore/Settings/SettingsRegistry.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzTest/AzTest.h>
#include <Configuration/AWSCoreConfiguration.h>
#include <TestFramework/AWSCoreFixture.h>
@@ -39,12 +38,11 @@ class AWSCoreConfigurationTest
: public AWSCoreFixture
{
public:
void CreateTestSetRegFile(const AZStd::string& setregContent)
AWSCoreConfigurationTest()
{
m_normalizedSetRegFilePath = AZStd::string::format("%s/%s",
m_normalizedSetRegFolderPath.c_str(), AWSCore::AWSCoreConfiguration::AWSCoreConfigurationFileName);
AzFramework::StringFunc::Path::Normalize(m_normalizedSetRegFilePath);
CreateTestFile(m_normalizedSetRegFilePath, setregContent);
m_setRegFilePath = (GetTestTempDirectoryPath() /
AZ::SettingsRegistryInterface::RegistryFolder /
AWSCore::AWSCoreConfiguration::AWSCoreConfigurationFileName).LexicallyNormal();
}
void SetUp() override
@@ -53,22 +51,13 @@ public:
m_awsCoreConfiguration = AZStd::make_unique<AWSCore::AWSCoreConfiguration>();
m_normalizedSourceProjectFolder = AZStd::string::format("%s/%s%s/", AZ::Test::GetCurrentExecutablePath().c_str(),
"AWSResourceMappingManager", AZ::Uuid::CreateRandom().ToString<AZStd::string>(false, false).c_str());
AzFramework::StringFunc::Path::Normalize(m_normalizedSourceProjectFolder);
m_normalizedSetRegFolderPath = AZStd::string::format("%s/%s/",
m_normalizedSourceProjectFolder.c_str(), AZ::SettingsRegistryInterface::RegistryFolder);
AzFramework::StringFunc::Path::Normalize(m_normalizedSetRegFolderPath);
m_localFileIO->SetAlias("@projectroot@", m_normalizedSourceProjectFolder.c_str());
CreateTestSetRegFile(TEST_VALID_RESOURCE_MAPPING_SETREG);
CreateFile(m_setRegFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_SETREG);
m_localFileIO->SetAlias("@projectroot@", GetTestTempDirectoryPath().Native().c_str());
}
void TearDown() override
{
RemoveTestFile();
RemoveTestDirectory();
RemoveFile(m_setRegFilePath.Native());
m_awsCoreConfiguration.reset();
@@ -76,52 +65,12 @@ public:
}
AZStd::unique_ptr<AWSCore::AWSCoreConfiguration> m_awsCoreConfiguration;
AZStd::string m_normalizedSetRegFilePath;
private:
AZStd::string m_normalizedSourceProjectFolder;
AZStd::string m_normalizedSetRegFolderPath;
void CreateTestFile(const AZStd::string& filePath, const AZStd::string& fileContent)
{
AZ::IO::SystemFile file;
if (!file.Open(filePath.c_str(),
AZ::IO::SystemFile::OpenMode::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_CREATE_PATH | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY))
{
AZ_Assert(false, "Failed to open test file");
}
if (file.Write(fileContent.c_str(), fileContent.size()) != fileContent.size())
{
AZ_Assert(false, "Failed to write test file");
}
file.Close();
}
void RemoveTestFile()
{
if (!m_normalizedSetRegFilePath.empty())
{
AZ_Assert(AZ::IO::SystemFile::Delete(m_normalizedSetRegFilePath.c_str()),
"Failed to delete test settings registry file at %s", m_normalizedSetRegFilePath.c_str());
}
}
void RemoveTestDirectory()
{
if (!m_normalizedSetRegFilePath.empty())
{
AZ_Assert(AZ::IO::SystemFile::DeleteDir(m_normalizedSetRegFolderPath.c_str()),
"Failed to delete test settings registry folder at %s", m_normalizedSetRegFolderPath.c_str());
AZ_Assert(AZ::IO::SystemFile::DeleteDir(m_normalizedSourceProjectFolder.c_str()),
"Failed to delete test folder at %s", m_normalizedSourceProjectFolder.c_str());
}
}
AZ::IO::Path m_setRegFilePath;
};
TEST_F(AWSCoreConfigurationTest, InitConfig_NoSourceProjectFolderFound_ReturnEmptyConfigFilePath)
{
m_settingsRegistry->MergeSettingsFile(m_normalizedSetRegFilePath, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_settingsRegistry->MergeSettingsFile(m_setRegFilePath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_localFileIO->ClearAlias("@projectroot@");
AZ_TEST_START_TRACE_SUPPRESSION;
@@ -134,8 +83,8 @@ TEST_F(AWSCoreConfigurationTest, InitConfig_NoSourceProjectFolderFound_ReturnEmp
TEST_F(AWSCoreConfigurationTest, InitConfig_SettingsRegistryIsEmpty_ReturnEmptyConfigFilePath)
{
CreateTestSetRegFile(TEST_INVALID_RESOURCE_MAPPING_SETREG);
m_settingsRegistry->MergeSettingsFile(m_normalizedSetRegFilePath, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
CreateFile(m_setRegFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_SETREG);
m_settingsRegistry->MergeSettingsFile(m_setRegFilePath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_awsCoreConfiguration->InitConfig();
auto actualConfigFilePath = m_awsCoreConfiguration->GetResourceMappingConfigFilePath();
@@ -144,7 +93,7 @@ TEST_F(AWSCoreConfigurationTest, InitConfig_SettingsRegistryIsEmpty_ReturnEmptyC
TEST_F(AWSCoreConfigurationTest, InitConfig_LoadValidSettingsRegistry_ReturnNonEmptyConfigFilePath)
{
m_settingsRegistry->MergeSettingsFile(m_normalizedSetRegFilePath, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_settingsRegistry->MergeSettingsFile(m_setRegFilePath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_awsCoreConfiguration->InitConfig();
auto actualConfigFilePath = m_awsCoreConfiguration->GetResourceMappingConfigFilePath();
@@ -153,7 +102,7 @@ TEST_F(AWSCoreConfigurationTest, InitConfig_LoadValidSettingsRegistry_ReturnNonE
TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_NoSourceProjectFolderFound_ReturnEmptyConfigFilePath)
{
m_settingsRegistry->MergeSettingsFile(m_normalizedSetRegFilePath, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_settingsRegistry->MergeSettingsFile(m_setRegFilePath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_localFileIO->ClearAlias("@projectroot@");
m_awsCoreConfiguration->ReloadConfiguration();
@@ -163,8 +112,8 @@ TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_NoSourceProjectFolderFound_
TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_LoadValidSettingsRegistryAfterInvalidOne_ReturnNonEmptyConfigFilePath)
{
CreateTestSetRegFile(TEST_INVALID_RESOURCE_MAPPING_SETREG);
m_settingsRegistry->MergeSettingsFile(m_normalizedSetRegFilePath, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
CreateFile(m_setRegFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_SETREG);
m_settingsRegistry->MergeSettingsFile(m_setRegFilePath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_awsCoreConfiguration->InitConfig();
auto actualConfigFilePath = m_awsCoreConfiguration->GetResourceMappingConfigFilePath();
@@ -172,7 +121,7 @@ TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_LoadValidSettingsRegistryAf
EXPECT_TRUE(actualConfigFilePath.empty());
EXPECT_TRUE(actualProfileName == AWSCoreConfiguration::AWSCoreDefaultProfileName);
CreateTestSetRegFile(TEST_VALID_RESOURCE_MAPPING_SETREG);
CreateFile(m_setRegFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_SETREG);
m_awsCoreConfiguration->ReloadConfiguration();
actualConfigFilePath = m_awsCoreConfiguration->GetResourceMappingConfigFilePath();
@@ -183,7 +132,7 @@ TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_LoadValidSettingsRegistryAf
TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_LoadInvalidSettingsRegistryAfterValidOne_ReturnEmptyConfigFilePath)
{
m_settingsRegistry->MergeSettingsFile(m_normalizedSetRegFilePath, AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_settingsRegistry->MergeSettingsFile(m_setRegFilePath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, {});
m_awsCoreConfiguration->InitConfig();
auto actualConfigFilePath = m_awsCoreConfiguration->GetResourceMappingConfigFilePath();
@@ -191,7 +140,7 @@ TEST_F(AWSCoreConfigurationTest, ReloadConfiguration_LoadInvalidSettingsRegistry
EXPECT_FALSE(actualConfigFilePath.empty());
EXPECT_TRUE(actualProfileName != AWSCoreConfiguration::AWSCoreDefaultProfileName);
CreateTestSetRegFile(TEST_INVALID_RESOURCE_MAPPING_SETREG);
CreateFile(m_setRegFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_SETREG);
m_awsCoreConfiguration->ReloadConfiguration();
actualConfigFilePath = m_awsCoreConfiguration->GetResourceMappingConfigFilePath();
@@ -25,6 +25,11 @@ public:
m_credentialHandler = AZStd::make_unique<AWSCVarCredentialHandler>();
}
void TearDown() override
{
m_credentialHandler.reset();
}
AZStd::unique_ptr<AWSCVarCredentialHandler> m_credentialHandler;
};
@@ -6,8 +6,6 @@
*
*/
#include <AzTest/AzTest.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <Credential/AWSCredentialBus.h>
@@ -19,14 +17,10 @@ class TestCredentialHandlerOne
: AWSCredentialRequestBus::Handler
{
public:
TestCredentialHandlerOne()
void ActivateHandler()
{
m_handlerCounter = 0;
m_credentialsProvider = std::make_shared<Aws::Auth::AnonymousAWSCredentialsProvider>();
}
void ActivateHandler()
{
AWSCredentialRequestBus::Handler::BusConnect();
}
@@ -55,14 +49,10 @@ class TestCredentialHandlerTwo
: AWSCredentialRequestBus::Handler
{
public:
TestCredentialHandlerTwo()
void ActivateHandler()
{
m_handlerCounter = 0;
m_credentialsProvider = std::make_shared<Aws::Auth::AnonymousAWSCredentialsProvider>();
}
void ActivateHandler()
{
AWSCredentialRequestBus::Handler::BusConnect();
}
@@ -88,7 +78,7 @@ public:
};
class AWSCredentialBusTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
{
public:
AWSCredentialBusTest()
@@ -99,6 +89,8 @@ public:
void SetUp() override
{
AWSCoreFixture::SetUpFixture();
m_handlerOne->ActivateHandler();
m_handlerTwo->ActivateHandler();
}
@@ -107,6 +99,8 @@ public:
{
m_handlerOne->DeactivateHandler();
m_handlerTwo->DeactivateHandler();
AWSCoreFixture::TearDownFixture();
}
AZStd::unique_ptr<TestCredentialHandlerOne> m_handlerOne;
@@ -6,11 +6,9 @@
*
*/
#include <AzCore/UnitTest/TestTypes.h>
#include <AzTest/AzTest.h>
#include <AWSCoreInternalBus.h>
#include <Credential/AWSDefaultCredentialHandler.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCore;
@@ -18,13 +16,15 @@ static constexpr char AWSDEFAULTCREDENTIALHANDLERTEST_ALLOC_TAG[] = "AWSDefaultC
static constexpr const char* AWS_ACCESS_KEY = "AWSACCESSKEY";
static constexpr const char* AWS_SECRET_KEY = "AWSSECRETKEY";
class EnvironmentAWSCredentialsProviderMock : public Aws::Auth::EnvironmentAWSCredentialsProvider
class EnvironmentAWSCredentialsProviderMock
: public Aws::Auth::EnvironmentAWSCredentialsProvider
{
public:
MOCK_METHOD0(GetAWSCredentials, Aws::Auth::AWSCredentials());
};
class ProfileConfigFileAWSCredentialsProviderMock : public Aws::Auth::ProfileConfigFileAWSCredentialsProvider
class ProfileConfigFileAWSCredentialsProviderMock
: public Aws::Auth::ProfileConfigFileAWSCredentialsProvider
{
public:
MOCK_METHOD0(GetAWSCredentials, Aws::Auth::AWSCredentials());
@@ -44,7 +44,7 @@ public:
};
class AWSDefaultCredentialHandlerTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
, public AWSCoreInternalRequestBus::Handler
{
public:
@@ -53,6 +53,8 @@ public:
void SetUp() override
{
AWSCoreFixture::SetUpFixture();
AWSCoreInternalRequestBus::Handler::BusConnect();
m_environmentCredentialsProviderMock = Aws::MakeShared<EnvironmentAWSCredentialsProviderMock>(AWSDEFAULTCREDENTIALHANDLERTEST_ALLOC_TAG);
m_profileCredentialsProviderMock = Aws::MakeShared<ProfileConfigFileAWSCredentialsProviderMock>(AWSDEFAULTCREDENTIALHANDLERTEST_ALLOC_TAG);
@@ -68,6 +70,8 @@ public:
m_profileCredentialsProviderMock.reset();
m_environmentCredentialsProviderMock.reset();
AWSCoreInternalRequestBus::Handler::BusDisconnect();
AWSCoreFixture::TearDownFixture();
}
// AWSCoreInternalRequestBus interface implementation
@@ -11,7 +11,7 @@
#include <Editor/Attribution/AWSAttributionServiceApi.h>
#include <Framework/JsonObjectHandler.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCore;
@@ -36,7 +36,7 @@ namespace AWSCoreUnitTest
};
class AWSAttributionServiceApiTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
{
public:
testing::NiceMock<JsonReaderMock> JsonReader;
@@ -10,7 +10,6 @@
#include <Editor/Attribution/AWSCoreAttributionMetric.h>
#include <Credential/AWSCredentialBus.h>
#include <AzFramework/IO/LocalFileIO.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/base.h>
@@ -23,7 +22,6 @@
#include <AzCore/Jobs/JobManagerBus.h>
#include <AzCore/Jobs/JobContext.h>
#include <AzCore/Utils/Utils.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Module/ModuleManagerBus.h>
#include <AzCore/PlatformId/PlatformId.h>
@@ -167,7 +165,6 @@ namespace AWSAttributionUnitTest
AZStd::unique_ptr<AZ::JobManager> m_jobManager;
AZStd::array<char, AZ::IO::MaxPathLength> m_resolvedSettingsPath;
ModuleManagerRequestBusMock m_moduleManagerRequestBusMock;
AWSCredentialRquestsBusMock m_credentialRequestBusMock;
void SetUp() override
{
@@ -221,6 +218,7 @@ namespace AWSAttributionUnitTest
TEST_F(AttributionManagerTest, MetricsSettings_ConsentShown_AttributionDisabled_SkipsSend)
{
// GIVEN
AWSCredentialRquestsBusMock credentialRequestBusMock;
AWSAttributionManagerMock manager;
CreateFile(m_resolvedSettingsPath.data(), R"({
@@ -239,7 +237,7 @@ namespace AWSAttributionUnitTest
EXPECT_CALL(manager, SubmitMetric(testing::_)).Times(0);
EXPECT_CALL(m_moduleManagerRequestBusMock, EnumerateModules(testing::_)).Times(0);
EXPECT_CALL(m_credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(credentialRequestBusMock, GetCredentialsProvider()).Times(1);
// WHEN
manager.MetricCheck();
@@ -255,6 +253,7 @@ namespace AWSAttributionUnitTest
TEST_F(AttributionManagerTest, AttributionEnabled_ContentShown_NoPreviousTimeStamp_SendSuccess)
{
// GIVEN
AWSCredentialRquestsBusMock credentialRequestBusMock;
AWSAttributionManagerMock manager;
CreateFile(m_resolvedSettingsPath.data(), R"({
@@ -272,7 +271,7 @@ namespace AWSAttributionUnitTest
EXPECT_CALL(manager, SubmitMetric(testing::_)).Times(1);
EXPECT_CALL(m_moduleManagerRequestBusMock, EnumerateModules(testing::_)).Times(1);
EXPECT_CALL(m_credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(credentialRequestBusMock, GetCredentialsProvider()).Times(1);
// WHEN
manager.MetricCheck();
@@ -289,6 +288,7 @@ namespace AWSAttributionUnitTest
TEST_F(AttributionManagerTest, AttributionEnabled_ContentShown_ValidPreviousTimeStamp_SendSuccess)
{
// GIVEN
AWSCredentialRquestsBusMock credentialRequestBusMock;
AWSAttributionManagerMock manager;
CreateFile(m_resolvedSettingsPath.data(), R"({
@@ -308,7 +308,7 @@ namespace AWSAttributionUnitTest
EXPECT_CALL(manager, SubmitMetric(testing::_)).Times(1);
EXPECT_CALL(m_moduleManagerRequestBusMock, EnumerateModules(testing::_)).Times(1);
EXPECT_CALL(m_credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(credentialRequestBusMock, GetCredentialsProvider()).Times(1);
// WHEN
manager.MetricCheck();
@@ -324,6 +324,7 @@ namespace AWSAttributionUnitTest
TEST_F(AttributionManagerTest, AttributionEnabled_ContentShown_DelayNotSatisfied_SendFail)
{
// GIVEN
AWSCredentialRquestsBusMock credentialRequestBusMock;
AWSAttributionManagerMock manager;
CreateFile(m_resolvedSettingsPath.data(), R"({
@@ -346,7 +347,7 @@ namespace AWSAttributionUnitTest
EXPECT_CALL(manager, SubmitMetric(testing::_)).Times(0);
EXPECT_CALL(m_moduleManagerRequestBusMock, EnumerateModules(testing::_)).Times(0);
EXPECT_CALL(m_credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(credentialRequestBusMock, GetCredentialsProvider()).Times(1);
// WHEN
manager.MetricCheck();
@@ -362,6 +363,7 @@ namespace AWSAttributionUnitTest
TEST_F(AttributionManagerTest, AttributionEnabledNotFound_ContentShown_SendFail)
{
// GIVEN
AWSCredentialRquestsBusMock credentialRequestBusMock;
AWSAttributionManagerMock manager;
CreateFile(m_resolvedSettingsPath.data(), R"({
@@ -378,7 +380,7 @@ namespace AWSAttributionUnitTest
EXPECT_CALL(manager, SubmitMetric(testing::_)).Times(0);
EXPECT_CALL(m_moduleManagerRequestBusMock, EnumerateModules(testing::_)).Times(0);
EXPECT_CALL(m_credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(credentialRequestBusMock, GetCredentialsProvider()).Times(1);
// WHEN
manager.MetricCheck();
@@ -394,12 +396,13 @@ namespace AWSAttributionUnitTest
TEST_F(AttributionManagerTest, AttributionEnabledNotFound_ContentNotShown_SendFail)
{
// GIVEN
AWSCredentialRquestsBusMock credentialRequestBusMock;
AWSAttributionManagerMock manager;
manager.Init();
EXPECT_CALL(manager, SubmitMetric(testing::_)).Times(0);
EXPECT_CALL(m_moduleManagerRequestBusMock, EnumerateModules(testing::_)).Times(0);
EXPECT_CALL(m_credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(credentialRequestBusMock, GetCredentialsProvider()).Times(1);
EXPECT_CALL(manager, ShowConsentDialog()).Times(1);
// WHEN
@@ -6,9 +6,6 @@
*
*/
#include <AzTest/AzTest.h>
#include <AWSNativeSDKInit/AWSNativeSDKInit.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/S3Client.h>
@@ -19,7 +16,7 @@
using namespace AWSCore;
class AWSApiClientJobConfigTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
, public AWSCredentialRequestBus::Handler
{
public:
@@ -30,13 +27,9 @@ public:
void SetUp() override
{
AWSNativeSDKInit::InitializationManager::InitAwsApi();
m_credentialHandlerCounter = 0;
}
AWSCoreFixture::SetUpFixture();
void TearDown() override
{
AWSNativeSDKInit::InitializationManager::Shutdown();
m_credentialHandlerCounter = 0;
}
// AWSCredentialRequestBus interface implementation
@@ -8,7 +8,6 @@
#include <AzCore/Jobs/JobManager.h>
#include <AzCore/Jobs/JobContext.h>
#include <AzTest/AzTest.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
@@ -20,14 +19,14 @@
using namespace AWSCore;
class AwsApiJobConfigTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
, AWSCredentialRequestBus::Handler
, AWSCoreRequestBus::Handler
{
public:
void SetUp() override
{
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Create();
AWSCoreFixture::SetUpFixture();
m_credentialsHandler = std::make_shared<Aws::Auth::AnonymousAWSCredentialsProvider>();
AZ::JobManagerDesc jobDesc;
@@ -45,7 +44,7 @@ public:
m_jobManager.reset();
m_credentialsHandler.reset();
AZ::AllocatorInstance<AZ::ThreadPoolAllocator>::Destroy();
AWSCoreFixture::TearDownFixture();
}
// AWSCredentialRequestBus interface implementation
@@ -6,24 +6,24 @@
*
*/
#include <AzTest/AzTest.h>
#include <Framework/HttpRequestJob.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCore;
class HttpRequestJobTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
{
void SetUp() override
{
AWSCoreFixture::SetUpFixture();
HttpRequestJob::StaticInit();
}
void TearDown() override
{
HttpRequestJob::StaticShutdown();
AWSCoreFixture::TearDownFixture();
}
};
@@ -6,8 +6,6 @@
*
*/
#include <AzTest/AzTest.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <TestFramework/AWSCoreFixture.h>
@@ -18,7 +16,7 @@ using OBJECT_TYPE = TestObject<AZStd::string>;
using ARRAY_TYPE = AZStd::vector<AZStd::string>;
using ARRAY_OF_ARRAY_TYPE = AZStd::vector<AZStd::vector<AZStd::string>>;
using ARRAY_OF_OBJECT_TYPE = AZStd::vector<TestObject<AZStd::string>>;
using JsonReaderTest = UnitTest::ScopedAllocatorSetupFixture;
using JsonReaderTest = AWSCoreFixture;
template<class ValueType>
void TestJsonReaderSuccess(const ValueType& expectedValue, const char* valueString)
@@ -6,8 +6,6 @@
*
*/
#include <AzTest/AzTest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
@@ -17,7 +15,7 @@ using namespace AWSCoreTestingUtils;
using OBJECT_TYPE = TestObject<AZStd::string>;
using ARRAY_TYPE = AZStd::vector<AZStd::string>;
using JsonWriterTest = UnitTest::ScopedAllocatorSetupFixture;
using JsonWriterTest = AWSCoreFixture;
template<class ValueType>
void TestJsonWriterSuccess(const ValueType& actualValue, const char* valueString)
@@ -6,15 +6,13 @@
*
*/
#include <AzTest/AzTest.h>
#include <Framework/RequestBuilder.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCore;
using namespace AWSCoreTestingUtils;
using RequestBuilderTest = UnitTest::ScopedAllocatorSetupFixture;
using RequestBuilderTest = AWSCoreFixture;
TEST_F(RequestBuilderTest, WriteJsonBodyParameter_UseTestJsonBody_GetExpectedValue)
{
@@ -6,8 +6,6 @@
*
*/
#include <AzTest/AzTest.h>
#include <AWSCoreBus.h>
#include <Framework/ServiceClientJobConfig.h>
#include <ResourceMapping/AWSResourceMappingBus.h>
@@ -19,17 +17,21 @@ static constexpr const char TEST_EXPECTED_FEATURE_SERVICE_URL[] = "https://featu
static constexpr const char TEST_EXPECTED_CUSTOM_SERVICE_URL[] = "https://custom.service.com";
class ServiceClientJobConfigTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
, AWSResourceMappingRequestBus::Handler
{
void SetUp() override
{
AWSCoreFixture::SetUpFixture();
AWSResourceMappingRequestBus::Handler::BusConnect();
}
void TearDown() override
{
AWSResourceMappingRequestBus::Handler::BusDisconnect();
AWSCoreFixture::TearDownFixture();
}
// AWSResourceMappingRequestBus interface implementation
@@ -6,12 +6,10 @@
*
*/
#include <AzTest/AzTest.h>
#include <Framework/ServiceJobUtil.h>
#include <TestFramework/AWSCoreFixture.h>
using ServiceJobUtilTest = UnitTest::ScopedAllocatorSetupFixture;
using ServiceJobUtilTest = AWSCoreFixture;
TEST_F(ServiceJobUtilTest, DetermineRegionFromRequestUrl_DefaultUrlFormat_Success)
{
@@ -6,15 +6,13 @@
*
*/
#include <AzTest/AzTest.h>
#include <AWSCoreBus.h>
#include <Framework/ServiceRequestJob.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCore;
using ServiceRequestJobTest = UnitTest::ScopedAllocatorSetupFixture;
using ServiceRequestJobTest = AWSCoreFixture;
#define TEST_SERVICE_REQUEST(SERVICE_NAME, METHOD, PATH) \
static const char* Path() { return PATH; } \
@@ -6,14 +6,12 @@
*
*/
#include <AzTest/AzTest.h>
#include <Framework/Util.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCoreTestingUtils;
using FrameworkUtilTest = UnitTest::ScopedAllocatorSetupFixture;
using FrameworkUtilTest = AWSCoreFixture;
TEST_F(FrameworkUtilTest, ToAwsString_UseAzString_GetExpectedAwsString)
{
@@ -8,7 +8,6 @@
#include <AzCore/Settings/SettingsRegistry.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzTest/AzTest.h>
#include <Configuration/AWSCoreConfiguration.h>
#include <ResourceMapping/AWSResourceMappingConstants.h>
@@ -112,31 +111,21 @@ public:
m_resourceMappingManager = AZStd::make_unique<AWSCore::AWSResourceMappingManager>();
}
void CreateTestConfigFile(const AZStd::string& configContent)
{
m_normalizedConfigFilePath = AZStd::string::format("%s/%s", m_normalizedConfigFolderPath.c_str(), "test_aws_resource_mappings.json");
AzFramework::StringFunc::Path::Normalize(m_normalizedConfigFilePath);
CreateTestFile(m_normalizedConfigFilePath, configContent);
}
void SetUp() override
{
AWSCoreFixture::SetUpFixture(false);
m_normalizedSourceProjectFolder = AZStd::string::format("%s/%s%s/", AZ::Test::GetCurrentExecutablePath().c_str(),
"AWSResourceMappingManager", AZ::Uuid::CreateRandom().ToString<AZStd::string>(false, false).c_str());
AzFramework::StringFunc::Path::Normalize(m_normalizedSourceProjectFolder);
m_normalizedConfigFolderPath = AZStd::string::format("%s/%s/",
m_normalizedSourceProjectFolder.c_str(), AWSCore::AWSCoreConfiguration::AWSCoreResourceMappingConfigFolderName);
AzFramework::StringFunc::Path::Normalize(m_normalizedConfigFolderPath);
m_configFilePath = (GetTestTempDirectoryPath() /
AWSCore::AWSCoreConfiguration::AWSCoreResourceMappingConfigFolderName /
"test_aws_resource_mappings.json").LexicallyNormal();
AWSCoreInternalRequestBus::Handler::BusConnect();
}
void TearDown() override
{
AWSCoreInternalRequestBus::Handler::BusDisconnect();
RemoveTestFile();
RemoveTestDirectory();
RemoveFile(m_configFilePath.Native());
m_configFilePath.clear();
m_reloadConfigurationCounter = 0;
m_resourceMappingManager->DeactivateManager();
@@ -147,57 +136,17 @@ public:
// AWSCoreInternalRequestBus interface implementation
AZStd::string GetProfileName() const override { return ""; }
AZStd::string GetResourceMappingConfigFilePath() const override { return m_normalizedConfigFilePath; }
AZStd::string GetResourceMappingConfigFilePath() const override { return m_configFilePath.Native(); }
void ReloadConfiguration() override { m_reloadConfigurationCounter++; }
AZStd::unique_ptr<AWSCore::AWSResourceMappingManager> m_resourceMappingManager;
AZ::u8 m_reloadConfigurationCounter;
private:
AZStd::string m_normalizedSourceProjectFolder;
AZStd::string m_normalizedConfigFolderPath;
AZStd::string m_normalizedConfigFilePath;
void CreateTestFile(const AZStd::string& filePath, const AZStd::string& fileContent)
{
AZ::IO::SystemFile file;
if (!file.Open(filePath.c_str(),
AZ::IO::SystemFile::OpenMode::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_CREATE_PATH | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY))
{
AZ_Assert(false, "Failed to open test file");
}
if (file.Write(fileContent.c_str(), fileContent.size()) != fileContent.size())
{
AZ_Assert(false, "Failed to write test file");
}
file.Close();
}
void RemoveTestFile()
{
if (!m_normalizedConfigFilePath.empty())
{
AZ_Assert(AZ::IO::SystemFile::Delete(m_normalizedConfigFilePath.c_str()),
"Failed to delete test config file at %s", m_normalizedConfigFilePath.c_str());
}
}
void RemoveTestDirectory()
{
if (!m_normalizedConfigFilePath.empty())
{
AZ_Assert(AZ::IO::SystemFile::DeleteDir(m_normalizedConfigFolderPath.c_str()),
"Failed to delete test config folder at %s", m_normalizedConfigFolderPath.c_str());
AZ_Assert(AZ::IO::SystemFile::DeleteDir(m_normalizedSourceProjectFolder.c_str()),
"Failed to delete test folder at %s", m_normalizedSourceProjectFolder.c_str());
}
}
AZ::IO::Path m_configFilePath;
};
TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseInvalidConfigFile_ConfigDataIsEmpty)
{
CreateTestConfigFile(TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -212,7 +161,7 @@ TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseInvalidConfigFile_Con
TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_ConfigDataIsNotEmpty)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -227,7 +176,7 @@ TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_Confi
TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseTemplateConfigFile_ConfigDataIsNotEmpty)
{
CreateTestConfigFile(TEST_TEMPLATE_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_TEMPLATE_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -242,7 +191,7 @@ TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseTemplateConfigFile_Co
TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_ConfigDataIsNotEmptyWithMultithreadCalls)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
constexpr int testThreadNumber = 10;
@@ -267,7 +216,7 @@ TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_Confi
TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_GlobalAccountIdEmpty)
{
CreateTestConfigFile(TEST_VALID_EMPTY_ACCOUNTID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_EMPTY_ACCOUNTID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -282,7 +231,7 @@ TEST_F(AWSResourceMappingManagerTest, ActivateManager_ParseValidConfigFile_Globa
TEST_F(AWSResourceMappingManagerTest, DeactivateManager_AfterActivatingWithValidConfigFile_ConfigDataGetCleanedUp)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -302,7 +251,7 @@ TEST_F(AWSResourceMappingManagerTest, DeactivateManager_AfterActivatingWithValid
TEST_F(AWSResourceMappingManagerTest, GetDefaultAccountId_AfterParsingValidConfigFile_GetExpectedDefaultAccountId)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -313,7 +262,7 @@ TEST_F(AWSResourceMappingManagerTest, GetDefaultAccountId_AfterParsingValidConfi
TEST_F(AWSResourceMappingManagerTest, GetDefaultRegion_AfterParsingValidConfigFile_GetExpectedDefaultRegion)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualRegion;
@@ -324,7 +273,7 @@ TEST_F(AWSResourceMappingManagerTest, GetDefaultRegion_AfterParsingValidConfigFi
TEST_F(AWSResourceMappingManagerTest, GetResourceAccountId_AfterParsingValidConfigFile_GetExpectedAccountId)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -341,7 +290,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceAccountId_AfterParsingValidConf
TEST_F(AWSResourceMappingManagerTest, GetResourceAccountId_QueryNonexistResourceMappingKeyName_GetEmptyAccountId)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -352,7 +301,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceAccountId_QueryNonexistResource
TEST_F(AWSResourceMappingManagerTest, GetResourceNameId_AfterParsingValidConfigFile_GetExpectedNameId)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualNameId;
@@ -369,7 +318,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceNameId_AfterParsingValidConfigF
TEST_F(AWSResourceMappingManagerTest, GetResourceNameId_QueryNonexistResourceMappingKeyName_GetEmptyNameId)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualNameId;
@@ -380,7 +329,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceNameId_QueryNonexistResourceMap
TEST_F(AWSResourceMappingManagerTest, GetResourceRegion_AfterParsingValidConfigFile_GetExpectedRegion)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualRegion;
@@ -397,7 +346,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceRegion_AfterParsingValidConfigF
TEST_F(AWSResourceMappingManagerTest, GetResourceRegion_QueryNonexistResourceMappingKeyName_GetEmptyRegion)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualRegion;
@@ -408,7 +357,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceRegion_QueryNonexistResourceMap
TEST_F(AWSResourceMappingManagerTest, GetResourceType_AfterParsingValidConfigFile_GetExpectedType)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualType;
@@ -425,7 +374,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceType_AfterParsingValidConfigFil
TEST_F(AWSResourceMappingManagerTest, GetResourceType_QueryNonexistResourceMappingKeyName_GetEmptyType)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualType;
@@ -436,7 +385,7 @@ TEST_F(AWSResourceMappingManagerTest, GetResourceType_QueryNonexistResourceMappi
TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_PassingEmptyServiceName_GetEmptyUrl)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualServiceUrl;
@@ -447,7 +396,7 @@ TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_PassingEmptyServiceName_GetE
TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_PassingEmptyRESTApiIdAndStage_GetEmptyUrl)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualServiceUrl;
@@ -458,7 +407,7 @@ TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_PassingEmptyRESTApiIdAndStag
TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_RESTApiIdAndStageHaveInconsistentRegion_GetEmptyUrl)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualServiceUrl;
@@ -469,7 +418,7 @@ TEST_F(AWSResourceMappingManagerTest, GetServiceUrl_RESTApiIdAndStageHaveInconsi
TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ParseValidConfigFileAfterParsingInvalid_ConfigDataGetParsed)
{
CreateTestConfigFile(TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_INVALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ActivateManager();
AZStd::string actualAccountId;
@@ -481,7 +430,7 @@ TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ParseValidConfigFileAfter
EXPECT_TRUE(actualRegion.empty());
EXPECT_TRUE(m_resourceMappingManager->GetStatus() == AWSResourceMappingManager::Status::Error);
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ReloadConfigFile();
AWSResourceMappingRequestBus::BroadcastResult(actualAccountId, &AWSResourceMappingRequests::GetDefaultAccountId);
@@ -494,7 +443,7 @@ TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ParseValidConfigFileAfter
TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ReloadConfigFileNameAndParseValidConfigFile_ConfigDataGetParsed)
{
CreateTestConfigFile(TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
CreateFile(m_configFilePath.Native(), TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE);
m_resourceMappingManager->ReloadConfigFile(true);
EXPECT_EQ(m_reloadConfigurationCounter, 1);
@@ -505,6 +454,7 @@ TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_ReloadConfigFileNameAndPa
TEST_F(AWSResourceMappingManagerTest, ReloadConfigFile_MissingSetRegFile_ConfigDataIsNotParsed)
{
m_configFilePath.clear();
m_resourceMappingManager->ReloadConfigFile(true);
EXPECT_EQ(m_reloadConfigurationCounter, 1);
@@ -6,8 +6,6 @@
*
*/
#include <AzTest/AzTest.h>
#include <ResourceMapping/AWSResourceMappingUtils.h>
#include <TestFramework/AWSCoreFixture.h>
@@ -18,7 +16,7 @@ static constexpr const char TEST_VALID_RESTAPI_REGION[] = "us-west-2";
static constexpr const char TEST_VALID_RESTAPI_CHINA_REGION[] = "cn-north-1";
static constexpr const char TEST_VALID_RESTAPI_STAGE[] = "prod";
using AWSResourceMappingUtilsTest = UnitTest::ScopedAllocatorSetupFixture;
using AWSResourceMappingUtilsTest = AWSCoreFixture;
TEST_F(AWSResourceMappingUtilsTest, FormatRESTApiUrl_PassingValidArguments_ReturnExpectedResult)
{
@@ -7,7 +7,6 @@
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzTest/AzTest.h>
#include <ScriptCanvas/AWSScriptBehaviorDynamoDB.h>
#include <TestFramework/AWSCoreFixture.h>
@@ -32,7 +31,7 @@ public:
MOCK_METHOD1(OnGetItemError, void(const AZStd::string&));
};
using AWSScriptBehaviorDynamoDBTest = UnitTest::ScopedAllocatorSetupFixture;
using AWSScriptBehaviorDynamoDBTest = AWSCoreFixture;
TEST_F(AWSScriptBehaviorDynamoDBTest, GetItemRaw_CallWithEmptyTableName_InvokeOnError)
{
@@ -7,14 +7,14 @@
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzTest/AzTest.h>
#include <ScriptCanvas/AWSScriptBehaviorLambda.h>
#include <TestFramework/AWSCoreFixture.h>
using namespace AWSCore;
class AWSScriptBehaviorLambdaNotificationBusHandlerMock : public AWSScriptBehaviorLambdaNotificationBusHandler
class AWSScriptBehaviorLambdaNotificationBusHandlerMock
: public AWSScriptBehaviorLambdaNotificationBusHandler
{
public:
AWSScriptBehaviorLambdaNotificationBusHandlerMock()
@@ -31,7 +31,7 @@ public:
MOCK_METHOD1(OnInvokeError, void(const AZStd::string&));
};
using AWSScriptBehaviorLambdaTest = UnitTest::ScopedAllocatorSetupFixture;
using AWSScriptBehaviorLambdaTest = AWSCoreFixture;
TEST_F(AWSScriptBehaviorLambdaTest, InvokeRaw_CallWithEmptyFunctionName_InvokeOnError)
{
@@ -145,17 +145,18 @@ TEST_F(AWSScriptBehaviorS3Test, GetObjectRaw_CallWithOutfileDirectoryNoExist_Inv
AWSScriptBehaviorS3::GetObjectRaw("dummyBucket", "dummyObject", "dummyRegion", dummyDirectory);
}
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
// The preparation step for this test case does not work in release mode
TEST_F(AWSScriptBehaviorS3Test, GetObjectRaw_CallWithOutfileIsReadOnly_InvokeOnError)
{
AWSScriptBehaviorS3NotificationBusHandlerMock s3HandlerMock;
EXPECT_CALL(s3HandlerMock, OnGetObjectError(::testing::_)).Times(1);
AZStd::string randomTestFile = AZStd::string::format("%s/test%s.txt",
AZ::Test::GetCurrentExecutablePath().c_str(), AZ::Uuid::CreateRandom().ToString<AZStd::string>(false, false).c_str());
AzFramework::StringFunc::Path::Normalize(randomTestFile);
CreateReadOnlyTestFile(randomTestFile);
AWSScriptBehaviorS3::GetObjectRaw("dummyBucket", "dummyObject", "dummyRegion", randomTestFile);
RemoveReadOnlyTestFile(randomTestFile);
AZ::IO::Path randomTestFilePath = (GetTestTempDirectoryPath() / "random_test.txt").LexicallyNormal();
CreateReadOnlyTestFile(randomTestFilePath.Native());
AWSScriptBehaviorS3::GetObjectRaw("dummyBucket", "dummyObject", "dummyRegion", randomTestFilePath.Native());
RemoveReadOnlyTestFile(randomTestFilePath.Native());
}
#endif
TEST_F(AWSScriptBehaviorS3Test, GetObject_NoBucketNameInResourceMappingFound_InvokeOnError)
{
@@ -9,7 +9,6 @@
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzTest/AzTest.h>
#include <ScriptCanvas/AWSScriptBehaviorsComponent.h>
#include <TestFramework/AWSCoreFixture.h>
@@ -17,11 +16,12 @@
using namespace AWSCore;
class AWSScriptBehaviorsComponentTest
: public UnitTest::ScopedAllocatorSetupFixture
: public AWSCoreFixture
{
public:
void SetUp() override
{
AWSCoreFixture::SetUpFixture();
m_serializeContext = AZStd::make_unique<AZ::SerializeContext>();
m_serializeContext->CreateEditContext();
m_behaviorContext = AZStd::make_unique<AZ::BehaviorContext>();
@@ -39,6 +39,7 @@ public:
m_componentDescriptor.reset();
m_behaviorContext.reset();
m_serializeContext.reset();
AWSCoreFixture::TearDownFixture();
}
protected:
@@ -17,6 +17,8 @@
#include <Framework/JsonObjectHandler.h>
#include <Framework/JsonWriter.h>
#include <AWSNativeSDKInit/AWSNativeSDKInit.h>
namespace AWSCoreTestingUtils
{
static const AZStd::string STRING_VALUE{"s"};
@@ -135,6 +137,8 @@ public:
{
m_app = AZStd::make_unique<AZ::ComponentApplication>();
}
AWSNativeSDKInit::InitializationManager::InitAwsApi();
}
void TearDown() override
@@ -144,6 +148,8 @@ public:
void TearDownFixture(bool mockSettingsRegistry = true)
{
AWSNativeSDKInit::InitializationManager::Shutdown();
if (mockSettingsRegistry)
{
AZ::SettingsRegistry::Unregister(m_settingsRegistry.get());
@@ -171,7 +177,7 @@ public:
bool CreateFile(const AZStd::string& filePath, const AZStd::string& content)
{
AZ::IO::HandleType fileHandle;
if (!m_localFileIO->Open(filePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText, fileHandle))
if (!m_localFileIO->Open(filePath.c_str(), AZ::IO::OpenMode::ModeCreatePath | AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText, fileHandle))
{
return false;
}
@@ -197,6 +203,13 @@ private:
AZ::IO::FileIOBase* m_otherFileIO = nullptr;
protected:
AZ::IO::Path GetTestTempDirectoryPath()
{
AZ::IO::Path testTempDirPath{ m_testTempDirectory.GetDirectory() };
return testTempDirPath;
}
AZ::Test::ScopedAutoTempDirectory m_testTempDirectory;
AZStd::unique_ptr<AZ::SettingsRegistryImpl> m_settingsRegistry;
AZStd::unique_ptr<AZ::ComponentApplication> m_app;
};
@@ -10,6 +10,7 @@
#include <scenesrg.srgi>
#include <viewsrg.srgi>
#include <Atom/RPI/Math.azsli>
#include "Shadow.azsli"
#include "ShadowmapAtlasLib.azsli"
#include "BicubicPcfFilters.azsli"
@@ -25,6 +26,10 @@
enum class ShadowFilterMethod {None, Pcf, Esm, EsmPcf};
option ShadowFilterMethod o_directional_shadow_filtering_method = ShadowFilterMethod::None;
option bool o_directional_shadow_receiver_plane_bias_enable = true;
option bool o_blend_between_cascades_enable = false;
static const float CascadeBlendArea = 0.015f; // might be worth exposing this as a slider.
// DirectionalLightShadow calculates lit ratio for a directional light.
class DirectionalLightShadow
@@ -98,6 +103,8 @@ class DirectionalLightShadow
float SamplePcfBicubic(float3 shadowCoord, uint indexOfCascade);
float CalculateCascadeBlendAmount(const float3 texCoord);
uint m_lightIndex;
float3 m_shadowCoords[ViewSrg::MaxCascadeCount];
float m_slopeBias[ViewSrg::MaxCascadeCount];
@@ -174,6 +181,7 @@ bool2 DirectionalLightShadow::IsShadowed(float3 shadowCoord, uint indexOfCascade
const uint cascadeCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_cascadeCount;
Texture2DArray<float> shadowmap = PassSrg::m_directionalLightShadowmap;
[branch]
if (shadowCoord.x >= 0. && shadowCoord.x * size < size - PixelMargin &&
shadowCoord.y >= 0. && shadowCoord.y * size < size - PixelMargin)
{
@@ -213,20 +221,46 @@ float DirectionalLightShadow::GetVisibilityFromLightPcf()
static const float PixelMargin = 1.5; // avoiding artifact between cascade levels.
static const float DepthMargin = 1e-8; // avoiding artifact when near depth bounds.
bool cascadeFound = false;
int currentCascadeIndex = 0;
const uint size = ViewSrg::m_directionalLightShadows[m_lightIndex].m_shadowmapSize;
const uint cascadeCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_cascadeCount;
for (uint indexOfCascade = 0; indexOfCascade < cascadeCount; ++indexOfCascade)
{
const float3 shadowCoord = m_shadowCoords[indexOfCascade];
if (shadowCoord.x >= 0. && shadowCoord.x * size < size - PixelMargin &&
shadowCoord.y >= 0. && shadowCoord.y * size < size - PixelMargin &&
shadowCoord.z < 1. - DepthMargin)
{
m_debugInfo.m_cascadeIndex = indexOfCascade;
return SamplePcfBicubic(shadowCoord, indexOfCascade);
currentCascadeIndex = m_debugInfo.m_cascadeIndex = indexOfCascade;
cascadeFound = true;
break;
}
}
[branch]
if (cascadeFound)
{
float lit = SamplePcfBicubic(m_shadowCoords[currentCascadeIndex], currentCascadeIndex);
if(o_blend_between_cascades_enable)
{
const float blendBetweenCascadesAmount = CalculateCascadeBlendAmount(m_shadowCoords[currentCascadeIndex].xyz);
const int nextCascadeIndex = currentCascadeIndex + 1;
[branch]
if (blendBetweenCascadesAmount < 1.0f && nextCascadeIndex < cascadeCount)
{
const float nextLit = SamplePcfBicubic(m_shadowCoords[nextCascadeIndex], nextCascadeIndex);
lit = lerp(nextLit, lit, blendBetweenCascadesAmount);
}
}
return lit;
}
m_debugInfo.m_cascadeIndex = cascadeCount;
return 1.;
}
@@ -244,6 +278,8 @@ float DirectionalLightShadow::GetVisibilityFromLightEsm()
const float distanceMin = ViewSrg::m_esmsDirectional[indexOfCascade].m_lightDistanceOfCameraViewFrustum;
bool2 checkedShadowed = IsShadowed(shadowCoord, indexOfCascade);
const float depthDiff = shadowCoord.z - distanceMin;
[branch]
if (checkedShadowed.x && depthDiff >= 0)
{
const float distanceWithinCameraView = depthDiff / (1. - distanceMin);
@@ -274,6 +310,8 @@ float DirectionalLightShadow::GetVisibilityFromLightEsmPcf()
const float distanceMin = ViewSrg::m_esmsDirectional[indexOfCascade].m_lightDistanceOfCameraViewFrustum;
bool2 checkedShadowed = IsShadowed(shadowCoord, indexOfCascade);
const float depthDiff = shadowCoord.z - distanceMin;
[branch]
if (checkedShadowed.x && depthDiff >= 0)
{
const float distanceWithinCameraView = depthDiff / (1. - distanceMin);
@@ -319,6 +357,7 @@ float DirectionalLightShadow::SamplePcfBicubic(float3 shadowCoord, uint indexOfC
param.samplerState = SceneSrg::m_hwPcfSampler;
param.receiverPlaneDepthBias = o_directional_shadow_receiver_plane_bias_enable ? ComputeReceiverPlaneDepthBias(m_shadowPosDX[indexOfCascade], m_shadowPosDY[indexOfCascade]) : 0;
[branch]
if (filteringSampleCount <= 4)
{
return SampleShadowMapBicubic_4Tap(param);
@@ -420,3 +459,10 @@ float3 DirectionalLightShadow::AddDebugColoring(
}
return color;
}
float DirectionalLightShadow::CalculateCascadeBlendAmount(const float3 texCoord)
{
const float distanceToOneMin = min3(1.0f - texCoord);
const float currentPixelsBlendBandLocation = min(min(texCoord.x, texCoord.y), distanceToOneMin);
return currentPixelsBlendBandLocation / CascadeBlendArea;
}
@@ -368,16 +368,19 @@ void CullDecals(uint groupIndex, TileLightData tileLightData, float3 aabb_center
float3 decalPosition = WorldToView_Point(decal.m_position);
// just wrapping a bounding sphere around a cube for now to get a minor perf boost. i.e. the sphere radius is sqrt(x*x + y*y + z*z)
// ATOM-4224 - try AABB-AABB and implement depth binning for the decals
float maxHalfSize = max(max(decal.m_halfSize.x, decal.m_halfSize.y), decal.m_halfSize.z);
float boundingSphereRadiusSqr = maxHalfSize * maxHalfSize * 3;
// ATOM-4224 - try AABB-AABB
float boundingSphereRadiusSqr = dot(decal.m_halfSize, decal.m_halfSize);
bool potentiallyIntersects = TestSphereVsAabb(decalPosition, boundingSphereRadiusSqr, aabb_center, aabb_extents);
if (potentiallyIntersects)
{
// Implement and profile fine-grained light culling testing
// ATOM-3732
MarkLightAsVisibleInSharedMemory(decalIndex, 0xFFFF);
uint inside = 0;
float2 minmax = ComputePointLightMinMaxZ(sqrt(boundingSphereRadiusSqr), decalPosition);
if (IsObjectInsideTile(tileLightData, minmax, inside))
{
MarkLightAsVisibleInSharedMemory(decalIndex, inside);
}
}
}
}
@@ -163,6 +163,9 @@ namespace AZ
//! Reduces acne by biasing the shadowmap lookup along the geometric normal.
virtual void SetNormalShadowBias(LightHandle handle, float normalShadowBias) = 0;
//! Sets whether or not blending between shadow map cascades is enabled.
virtual void SetCascadeBlendingEnabled(LightHandle handle, bool enable) = 0;
};
} // namespace Render
} // namespace AZ
@@ -198,13 +198,15 @@ namespace AZ
if (m_shadowingLightHandle.IsValid())
{
uint32_t shadowFilterMethod = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_shadowFilterMethod;
const uint32_t shadowFilterMethod = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_shadowFilterMethod;
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowFilteringMethodName, AZ::RPI::ShaderOptionValue{shadowFilterMethod});
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowReceiverPlaneBiasEnableName, AZ::RPI::ShaderOptionValue{ m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()).m_isReceiverPlaneBiasEnabled });
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowReceiverPlaneBiasEnableName, AZ::RPI::ShaderOptionValue{ m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()).m_isReceiverPlaneBiasEnabled });
const uint32_t cascadeCount = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_cascadeCount;
ShadowProperty& property = m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex());
RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_BlendBetweenCascadesEnableName, AZ::RPI::ShaderOptionValue{cascadeCount > 1 && m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()).m_blendBetwenCascades });
ShadowProperty& property = m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex());
bool segmentsNeedUpdate = property.m_segments.empty();
for (const auto& passIt : m_cascadedShadowmapsPasses)
{
@@ -577,6 +579,11 @@ namespace AZ
m_shadowProperties.GetData(handle.GetIndex()).m_isReceiverPlaneBiasEnabled = enable;
}
void DirectionalLightFeatureProcessor::SetCascadeBlendingEnabled(LightHandle handle, bool enable)
{
m_shadowProperties.GetData(handle.GetIndex()).m_blendBetwenCascades = enable;
}
void DirectionalLightFeatureProcessor::SetShadowBias(LightHandle handle, float bias)
{
for (auto& it : m_shadowData)
@@ -176,6 +176,8 @@ namespace AZ
// If true, this will reduce the shadow acne introduced by large pcf kernels by estimating the angle of the triangle being shaded
// with the ddx/ddy functions.
bool m_isReceiverPlaneBiasEnabled = true;
bool m_blendBetwenCascades = false;
};
static void Reflect(ReflectContext* context);
@@ -215,6 +217,7 @@ namespace AZ
void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) override;
void SetFilteringSampleCount(LightHandle handle, uint16_t count) override;
void SetShadowReceiverPlaneBiasEnabled(LightHandle handle, bool enable) override;
void SetCascadeBlendingEnabled(LightHandle handle, bool enable) override;
void SetShadowBias(LightHandle handle, float bias) override;
void SetNormalShadowBias(LightHandle handle, float normalShadowBias) override;
@@ -367,6 +370,7 @@ namespace AZ
Name m_lightTypeName = Name("directional");
Name m_directionalShadowFilteringMethodName = Name("o_directional_shadow_filtering_method");
Name m_directionalShadowReceiverPlaneBiasEnableName = Name("o_directional_shadow_receiver_plane_bias_enable");
Name m_BlendBetweenCascadesEnableName = Name("o_blend_between_cascades_enable");
static constexpr const char* FeatureProcessorName = "DirectionalLightFeatureProcessor";
};
} // namespace Render
@@ -9,6 +9,7 @@
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/string/conversions.h>
@@ -184,6 +184,14 @@ namespace AZ
//! Reduces acne by biasing the shadowmap lookup along the geometric normal.
//! @param normalShadowBias Sets the amount of normal shadow bias to apply.
virtual void SetNormalShadowBias(float normalShadowBias) = 0;
//! Gets whether the directional shadow map has cascade blending enabled.
//! This smooths out the border between cascades at the cost of some performance in the blend area.
virtual bool GetCascadeBlendingEnabled() const = 0;
//! Sets whether the directional shadow map has cascade blending enabled.
//! @param enable flag specifying whether to enable cascade blending.
virtual void SetCascadeBlendingEnabled(bool enable) = 0;
};
using DirectionalLightRequestBus = EBus<DirectionalLightRequests>;
@@ -115,6 +115,9 @@ namespace AZ
//! Reduces shadow acne by applying a small amount of offset along shadow-space z.
float m_shadowBias = 0.0f;
// If true, sample between two adjacent shadow map cascades in a small boundary area to smooth out the transition.
bool m_cascadeBlendingEnabled = false;
bool IsSplitManual() const;
bool IsSplitAutomatic() const;
bool IsCascadeCorrectionDisabled() const;
@@ -40,7 +40,8 @@ namespace AZ
->Field("PcfFilteringSampleCount", &DirectionalLightComponentConfig::m_filteringSampleCount)
->Field("ShadowReceiverPlaneBiasEnabled", &DirectionalLightComponentConfig::m_receiverPlaneBiasEnabled)
->Field("Shadow Bias", &DirectionalLightComponentConfig::m_shadowBias)
->Field("Normal Shadow Bias", &DirectionalLightComponentConfig::m_normalShadowBias);
->Field("Normal Shadow Bias", &DirectionalLightComponentConfig::m_normalShadowBias)
->Field("CascadeBlendingEnabled", &DirectionalLightComponentConfig::m_cascadeBlendingEnabled);
}
}
@@ -113,8 +114,7 @@ namespace AZ
bool DirectionalLightComponentConfig::IsShadowPcfDisabled() const
{
return !(m_shadowFilterMethod == ShadowFilterMethod::Pcf ||
m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
return !(m_shadowFilterMethod == ShadowFilterMethod::Pcf);
}
bool DirectionalLightComponentConfig::IsEsmDisabled() const
@@ -88,6 +88,8 @@ namespace AZ
->Event("SetShadowBias", &DirectionalLightRequestBus::Events::SetShadowBias)
->Event("GetNormalShadowBias", &DirectionalLightRequestBus::Events::GetNormalShadowBias)
->Event("SetNormalShadowBias", &DirectionalLightRequestBus::Events::SetNormalShadowBias)
->Event("GetCascadeBlendingEnabled", &DirectionalLightRequestBus::Events::GetCascadeBlendingEnabled)
->Event("SetCascadeBlendingEnabled", &DirectionalLightRequestBus::Events::SetCascadeBlendingEnabled)
->VirtualProperty("Color", "GetColor", "SetColor")
->VirtualProperty("Intensity", "GetIntensity", "SetIntensity")
->VirtualProperty("AngularDiameter", "GetAngularDiameter", "SetAngularDiameter")
@@ -104,7 +106,8 @@ namespace AZ
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
->VirtualProperty("ShadowReceiverPlaneBiasEnabled", "GetShadowReceiverPlaneBiasEnabled", "SetShadowReceiverPlaneBiasEnabled")
->VirtualProperty("ShadowBias", "GetShadowBias", "SetShadowBias")
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias");
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias")
->VirtualProperty("BlendBetweenCascadesEnabled", "GetCascadeBlendingEnabled", "SetCascadeBlendingEnabled");
;
}
}
@@ -537,6 +540,7 @@ namespace AZ
SetNormalShadowBias(m_configuration.m_normalShadowBias);
SetFilteringSampleCount(m_configuration.m_filteringSampleCount);
SetShadowReceiverPlaneBiasEnabled(m_configuration.m_receiverPlaneBiasEnabled);
SetCascadeBlendingEnabled(m_configuration.m_cascadeBlendingEnabled);
// [GFX TODO][ATOM-1726] share config for multiple light (e.g., light ID).
// [GFX TODO][ATOM-2416] adapt to multiple viewports.
@@ -636,5 +640,16 @@ namespace AZ
m_featureProcessor->SetShadowReceiverPlaneBiasEnabled(m_lightHandle, enable);
}
bool DirectionalLightComponentController::GetCascadeBlendingEnabled() const
{
return m_configuration.m_cascadeBlendingEnabled;
}
void DirectionalLightComponentController::SetCascadeBlendingEnabled(bool enable)
{
m_configuration.m_cascadeBlendingEnabled = enable;
m_featureProcessor->SetCascadeBlendingEnabled(m_lightHandle, enable);
}
} // namespace Render
} // namespace AZ
@@ -83,7 +83,9 @@ namespace AZ
float GetShadowBias() const override;
void SetShadowBias(float bias) override;
float GetNormalShadowBias() const override;
void SetNormalShadowBias(float bias) override;
void SetNormalShadowBias(float bias) override;
bool GetCascadeBlendingEnabled() const override;
void SetCascadeBlendingEnabled(bool enable) override;
private:
friend class EditorDirectionalLightComponent;
@@ -161,7 +161,11 @@ namespace AZ
->Attribute(Edit::Attributes::Min, 0.f)
->Attribute(Edit::Attributes::Max, 10.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
;
->DataElement(
Edit::UIHandlers::CheckBox, &DirectionalLightComponentConfig::m_cascadeBlendingEnabled,
"Blend between cascades\n", "Enables smooth blending between shadow map cascades.")
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsShadowPcfDisabled)
;
}
}
@@ -688,7 +688,7 @@ namespace MCommon
const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(jointIndex).m_position;
const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).m_position;
const AZ::Vector3 bone = parentWorldPos - nodeWorldPos;
const AZ::Vector3 boneDirection = MCore::SafeNormalize(bone);
const AZ::Vector3 boneDirection = bone.GetNormalizedSafe();
const float boneLength = MCore::SafeLength(bone);
const float boneScale = GetBoneScale(actorInstance, joint);
const float parentBoneScale = GetBoneScale(actorInstance, skeleton->GetNode(parentIndex));
@@ -258,9 +258,9 @@ namespace EMotionFX
// Calculate the matrix to rotate the solve plane.
void BlendTreeFootIKNode::CalculateMatrix(const AZ::Vector3& goal, const AZ::Vector3& bendDir, AZ::Matrix3x3* outForward)
{
const AZ::Vector3 x = MCore::SafeNormalize(goal);
const AZ::Vector3 x = goal.GetNormalizedSafe();
const float dot = bendDir.Dot(x);
const AZ::Vector3 y = MCore::SafeNormalize(bendDir - (dot * x));
const AZ::Vector3 y = (bendDir - (dot * x)).GetNormalizedSafe();
const AZ::Vector3 z = x.Cross(y);
outForward->SetRow(0, x);
outForward->SetRow(1, y);
@@ -189,11 +189,11 @@ namespace EMotionFX
void BlendTreeTwoLinkIKNode::CalculateMatrix(const AZ::Vector3& goal, const AZ::Vector3& bendDir, AZ::Matrix3x3* outForward)
{
// the inverse matrix defines a coordinate system whose x axis contains P, so X = unit(P).
const AZ::Vector3 x = MCore::SafeNormalize(goal);
const AZ::Vector3 x = goal.GetNormalizedSafe();
// the y axis of the inverse is perpendicular to P, so Y = unit( D - X(D . X) ).
const float dot = bendDir.Dot(x);
const AZ::Vector3 y = MCore::SafeNormalize(bendDir - (dot * x));
const AZ::Vector3 y = (bendDir - (dot * x)).GetNormalizedSafe();
// the z axis of the inverse is perpendicular to both X and Y, so Z = X x Y.
const AZ::Vector3 z = x.Cross(y);
@@ -372,11 +372,11 @@ namespace EMotionFX
if (m_relativeBendDir && !m_extractBendDir)
{
bendDir = actorInstance->GetWorldSpaceTransform().m_rotation.TransformVector(bendDir);
bendDir = MCore::SafeNormalize(bendDir);
bendDir.NormalizeSafe();
}
else
{
bendDir = MCore::SafeNormalize(bendDir);
bendDir.NormalizeSafe();
}
// if end node rotation is enabled
@@ -470,8 +470,8 @@ namespace EMotionFX
// calculate the differences between the current forward vector and the new one after IK
AZ::Vector3 oldForward = globalTransformB.m_position - globalTransformA.m_position;
AZ::Vector3 newForward = midPos - globalTransformA.m_position;
oldForward = MCore::SafeNormalize(oldForward);
newForward = MCore::SafeNormalize(newForward);
oldForward.NormalizeSafe();
newForward.NormalizeSafe();
// perform a delta rotation to rotate into the new direction after IK
float dotProduct = oldForward.Dot(newForward);
@@ -499,9 +499,8 @@ namespace EMotionFX
oldForward = endEffectorNodePos - globalTransformB.m_position;
}
oldForward = MCore::SafeNormalize(oldForward);
newForward = goal - globalTransformB.m_position;
newForward = MCore::SafeNormalize(newForward);
oldForward.NormalizeSafe();
newForward = (goal - globalTransformB.m_position).GetNormalizedSafe();
// calculate the delta rotation
dotProduct = oldForward.Dot(newForward);
@@ -581,8 +581,8 @@ namespace EMotionFX
&curTangent, &curBitangent);
// normalize the vectors
curTangent = MCore::SafeNormalize(curTangent);
curBitangent = MCore::SafeNormalize(curBitangent);
curTangent.NormalizeSafe();
curBitangent.NormalizeSafe();
// store the tangents in the orgTangents array
const AZ::Vector4 vec4Tangent(curTangent.GetX(), curTangent.GetY(), curTangent.GetZ(), 1.0f);
@@ -605,7 +605,7 @@ namespace EMotionFX
{
// get the normal
AZ::Vector3 normal(normals[i]);
normal = MCore::SafeNormalize(normal);
normal.NormalizeSafe();
// get the tangent
AZ::Vector3 tangent = AZ::Vector3(orgTangents[i].GetX(), orgTangents[i].GetY(), orgTangents[i].GetZ());
@@ -631,7 +631,7 @@ namespace EMotionFX
// Gram-Schmidt orthogonalize
AZ::Vector3 fixedTangent = tangent - (normal * normal.Dot(tangent));
fixedTangent = MCore::SafeNormalize(fixedTangent);
fixedTangent.NormalizeSafe();
// calculate handedness
const AZ::Vector3 crossResult = normal.Cross(tangent);
@@ -1671,7 +1671,7 @@ namespace EMotionFX
const AZ::Vector3& posA = positions[ indexA ];
const AZ::Vector3& posB = positions[ indexB ];
const AZ::Vector3& posC = positions[ indexC ];
AZ::Vector3 faceNormal = MCore::SafeNormalize((posB - posA).Cross(posC - posB));
AZ::Vector3 faceNormal = (posB - posA).Cross(posC - posB).GetNormalizedSafe();
// store the tangents in the orgTangents array
smoothNormals[ orgVerts[indexA] ] += faceNormal;
@@ -1684,7 +1684,7 @@ namespace EMotionFX
// normalize
for (uint32 i = 0; i < m_numOrgVerts; ++i)
{
smoothNormals[i] = MCore::SafeNormalize(smoothNormals[i]);
smoothNormals[i].NormalizeSafe();
}
for (uint32 i = 0; i < m_numVertices; ++i)
@@ -1721,7 +1721,7 @@ namespace EMotionFX
const AZ::Vector3& posA = positions[ indexA ];
const AZ::Vector3& posB = positions[ indexB ];
const AZ::Vector3& posC = positions[ indexC ];
AZ::Vector3 faceNormal = MCore::SafeNormalize((posB - posA).Cross(posC - posB));
AZ::Vector3 faceNormal = (posB - posA).Cross(posC - posB).GetNormalizedSafe();
// store the tangents in the orgTangents array
normals[indexA] = normals[indexA] + faceNormal;
@@ -1734,7 +1734,7 @@ namespace EMotionFX
// normalize the normals
for (uint32 i = 0; i < m_numVertices; ++i)
{
normals[i] = MCore::SafeNormalize(normals[i]);
normals[i].NormalizeSafe();
}
}
}
@@ -17,12 +17,14 @@
namespace MCore
{
//! @deprecated Use AZ::Vector3::NormalizeSafeWithLength()
inline float SafeLength(const AZ::Vector3& rhs)
{
const float lenSq = rhs.Dot(rhs);
return (lenSq > FLT_EPSILON) ? sqrtf(lenSq) : 0.0f;
}
//! @deprecated Use AZ::Vector3::GetNormalizedSafe()
inline AZ::Vector3 SafeNormalize(const AZ::Vector3& rhs)
{
AZ::Vector3 result(0.0f);
@@ -43,6 +45,7 @@ namespace MCore
return AZ::Vector3(vec.GetX() - fac * n.GetX(), vec.GetY() - fac * n.GetY(), vec.GetZ() - fac * n.GetZ());
}
//! @deprecated Use AZ::Vector3::Project()
MCORE_INLINE AZ::Vector3 Projected(const AZ::Vector3& vec, const AZ::Vector3& projectOnto)
{
AZ::Vector3 result = projectOnto;
@@ -60,6 +63,7 @@ namespace MCore
(MCore::Math::Abs(val.GetX() - val.GetZ()) < MCore::Math::epsilon));
}
//! @deprecated Use AZ::Vector3::Lerp()
template <>
MCORE_INLINE AZ::Vector3 LinearInterpolate(const AZ::Vector3& source, const AZ::Vector3& target, float timeValue)
{

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