Commit Graph

9 Commits (ab3aa904f0328ea854d74e3cf236dbefaad2113e)

Author SHA1 Message Date
Mike Balfour ab3aa904f0
Fixed misc slice conversion bugs
* Fixed crash caused by nesting the same slice twice
If the same slice is nested at multiple levels in the same slice hierarchy, the second conversion would reregister the prefab and crash.  Now that case is detected and the slice isn't reconverted.

* Fixed json array patches where multiple elements are removed.
The patches now generate removals from back to front, instead of front to back, so that the indices remain valid as each patch is applied.
5 years ago
Mike Balfour 6f61454be4
Added support for remapping entity refs across slice instances (#1284)
* Fixed memory assert on shutdown.
Cleaned up the entity pointers on serialization, so that they no longer leak themselves, their asset references, or anything else within them.

* Added support for remapping entity refs across slice instances.
Slice instances can have components with entity references that have been modified to reference entities in other slice instances, or even in the parent.  This change detects and remaps those references so that they work correctly.
5 years ago
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)
5 years ago
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.
5 years ago
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.
5 years ago
Mike Balfour 0be75732cc
Added initial support for nested slices to slice-prefab converter (#881)
Nested slices are now detected, converted into prefabs, and the top-level prefab will get linked to the nested prefabs with the proper number of instances.  However, the nested prefabs won't retain any of the slice override values or parent entity hierarchy.  That will (hopefully) be added in a separate PR.

This also adds support for better relative source paths for nested prefabs.  To support this, the tool now needs to connect/disconnect with the AssetProcessor to be able to turn a slice asset ID into a relative source path, so that nested templates can be looked up and converted correctly.
5 years ago
Aaron Ruiz Mora 87ec96fbf4
Fix compilation errors in windows release 5 years ago
Mike Balfour d084027b6e
Bugfixes to enable slice-to-prefab conversion to run with less warnings/errors/crashes (#768)
While trying to process all slices and levels in Automated Testing, a few bugs came up that needed to be addressed:
- [LYN-3832] TransformComponent had a field removed without updating the version number and converter, which caused a lot of excessive warnings
- SliceComponent would crash in debug builds on instantiation failures due to a null dereference that was guarded against in most but not all places
- SliceConverter now detects when nested slices exist and gracefully warns about it.
- InstanceUpdateExecutor / TemplateInstanceMapper will now immediately remove instances that are unregistered, so that any in the queue don't get processed on a subsequent tick.  This was causing crashes when the instance was destroyed before the processing occurred.  It also has a side benefit of preventing the same instance from executing multiple times.
- Minor logic bugfix to the pack close warning, the boolean check was flipped.

Also added an early-out on SetTemplateId, since this was causing some unnecessary instance queue entries.
5 years ago
Mike Balfour 77278a0329
First version of the slice-to-prefab converter
It converts .slice and .ly files to .prefab files, but doesn't handle nested or complicated slices correctly yet.
5 years ago