示例#1
0
        void AppendType(Type type, PropertyInfo[] props = null, TypeRow parentRow = null)
        {
            if (props == null)
            {
                props = new PropertyInfo[0];
            }

            var ps = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            List<TypeRow> sameLayer = new List<TypeRow>();

            for (int i = 0; i < ps.Length; i++)
            {
                var attributes = ps[i].GetCustomAttributes(false);

                var list_props = new List<PropertyInfo>(props);
                list_props.Add(ps[i]);

                var row = new TypeRow(list_props.ToArray(), sameLayer, parentRow);

                if (row.Control != null)
                {
                    // 表示可能な値
                    typeRows.Add(row);
                    sameLayer.Add(row);
                }
                else
                {
                    // 値コンテナ

                    // ループ防止
                    if (ps[i].PropertyType == typeof(Data.NodeBase)) continue;
                    if (ps[i].PropertyType == typeof(Data.NodeBase.ChildrenCollection)) continue;
                    if (ps[i].PropertyType == typeof(Data.Value.FCurve<float>)) continue;
                    if (ps[i].PropertyType == typeof(Data.Value.FCurve<byte>)) continue;

                    typeRows.Add(row);
                    sameLayer.Add(row);
                    AppendType(ps[i].PropertyType, list_props.ToArray(), row);
                }
            }
        }
示例#2
0
        public void WriteBody(TypeRow type, DCRows dcRows)
        {
            foreach (DCRow dcRow in dcRows.List)
            {
                string sum = dcRow.SumString.ToString();
                if (sum.IndexOf(',') == -1)
                    sum += ",";

                string letters = (_invoice.IsRub) ? "NCMI" : "NTRF";

                WriteLine(string.Concat(":61:", _file1C.DateFormated, type.ToString(), sum, letters, dcRow.Number, "//", dcRow.Number));
                WriteLine(string.Concat(":86:/ORDP/", dcRow.Ordp));
                WriteLine(string.Concat("/BENM/", dcRow.Benm));

                foreach (string s1 in dcRow.CommList)
                {
                    WriteLine(s1);
                }
            }
        }
