Xlinka / NeosPlus

NeosVR Plugin Extra Logix nodes and features
https://discord.gg/9QAaMtXwke
Other
29 stars 18 forks source link

Add Component Access #11

Closed DoubleStyx closed 2 years ago

DoubleStyx commented 2 years ago

Allow specifying value or reference fields to target for a component. Allow reading/writing fields.

DoubleStyx commented 2 years ago

Thinking about the design for how something like this would be used in-game. One commonly proposed idea is an interface-card-style node that allows you to specify a component reference and read/write values from there. The main issue with this approach is that you have to declare the type beforehand. Ideally, you’d be able to specify a type, the field you want from the type, and a reference to a component instance.

Specifying a type is fairly straightforward currently, although it would be nice in the future to have a graphical alternative to manually entering the type name. Declaring a particular field would likely require a string containing the field’s name.

DoubleStyx commented 2 years ago

We should try to avoid straying too far into C# Reflection territory. Reflection would definitely be the easiest way to implement component access, but the performance hit might not be acceptable. I know @RileyGuy has experimented with alternatives to reflection, though I don’t know if those approaches would be applicable here.

DoubleStyx commented 2 years ago

Reflectionless field access: https://github.com/DoubleStyx/NeosPlus/blob/main/Logix/Components/GetField.cs

Still need to add additional nodes for getting the components themselves.

Or maybe we'll implement something similar to dynamic interface cards.

DoubleStyx commented 2 years ago

I don't think we're going to do this. At least not with the current state of Neos' permissions system. Feel free to build your own version of NeosPlus using this branch, though. Maybe close this issue?