예제 #1
0
        public override DataItem LoadFromString(string data, UndoRedoManager undoRedo)
        {
            var item = new VectorItem(this, undoRedo);

            item.Value = VectorN.FromString(data);
            return(item);
        }
예제 #2
0
        public override void Parse(XElement definition)
        {
            NumComponents = TryParseInt(definition, "NumComponents", 2);
            XName         = definition.Attribute("Name1")?.Value?.ToString() ?? XName;
            YName         = definition.Attribute("Name2")?.Value?.ToString() ?? YName;
            ZName         = definition.Attribute("Name3")?.Value?.ToString() ?? ZName;
            WName         = definition.Attribute("Name4")?.Value?.ToString() ?? WName;

            MinValue = TryParseFloat(definition, "Min", -float.MaxValue);
            MaxValue = TryParseFloat(definition, "Max", float.MaxValue);

            var type = definition.Attribute("Type")?.Value?.ToString().ToUpper();

            if (type == "INT")
            {
                UseIntegers = true;
            }

            var defaultString = definition.Attribute("Default")?.Value?.ToString() ?? "0,0,0,0";

            Default = VectorN.FromString(defaultString, NumComponents);
        }
예제 #3
0
        public override DataItem LoadData(XElement element, UndoRedoManager undoRedo)
        {
            var item = new VectorItem(this, undoRedo);

            item.Value = VectorN.FromString(element.Value);

            foreach (var att in Attributes)
            {
                var      el      = element.Attribute(att.Name);
                DataItem attItem = null;

                if (el != null)
                {
                    attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo);
                }
                else
                {
                    attItem = att.CreateData(undoRedo);
                }
                item.Attributes.Add(attItem);
            }

            return(item);
        }