示例#3
0
            /// <summary>
            /// プロパティから生成
            /// </summary>
            /// <param name="properties"></param>
            public TypeRow(PropertyInfo[] properties, List<TypeRow> sameLayer, TypeRow parent)
            {
                Parent = parent;

                var p = properties.LastOrDefault();
                var attributes = p.GetCustomAttributes(false);

                Control gui = null;

                var undo = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.UndoAttribute)).FirstOrDefault() as Effekseer.Data.UndoAttribute;
                if (undo != null && !undo.Undo)
                {
                    EnableUndo = false;
                }
                else
                {
                    EnableUndo = true;
                }

                var shown = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.ShownAttribute)).FirstOrDefault() as Effekseer.Data.ShownAttribute;

                if (shown != null && !shown.Shown)
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.String))
                {
                    gui = new String();
                }
                else if (p.PropertyType == typeof(Data.Value.Boolean))
                {
                    gui = new Boolean();
                }
                else if (p.PropertyType == typeof(Data.Value.Int))
                {
                    gui = new Int();
                }
                else if (p.PropertyType == typeof(Data.Value.IntWithInifinite))
                {
                    gui = new IntWithInifinite();
                }
                else if (p.PropertyType == typeof(Data.Value.IntWithRandom))
                {
                    gui = new IntWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Float))
                {
                    gui = new Float();
                }
                else if (p.PropertyType == typeof(Data.Value.FloatWithRandom))
                {
                    gui = new FloatWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector2D))
                {
                    gui = new Vector2D();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector2DWithRandom))
                {
                    gui = new Vector2DWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector3D))
                {
                    gui = new Vector3D();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector3DWithRandom))
                {
                    gui = new Vector3DWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Color))
                {
                    gui = new ColorCtrl();
                }
                else if (p.PropertyType == typeof(Data.Value.ColorWithRandom))
                {
                    gui = new ColorWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Path))
                {
                    gui = new Path();
                }
                else if (p.PropertyType == typeof(Data.Value.PathForImage))
                {
                    gui = new PathForImage();
                }
                else if (p.PropertyType == typeof(Data.Value.PathForSound))
                {
                    gui = new PathForSound();
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveVector3D))
                {
                    FCurveButton button = new FCurveButton();
                    button.Text = "Fカーブ";
                    gui = button;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveColorRGBA))
                {
                    FCurveButton button = new FCurveButton();
                    button.Text = "Fカーブ";
                    gui = button;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurve<float>))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurve<byte>))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.IFCurveKey))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType.IsGenericType)
                {
                    var types = p.PropertyType.GetGenericArguments();
                    var generic_type = typeof(Enum<>).MakeGenericType(types);
                    var constructor = generic_type.GetConstructor(new Type[] { });
                    gui = constructor.Invoke(null) as Control;
                }

                var selector_attribute = (from a in attributes where a is Data.SelectorAttribute select a).FirstOrDefault() as Data.SelectorAttribute;
                if (selector_attribute != null)
                {
                    IsSelector = true;
                    SelectorID = selector_attribute.ID;
                }
                else
                {
                    IsSelector = false;
                    SelectorID = -1;
                }

                Properties = properties.Clone() as PropertyInfo[];
                Title = NameAttribute.GetName(attributes);
                Description = DescriptionAttribute.GetDescription(attributes);
                Control = gui;

                // Selector
                var selected_attribute = (from a in attributes where a is Data.SelectedAttribute select a).FirstOrDefault() as Data.SelectedAttribute;
                if (selected_attribute != null)
                {
                    var selector = sameLayer.Where(_ => _.IsSelector && _.SelectorID == selected_attribute.ID).LastOrDefault();

                    if (selector != null)
                    {
                        Selector = selector;
                        SelectorValue = selected_attribute.Value;
                    }
                }

                Label = new Label();
                Label.Width = 0;
                Label.AutoSize = true;
                Label.Text = Title;
                Label.TextAlign = ContentAlignment.MiddleCenter;
                Label.Font = new Font(Label.Font.FontFamily, 9);
                ControlDynamic = Control;

                if (Control != null && !(Control is Button))
                {
                    ControlDynamic.EnableUndo = EnableUndo;
                }
            }
 public TypeRowChangeEvent(TypeRow row, DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }
示例#5
0
        void RemoveRow(TypeRow row, bool removeControls)
        {
            if (row.Control == null) return;

            row.ControlDynamic.SetBinding(null);

            if (bindingObject != null)
            {
                var o0 = row.GetValue(bindingObject) as Data.Value.EnumBase;
                var o1 = row.GetValue(bindingObject) as Data.Value.PathForImage;
                if (o0 != null && row.IsSelector)
                {
                    o0.OnChanged -= ChangeSelector;
                }
                else if (o1 != null)
                {
                    o1.OnChanged -= ChangeSelector;
                }
            }

            if (removeControls)
            {
                this.Controls.Remove(row.Control);
                this.Controls.Remove(row.Label);
            }
        }
 public void AddTypeRow(TypeRow row) {
     this.Rows.Add(row);
 }
 public void RemoveTypeRow(TypeRow row) {
     this.Rows.Remove(row);
 }
