Skip to content

fix: Finalize array support in Quantum#3212

Open
Eideren wants to merge 3 commits into
stride3d:masterfrom
Eideren:quantum_array
Open

fix: Finalize array support in Quantum#3212
Eideren wants to merge 3 commits into
stride3d:masterfrom
Eideren:quantum_array

Conversation

@Eideren

@Eideren Eideren commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

PR Details

Arrays previously had limited support in the gamestudio, asset types could not be assigned to one of its slots for example. This PR fixes that.

Note that this PR does not affect collection id support for arrays; derived arrays still won't inherit appropriately as it requires rewriting some of the internal logic called through AssetPropertyGraph.ReconcileWithBaseNode that work with the expectation that one can remove and add to the collection.

Also note that some of these changes refactor some of the reflection logic around collection types to move type-specific logic to their own implementation. Let me know if this is a pain on your side @Kryptos-FR and we'll see what I can do to help you out.

Related Issue

Fixes #2386

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.


private bool ShouldGenerateItemIdCollection(object collection)
{
// Arrays do not support Collection Ids right now;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is a "right now" and talks about a known shortcoming of the current solution, I'd put a "TODO" there so we won't forget

@Eideren Eideren Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created an issue (#3213) instead, TODOs feel a bit too easy to ignore, let me know if you feel like I should include it with the comment anyway

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you are right. An issue is better

@Kryptos-FR

Copy link
Copy Markdown
Member

I'll try to review it on the weekend.

@Kryptos-FR Kryptos-FR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good, a few minor issues, and we should add more tests to cover the specifics.

Possible area:

  • reflection: DescriptorTests for each descriptor type, test each methods from the base class and the correct behavior for it
  • quantum: TestCollections add TestArrays
  • asset: in Stride.Core.Quantum.test, serialize/deserialize a component with an array of content references, do a round trip
  • archetype regression (will be useful for #3213): a base + derived asset using arrays. Confirm no exception during ReconcileWithBaseNode and no ~Id emitted.

Comment thread sources/core/Stride.Core.Reflection/TypeDescriptors/SetDescriptor.cs Outdated
Comment thread sources/core/Stride.Core.Reflection/TypeDescriptors/SetDescriptor.cs Outdated
Comment thread sources/core/Stride.Core.Reflection/TypeDescriptors/SetDescriptor.cs Outdated
Comment thread sources/core/Stride.Core.Reflection/TypeDescriptors/DictionaryDescriptor.cs Outdated
}
else if (descriptor is DictionaryDescriptor dictionaryDescriptor)
{
if (dictionaryDescriptor.KeyType.IsInstanceOfType(index.Value)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably still need to check the type and short-circuit, otherwise it will throw in dictionaryDescriptor.

Either that, or opposite to the comment in DictionaryDescriptior return false instead of throwing if key is null.

Whatever the choice is, we need new tests to cover these cases.

@Eideren Eideren Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other comment, will produce tests once we resolve this.

Comment thread sources/presentation/Stride.Core.Quantum/DynamicNode.cs
Comment thread sources/core/Stride.Core.Reflection/TypeDescriptors/CollectionBaseDescriptor.cs Outdated
@Eideren Eideren marked this pull request as draft June 23, 2026 02:46
@github-actions

Copy link
Copy Markdown

🤖 Draft PR — automatic CI is skipped to save runner minutes.

  • Mark the PR ready for review to run the full automatic CI — or add a ci-run-on-draft label to run it now without leaving draft.
  • Or arm a specific opt-in suite: ci-enduser, ci-editor, ci-ios, ci-android.

@Eideren

Eideren commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Kindly pinging @Kryptos-FR if he can reply to the discussion above - no rush, just in case you forgot ;)

@Kryptos-FR

Copy link
Copy Markdown
Member

@Eideren I did forget ;). Looks ok to me now.

@Kryptos-FR Kryptos-FR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a few more tests it should be good.

@Eideren

Eideren commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

@Kryptos-FR Looks like the DynamicNode and all derived types are unused in the source - the only other spot where they are being used is in a test suite which is entirely skipped, and does throw when forced.

I don't think it makes sense to maintain these given that they are not really user-facing, nor particularly useful ?

I added tests to cover the other changes.

@Eideren Eideren marked this pull request as ready for review July 8, 2026 17:08
@Kryptos-FR

Copy link
Copy Markdown
Member

@Eideren yeah DynamicNode looks like an unfinished attempt. I don't see any use case for it today so I think it's fine to remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stride Prefab Selecting from array not working

3 participants