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:
parent
d8a4a41a8f
commit
f6e0e3bc4d
@ -184,7 +184,7 @@ namespace XNodeEditor {
|
|||||||
Rect fromRect;
|
Rect fromRect;
|
||||||
if (!_portConnectionPoints.TryGetValue(output, out fromRect)) continue;
|
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++) {
|
for (int k = 0; k < output.ConnectionCount; k++) {
|
||||||
XNode.NodePort input = output.GetConnection(k);
|
XNode.NodePort input = output.GetConnection(k);
|
||||||
|
|||||||
@ -142,7 +142,7 @@ namespace XNodeEditor {
|
|||||||
Color backgroundColor = new Color32(90, 97, 105, 255);
|
Color backgroundColor = new Color32(90, 97, 105, 255);
|
||||||
Color tint;
|
Color tint;
|
||||||
if (NodeEditorWindow.nodeTint.TryGetValue(port.node.GetType(), out tint)) backgroundColor *= 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);
|
DrawPortHandle(rect, backgroundColor, col);
|
||||||
|
|
||||||
// Register the handle position
|
// Register the handle position
|
||||||
@ -199,7 +199,7 @@ namespace XNodeEditor {
|
|||||||
Color backgroundColor = new Color32(90, 97, 105, 255);
|
Color backgroundColor = new Color32(90, 97, 105, 255);
|
||||||
Color tint;
|
Color tint;
|
||||||
if (NodeEditorWindow.nodeTint.TryGetValue(port.node.GetType(), out tint)) backgroundColor *= 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);
|
DrawPortHandle(rect, backgroundColor, col);
|
||||||
|
|
||||||
// Register the handle position
|
// Register the handle position
|
||||||
@ -228,7 +228,7 @@ namespace XNodeEditor {
|
|||||||
Color backgroundColor = new Color32(90, 97, 105, 255);
|
Color backgroundColor = new Color32(90, 97, 105, 255);
|
||||||
Color tint;
|
Color tint;
|
||||||
if (NodeEditorWindow.nodeTint.TryGetValue(port.node.GetType(), out tint)) backgroundColor *= 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);
|
DrawPortHandle(rect, backgroundColor, col);
|
||||||
|
|
||||||
// Register the handle position
|
// Register the handle position
|
||||||
|
|||||||
@ -57,6 +57,10 @@ namespace XNodeEditor {
|
|||||||
NodeEditorWindow.AddCustomContextMenuItems(menu, target);
|
NodeEditorWindow.AddCustomContextMenuItems(menu, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual Color GetPortColor(XNode.NodePort port) {
|
||||||
|
return GetTypeColor(port.ValueType);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Color GetTypeColor(Type type) {
|
public virtual Color GetTypeColor(Type type) {
|
||||||
return NodeEditorPreferences.GetTypeColor(type);
|
return NodeEditorPreferences.GetTypeColor(type);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user