1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-11 09:38:45 +08:00

Updated Examples

This commit is contained in:
Thor Brigsted 2017-11-05 23:55:44 +01:00
parent 9784bebd88
commit 031e1d83df
3 changed files with 98 additions and 52 deletions

View File

@ -27,25 +27,38 @@ MonoBehaviour:
m_Name: MathNode m_Name: MathNode
m_EditorClassIdentifier: m_EditorClassIdentifier:
graph: {fileID: 11400000} graph: {fileID: 11400000}
position: {x: -539.5, y: -205} position: {x: -401.5, y: -119}
inputs: ports:
- node: {fileID: 114511978881715272} keys:
_fieldName: a - a
connections: [] - b
_direction: 0 - result
- node: {fileID: 114511978881715272} values:
_fieldName: b - _fieldName: a
connections: [] _node: {fileID: 114511978881715272}
_direction: 0 _typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
outputs: PublicKeyToken=b77a5c561934e089
- node: {fileID: 114511978881715272} connections: []
_fieldName: result _direction: 0
connections: _dynamic: 0
- fieldName: x - _fieldName: b
node: {fileID: 114708853913061688} _node: {fileID: 114511978881715272}
_direction: 1 _typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
a: 2.7975256 PublicKeyToken=b77a5c561934e089
b: 6.7917466 connections: []
_direction: 0
_dynamic: 0
- _fieldName: result
_node: {fileID: 114511978881715272}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections:
- fieldName: x
node: {fileID: 114708853913061688}
_direction: 1
_dynamic: 0
a: 3.06
b: 7.29
result: 0 result: 0
mathType: 0 mathType: 0
--- !u!114 &114708853913061688 --- !u!114 &114708853913061688
@ -61,28 +74,45 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
graph: {fileID: 11400000} graph: {fileID: 11400000}
position: {x: -157.5, y: -115} position: {x: -157.5, y: -115}
inputs: ports:
- node: {fileID: 114708853913061688} keys:
_fieldName: x - x
connections: - y
- fieldName: result - z
node: {fileID: 114511978881715272} - vector
_direction: 0 values:
- node: {fileID: 114708853913061688} - _fieldName: x
_fieldName: y _node: {fileID: 114708853913061688}
connections: [] _typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
_direction: 0 PublicKeyToken=b77a5c561934e089
- node: {fileID: 114708853913061688} connections:
_fieldName: z - fieldName: result
connections: [] node: {fileID: 114511978881715272}
_direction: 0 _direction: 0
outputs: _dynamic: 0
- node: {fileID: 114708853913061688} - _fieldName: y
_fieldName: vector _node: {fileID: 114708853913061688}
connections: _typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
- fieldName: value PublicKeyToken=b77a5c561934e089
node: {fileID: 114729867621534192} connections: []
_direction: 1 _direction: 0
_dynamic: 0
- _fieldName: z
_node: {fileID: 114708853913061688}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: []
_direction: 0
_dynamic: 0
- _fieldName: vector
_node: {fileID: 114708853913061688}
_typeQualifiedName: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
connections:
- fieldName: input
node: {fileID: 114729867621534192}
_direction: 1
_dynamic: 0
x: 0 x: 0
y: 2.6412349 y: 2.6412349
z: 14.33477 z: 14.33477
@ -99,12 +129,25 @@ MonoBehaviour:
m_Name: DisplayValue m_Name: DisplayValue
m_EditorClassIdentifier: m_EditorClassIdentifier:
graph: {fileID: 11400000} graph: {fileID: 11400000}
position: {x: 78.5, y: -64} position: {x: 104.5, y: -82}
inputs: ports:
- node: {fileID: 114729867621534192} keys:
_fieldName: value - value
connections: - input
- fieldName: vector values:
node: {fileID: 114708853913061688} - _fieldName: value
_direction: 0 _node: {fileID: 114729867621534192}
outputs: [] _typeQualifiedName: System.Object, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: []
_direction: 0
_dynamic: 0
- _fieldName: input
_node: {fileID: 114729867621534192}
_typeQualifiedName: System.Object, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections:
- fieldName: vector
node: {fileID: 114708853913061688}
_direction: 0
_dynamic: 1

View File

@ -2,10 +2,12 @@
namespace BasicNodes { namespace BasicNodes {
public class DisplayValue : Node { public class DisplayValue : Node {
[Input(ShowBackingValue.Never)] public object value; protected override void Init() {
if (!HasPort("input")) AddInstanceInput(typeof(object), "input");
}
public override object GetValue(NodePort port) { public override object GetValue(NodePort port) {
return GetInputValue<object>("value", value); return GetInputValue<object>("input");
} }
} }
} }

View File

@ -7,6 +7,7 @@ namespace BasicNodes {
public override void OnBodyGUI() { public override void OnBodyGUI() {
base.OnBodyGUI(); base.OnBodyGUI();
NodeEditorGUILayout.PortField(target.GetInputPort("input"));
object obj = target.GetValue(null); object obj = target.GetValue(null);
if (obj != null) EditorGUILayout.LabelField(target.GetValue(null).ToString()); if (obj != null) EditorGUILayout.LabelField(target.GetValue(null).ToString());
} }