1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

Added NodeGraphEditor.GetPortColor

This commit is contained in:
Thor Brigsted 2019-04-03 21:50:29 +02:00
parent d8a4a41a8f
commit f6e0e3bc4d
3 changed files with 8 additions and 4 deletions

View File

@ -184,7 +184,7 @@ namespace XNodeEditor {
Rect fromRect;
if (!_portConnectionPoints.TryGetValue(output, out fromRect)) continue;
Color connectionColor = graphEditor.GetTypeColor(output.ValueType);
Color connectionColor = graphEditor.GetPortColor(output);
for (int k = 0; k < output.ConnectionCount; k++) {
XNode.NodePort input = output.GetConnection(k);

View File

@ -142,7 +142,7 @@ namespace XNodeEditor {
Color backgroundColor = new Color32(90, 97, 105, 255);
Color tint;
if (NodeEditorWindow.nodeTint.TryGetValue(port.node.GetType(), out tint)) backgroundColor *= tint;
Color col = NodeEditorWindow.current.graphEditor.GetTypeColor(port.ValueType);
Color col = NodeEditorWindow.current.graphEditor.GetPortColor(port);
DrawPortHandle(rect, backgroundColor, col);
// Register the handle position
@ -199,7 +199,7 @@ namespace XNodeEditor {
Color backgroundColor = new Color32(90, 97, 105, 255);
Color tint;
if (NodeEditorWindow.nodeTint.TryGetValue(port.node.GetType(), out tint)) backgroundColor *= tint;
Color col = NodeEditorWindow.current.graphEditor.GetTypeColor(port.ValueType);
Color col = NodeEditorWindow.current.graphEditor.GetPortColor(port);
DrawPortHandle(rect, backgroundColor, col);
// Register the handle position
@ -228,7 +228,7 @@ namespace XNodeEditor {
Color backgroundColor = new Color32(90, 97, 105, 255);
Color tint;
if (NodeEditorWindow.nodeTint.TryGetValue(port.node.GetType(), out tint)) backgroundColor *= tint;
Color col = NodeEditorWindow.current.graphEditor.GetTypeColor(port.ValueType);
Color col = NodeEditorWindow.current.graphEditor.GetPortColor(port);
DrawPortHandle(rect, backgroundColor, col);
// Register the handle position

View File

@ -57,6 +57,10 @@ namespace XNodeEditor {
NodeEditorWindow.AddCustomContextMenuItems(menu, target);
}
public virtual Color GetPortColor(XNode.NodePort port) {
return GetTypeColor(port.ValueType);
}
public virtual Color GetTypeColor(Type type) {
return NodeEditorPreferences.GetTypeColor(type);
}