Skip to content

Commit be7ca0e

Browse files
Use virtual method to apply node color for more flexibility
1 parent c3b3a1d commit be7ca0e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,11 @@ void InitializeView()
156156

157157
title = (string.IsNullOrEmpty(nodeTarget.name)) ? nodeTarget.GetType().Name : nodeTarget.name;
158158

159-
// Apply node accent color
160-
if (nodeTarget.color.a > 0)
161-
{
162-
titleContainer.style.borderBottomColor = new StyleColor(nodeTarget.color);
163-
titleContainer.style.borderBottomWidth = new StyleFloat(5f);
164-
}
165-
166159
initializing = true;
167160

168161
SetPosition(nodeTarget.position);
169-
162+
SetNodeColor(nodeTarget.color);
163+
170164
AddInputContainer();
171165
}
172166

@@ -634,6 +628,12 @@ protected virtual void DrawDefaultInspector(bool fromInspector = false)
634628
}
635629
}
636630

631+
protected virtual void SetNodeColor(Color color)
632+
{
633+
titleContainer.style.borderBottomColor = new StyleColor(color);
634+
titleContainer.style.borderBottomWidth = new StyleFloat(color.a > 0 ? 5f : 0f);
635+
}
636+
637637
private void AddEmptyField(FieldInfo field, bool fromInspector)
638638
{
639639
if(field.GetCustomAttribute(typeof(InputAttribute)) == null || fromInspector) return;

0 commit comments

Comments
 (0)