-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track View: Optional fix for GHI #11500: fix prefabs previously stored with invalid entity parents. #18548
base: development
Are you sure you want to change the base?
Track View: Optional fix for GHI #11500: fix prefabs previously stored with invalid entity parents. #18548
Conversation
…d entity parents Signed-off-by: Aleks Starykh <[email protected]>
Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.cpp
Outdated
Show resolved
Hide resolved
Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabDomUtils.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Aleks Starykh <[email protected]>
Signed-off-by: Aleks Starykh <[email protected]>
@@ -605,7 +605,10 @@ namespace AzToolsFramework | |||
|
|||
PrefabDom& loadedTemplateDomRef = loadedTemplateDom->get(); | |||
|
|||
// first, decode the template DOM into actual Instance data. This will actually create real | |||
// first, check and fix prefabs which could be previously stored with invalid entities' parents (GHI #11500) | |||
PrefabDomUtils::SubstituteInvalidParentsInEntities(loadedTemplateDomRef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its a good change and I'll approve, but thinking long-term I don't think we should pay the cost upon loading a level for validation checkups as it might get expensive and basically you should only do it once ever per broke dataset.
We don't have these facilities right now in the editor, but I would rather have a batch/script UI tool that you can trigger on a provided list of files/current open file to fix the data and call it done. A quick way to have something like that would be as an additional button in the menu "Fix prefab data"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tagging @lsemp3d for vis, as in general as we will have bigger projects in o3de, we'll need facilities to fixup large batch of data, auto-checkout the files, and generate a text report
What does this PR do?
Fixes one consequence of the issue #11500:
With earlier code prefabs could be saved with "torn-off" Entities having a TrackView
EditorSeqenceComponrnt
:with a spoiled (empty) "Parent Entity" sentence in the
TransformComponent
of this entity.Such prefab is still loaded wrongly with the current code without even warning, which seems not very user - friendly.
This optional fix:
ContainerEntity
of the prefab;In most practical cases the AssetBuilder now will deserialize a buggy
prefab
into a correctspawnable
(with error report).This PR is optional, but I remember that similar problems with "torn-off" entities made porting of LY slices into prefabs very difficult (especially for levels), so I dared to spend some (minimal) time to implement this.
How was this PR tested?
Saved (and artificially) broken prefabs with the linked
Camera2
andSequence
entities evaluated by AssetProcessor and loaded into Editor under Windows: