Example #1
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;
                }
            }
Example #2
0
            /// <summary>
            /// Generate based on property
            /// </summary>
            /// <param name="propInfo"></param>
            public TypeRow(Data.EditableValue propInfo)
            {
                editableValue = propInfo;

                Title       = editableValue.Title;
                Description = editableValue.Description;
                EnableUndo  = editableValue.IsUndoEnabled;
                var shown = editableValue.IsShown;

                IParameterControl gui = null;
                var type = editableValue.Value.GetType();

                if (!shown)
                {
                    gui = null;
                    return;
                }
                else if (type == typeof(Data.Value.String))
                {
                    gui = new String(Title);
                }
                else if (type == typeof(Data.Value.Boolean))
                {
                    gui = new Boolean(Title);
                }
                else if (type == typeof(Data.Value.Int))
                {
                    gui = new Int(Title);
                }
                else if (type == typeof(Data.Value.IntWithInifinite))
                {
                    gui = new IntWithInifinite(Title);
                }
                else if (type == typeof(Data.Value.IntWithRandom))
                {
                    gui = new IntWithRandom(Title);
                }
                else if (type == typeof(Data.Value.Float))
                {
                    gui = new Float(Title);
                }
                else if (type == typeof(Data.Value.FloatWithRandom))
                {
                    gui = new FloatWithRandom(Title);
                }
                else if (type == typeof(Data.Value.Vector2D))
                {
                    gui = new Vector2D(Title);
                }
                else if (type == typeof(Data.Value.Vector2DWithRandom))
                {
                    gui = new Vector2DWithRandom(Title);
                }
                else if (type == typeof(Data.Value.Vector3D))
                {
                    gui = new Vector3D(Title);
                }
                else if (type == typeof(Data.Value.Vector3DWithRandom))
                {
                    gui = new Vector3DWithRandom(Title);
                }
                else if (type == typeof(Data.Value.Vector4D))
                {
                    gui = new Vector4D(Title);
                }
                else if (type == typeof(Data.Value.Color))
                {
                    gui = new ColorCtrl(Title);
                }
                else if (type == typeof(Data.Value.ColorWithRandom))
                {
                    gui = new ColorWithRandom(Title);
                }
                else if (type == typeof(Data.Value.Path))
                {
                    gui = null;
                    return;
                }
                else if (type == typeof(Data.Value.PathForModel))
                {
                    gui = new PathForModel(Title);
                }
                else if (type == typeof(Data.Value.PathForImage))
                {
                    gui = new PathForImage(Title);
                }
                else if (type == typeof(Data.Value.PathForSound))
                {
                    gui = new PathForSound(Title);
                }
                else if (type == typeof(Data.Value.PathForMaterial))
                {
                    gui = new PathForMaterial(Title);
                }
#if __EFFEKSEER_BUILD_VERSION16__
                else if (type == typeof(Data.Value.FCurveScalar))
                {
                    gui = new FCurveButton(Title);
                }
#endif
                else if (type == typeof(Data.Value.FCurveVector2D))
                {
                    gui = new FCurveButton(Title);
                }
                else if (type == typeof(Data.Value.FCurveVector3D))
                {
                    gui = new FCurveButton(Title);
                }
                else if (type == typeof(Data.Value.FCurveColorRGBA))
                {
                    gui = new FCurveButton(Title);
                }
                else if (editableValue.Value is Data.IEditableValueCollection)
                {
                    gui = new Dummy(Title);
                }
                else if (type == typeof(Data.Value.FCurve <float>))
                {
                    gui = null;
                    return;
                }
                else if (type == typeof(Data.Value.FCurve <byte>))
                {
                    gui = null;
                    return;
                }
                else if (type == typeof(Data.Value.IFCurveKey))
                {
                    gui = null;
                    return;
                }
                else if (type.IsGenericType)
                {
                    var types = type.GetGenericArguments();
                    gui = new Enum(Title);

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

                if (editableValue.SelfSelectorID >= 0)
                {
                    IsSelector     = true;
                    SelfSelectorID = editableValue.SelfSelectorID;
                }
                else
                {
                    IsSelector     = false;
                    SelfSelectorID = -1;
                }

                Control = gui;

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

                Label = Title;

                ControlDynamic = Control;

                if (Control != null)
                {
                    Control.EnableUndo = EnableUndo;
                }
            }
Example #3
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;
                }
            }
