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; }