mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Added virtual NodeEdutor.GetTint()
This commit is contained in:
parent
dcff69979c
commit
710692a326
@ -8,6 +8,7 @@ using XNode;
|
||||
namespace XNodeEditor {
|
||||
/// <summary> Base class to derive custom Node editors from. Use this to create your own custom inspectors and editors for your nodes. </summary>
|
||||
public class NodeEditor {
|
||||
|
||||
/// <summary> Fires every whenever a node was modified through the editor </summary>
|
||||
public static Action<Node> onUpdateNode;
|
||||
public Node target;
|
||||
@ -45,6 +46,12 @@ namespace XNodeEditor {
|
||||
public virtual int GetWidth() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
public virtual Color GetTint() {
|
||||
Type type = GetType();
|
||||
if (NodeEditorWindow.nodeTint.ContainsKey(type)) return NodeEditorWindow.nodeTint[type];
|
||||
else return Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
|
||||
@ -204,7 +204,7 @@ namespace XNodeEditor {
|
||||
GUILayout.BeginArea(new Rect(nodePos, new Vector2(nodeEditor.GetWidth(), 4000)));
|
||||
|
||||
GUIStyle style = NodeEditorResources.styles.nodeBody;
|
||||
if (nodeTint.ContainsKey(nodeType)) GUI.color = nodeTint[nodeType];
|
||||
GUI.color = nodeEditor.GetTint();
|
||||
GUILayout.BeginVertical(new GUIStyle(style));
|
||||
GUI.color = guiColor;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user