summaryrefslogtreecommitdiff
path: root/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor
diff options
context:
space:
mode:
Diffstat (limited to 'Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor')
-rw-r--r--Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs27
-rw-r--r--Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs.meta13
2 files changed, 40 insertions, 0 deletions
diff --git a/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs
new file mode 100644
index 00000000..706c5dc2
--- /dev/null
+++ b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs
@@ -0,0 +1,27 @@
+using UnityEditor;
+using XNode.Examples.MathNodes;
+
+namespace XNodeEditor.Examples {
+
+ /// <summary>
+ /// NodeEditor functions similarly to the Editor class, only it is xNode specific.
+ /// Custom node editors should have the CustomNodeEditor attribute that defines which node type it is an editor for.
+ /// </summary>
+ [CustomNodeEditor(typeof(DisplayValue))]
+ public class DisplayValueEditor : NodeEditor {
+
+ /// <summary> Called whenever the xNode editor window is updated </summary>
+ public override void OnBodyGUI() {
+
+ // Draw the default GUI first, so we don't have to do all of that manually.
+ base.OnBodyGUI();
+
+ // `target` points to the node, but it is of type `Node`, so cast it.
+ DisplayValue displayValueNode = target as DisplayValue;
+
+ // Get the value from the node, and display it
+ object obj = displayValueNode.GetValue();
+ if (obj != null) EditorGUILayout.LabelField(obj.ToString());
+ }
+ }
+} \ No newline at end of file
diff --git a/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs.meta b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs.meta
new file mode 100644
index 00000000..971da18a
--- /dev/null
+++ b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/MathGraph/Nodes/Editor/DisplayValueEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 7d7298690665789498dc42a285eb2c28
+timeCreated: 1509305659
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: