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 {
|
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>
|
/// <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 {
|
public class NodeEditor {
|
||||||
|
|
||||||
/// <summary> Fires every whenever a node was modified through the editor </summary>
|
/// <summary> Fires every whenever a node was modified through the editor </summary>
|
||||||
public static Action<Node> onUpdateNode;
|
public static Action<Node> onUpdateNode;
|
||||||
public Node target;
|
public Node target;
|
||||||
@ -45,6 +46,12 @@ namespace XNodeEditor {
|
|||||||
public virtual int GetWidth() {
|
public virtual int GetWidth() {
|
||||||
return 200;
|
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)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
|
|||||||
@ -204,7 +204,7 @@ namespace XNodeEditor {
|
|||||||
GUILayout.BeginArea(new Rect(nodePos, new Vector2(nodeEditor.GetWidth(), 4000)));
|
GUILayout.BeginArea(new Rect(nodePos, new Vector2(nodeEditor.GetWidth(), 4000)));
|
||||||
|
|
||||||
GUIStyle style = NodeEditorResources.styles.nodeBody;
|
GUIStyle style = NodeEditorResources.styles.nodeBody;
|
||||||
if (nodeTint.ContainsKey(nodeType)) GUI.color = nodeTint[nodeType];
|
GUI.color = nodeEditor.GetTint();
|
||||||
GUILayout.BeginVertical(new GUIStyle(style));
|
GUILayout.BeginVertical(new GUIStyle(style));
|
||||||
GUI.color = guiColor;
|
GUI.color = guiColor;
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user