示例#8
0
        void RegisterValue(object value)
        {
            List <TypeRow> newRows = new List <TypeRow>();

            Action <object, int> parseObject = null;

            parseObject = (objValue, indent) =>
            {
                Data.EditableValue[] editableValues = null;

                if (objValue is Data.IEditableValueCollection)
                {
                    editableValues = (objValue as Data.IEditableValueCollection).GetValues();
                }
                else
                {
                    var props = objValue.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
                    editableValues = props.Select(_ => Data.EditableValue.Create(_.GetValue(objValue), _)).ToArray();
                }

                List <TypeRow> localRows = new List <TypeRow>();

                foreach (var editableValue in editableValues)
                {
                    var propValue = editableValue.Value;
                    var prop      = editableValue;

                    TypeRow row = null;

                    if (!editableValue.IsShown)
                    {
                        continue;
                    }

                    if (objToTypeRow.ContainsKey(propValue))
                    {
                        row = objToTypeRow[propValue];
                        row.SetSelector(localRows);
                        row.SelectorIndent = indent;
                        if (row.Selector != null)
                        {
                            row.SelectorIndent++;
                        }
#if DEBUG
                        if (row.BindingValue != propValue)
                        {
                            throw new Exception();
                        }
#endif

                        if (!row.IsShown())
                        {
                            continue;
                        }
                    }
                    else
                    {
                        row = new TypeRow(prop);
                        row.SetSelector(localRows);
                        row.BindingValue   = propValue;
                        row.SelectorIndent = indent;
                        if (row.Selector != null)
                        {
                            row.SelectorIndent++;
                        }

                        if (!row.IsShown())
                        {
                            continue;
                        }

                        if (row.Control == null)
                        {
                            if (prop.Value.GetType() == typeof(Data.NodeBase))
                            {
                                continue;
                            }
                            if (prop.Value.GetType() == typeof(Data.NodeBase.ChildrenCollection))
                            {
                                continue;
                            }
                            if (prop.Value.GetType() == typeof(Data.Value.FCurve <float>))
                            {
                                continue;
                            }
                            if (prop.Value.GetType() == typeof(Data.Value.FCurve <byte>))
                            {
                                continue;
                            }

                            parseObject(propValue, row.SelectorIndent);
                            continue;
                        }
                        else
                        {
                            row.ControlDynamic.SetBinding(propValue);
                            objToTypeRow.Add(propValue, row);
                        }
                    }

                    newRows.Add(row);
                    localRows.Add(row);

                    if (propValue is Data.IEditableValueCollection)
                    {
                        parseObject(propValue, row.SelectorIndent);
                    }

                    {
                        var o0 = row.BindingValue as Data.Value.EnumBase;
                        var o1 = row.BindingValue as Data.Value.PathForImage;
                        var o2 = row.BindingValue as Data.IEditableValueCollection;
                        if (o0 != null && row.IsSelector)
                        {
                            o0.OnChanged += ChangeSelector;
                        }
                        else if (o1 != null)
                        {
                            o1.OnChanged += ChangeSelector;
                        }
                        else if (o2 != null)
                        {
                            o2.OnChanged += ChangeSelector;
                        }
                    }
                }
            };

            parseObject(value, 0);

            foreach (var row in controlRows.Internal.ToArray())
            {
                if (newRows.Contains(row))
                {
                    continue;
                }
                RemoveRow(row, true);
                objToTypeRow.Remove(row.BindingValue);
            }

            controlRows.Clear();

            foreach (var n in newRows)
            {
                controlRows.Add(n);
            }

            bindingObject = value;

            if (bindingObject is Data.IEditableValueCollection)
            {
                var o2 = bindingObject as Data.IEditableValueCollection;
                o2.OnChanged += ChangeSelector;
            }
        }
