If we use the original:
if (port != null && port.IsConnectedTo(this)) port.node.OnRemoveConnection(port);
we going to have always wrong condition, about "IsConnectedTo(this)" and port.node.OnRemoveConnection(port) just won't be called, cause we already have disconnected ports. So we need to do it exactly at the moment of disconnection.
- Added the GetPortStyle(...) as virtual method at GraphEditor.
With this, users can customize the texture for different ports, and they can also modify the padding without having to overwrite the default xNode style.
This prevents many problems when working with multiple graphics.
The style properties used from Style is:
- padding-left.
- padding-right.
- normal.background, to border texture.
- active.background, to dot texture.
- Added preference to filter the nodes from the draggable context menu, to show only nodes that have ports compatible with the dragged port
- Minor modification in NodeEditorActions, to allow the filter
- Minor modification in NodeGraphEditor to use or not the filter, based in preferences
- Added parameters to get contextMenu with compatibles node filter.
These parameters are auto-filled and do not interfere with the standard operation of this function.
> Param: Type compatibleType:
Use it to filter only nodes with ports value type, compatible with this type: Default null.
> Param: NodePor.IO:
Direction of the compatiblity: (Default Input)
_ HasCompatiblePortType:
Looking for ports with value Type compatible with a given type.
- GetCompatibleNodesTypes:
Filter only node types that contains some port value type compatible with an given type
Added the separate port padding to control the port's offset position in relation to the node content padding
Currently, if I try to create a custom theme for node, i will be stuck with the port padding, because currently there are not separate padding from the node,
Some useful methods for research.
Now with these methods and the previous commit it is now possible to play not only with the theme of xNode but also with the functionality of ports, nodes and noodles.
I made these variables public to be able to work with more information from GraphEditor. They are only Boolean and do not pose any danger.
- IsDraggingPort:
- IsHoveringPort
- IsHoveringNode
- IsHoveringReroute