mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!W(Node Editor GUI Layout) LabelAttribute logic
This commit is contained in:
parent
ecb863630c
commit
32e375e3da
@ -36,10 +36,25 @@ namespace XNodeEditor {
|
||||
/// <summary> Make a field for a serialized property. Manual node port override. </summary>
|
||||
public static void PropertyField(SerializedProperty property, GUIContent label, XNode.NodePort port, bool includeChildren = true, params GUILayoutOption[] options) {
|
||||
if (property == null) throw new NullReferenceException();
|
||||
|
||||
|
||||
// If property is not a port, display a regular property field
|
||||
if (port == null) EditorGUILayout.PropertyField(property, label, includeChildren, GUILayout.MinWidth(30));
|
||||
else {
|
||||
|
||||
Node.LabelAttribute labelAttribute;
|
||||
|
||||
if (NodeEditorUtilities.GetCachedAttrib(port.node.GetType(), property.name, out labelAttribute))
|
||||
{
|
||||
if (label != null)
|
||||
{
|
||||
label.text = labelAttribute.Label;
|
||||
}
|
||||
else
|
||||
{
|
||||
label = new GUIContent(labelAttribute.Label);
|
||||
}
|
||||
}
|
||||
|
||||
Rect rect = new Rect();
|
||||
|
||||
float spacePadding = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user