示例#9
0
            void RegisterValue(object value, int indent)
            {
                List <TypeRow> newRows = new List <TypeRow>();

                Dictionary <object, TypeRow> objToTypeRow = new Dictionary <object, TypeRow>();

                foreach (var row in controlRows.Internal)
                {
                    objToTypeRow.Add(row.BindingValue, row);
                }

                {
                    Data.EditableValue[] editableValues = null;

                    if (value is Data.IEditableValueCollection)
                    {
                        editableValues = (value as Data.IEditableValueCollection).GetValues();
                    }
                    else
                    {
                        var props = value.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).OrderBy(x => x.MetadataToken);
                        editableValues = props.Select(_ => Data.EditableValue.Create(_.GetValue(value), _)).ToArray();
                    }

                    List <TypeRow> localRows = new List <TypeRow>();

                    foreach (var editableValue in editableValues)
                    {
                        var propValue = editableValue.Value;
                        var prop      = editableValue;

                        TypeRow row = null;

                        if (!editableValue.IsShown)
                        {
                            continue;
                        }

                        if (objToTypeRow.ContainsKey(propValue))
                        {
                            row = objToTypeRow[propValue];
                            row.UpdateTitleAndDesc(prop);
                            row.SetSelector(localRows);
                            row.SelectorIndent = indent;
                            if (row.Selector != null)
                            {
                                row.SelectorIndent++;
                            }
#if DEBUG
                            if (row.BindingValue != propValue)
                            {
                                throw new Exception();
                            }
#endif

                            if (!row.IsShown())
                            {
                                continue;
                            }

                            if (row.Control == null)
                            {
                                // It is possible that children are changed even if a parent is not changed.
                                row.Children.RegisterValue(propValue, row.SelectorIndent);
                            }
                        }
                        else
                        {
                            row = new TypeRow(prop);
                            row.SetSelector(localRows);
                            row.BindingValue   = propValue;
                            row.SelectorIndent = indent;
                            if (row.Selector != null)
                            {
                                row.SelectorIndent++;
                            }

                            if (!row.IsShown())
                            {
                                continue;
                            }

                            if (row.Control == null)
                            {
                                row.Children = new TypeRowCollection();
                                row.Children.RegisterValue(propValue, row.SelectorIndent);
                            }
                            else
                            {
                                row.ControlDynamic.SetBinding(propValue);
                            }
                            objToTypeRow.Add(propValue, row);
                        }

                        newRows.Add(row);
                        localRows.Add(row);

                        if (propValue is Data.IEditableValueCollection)
                        {
                            row.Children = new TypeRowCollection();
                            row.Children.RegisterValue(propValue, row.SelectorIndent);
                        }

                        {
                            var o0 = row.BindingValue as Data.Value.EnumBase;
                            var o1 = row.BindingValue as Data.Value.PathForImage;
                            var o2 = row.BindingValue as Data.IEditableValueCollection;
                            var o3 = row.BindingValue as Data.Value.Boolean;

                            if (o0 != null && row.IsSelector)
                            {
                                o0.OnChanged += ChangeSelector;
                            }
                            else if (o1 != null)
                            {
                                o1.OnChanged += ChangeSelector;
                            }
                            else if (o2 != null)
                            {
                                o2.OnChanged += ChangeSelector;
                            }
                            else if (o3 != null)
                            {
                                o3.OnChanged += ChangeSelector;
                            }
                        }
                    }
                }

                foreach (var row in controlRows.Internal.ToArray())
                {
                    if (newRows.Contains(row))
                    {
                        continue;
                    }
                    RemoveRow(row, true);
                    objToTypeRow.Remove(row.BindingValue);
                }

                controlRows.Clear();

                foreach (var n in newRows)
                {
                    controlRows.Add(n);
                }

                bindingObject = value;

                if (bindingObject is Data.IEditableValueCollection)
                {
                    var o2 = bindingObject as Data.IEditableValueCollection;
                    o2.OnChanged += ChangeSelector;
                }
            }