Example #4
0
            /// <summary>
            /// Generate based on property
            /// </summary>
            /// <param name="propInfo"></param>
            public TypeRow(Data.EditableValue propInfo)
            {
                EditableValue = propInfo;

                Title       = EditableValue.Title;
                Description = EditableValue.Description;
                EnableUndo  = EditableValue.IsUndoEnabled;
                var shown = EditableValue.IsShown;

                IParameterControl gui = null;
                var type = EditableValue.Value.GetType();

                if (!shown)
                {
                    gui = null;
                    return;
                }

                gui = ParameterListComponentFactory.Generate(type);

                if (gui != null)
                {
                    // already generated
                }
                else if (type == typeof(Data.NodeBase) || type == typeof(Data.NodeBase.ChildrenCollection))
                {
                    // Ignore
                    gui = new Dummy();
                    return;
                }
                else if (type == typeof(Data.Value.String))
                {
                    gui = new String();
                }
                else if (type == typeof(Data.Value.Boolean))
                {
                    gui = new Boolean();
                }
                else if (type == typeof(Data.Value.Int))
                {
                    gui = new Int();
                }
                else if (type == typeof(Data.Value.Int2))
                {
                    gui = new Int2();
                }
                else if (type == typeof(Data.Value.IntWithInifinite))
                {
                    gui = new IntWithInifinite();
                }
                else if (type == typeof(Data.Value.IntWithRandom))
                {
                    gui = new IntWithRandom();
                }
                else if (type == typeof(Data.Value.Float))
                {
                    gui = new Float();
                }
                else if (type == typeof(Data.Value.FloatWithRandom))
                {
                    gui = new FloatWithRandom();
                }
                else if (type == typeof(Data.Value.Vector2D))
                {
                    gui = new Vector2D();
                }
                else if (type == typeof(Data.Value.Vector2DWithRandom))
                {
                    gui = new Vector2DWithRandom();
                }
                else if (type == typeof(Data.Value.Vector3D))
                {
                    gui = new Vector3D();
                }
                else if (type == typeof(Data.Value.Vector3DWithRandom))
                {
                    gui = new Vector3DWithRandom();
                }
                else if (type == typeof(Data.Value.Vector4D))
                {
                    gui = new Vector4D();
                }
                else if (type == typeof(Data.Value.Color))
                {
                    gui = new ColorCtrl();
                }
                else if (type == typeof(Data.Value.ColorWithRandom))
                {
                    gui = new ColorWithRandom();
                }
                else if (type == typeof(Data.Value.Path))
                {
                    // Ignore
                    gui = new Dummy();
                    return;
                }
                else if (type == typeof(Data.Value.PathForModel))
                {
                    gui = new PathForModel();
                }
                else if (type == typeof(Data.Value.PathForImage))
                {
                    gui = new PathForImage();
                }
                else if (type == typeof(Data.Value.PathForSound))
                {
                    gui = new PathForSound();
                }
                else if (type == typeof(Data.Value.PathForMaterial))
                {
                    gui = new PathForMaterial();
                }
                else if (type == typeof(Data.Value.PathForCurve))
                {
                    gui = new PathForCurve();
                }
                else if (type == typeof(Data.Value.FCurveScalar))
                {
                    gui = new FCurveButton();
                }
                else if (type == typeof(Data.Value.FCurveVector2D))
                {
                    gui = new FCurveButton();
                }
                else if (type == typeof(Data.Value.FCurveVector3D))
                {
                    gui = new FCurveButton();
                }
                else if (type == typeof(Data.Value.FCurveColorRGBA))
                {
                    gui = new FCurveButton();
                }
                else if (EditableValue.Value is Data.IEditableValueCollection)
                {
                    gui = new Dummy();
                }
                else if (type == typeof(Data.Value.FCurve <float>) || type == typeof(Data.Value.FCurve <byte>) || type == typeof(Data.Value.IFCurveKey))
                {
                    // Ignore
                    gui = new Dummy();
                    return;
                }
                else if (type.IsGenericType)
                {
                    var types = type.GetGenericArguments();
                    gui = new Enum();

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

                if (EditableValue.SelfSelectorID >= 0)
                {
                    IsSelector     = true;
                    SelfSelectorID = EditableValue.SelfSelectorID;
                }
                else
                {
                    IsSelector     = false;
                    SelfSelectorID = -1;
                }

                Control = gui;

                Label = Title;

                TreeNodeID   = propInfo.TreeNodeID;
                TreeNodeType = propInfo.TreeNodeType;

                ControlDynamic = Control;

                if (Control != null)
                {
                    Control.EnableUndo = EnableUndo;
                }
            }
Example #5
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;
                }
            }