//TODO simplistic, to improve. static bool IsRelevantMathNode(ValueType valueType, NodeSearcherItemData data) { if (data.Type != typeof(MathNodeModel)) { return(false); } switch (valueType) { case ValueType.Bool: case ValueType.Int: case ValueType.Float: case ValueType.Float2: case ValueType.Float3: case ValueType.Float4: case ValueType.Quaternion: return(true); default: return(false); } }
public static ulong GenerateStableValueForMathOp(MathOperationsMetaData.MathOps mathOp, ValueType returnType, ValueType[] paramTypes) { uint signature = GenerateSignatureFlag(returnType, paramTypes); uint op = (uint)mathOp; Assert.AreNotEqual((op & k_IsCustomOpBit), k_IsCustomOpBit, $"Op {mathOp} uses the {nameof(k_IsCustomOpBit)} bit"); ulong result = ((ulong)signature << 32) | op; return(result); }
public static bool ToValueType(this TypeHandle handle, out ValueType typeHandleToValueType) { typeHandleToValueType = ValueType.Unknown; if (handle == TypeHandle.Unknown) { typeHandleToValueType = ValueType.Unknown; return(true); } if (handle == TypeHandle.Bool) { typeHandleToValueType = ValueType.Bool; return(true); } if (handle == TypeHandle.Int) { typeHandleToValueType = ValueType.Int; return(true); } if (handle == TypeHandle.Float) { typeHandleToValueType = ValueType.Float; return(true); } if (handle == TypeHandle.Vector2 || handle == DotsTypeHandle.Float2) { typeHandleToValueType = ValueType.Float2; return(true); } if (handle == TypeHandle.Vector3 || handle == DotsTypeHandle.Float3) { typeHandleToValueType = ValueType.Float3; return(true); } if (handle == TypeHandle.Vector4 || handle == DotsTypeHandle.Float4) { typeHandleToValueType = ValueType.Float4; return(true); } if (handle == TypeHandle.Quaternion || handle == DotsTypeHandle.Quaternion) { typeHandleToValueType = ValueType.Quaternion; return(true); } if (handle == TypeHandle.GameObject || handle == DotsTypeHandle.Entity) { typeHandleToValueType = ValueType.Entity; return(true); } if (handle == TypeHandle.String || handle.IsNativeString()) { typeHandleToValueType = ValueType.StringReference; return(true); } return(false); }
public static SearcherFilter WithDataOutputNodes(this SearcherFilter self, ValueType portType) { self.RegisterNode(data => IsRelevantMathNode(portType, data) || typeof(IHasMainOutputPort).IsAssignableFrom(data.Type)); return(self); }