/// <summary> /// Initialize this Vector based on an FString. The String is expected to contain X=, Y=. /// The FVector2D will be bogus when InitFromString returns false. /// </summary> /// <param name="sourceString">String containing the vector values.</param> /// <returns>true if the X,Y values were read successfully; false otherwise.</returns> public bool InitFromString(string sourceString) { X = Y = 0; // The initialization is only successful if the X, Y, and Z values can all be parsed from the string bool successful = FParse.Value(sourceString, "X=", ref X) && FParse.Value(sourceString, "Y=", ref Y); return(successful); }
/// <summary> /// Initialize this Rotator based on an FString. The String is expected to contain P=, Y=, R=. /// The FRotator will be bogus when InitFromString returns false. /// </summary> /// <param name="sourceString">String containing the rotator values.</param> /// <returns>true if the P,Y,R values were read successfully; false otherwise.</returns> public bool InitFromString(string sourceString) { Pitch = Yaw = Roll = 0; // The initialization is only successful if the X, Y, and Z values can all be parsed from the string bool successful = FParse.Value(sourceString, "P=", ref Pitch) && FParse.Value(sourceString, "Y=", ref Yaw) && FParse.Value(sourceString, "R=", ref Roll); DiagnosticCheckNaN(); return(successful); }
/// <summary> /// Initialize this FQuat from a string. /// The string is expected to contain X=, Y=, Z=, W=, otherwise /// this FQuat will have indeterminate (invalid) values. /// </summary> /// <param name="sourceString">String containing the quaternion values.</param> /// <returns>true if the FQuat was initialized; false otherwise.</returns> public bool InitFromString(string sourceString) { X = Y = Z = 0.0f; W = 1.0f; bool success = FParse.Value(sourceString, "X=", ref X) && FParse.Value(sourceString, "Y=", ref Y) && FParse.Value(sourceString, "Z=", ref Z) && FParse.Value(sourceString, "W=", ref W); DiagnosticCheckNaN(); return(success); }
/// <summary> /// Initialize this Vector based on an FString. The String is expected to contain X=, Y=, Z=, W=. /// The FVector4 will be bogus when InitFromString returns false. /// </summary> /// <param name="sourceString">String containing the vector values.</param> /// <returns>true if the X,Y,Z values were read successfully; false otherwise.</returns> public bool InitFromString(string sourceString) { X = Y = Z = 0; W = 1.0f; // The initialization is only successful if the X, Y, and Z values can all be parsed from the string bool successful = FParse.Value(sourceString, "X=", ref X) && FParse.Value(sourceString, "Y=", ref Y) && FParse.Value(sourceString, "Z=", ref Z); // W is optional, so don't factor in its presence (or lack thereof) in determining initialization success FParse.Value(sourceString, "W=", ref W); return(successful); }
/// <summary> /// Initialize this Color based on an FString. The String is expected to contain R=, G=, B=, A=. /// The FColor will be bogus when InitFromString returns false. /// </summary> /// <param name="sourceString">String containing the color values.</param> /// <returns>true if the R,G,B values were read successfully; false otherwise.</returns> public bool InitFromString(string sourceString) { packedValue = 0; A = 255; // The initialization is only successful if the R, G, and B values can all be parsed from the string byte r = R, g = G, b = B, a = A; bool successful = FParse.Value(sourceString, "R=", ref r) && FParse.Value(sourceString, "G=", ref g) && FParse.Value(sourceString, "B=", ref b); R = r; G = g; B = b; // Alpha is optional, so don't factor in its presence (or lack thereof) in determining initialization success FParse.Value(sourceString, "A=", ref a); A = a; return(successful); }