Skip to content
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

"Array to Array of VData" should not unwrap variants #71

Open
RaphSchru opened this issue Oct 1, 2024 · 1 comment
Open

"Array to Array of VData" should not unwrap variants #71

RaphSchru opened this issue Oct 1, 2024 · 1 comment

Comments

@RaphSchru
Copy link

RaphSchru commented Oct 1, 2024

image

Behavior:
When decomposing a variant containing an array of variants into an array of variants with the function "Array to Array of VData", the elements are automatically unwrapped from their variant, so instead of having an array of variants containing each a variant, I have an array of variants with the contained type directly.

Problem:
Now I have an array of variants with heterogeneous contained types, so I cannot apply the reverse operation with function "Array of VData to Array". I have to wrap each element back in a variant first, then use the reverse function.

This behavior differs from the similar function for clusters, which, when decomposing a cluster of variants into an array of variants, effectively gives the correct "Variant" type (the elements are not unwrapped from their variant).

Explanation:
This is because "Array to Array of VData" internally uses the native function "Variant to Data", which naturally unwraps variants, while "Cluster to Array of VData" implements its own parsing method, which strictly preserves data types.

Proposed solutions:
Align the behavior of "Array to Array of VData" with the function "Cluster to Array of VData", meaning strictly preserve data types of the elements.
If modifying the current behavior is too dangerous for applications relying on the current behavior, could we imagine adding an option on the function to choose to not unwrap the variants?

See attached the VI created with LV2020-32bit:
[LV2020] OpenG Array to Array of VData Unwraps Variants.zip

Regards,
Raphaël.

@RaphSchru
Copy link
Author

RaphSchru commented Oct 1, 2024

Proposed modification for "Array to Array of VData":

Instead of this:
image

Have this:
image

Here is a proposed implementation for the new "1D VArray to Array of VData" VI:
1D VArray to Array of VData.zip

It would be the TRUE symmetry of VI "Array of VData to VArray", which could be also renamed "Array of VData to 1D VArray".
Also, the new VI would output the array name and element data type to facilitate decomposition / recomposition of the array. Example:
image

Additional bug:
To make the new VI work, the subVI "Get Default Data from TD" :
image
should also be corrected to implement the variant case (should give a "Void" variant wrapped in the variant output instead of throwing an error).

Regards,
Raphaël.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant