Ejemplo n.º 1
0
 public void UpdateTitleAndDesc(Data.EditableValue propInfo)
 {
     Title       = propInfo.Title;
     Description = propInfo.Description;
     Label       = Title;
 }
Ejemplo n.º 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;
                }

                gui = ParameterListComponentFactory.Generate(type);

                if (gui != null)
                {
                    // already generated
                }
                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.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))
                {
                    gui = null;
                    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.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>))
                {
                    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();

                    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;

                ControlDynamic = Control;

                if (Control != null)
                {
                    Control.EnableUndo = EnableUndo;
                }
            }