Closed Daguerreo closed 2 years ago
Hi @Daguerreo ,
actually, there is a small example there https://github.com/paceholder/nodeeditor/tree/v3alpha/examples/graph
.
I think I finished all the basic features of the framework in this branch. What still missing is fixing a couple of tests and re-working the CI-scripts -- they were broken due to changes on the CI-server sides.
Hi @Daguerreo ,
actually, there is a small example there
https://github.com/paceholder/nodeeditor/tree/v3alpha/examples/graph
.I think I finished all the basic features of the framework in this branch. What still missing is fixing a couple of tests and re-working the CI-scripts -- they were broken due to changes on the CI-server sides.
Yep I'm aware of that, I was trying to figure out how to deal with actual data and port type with the new version, maybe a porting of the calculator example would be enough?
The actual data is stored inside the library user's model. It could be an arbitrary storage, it must just fulfill the interface of AbstractGraphModel
.
The port information is extracted using
QVariant AbstractGraphModel::portData(NodeId nodeId,
PortType portType,
PortIndex index,
PortRole role) const = 0;
, particularly using PortRole::Data
and PortRole::DataType
, see Definitions.hpp
.
The example Calculator
is already adjusted to the new code, it just keeps using "delegates" a.k.a NodeModelData types from the previous version. Now it is all wrapped in an AbstractGraphModel
instance.
Ok, I will try being more specific: in the graph example, how can I manage the fact my custom NodeType1 output can't go in NodeType2 input port? That's why I talked about actual data.
That's up to your concrete model implementation.
You'd need to implement an abstract function AbstractGraphModel::connectionPossible(ConnectionId const)
.
The ConnectionId
is nothing else but a tuple of (node1_id, out_port_index, node2_id, in_port_index). This gives your model all the information to figure out the data types and the possibility of a connection.
In the graph
example I simply check that the ports are empty. You could add extra checks for data types.
I understood your point and will try to figure out another example
I understood your point and will try to figure out another example
That would be great, thank you.
Hi, could you please add an example for v3-alpha with the new graph model and actual nodes with data type?