Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
138 stars 2 forks source link

ObjectToValueCast #1341

Open mpmxyz opened 8 months ago

mpmxyz commented 8 months ago

Is your feature request related to a problem? Please describe.

We have ValueToObjectCast but we don't have the reverse operation to get a primitive value out of an object. (specific use case: transmitting values via dynamic impulses where there is code between sender and receiver which is type independent)

Describe the solution you'd like

A new node ObjectToValueCast, which outputs a primitive value and a boolean to indicate if the cast was successful

Describe alternatives you've considered

A current workaround is to use ToString followed by ParseX. Note:

Additional Context

No response

Requesters

No response

Nytra commented 8 months ago

I think the Unbox node does this however it does not output a boolean, only the casted value

mpmxyz commented 8 months ago

Oh, my bad! Why do we have both ValueToObjectCast and Box, though? They are basically the same with different visuals, right? Edit: Reopened the issue until this question is answered.

Nytra commented 8 months ago

My guess is that since the ValueToObjectCast is a Cast node it can be auto-created when needed whereas the Box node is just a dedicated node. They do seem to do exactly the same thing functionally.

989onan commented 8 months ago

box needs to be balanced with an unbox in the code I bet

shiftyscales commented 8 months ago

Seeking feedback from @Frooxius or @ProbablePrime on this one.