Gentlymad-Studios / NewGraph

A general node graph solution centered on data management. This is based on the idea to visualize complex data structures as graph networks without having to modify already established data classes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PortList only accepts type INode

DraconInteractive opened this issue · comments

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!

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!

It works :) Closing