示例#10
0
            /// <summary>
            /// Generate based on property
            /// </summary>
            /// <param name="properties"></param>
            public TypeRow(PropertyInfo[] properties, List <TypeRow> sameLayer, TypeRow parent)
            {
                Parent = parent;

                var p          = properties.LastOrDefault();
                var attributes = p.GetCustomAttributes(false);

                Title       = NameAttribute.GetName(attributes);
                Description = DescriptionAttribute.GetDescription(attributes);

                IParameterControl gui = null;

                var undo = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.UndoAttribute)).FirstOrDefault() as Effekseer.Data.UndoAttribute;

                if (undo != null && !undo.Undo)
                {
                    EnableUndo = false;
                }
                else
                {
                    EnableUndo = true;
                }

                var shown = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.ShownAttribute)).FirstOrDefault() as Effekseer.Data.ShownAttribute;

                if (shown != null && !shown.Shown)
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.String))
                {
                    gui = new String(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Boolean))
                {
                    gui = new Boolean(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Int))
                {
                    gui = new Int(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.IntWithInifinite))
                {
                    gui = new IntWithInifinite(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.IntWithRandom))
                {
                    gui = new IntWithRandom(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Float))
                {
                    gui = new Float(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.FloatWithRandom))
                {
                    gui = new FloatWithRandom(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Vector2D))
                {
                    gui = new Vector2D(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Vector2DWithRandom))
                {
                    gui = new Vector2DWithRandom(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Vector3D))
                {
                    gui = new Vector3D(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Vector3DWithRandom))
                {
                    gui = new Vector3DWithRandom(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Color))
                {
                    gui = new ColorCtrl(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.ColorWithRandom))
                {
                    gui = new ColorWithRandom(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.Path))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.PathForModel))
                {
                    gui = new PathForModel(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.PathForImage))
                {
                    gui = new PathForImage(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.PathForSound))
                {
                    gui = new PathForSound(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveVector2D))
                {
                    gui = new FCurveButton(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveVector3D))
                {
                    gui = new FCurveButton(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveColorRGBA))
                {
                    gui = new FCurveButton(Title);
                }
                else if (p.PropertyType == typeof(Data.Value.FCurve <float>))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurve <byte>))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.IFCurveKey))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType.IsGenericType)
                {
                    var types = p.PropertyType.GetGenericArguments();
                    gui = new Enum(Title);

                    var dgui = (dynamic)gui;
                    dgui.Initialize(types[0]);
                }

                var selector_attribute = (from a in attributes where a is Data.SelectorAttribute select a).FirstOrDefault() as Data.SelectorAttribute;

                if (selector_attribute != null)
                {
                    IsSelector = true;
                    SelectorID = selector_attribute.ID;
                }
                else
                {
                    IsSelector = false;
                    SelectorID = -1;
                }

                Properties = properties.Clone() as PropertyInfo[];
                Control    = gui;

                if (gui != null)
                {
                    gui.Description = this.Description;
                }

                // Selector
                var selected_attribute = (from a in attributes where a is Data.SelectedAttribute select a).FirstOrDefault() as Data.SelectedAttribute;

                if (selected_attribute != null)
                {
                    var selector = sameLayer.Where(_ => _.IsSelector && _.SelectorID == selected_attribute.ID).LastOrDefault();

                    if (selector != null)
                    {
                        Selector      = selector;
                        SelectorValue = selected_attribute.Value;
                    }
                }

                Label = Title;

                ControlDynamic = Control;

                if (Control != null)
                {
                    Control.EnableUndo = EnableUndo;
                }
            }
示例#11
0
        void AppendType(Type type, int selectorIndent, PropertyInfo[] props = null, TypeRow parentRow = null)
        {
            if (props == null)
            {
                props = new PropertyInfo[0];
            }

            var ps = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            List <TypeRow> sameLayer = new List <TypeRow>();

            for (int i = 0; i < ps.Length; i++)
            {
                var attributes = ps[i].GetCustomAttributes(false);

                var list_props = new List <PropertyInfo>(props);
                list_props.Add(ps[i]);

                var row = new TypeRow(list_props.ToArray(), sameLayer, parentRow);

                if (row.Control != null)
                {
                    // visible values
                    typeRows.Add(row);
                    sameLayer.Add(row);

                    if (row.Selector != null)
                    {
                        row.SelectorIndent = selectorIndent + 1;
                    }
                    else
                    {
                        row.SelectorIndent = selectorIndent;
                    }
                }
                else
                {
                    // value container

                    // protect looping
                    if (ps[i].PropertyType == typeof(Data.NodeBase))
                    {
                        continue;
                    }
                    if (ps[i].PropertyType == typeof(Data.NodeBase.ChildrenCollection))
                    {
                        continue;
                    }
                    if (ps[i].PropertyType == typeof(Data.Value.FCurve <float>))
                    {
                        continue;
                    }
                    if (ps[i].PropertyType == typeof(Data.Value.FCurve <byte>))
                    {
                        continue;
                    }

                    typeRows.Add(row);
                    sameLayer.Add(row);

                    var selectorIndentLocal = selectorIndent;
                    if (row.Selector != null)
                    {
                        selectorIndentLocal = selectorIndentLocal + 1;
                    }

                    AppendType(ps[i].PropertyType, selectorIndentLocal, list_props.ToArray(), row);
                }
            }
        }
