1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-20 00:36:44 +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
- b
- result
values:
- _fieldName: a
_node: {fileID: 114511978881715272}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: [] connections: []
_direction: 0 _direction: 0
- node: {fileID: 114511978881715272} _dynamic: 0
_fieldName: b - _fieldName: b
_node: {fileID: 114511978881715272}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: [] connections: []
_direction: 0 _direction: 0
outputs: _dynamic: 0
- node: {fileID: 114511978881715272} - _fieldName: result
_fieldName: result _node: {fileID: 114511978881715272}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: connections:
- fieldName: x - fieldName: x
node: {fileID: 114708853913061688} node: {fileID: 114708853913061688}
_direction: 1 _direction: 1
a: 2.7975256 _dynamic: 0
b: 6.7917466 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
- y
- z
- vector
values:
- _fieldName: x
_node: {fileID: 114708853913061688}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: connections:
- fieldName: result - fieldName: result
node: {fileID: 114511978881715272} node: {fileID: 114511978881715272}
_direction: 0 _direction: 0
- node: {fileID: 114708853913061688} _dynamic: 0
_fieldName: y - _fieldName: y
_node: {fileID: 114708853913061688}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: [] connections: []
_direction: 0 _direction: 0
- node: {fileID: 114708853913061688} _dynamic: 0
_fieldName: z - _fieldName: z
_node: {fileID: 114708853913061688}
_typeQualifiedName: System.Single, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
connections: [] connections: []
_direction: 0 _direction: 0
outputs: _dynamic: 0
- node: {fileID: 114708853913061688} - _fieldName: vector
_fieldName: vector _node: {fileID: 114708853913061688}
_typeQualifiedName: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
connections: connections:
- fieldName: value - fieldName: input
node: {fileID: 114729867621534192} node: {fileID: 114729867621534192}
_direction: 1 _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
- input
values:
- _fieldName: value
_node: {fileID: 114729867621534192}
_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: connections:
- fieldName: vector - fieldName: vector
node: {fileID: 114708853913061688} node: {fileID: 114708853913061688}
_direction: 0 _direction: 0
outputs: [] _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());
} }