Commit Graph

154 Commits

Author SHA1 Message Date
Danilo Aimini 9b6ef150ff LYN-2480 | Minor fixes to the Prefab system (#1581)
Remove warning when entities that aren't registered to instances get passed to the Prefab Undo Cache (just ignore them to avoid noise in the console).
Also avoid marking templates dirty when they are added.
2021-06-25 08:53:25 -07:00
Steve Pham 70042fcdcd O3DE Copyright Updates for Linux Foundation (#1504) 2021-06-23 10:55:22 -07:00
Danilo Aimini a0f4f16b98 Fix Duplicate function to correctly replace the aliases in patches that get ported over. Also correctly undo/redo link creation. (#1449) 2021-06-21 15:47:25 -07:00
srikappa-amzn 8f3c227842 Merge pull request #1438 from aws-lumberyard-dev/Prefab/DetachPrefabBugFixes
Fix bug with DetachPrefab incorrectly replacing old entity aliases in patches
2021-06-18 13:34:01 -07:00
Danilo Aimini acd23698ea Prefab Serialization | Remove "Source" parameter from prefab source file (#1387)
* When loading a template to memory, store the current Source (potentially overriding what was stored to disk)

* Before storing the prefab disk, remove the Source parameter from the Dom (as it's no longer necessary to save it).
2021-06-18 12:37:37 -07:00
srikappa 4d90b7cfb6 Fix bug with detachPrefab incorrectly replacing old entity aliases in patches 2021-06-18 11:19:59 -07:00
sconel e4921c8d0a Fix nested container entities not getting editor info removed during prefab processing 2021-06-11 17:45:46 -07:00
sconel 38b1a89631 Merge pull request #1233 from aws-lumberyard-dev/Prefabs/NestedContainerExport
Fix issue involving missing parent container entities in spawnables
2021-06-10 16:28:56 -07:00
Mike Balfour ffe913a2d6 Added ability to convert multiply-nested slices (#1239) (#1245)
* Addressed feedback from previous PR
* Change missing entity aliases to be deterministic.
When converting slices, this helps produce the same results on multiple reconversions of the same data.
* Exposed the asset filter callback.
This allows the slice converter to specifically load nested slices as opposed to not loading *any* referenced assets.
* Added support for multiply-nested slice instance conversion.

(cherry picked from commit 86136ddfa6)
2021-06-10 16:16:03 -05:00
sconel 856daf1485 Addressed PR feedback 2021-06-10 10:46:36 -07:00
sconel 2dee4d3ac9 Add support to export nested container entities. Resolves missing parents in spawnables 2021-06-09 17:37:41 -07:00
srikappa-amzn 20dc47e6d0 Merge pull request #1198 from aws-lumberyard-dev/Prefab/RemoveFileSizeLimits
Remove file size limits when loading prefabs and prefab-based-levels
2021-06-09 10:05:45 -07:00
rhongAMZ 3fd2f1305f Selecting and deleting the level prefab root entity crashes editor (#1179)
Early remove the level instance from the entity id list in the delete function and duplicate function.
2021-06-09 09:15:09 -07:00
srikappa b23c95cab3 Removed the new added flavor of ReadFile and reused existing one 2021-06-08 17:58:59 -07:00
srikappa 9dec723e33 Remove file size limits when loading prefabs and prefab-based-levels 2021-06-08 17:28:23 -07:00
Danilo Aimini 80f62d0523 LYN-3708 | Optimize Prefab instance propagation to stabilize UX (#700)
* Add instanceToIgnore to calls leading to instances being added to the queue for propagation.

* Change PrefabUndoEntityUpdate to make it so that the instance triggering the prefab template change is not reloaded on propagation, since it will already be up to date due to the way we generated the patch to begin with.

* Add FindPrefabDomValue utility function for paths

* Expose the level root prefab template id in the Prefab EOS Interface

* Fix Instance Alias Path generation to work with the new FindValueInPrefabDom function

* Stop reloading ancestors on propagation, and fix instance reloading so that the level dom is used (and overrides are preserved)

* Remove commented out code, refactor FindPrefabDomValue for paths (was handling an edge case incorrectly, and it's not even triggered)

* Fix issue with PathView reference - with PathView already being a reference, this resulted in a copy and triggered a warning during automated review builds.

* Additional fix to the build warning, remove redundant error message

* Revert changes to Instance::GetAbsoluteInstanceAliasPath(), as they were impacting serialization.

* Remove the dependency to the level root prefab template in the propagation code, climb up the hierarchy instead. This allows tests to work despite not using the EOS properly.
Also use PrefabDomPaths to retrieve the instance dom from the root dom instead of iterating.

* Remove now unused PrefabDomUtils function, extend optimization to link updates.

* Trigger a full instance propagation to correctly refresh alias references.
This is an issue in the test because some operations are called from the backend API and will not trigger propagation properly. Tests will soon be rewritten to more properly represent frontend workflows.

* Fixes lingering issues with propagation:
- Restores code that fixes the selection if entityIds have changed;
- Fixes Do() function on link update. Prefab containers will propagate correctly while still being stable during editing.

* Remove GetRootPrefabInstanceTemplateId (no longer necessary after the code has been rewritten)

* Fix optimization code to account for instances being removed and propagation being run out of order in Create Prefab undo.

* Renamed variable, added comments for clarity.

* Restore asserts on instance not being found; Rename Do to Redo for clarity; Add comments.

* Fixed incomplete comment.
2021-06-08 10:44:20 -07:00
cgalvan deb3c5e74a [LYN-2446] Implemented support for duplicating instances. (#1097)
* [LYN-2446] Implemented support for duplicating instances.

* [LYN-2446] Addressed PR feedback.

* [LYN-2446] Addressed additional PR feedback.
2021-06-03 16:20:59 -07:00
Danilo Aimini fda28bb7b2 LYN-1818 | [USE CASE] Reparenting between different prefab instances by drag/drop in the Outliner (#1088)
* Add the last known parent to the prefab undo cache to detect changes in the owning instance.
Still WIP.

* Progress in handling reparenting. Still WIP, need a change in CreateLink that will be addressed in a separate branch and then merged back.

* A few fixes, reparenting now works with entities. Still working on instances.

* Fix assert crashing the Editor because of the arguments being in the wrong order.

* Handle moving the patches when removing and recreating links when reparenting nested instances.

* Rearrange some code to prevent including instance removal in instance update undo node, as it would be redundant and cause errors in some edge cases.

* Reorder instance reparenting to account for correct order of operation during undo/redo

* Fix order of operations to support multiple operations in one edit (reparenting to non-container entities while changing instance)

* Add function to refresh patches on links to allow aliases to be restored correctly on reparenting.

* Removed RefreshEntityPatchOnLink function. Introduced a simpler way of handling porting patches.

* Removing unnecessary code that was left after testing.

* Minor fixes to naming and comments.

* Restore previous error, no longer printing the failed patch.

* Remove unused includes.

* Restore include removed by mistake.

* Simplified patches retrieval by using internal function. Renamed some internal functions and variables to be more accurate.
2021-06-03 14:02:40 -07:00
Mike Balfour d90a3d46a7 Support for nested slice conversions (#1121)
This set of changes enables conversions for singly-nested slices. Multiple nesting hierarchies are only partially supported at this point. Conversion is also significantly more deterministic, which makes it easier to convert single slices without needing to reconvert every slice or level that relies on it as well.
Changes:

- Added version of Instance::AddInstance() that takes in an alias to allow for deterministic aliases
- Added a "SliceConverterEditorEntityContextComponent" that's used to specifically disable entity activation on creation. The disabling is done this way vs adding a new public API, because the disable shouldn't be required in any normal case outside of this tool.
- Disabled more AWS gems for the SliceConverter, as they're unneeded and cause issues if they're around in the tool.
- Added a small null check to the Camera Controller.
- Added the actual support for slice instance conversion. This instantiates the entities, applies the data patches, turns them into a prefab instance, and generates a JSON patch out of the changes.
2021-06-03 15:59:45 -05:00
srikappa 574563adaf Merge branch 'main' into DetachPrefab 2021-06-02 15:09:40 -07:00
Danilo Aimini 8a7f156e2c LYN-4133 | Prefab Container Transform stores non-default values to template on Create Prefab (#1038)
* Show container transforms, reset container transform to zero before saving a prefab after create.

* Fix order of operations to prevent patching issues

* Reset the entity to the Identity Transform instead of the default constructor to correctly set the scale to 1.0
2021-06-02 14:45:43 -07:00
srikappa 9fd690f004 Changed a function parameter name 2021-06-01 17:03:50 -07:00
srikappa a9d030b454 Merge branch 'main' into DetachPrefab 2021-06-01 11:12:52 -07:00
srikappa e8e9096dda Changed a function name and removed a comment 2021-06-01 11:11:13 -07:00
AMZN-koppersr c0dade8883 Merge branch 'main' into SpawnablePriorityQueue 2021-06-01 09:57:27 -07:00
Mike Balfour 895bbafa9e Fixed CreatePrefab to use correct absolute path (#1044)
The initial CreatePrefab flow was trying to go from absolute -> relative -> absolute path before the file had ever been saved, so the relative -> absolute path conversion generated an error and always produced a project-relative path, even if the initial path was in a gem.  For example, trying to save "c:/o3de/Gems/Camera/Assets/Entity1.prefab" would instead create "c:/o3de/AutomatedTesting/Entity1.prefab".  This change preserves the absolute path throughout the initial creation flow so that the file is saved in the correct location.
2021-06-01 10:50:10 -05:00
chiyteng da0ab84f1c Add helper function to update entity aliases in link patch 2021-05-28 11:42:36 -07:00
chiyteng de4cfdb5d7 Add helper function to update entity aliases in link patch 2021-05-28 11:33:58 -07:00
chiyteng 984db9c1b4 Remove selection command and update undo batch in DetachPrefab function 2021-05-28 10:56:03 -07:00
sconel 0a32951e7e Merge branch 'main' of https://github.com/aws-lumberyard/o3de into Spawnable/ScriptCanvas/Integration 2021-05-28 10:48:44 -07:00
Mike Balfour 96905a26d7 Add support for AP-compliant relative paths (#998)
The method "PrefabLoader::GetRelativePathToProject" has been changed to "PrefabLoader::GenerateRelativePath", and reworked to get a correct relative path.  GetFullPath has also been modified to get correct relative paths too.  This requires an Asset Processor connection - if one isn't available (like during unit tests), the methods have fallback logic to produce project-relative paths.

With this change, SliceConverter can't use SaveTemplate() to save the file any more, because GetFullPath now expects to find an existing path, which doesn't work for not-yet-created files.  Instead, it now has to use the same technique as the Editor and call SaveTemplateToString then save the string out as a file.
2021-05-28 09:57:17 -05:00
srikappa 55e1da64bb Renamed a function and improved comments 2021-05-28 02:29:09 -07:00
srikappa be6cee806d Show detach prefab only when a single instance is selected 2021-05-28 02:14:28 -07:00
srikappa dc4a15628f Remove unused GetNestedInstance method in Prefab Instance class 2021-05-28 00:43:31 -07:00
srikappa 57913d8378 A couple of bug fixes 2021-05-27 18:19:28 -07:00
chiyteng c21a59af50 Remove print dom for debug previously 2021-05-27 17:19:32 -07:00
srikappa 053e273b97 Clear dirty entities at the end of InstantiatePrefab logic 2021-05-26 18:24:49 -07:00
chiyteng 4fc7d72b2b modify DetachPrefabFromParent function for debugging 2021-05-26 16:49:09 -07:00
sconel 07ecb938e7 Merge branch 'main' of https://github.com/aws-lumberyard/o3de into Spawnable/ScriptCanvas/Integration 2021-05-26 16:45:23 -07:00
sconel b5599ca739 Add asset picker support to spawn SC node and thread safety measures 2021-05-26 16:45:04 -07:00
chiyteng 4b610058b5 implement function DetachPrefabFromParent in PrefabPublicHandler 2021-05-26 15:47:41 -07:00
AMZN-koppersr 37b53c0680 Spawnables can no longer be moved.
Spawnables had support for moving, but as the base class AZ::Data::AssetData doesn't support moving this was causing subtle issues. Moving spawnables wasn't used so it was removed.
2021-05-26 14:29:31 -07:00
srikappa 0ffaa5429b Fixed a linux build error where an implicit conversion to const ref is not supported 2021-05-26 11:31:16 -07:00
srikappa 7d3dcf85f6 Merge branch 'main' into Prefab/RemoveUndoCacheDependency 2021-05-26 10:47:35 -07:00
srikappa 5a41746683 Fixed a comment and added a forward declaration 2021-05-26 10:46:00 -07:00
srikappa be9c9d9fa3 Remove prefab undo cache dependency on CreatePrefab use case 2021-05-25 12:57:16 -07:00
amzn-sj d369912727 Merge branch 'main' into LYN-2461 2021-05-21 16:41:46 -07:00
Chris Galvan 21620a0d73 [LYN-2255] Fixed additional alias replacement case, and removed now unneeded specific alias replacement. 2021-05-21 14:19:00 -05:00
Chris Galvan 3d1fa538c2 [LYN-2255] Added extra protection for duplicate replacement of alias logic by bookending the strings. 2021-05-21 12:05:24 -05:00
Chris Galvan 1a15007dcb Merge branch 'main' of https://github.com/aws-lumberyard/o3de into cgalvan/DuplicateEntities 2021-05-20 14:44:36 -05:00