mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-21 17:26:47 +08:00
Nodes now show unsupported value types as labels.
This commit is contained in:
parent
eaeca48f69
commit
f335ecfbb5
@ -31,7 +31,7 @@ public class NodeEditor {
|
|||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
FieldInfo[] fields = GetInspectorFields(target);
|
FieldInfo[] fields = GetInspectorFields(target);
|
||||||
for (int i = 0; i < fields.Length; i++) {
|
for (int i = 0; i < fields.Length; i++) {
|
||||||
if (fields[i].Name == "graph" || fields[i].Name == "position") continue;
|
switch (fields[i].Name) { case "graph": case "position": case "inputs": case "outputs": continue; }
|
||||||
NodeEditorGUILayout.PropertyField(target, fields[i], portPositions);
|
NodeEditorGUILayout.PropertyField(target, fields[i], portPositions);
|
||||||
}
|
}
|
||||||
//If user changed a value, notify other scripts through onUpdateNode
|
//If user changed a value, notify other scripts through onUpdateNode
|
||||||
|
|||||||
@ -85,7 +85,7 @@ public class NodeEditorGUILayout {
|
|||||||
else if (type == typeof(AnimationCurve)) return CurveField(label, value is AnimationCurve ? (AnimationCurve)value : default(AnimationCurve));
|
else if (type == typeof(AnimationCurve)) return CurveField(label, value is AnimationCurve ? (AnimationCurve)value : default(AnimationCurve));
|
||||||
else if (type.IsSubclassOf(typeof(Enum)) || type == typeof(Enum)) return EnumField(label, (Enum)value);
|
else if (type.IsSubclassOf(typeof(Enum)) || type == typeof(Enum)) return EnumField(label, (Enum)value);
|
||||||
else if (type.IsSubclassOf(typeof(UnityEngine.Object)) || type == typeof(UnityEngine.Object)) return ObjectField(label, (UnityEngine.Object)value, type);
|
else if (type.IsSubclassOf(typeof(UnityEngine.Object)) || type == typeof(UnityEngine.Object)) return ObjectField(label, (UnityEngine.Object)value, type);
|
||||||
else return value;
|
else { GUILayout.Label(label); return value; }
|
||||||
}
|
}
|
||||||
public static Rect GetRect(string label) {
|
public static Rect GetRect(string label) {
|
||||||
Rect rect = EditorGUILayout.GetControlRect();
|
Rect rect = EditorGUILayout.GetControlRect();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user