mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
Removed GetValue
This commit is contained in:
parent
147dc639e8
commit
6e000c20b2
@ -454,7 +454,8 @@ namespace XNodeEditor {
|
||||
GUIContent content = new GUIContent();
|
||||
content.text = type.PrettyName();
|
||||
if (hoveredPort.IsOutput) {
|
||||
object obj = hoveredPort.node.GetValue(hoveredPort);
|
||||
if (hoveredPort.targetDelegate == null) hoveredPort.Initialize(hoveredPort.node.GetDelegate);
|
||||
object obj = hoveredPort.targetDelegate.DynamicInvoke();
|
||||
content.text += " = " + (obj != null ? obj.ToString() : "null");
|
||||
}
|
||||
Vector2 size = NodeEditorResources.styles.tooltip.CalcSize(content);
|
||||
|
||||
@ -182,25 +182,6 @@ namespace XNode {
|
||||
else return fallback;
|
||||
}
|
||||
|
||||
/// <summary> Returns a value based on requested port output. Should be overridden in all derived nodes with outputs. </summary>
|
||||
/// <param name="port">The requested port.</param>
|
||||
public object GetValue(NodePort port) {
|
||||
if (port.targetDelegate == null) port.Initialize(GetDelegate);
|
||||
return port.targetDelegate.DynamicInvoke();
|
||||
}
|
||||
|
||||
/// <summary> Returns a value based on requested port output. Should be overridden in all derived nodes with outputs. </summary>
|
||||
/// <param name="port">The requested port.</param>
|
||||
public T GetValue<T>(NodePort port) {
|
||||
if (port.targetDelegate == null) port.Initialize(GetDelegate);
|
||||
Func<T> func = port.targetDelegate as Func<T>;
|
||||
|
||||
if (func != null)
|
||||
return func();
|
||||
|
||||
return default(T); //default
|
||||
}
|
||||
|
||||
public abstract Delegate GetDelegate(string fieldName);
|
||||
#endregion
|
||||
|
||||
|
||||
@ -110,7 +110,13 @@ namespace XNode {
|
||||
/// <returns> <see cref="Node.GetValue(NodePort)"/> </returns>
|
||||
public T GetOutputValue<T>() {
|
||||
if (direction == IO.Input) return default(T);
|
||||
return node.GetValue<T>(this);
|
||||
if (targetDelegate == null) Initialize(node.GetDelegate);
|
||||
Func<T> func = targetDelegate as Func<T>;
|
||||
|
||||
if (func != null)
|
||||
return func();
|
||||
|
||||
return default(T); //default
|
||||
}
|
||||
|
||||
/// <summary> Return the output value of the first connected port. Returns null if none found or invalid.</summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user