public static void LoadFromElement(XmlElement e, Value.FCurveColorRGBA value, bool isClip) { Action<Data.Value.FCurve<byte>, XmlElement> import = (v_, e_) => { foreach (XmlElement r in e_.ChildNodes) { if (r.Name.StartsWith("Key")) { var f = r.GetTextAsInt("Frame"); var v = r.GetTextAsFloat("Value"); var lx = r.GetTextAsFloat("LeftX"); var ly = r.GetTextAsFloat("LeftY"); var rx = r.GetTextAsFloat("RightX"); var ry = r.GetTextAsFloat("RightY"); var i = r.GetTextAsInt("InterpolationType"); var t = new Value.FCurveKey<byte>(f, (byte)v); t.SetLeftDirectly(lx, ly); t.SetRightDirectly(rx, ry); t.InterpolationType.SetValue(i); v_.AddKeyDirectly(t); } else if (r.Name.StartsWith("StartType")) { var v = r.GetTextAsInt(); v_.StartType.SetValue(v); } else if (r.Name.StartsWith("EndType")) { var v = r.GetTextAsInt(); v_.EndType.SetValue(v); } else if (r.Name.StartsWith("OffsetMax")) { var v = r.GetTextAsFloat(); v_.OffsetMax.SetValueDirectly(v); } else if (r.Name.StartsWith("OffsetMin")) { var v = r.GetTextAsFloat(); v_.OffsetMin.SetValueDirectly(v); } else if (r.Name.StartsWith("Sampling")) { var v = r.GetTextAsInt(); v_.Sampling.SetValueDirectly(v); } } }; var e_keys = e["Keys"] as XmlElement; if (e_keys == null) return; var e_r = e_keys["R"] as XmlElement; var e_g = e_keys["G"] as XmlElement; var e_b = e_keys["B"] as XmlElement; var e_a = e_keys["A"] as XmlElement; if (e_r != null) import(value.R, e_r); if (e_g != null) import(value.G, e_g); if (e_b != null) import(value.B, e_b); if (e_a != null) import(value.A, e_a); }
public static void LoadFromElement(XmlElement e, Value.FCurveVector3D value, bool isClip) { var e_keys = e["Keys"] as XmlElement; if (e_keys == null) return; var e_x = e_keys["X"] as XmlElement; var e_y = e_keys["Y"] as XmlElement; var e_z = e_keys["Z"] as XmlElement; Action<Data.Value.FCurve<float>, XmlElement> import = (v_, e_) => { foreach (XmlElement r in e_.ChildNodes) { if (r.Name.StartsWith("Key")) { var f = r.GetTextAsInt("Frame"); var v = r.GetTextAsFloat("Value"); var lx = r.GetTextAsFloat("LeftX"); var ly = r.GetTextAsFloat("LeftY"); var rx = r.GetTextAsFloat("RightX"); var ry = r.GetTextAsFloat("RightY"); var i = r.GetTextAsInt("InterpolationType"); var t = new Value.FCurveKey<float>(f, v); t.SetLeftDirectly(lx, ly); t.SetRightDirectly(rx, ry); t.InterpolationType.SetValue(i); v_.AddKeyDirectly(t); } else if (r.Name.StartsWith("StartType")) { var v = r.GetTextAsInt(); v_.StartType.SetValue(v); } else if (r.Name.StartsWith("EndType")) { var v = r.GetTextAsInt(); v_.EndType.SetValue(v); } else if (r.Name.StartsWith("OffsetMax")) { var v = r.GetTextAsFloat(); v_.OffsetMax.SetValueDirectly(v); } else if (r.Name.StartsWith("OffsetMin")) { var v = r.GetTextAsFloat(); v_.OffsetMin.SetValueDirectly(v); } else if (r.Name.StartsWith("Sampling")) { var v = r.GetTextAsInt(); v_.Sampling.SetValueDirectly(v); } } }; if (e_x != null) import(value.X, e_x); if (e_y != null) import(value.Y, e_y); if (e_z != null) import(value.Z, e_z); }