mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Added possibility of overriding the body highlight style and the header title style of a node
This commit is contained in:
parent
a4ce09c212
commit
3667e26b05
@ -25,7 +25,7 @@ namespace XNodeEditor {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
public virtual void OnHeaderGUI() {
|
public virtual void OnHeaderGUI() {
|
||||||
GUILayout.Label(target.name, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
|
GUILayout.Label(target.name, GetHeaderTitleStyle(), GUILayout.Height(30));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Draws standard field editors for all public fields </summary>
|
/// <summary> Draws standard field editors for all public fields </summary>
|
||||||
@ -100,6 +100,16 @@ namespace XNodeEditor {
|
|||||||
return NodeEditorResources.styles.nodeBody;
|
return NodeEditorResources.styles.nodeBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual GUIStyle GetBodyHighlightStyle()
|
||||||
|
{
|
||||||
|
return NodeEditorResources.styles.nodeHighlight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual GUIStyle GetHeaderTitleStyle()
|
||||||
|
{
|
||||||
|
return NodeEditorResources.styles.nodeHeader;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Add items for the context menu when right-clicking this node. Override to add custom menu items. </summary>
|
/// <summary> Add items for the context menu when right-clicking this node. Override to add custom menu items. </summary>
|
||||||
public virtual void AddContextMenuItems(GenericMenu menu) {
|
public virtual void AddContextMenuItems(GenericMenu menu) {
|
||||||
// Actions if only one node is selected
|
// Actions if only one node is selected
|
||||||
@ -143,4 +153,4 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -379,7 +379,7 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
GUIStyle style = new GUIStyle(nodeEditor.GetBodyStyle());
|
GUIStyle style = new GUIStyle(nodeEditor.GetBodyStyle());
|
||||||
GUIStyle highlightStyle = new GUIStyle(NodeEditorResources.styles.nodeHighlight);
|
GUIStyle highlightStyle = new GUIStyle(nodeEditor.GetBodyHighlightStyle());
|
||||||
highlightStyle.padding = style.padding;
|
highlightStyle.padding = style.padding;
|
||||||
style.padding = new RectOffset();
|
style.padding = new RectOffset();
|
||||||
GUI.color = nodeEditor.GetTint();
|
GUI.color = nodeEditor.GetTint();
|
||||||
@ -490,4 +490,4 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user