示例#12
0
            /// <summary>
            /// プロパティから生成
            /// </summary>
            /// <param name="properties"></param>
            public TypeRow(PropertyInfo[] properties, List <TypeRow> sameLayer, TypeRow parent)
            {
                Parent = parent;

                var p          = properties.LastOrDefault();
                var attributes = p.GetCustomAttributes(false);

                Control gui = null;

                var undo = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.UndoAttribute)).FirstOrDefault() as Effekseer.Data.UndoAttribute;

                if (undo != null && !undo.Undo)
                {
                    EnableUndo = false;
                }
                else
                {
                    EnableUndo = true;
                }

                var shown = attributes.Where(_ => _.GetType() == typeof(Effekseer.Data.ShownAttribute)).FirstOrDefault() as Effekseer.Data.ShownAttribute;

                if (shown != null && !shown.Shown)
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.String))
                {
                    gui = new String();
                }
                else if (p.PropertyType == typeof(Data.Value.Boolean))
                {
                    gui = new Boolean();
                }
                else if (p.PropertyType == typeof(Data.Value.Int))
                {
                    gui = new Int();
                }
                else if (p.PropertyType == typeof(Data.Value.IntWithInifinite))
                {
                    gui = new IntWithInifinite();
                }
                else if (p.PropertyType == typeof(Data.Value.IntWithRandom))
                {
                    gui = new IntWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Float))
                {
                    gui = new Float();
                }
                else if (p.PropertyType == typeof(Data.Value.FloatWithRandom))
                {
                    gui = new FloatWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector2D))
                {
                    gui = new Vector2D();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector2DWithRandom))
                {
                    gui = new Vector2DWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector3D))
                {
                    gui = new Vector3D();
                }
                else if (p.PropertyType == typeof(Data.Value.Vector3DWithRandom))
                {
                    gui = new Vector3DWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Color))
                {
                    gui = new ColorCtrl();
                }
                else if (p.PropertyType == typeof(Data.Value.ColorWithRandom))
                {
                    gui = new ColorWithRandom();
                }
                else if (p.PropertyType == typeof(Data.Value.Path))
                {
                    gui = new Path();
                }
                else if (p.PropertyType == typeof(Data.Value.PathForImage))
                {
                    gui = new PathForImage();
                }
                else if (p.PropertyType == typeof(Data.Value.PathForSound))
                {
                    gui = new PathForSound();
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveVector3D))
                {
                    FCurveButton button = new FCurveButton();
                    gui = button;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurveColorRGBA))
                {
                    FCurveButton button = new FCurveButton();
                    gui = button;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurve <float>))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.FCurve <byte>))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.IFCurveKey))
                {
                    gui = null;
                    return;
                }
                else if (p.PropertyType == typeof(Data.Value.Enum <Language>))
                {
                    gui = new GuiLanguage();
                }
                else if (p.PropertyType.IsGenericType)
                {
                    var types        = p.PropertyType.GetGenericArguments();
                    var generic_type = typeof(Enum <>).MakeGenericType(types);
                    var constructor  = generic_type.GetConstructor(new Type[] { });
                    gui = constructor.Invoke(null) as Control;
                }

                var selector_attribute = (from a in attributes where a is Data.SelectorAttribute select a).FirstOrDefault() as Data.SelectorAttribute;

                if (selector_attribute != null)
                {
                    IsSelector = true;
                    SelectorID = selector_attribute.ID;
                }
                else
                {
                    IsSelector = false;
                    SelectorID = -1;
                }

                Properties  = properties.Clone() as PropertyInfo[];
                Title       = NameAttribute.GetName(attributes);
                Description = DescriptionAttribute.GetDescription(attributes);
                Control     = gui;

                // Selector
                var selected_attribute = (from a in attributes where a is Data.SelectedAttribute select a).FirstOrDefault() as Data.SelectedAttribute;

                if (selected_attribute != null)
                {
                    var selector = sameLayer.Where(_ => _.IsSelector && _.SelectorID == selected_attribute.ID).LastOrDefault();

                    if (selector != null)
                    {
                        Selector      = selector;
                        SelectorValue = selected_attribute.Value;
                    }
                }

                Label           = new Label();
                Label.Width     = 0;
                Label.AutoSize  = true;
                Label.Text      = Title;
                Label.TextAlign = ContentAlignment.MiddleCenter;
                Label.Font      = new Font(Label.Font.FontFamily, 9);
                ControlDynamic  = Control;

                if (Control != null && !(Control is Button))
                {
                    ControlDynamic.EnableUndo = EnableUndo;
                }
            }