From 16992c39722e1d43666aec21aa7451cc281d7dee Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Sat, 27 Oct 2018 18:41:13 +0200 Subject: [PATCH] Added NodeEditor.GetBodyStyle, allowing per-node body styles --- Scripts/Editor/NodeEditor.cs | 4 ++++ Scripts/Editor/NodeEditorGUI.cs | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Scripts/Editor/NodeEditor.cs b/Scripts/Editor/NodeEditor.cs index 1469e2d..46c13bf 100644 --- a/Scripts/Editor/NodeEditor.cs +++ b/Scripts/Editor/NodeEditor.cs @@ -75,6 +75,10 @@ namespace XNodeEditor { else return Color.white; } + public virtual GUIStyle GetBodyStyle() { + return NodeEditorResources.styles.nodeBody; + } + public void InitiateRename() { renaming = 1; } diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs index 9c77033..70cd76e 100644 --- a/Scripts/Editor/NodeEditorGUI.cs +++ b/Scripts/Editor/NodeEditorGUI.cs @@ -348,18 +348,18 @@ namespace XNodeEditor { bool selected = selectionCache.Contains(graph.nodes[n]); if (selected) { - GUIStyle style = new GUIStyle(NodeEditorResources.styles.nodeBody); + GUIStyle style = new GUIStyle(nodeEditor.GetBodyStyle()); GUIStyle highlightStyle = new GUIStyle(NodeEditorResources.styles.nodeHighlight); highlightStyle.padding = style.padding; style.padding = new RectOffset(); GUI.color = nodeEditor.GetTint(); - GUILayout.BeginVertical(new GUIStyle(style)); + GUILayout.BeginVertical(style); GUI.color = NodeEditorPreferences.GetSettings().highlightColor; GUILayout.BeginVertical(new GUIStyle(highlightStyle)); } else { - GUIStyle style = NodeEditorResources.styles.nodeBody; + GUIStyle style = new GUIStyle(nodeEditor.GetBodyStyle()); GUI.color = nodeEditor.GetTint(); - GUILayout.BeginVertical(new GUIStyle(style)); + GUILayout.BeginVertical(style); } GUI.color = guiColor;