Ejemplo n.º 1
0
 public CustomDataParameter()
 {
     CustomData  = new Value.Enum <CustomDataType>();
     Fixed       = new Value.Vector2D();
     Easing      = new Vector2DEasingParamater();
     FCurve      = new Value.FCurveVector2D();
     FCurveColor = new Value.FCurveColorRGBA();
 }
Ejemplo n.º 2
0
 public CustomDataParameter(int customDataNum)
 {
     this.customDataNum = customDataNum;
     CustomData         = new Value.Enum <CustomDataType>();
     Fixed       = new Value.Vector2D();
     Easing      = new Vector2DEasingParamater();
     FCurve      = new Value.FCurveVector2D();
     Fixed4      = new Value.Vector4D();
     FCurveColor = new Value.FCurveColorRGBA();
 }
Ejemplo n.º 3
0
 public UVFCurveParamater()
 {
     Start = new Value.FCurveVector2D();
     Size  = new Value.FCurveVector2D();
 }
Ejemplo n.º 4
0
        public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.FCurveVector2D value, bool isClip)
        {
            var e    = doc.CreateElement(element_name);
            var keys = doc.CreateElement("Keys");
            var x    = doc.CreateElement("X");
            var y    = doc.CreateElement("Y");

            int index = 0;

            Action <Value.FCurve <float>, XmlElement> setValues = (v, xml) =>
            {
                index = 0;

                var st   = SaveToElement(doc, "StartType", v.StartType, isClip);
                var et   = SaveToElement(doc, "EndType", v.EndType, isClip);
                var omax = SaveToElement(doc, "OffsetMax", v.OffsetMax, isClip);
                var omin = SaveToElement(doc, "OffsetMin", v.OffsetMin, isClip);
                var s    = SaveToElement(doc, "Sampling", v.Sampling, isClip);

                if (st != null)
                {
                    xml.AppendChild(st);
                }
                if (et != null)
                {
                    xml.AppendChild(et);
                }
                if (omax != null)
                {
                    xml.AppendChild(omax);
                }
                if (omin != null)
                {
                    xml.AppendChild(omin);
                }
                if (s != null)
                {
                    xml.AppendChild(s);
                }

                foreach (var k_ in v.Keys)
                {
                    var k = doc.CreateElement("Key" + index.ToString());
                    k.AppendChild(doc.CreateTextElement("Frame", k_.Frame.ToString()));
                    k.AppendChild(doc.CreateTextElement("Value", k_.ValueAsFloat.ToString()));
                    k.AppendChild(doc.CreateTextElement("LeftX", k_.LeftX.ToString()));
                    k.AppendChild(doc.CreateTextElement("LeftY", k_.LeftY.ToString()));
                    k.AppendChild(doc.CreateTextElement("RightX", k_.RightX.ToString()));
                    k.AppendChild(doc.CreateTextElement("RightY", k_.RightY.ToString()));

                    k.AppendChild(doc.CreateTextElement("InterpolationType", k_.InterpolationType.GetValueAsInt()));

                    xml.AppendChild(k);
                    index++;
                }
            };

            setValues(value.X, x);
            setValues(value.Y, y);

            if (x.ChildNodes.Count > 0)
            {
                keys.AppendChild(x);
            }
            if (y.ChildNodes.Count > 0)
            {
                keys.AppendChild(y);
            }
            if (keys.ChildNodes.Count > 0)
            {
                e.AppendChild(keys);
            }

            return(e.ChildNodes.Count > 0 ? e : null);
        }
Ejemplo n.º 5
0
        public static void LoadFromElement(XmlElement e, Value.FCurveVector2D 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;

            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 s  = r.GetTextAsInt("Sampling");

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