Feat: Restore re-orderable lists and add reordable arrays in GameStudio#3067
Feat: Restore re-orderable lists and add reordable arrays in GameStudio#3067Acissathar wants to merge 3 commits intostride3d:masterfrom
Conversation
…ently not supported due to the way Quantum tracks their changes
|
Draft because I haven't really put it through any wringers, just a super basic test. Test script: And GameStudiobehaivor: |
|
Per the linked issue, I tested Undo/Redo and Archetypes as mentioned by @Kryptos-FR as potential issues with reorderable collections in the past. Undo/Redo applies to the list element and changes done to the elements (in order of operation): Archetypes I don't have much practical experience with, just a general overview and assumption on how it works based on experience in Unity: Re-ordering the derived / child asset seems to work as expected without messing with the archetype / parent: However, changing it on the parent / archetype asset when the child has their own changes, does cause an issue and duplicates elements rather than shifting the order:
I suppose the question then becomes, what should it do? If the Archetype has Layers 0, 1, and 2 and on the Derived asset we swap layers 1 and 2 (0 - 2 - 1), then go on the Archetype and swap 0 and 1 (1 - 0 - 2), what should be reflected? With prefabs, we leave overridden child changes alone when changing the base/parent, but since we're swapping elements, I don't think that really works here because then we'd copy the unchanged layer (0) but since 1 was already moved, we'd have (1 - 2 -1) which seems wrong too. Maybe if any elements are re-ordered in the given section, we ignore any changes on the Archetype on the derived asset? I'll be gone this weekend for a trip so won't be able to take a stab at the archetypes part for a bit, so keeping it in a draft, but wanted to leave some more info. |





PR Details
Restore re-orderable list functionality in the GameStudio editor, along with adding support for Arrays and restrict dictionaries. Most of this code was already present in the engine, it was just commented out with "FIXME" without any info on what was broken.
Through local testing, the issue seemed to really just be that the re-ordering was attached to the Parent rather than the actual items of the list. This was a minor tweak, and supporting arrays just needed a small helper to store the indexes we're looking to swap.
Dictionaries I think are out of the scope of this PR, as I believe the Quantum system will need a decent amount of changes to account for needing to store a positional reference.
Related Issue
#3065
Types of changes
Checklist
In order to have an array or list be re-ordable, it needs the [MemberCollection(CanReorderItems = true)] attribute.