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

PortList only accepts type INode #35

Closed
DraconInteractive opened this issue Dec 31, 2023 · 2 comments
Closed

PortList only accepts type INode #35

DraconInteractive opened this issue Dec 31, 2023 · 2 comments

Comments

@DraconInteractive
Copy link

Hi again,
I have been using this graph a lot over the last few weeks, as it is amazing! Very easy to use, and extend upon.

However, I am finding an issue with the use of PortList, in that it only renders in the UI if the type of the list is List

As mentioned in my other ticket (#34) I am a base implementation of INode named CoreNode that all my other nodes derive from.

I am implementing resource/value nodes, so that I can have nodes that target / retrieve values when queried by a connected node.

After abandoning my attempt at input nodes (see other issue), I have been using output ports to connect to my value nodes. This is working well for value nodes with a single return / reference. However, I am now trying to implement value nodes that take a collection. For example, I have VNode_Vector3 that returns a single Vector3 value. However, I also want to have VNode_Vector3Collection. This would have a list of ports that would go out to a number of VNode_Vector3 ports.

However, if I implement it like the following, it does not render:
[PortList, SerializeReference]
public List<VNode_Vector3> valueNodes;

I have tried with a number of different classes, all deriving from INode either directly or via parents, and the only way I can get the port list to render is if I do the following:
[PortList, SerializeReference]
public List valueNodes;

This puts the burden of casting to the appropriate type onto the node when it is fetching values, and does not allow me to block connections from incompatible nodes.

Is there a method of implementation that I am not aware of, and if not could this please be considered for a future fix?
Thanks!

@DraconInteractive
Copy link
Author

I found that if I made a new interface that derives from INode and use that in the list that works too :) Testing now to see if I can create nodes with that interface that work how I want my end product to look like!

@DraconInteractive
Copy link
Author

It works :) Closing

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