From 36316e83b898826b62ede0f4c3af996440570e9f Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Wed, 6 Nov 2019 11:34:09 +0100 Subject: [PATCH] Flipped output inherited type constraints, edited comments --- Scripts/Node.cs | 4 ++-- Scripts/NodePort.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/Node.cs b/Scripts/Node.cs index fa196de..a07679a 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -45,11 +45,11 @@ namespace XNode { public enum TypeConstraint { /// Allow all types of input None, - /// Allow similar and inherited types + /// Allow connections where input value type is assignable from output value type (eg. ScriptableObject --> Object) Inherited, /// Allow only similar types Strict, - /// Allow similar and inherited types but checks inheritance in reverse + /// Allow connections where output value type is assignable from input value type (eg. Object --> ScriptableObject) InheritedInverse, } diff --git a/Scripts/NodePort.cs b/Scripts/NodePort.cs index 5ce980c..2fd613d 100644 --- a/Scripts/NodePort.cs +++ b/Scripts/NodePort.cs @@ -261,9 +261,9 @@ namespace XNode { if (input.typeConstraint == XNode.Node.TypeConstraint.Strict && input.ValueType != output.ValueType) return false; if (input.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !output.ValueType.IsAssignableFrom(input.ValueType)) return false; // Check output type constraints - if (output.typeConstraint == XNode.Node.TypeConstraint.Inherited && !output.ValueType.IsAssignableFrom(input.ValueType)) return false; - if (output.typeConstraint == XNode.Node.TypeConstraint.Strict && output.ValueType != input.ValueType) return false; - if (output.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !input.ValueType.IsAssignableFrom(output.ValueType)) return false; + if (output.typeConstraint == XNode.Node.TypeConstraint.Inherited && !input.ValueType.IsAssignableFrom(output.ValueType)) return false; + if (output.typeConstraint == XNode.Node.TypeConstraint.Strict && input.ValueType != output.ValueType) return false; + if (output.typeConstraint == XNode.Node.TypeConstraint.InheritedInverse && !output.ValueType.IsAssignableFrom(input.ValueType)) return false; // Success return true; }