예제 #1
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute;
        Type   itemType = dropdownAttribute.Type;
        object listObj  = ReflectionSystem.GetValue(property.serializedObject.targetObject, dropdownAttribute.ListPath);

        Debug.Log(listObj);


        var list = CastWholeList <Object>(listObj, typeof(Object));//FindList(property.serializedObject, dropdownAttribute.ListPath);

        string[] stringArray = ListToStringArray(list);
        Object   obj         = property.objectReferenceValue;

        #region Draw the list dropdown
        GUIContent dropdown = new GUIContent(property.name);

        int SelectedID    = FindSelectedID(list, obj);//Update the selectedID
        int newSelectedID = EditorGUILayout.Popup(dropdown, SelectedID, ListToStringArray(list));
        if (newSelectedID != SelectedID)
        {//changed
            SelectedID = newSelectedID;
            Object selectedObject = (Object)list[SelectedID];
            property.objectReferenceValue = selectedObject;
            //EditorUtility.SetDirty(property.serializedObject.targetObject);//repaint
            Debug.Log($"changed to {property.objectReferenceValue.name}");
        }

        #endregion
    }
예제 #2
0
 public override void OnSetAttribute()
 {
     attribute       = Attribute <DropdownAttribute>();
     bAutoAddDefault = attribute.IsAutoDefault;
     OnSetValue(attribute.Default);
     DisplayName = attribute.DisplayName;
 }
예제 #3
0
        public void DrawDirectly(SerializedProperty property, CyberAttribute atribute, GUIContent content, GUIStyle style, FieldInfo field)
        {
            DropdownAttribute atr = atribute as DropdownAttribute;



            TheEditor.DrawPropertyAsDropdownWithFixValue(property, field, content, style, atr.Values, (i) => property.SetValue(i), property.GetJustValue(),
                                                         (item, index) => atr.Names[index], true, atr.ShowAsName);
        }
        protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label)
        {
            DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute;
            object            values            = GetValues(property, dropdownAttribute.ValuesName);
            FieldInfo         fieldInfo         = ReflectionUtility.GetField(PropertyUtility.GetTargetObjectWithProperty(property), property.name);

            float propertyHeight = AreValuesValid(values, fieldInfo)
                                ? GetPropertyHeight(property)
                                : GetPropertyHeight(property) + GetHelpBoxHeight();

            return(propertyHeight);
        }
예제 #5
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            if (_attribute == null)
            {
                _attribute = (DropdownAttribute)attribute;
            }
            _attribute.Load(fieldInfo, prop);

            if (!_attribute.Valid)
            {
                return;
            }

            DrawDropdownOption(prop, position);
        }
예제 #6
0
파일: ObjectBindWF.cs 프로젝트: kbitc/oeip
 public override void OnBind()
 {
     foreach (var comp in components)
     {
         if (comp is DropdownControl)
         {
             DropdownControl   dc = comp as DropdownControl;
             DropdownAttribute da = comp.ControlAttribute as DropdownAttribute;
             if (!string.IsNullOrEmpty(da.Parent))
             {
                 var parent = GetComponent(da.Parent) as DropdownControl;
                 if (parent != null)
                 {
                     dc.parent = parent;
                 }
             }
         }
     }
 }
예제 #7
0
    void GetDropdownOptions()
    {
        DropdownAttribute dropdownAttr = (DropdownAttribute)attribute;
        Type staticType;

        if (string.IsNullOrEmpty(dropdownAttr.staticMethodType))
        {
            staticType = fieldInfo.DeclaringType;
        }
        else
        {
            staticType = fieldInfo.DeclaringType.Assembly.GetType(dropdownAttr.staticMethodType);
            if (staticType == null)
            {
                Debug.LogError("Get dropdown options type not found: " + dropdownAttr.staticMethodType);
                return;
            }
        }

        var getOptionsMethod = staticType.GetMethod(dropdownAttr.staticMethodName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);

        if (getOptionsMethod == null)
        {
            // try getting property
            getOptionsMethod = staticType.GetProperty(dropdownAttr.staticMethodName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public)?.GetMethod;
        }
        if (getOptionsMethod == null)
        {
            Debug.LogError("Get dropdown options method not found: " + dropdownAttr.staticMethodName);
            return;
        }

        var optionsEnumerable = getOptionsMethod.Invoke(null, null) as IEnumerable <string>;

        if (optionsEnumerable == null)
        {
            Debug.LogError("Get dropdown options method doesn't return an enumerable string collection");
            return;
        }
        dropdownOptions = optionsEnumerable.Select(s => new GUIContent(s)).ToArray();
    }
        protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(rect, label, property);

            DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute;
            object            target            = PropertyUtility.GetTargetObjectWithProperty(property);

            object    valuesObject  = GetValues(property, dropdownAttribute.ValuesName);
            FieldInfo dropdownField = ReflectionUtility.GetField(target, property.name);

            if (AreValuesValid(valuesObject, dropdownField))
            {
                if (valuesObject is IList && dropdownField.FieldType == GetElementType(valuesObject))
                {
                    // Selected value
                    object selectedValue = dropdownField.GetValue(target);

                    // Values and display options
                    IList    valuesList     = (IList)valuesObject;
                    object[] values         = new object[valuesList.Count];
                    string[] displayOptions = new string[valuesList.Count];

                    for (int i = 0; i < values.Length; i++)
                    {
                        object value = valuesList[i];
                        values[i]         = value;
                        displayOptions[i] = value == null ? "<null>" : value.ToString();
                    }

                    // Selected value index
                    int selectedValueIndex = Array.IndexOf(values, selectedValue);
                    if (selectedValueIndex < 0)
                    {
                        selectedValueIndex = 0;
                    }

                    NaughtyEditorGUI.Dropdown(
                        rect, property.serializedObject, target, dropdownField, label.text, selectedValueIndex, values, displayOptions);
                }
                else if (valuesObject is IDropdownList)
                {
                    // Current value
                    object selectedValue = dropdownField.GetValue(target);

                    // Current value index, values and display options
                    int           index = -1;
                    int           selectedValueIndex = -1;
                    List <object> values             = new List <object>();
                    List <string> displayOptions     = new List <string>();
                    IDropdownList dropdown           = (IDropdownList)valuesObject;

                    using (IEnumerator <KeyValuePair <string, object> > dropdownEnumerator = dropdown.GetEnumerator())
                    {
                        while (dropdownEnumerator.MoveNext())
                        {
                            index++;

                            KeyValuePair <string, object> current = dropdownEnumerator.Current;
                            if (current.Value?.Equals(selectedValue) == true)
                            {
                                selectedValueIndex = index;
                            }

                            values.Add(current.Value);

                            if (current.Key == null)
                            {
                                displayOptions.Add("<null>");
                            }
                            else if (string.IsNullOrWhiteSpace(current.Key))
                            {
                                displayOptions.Add("<empty>");
                            }
                            else
                            {
                                displayOptions.Add(current.Key);
                            }
                        }
                    }

                    if (selectedValueIndex < 0)
                    {
                        selectedValueIndex = 0;
                    }

                    NaughtyEditorGUI.Dropdown(
                        rect, property.serializedObject, target, dropdownField, label.text, selectedValueIndex, values.ToArray(), displayOptions.ToArray());
                }
            }
            else
            {
                string message = string.Format("Invalid values with name '{0}' provided to '{1}'. Either the values name is incorrect or the types of the target field and the values field/property/method don't match",
                                               dropdownAttribute.ValuesName, dropdownAttribute.GetType().Name);

                DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning);
            }

            EditorGUI.EndProperty();
        }
        public override void DrawProperty(SerializedProperty property)
        {
            EditorDrawUtility.DrawHeader(property);

            DropdownAttribute dropdownAttribute = PropertyUtility.GetAttribute <DropdownAttribute>(property);

            UnityEngine.Object target = PropertyUtility.GetTargetObject(property);

            FieldInfo fieldInfo       = ReflectionUtility.GetField(target, property.name);
            FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, dropdownAttribute.ValuesFieldName);

            if (valuesFieldInfo == null)
            {
                EditorDrawUtility.DrawHelpBox(string.Format("{0} 不能找到叫做 \"{1}\" 的值", dropdownAttribute.GetType().Name, dropdownAttribute.ValuesFieldName), MessageType.Warning, context: target, logToConsole: false);
                EditorDrawUtility.DrawPropertyField(property);
            }
            else if (valuesFieldInfo.GetValue(target) is IList &&
                     fieldInfo.FieldType == this.GetElementType(valuesFieldInfo))
            {
                // 所选的值
                object selectedValue = fieldInfo.GetValue(target);

                // 所有值和可选项
                IList    valuesList     = (IList)valuesFieldInfo.GetValue(target);
                object[] values         = new object[valuesList.Count];
                string[] displayOptions = new string[valuesList.Count];

                for (int i = 0; i < values.Length; i++)
                {
                    object value = valuesList[i];
                    values[i]         = value;
                    displayOptions[i] = value.ToString();
                }

                // 可选择值得索引
                int selectedValueIndex = Array.IndexOf(values, selectedValue);
                if (selectedValueIndex < 0)
                {
                    selectedValueIndex = 0;
                }

                // 绘制下拉栏
                this.DrawDropdown(target, fieldInfo, property.displayName, selectedValueIndex, values, displayOptions);
            }
            else if (valuesFieldInfo.GetValue(target) is IDropdownList)
            {
                // 当前值
                object selectedValue = fieldInfo.GetValue(target);

                // 当前值得索引,和所有值,显示出的选项
                IDropdownList dropdown = (IDropdownList)valuesFieldInfo.GetValue(target);
                IEnumerator <KeyValuePair <string, object> > dropdownEnumerator = dropdown.GetEnumerator();

                int           index = -1;
                int           selectedValueIndex = -1;
                List <object> values             = new List <object>();
                List <string> displayOptions     = new List <string>();

                while (dropdownEnumerator.MoveNext())
                {
                    index++;

                    KeyValuePair <string, object> current = dropdownEnumerator.Current;
                    if (current.Value.Equals(selectedValue))
                    {
                        selectedValueIndex = index;
                    }

                    values.Add(current.Value);
                    displayOptions.Add(current.Key);
                }

                if (selectedValueIndex < 0)
                {
                    selectedValueIndex = 0;
                }

                // 绘制下拉栏
                this.DrawDropdown(target, fieldInfo, property.displayName, selectedValueIndex, values.ToArray(), displayOptions.ToArray());
            }
            else
            {
                EditorDrawUtility.DrawHelpBox(typeof(DropdownAttribute).Name + " 只作用于指定字段与指定数组的元素类型相等时!!八嘎", MessageType.Warning, context: target, logToConsole: false);
                EditorDrawUtility.DrawPropertyField(property);
            }
        }
예제 #10
0
        public override void DrawProperty(SerializedProperty property)
        {
            EditorDrawUtility.DrawHeader(property);

            DropdownAttribute dropdownAttribute = PropertyUtility.GetAttribute <DropdownAttribute>(property);

            UnityEngine.Object target = PropertyUtility.GetTargetObject(property);

            FieldInfo fieldInfo       = ReflectionUtility.GetField(target, property.name);
            FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, dropdownAttribute.ValuesFieldName);

            if (valuesFieldInfo == null)
            {
                this.DrawWarningBox(string.Format("{0} cannot find a values field with name \"{1}\"", dropdownAttribute.GetType().Name, dropdownAttribute.ValuesFieldName));
                EditorGUILayout.PropertyField(property, true);
            }
            else if (valuesFieldInfo.GetValue(target) is IList &&
                     fieldInfo.FieldType == this.GetElementType(valuesFieldInfo))
            {
                // Selected value
                object selectedValue = fieldInfo.GetValue(target);

                // Values and display options
                IList    valuesList     = (IList)valuesFieldInfo.GetValue(target);
                object[] values         = new object[valuesList.Count];
                string[] displayOptions = new string[valuesList.Count];

                for (int i = 0; i < values.Length; i++)
                {
                    object value = valuesList[i];
                    values[i]         = value;
                    displayOptions[i] = value.ToString();
                }

                // Selected value index
                int selectedValueIndex = Array.IndexOf(values, selectedValue);
                if (selectedValueIndex < 0)
                {
                    selectedValueIndex = 0;
                }

                // Draw the dropdown
                this.DrawDropdown(target, fieldInfo, property.displayName, selectedValueIndex, values, displayOptions);
            }
            else if (valuesFieldInfo.GetValue(target) is IDropdownList)
            {
                // Current value
                object selectedValue = fieldInfo.GetValue(target);

                // Current value index, values and display options
                IDropdownList dropdown = (IDropdownList)valuesFieldInfo.GetValue(target);
                IEnumerator <KeyValuePair <string, object> > dropdownEnumerator = dropdown.GetEnumerator();

                int           index = -1;
                int           selectedValueIndex = -1;
                List <object> values             = new List <object>();
                List <string> displayOptions     = new List <string>();

                while (dropdownEnumerator.MoveNext())
                {
                    index++;

                    KeyValuePair <string, object> current = dropdownEnumerator.Current;
                    if (current.Value.Equals(selectedValue))
                    {
                        selectedValueIndex = index;
                    }

                    values.Add(current.Value);
                    displayOptions.Add(current.Key);
                }

                if (selectedValueIndex < 0)
                {
                    selectedValueIndex = 0;
                }

                // Draw the dropdown
                this.DrawDropdown(target, fieldInfo, property.displayName, selectedValueIndex, values.ToArray(), displayOptions.ToArray());
            }
            else
            {
                this.DrawWarningBox(typeof(DropdownAttribute).Name + " works only when the type of the field is equal to the element type of the array");
                EditorGUILayout.PropertyField(property, true);
            }
        }
예제 #11
0
        protected UIElement BuildParamater(object owner, EditableAttribute edit, PropertyInfo v, PropertyInfo template = null)
        {
            if (v == null || owner == null || edit == null)
            {
                return(null);
            }

            if (template == null)
            {
                template = v;
            }

            switch (edit.Type)
            {
            case ParameterInputType.FloatInput:
                NumberInput nfp = new NumberInput();
                nfp.Set(NumberInputType.Float, owner, v);
                return(nfp);

            case ParameterInputType.FloatSlider:
                NumberSlider nfs = new NumberSlider();
                nfs.Ticks = edit.Ticks;
                nfs.Set(edit.Min, edit.Max, v, owner);
                return(nfs);

            case ParameterInputType.IntInput:
                NumberInput nip = new NumberInput();
                nip.Set(NumberInputType.Int, owner, v);
                return(nip);

            case ParameterInputType.IntSlider:
                NumberSlider nis = new NumberSlider();
                nis.Ticks = edit.Ticks;
                nis.IsInt = true;
                nis.Set(edit.Min, edit.Max, v, owner);
                return(nis);

            case ParameterInputType.Dropdown:
                DropdownAttribute da      = template.GetCustomAttribute <DropdownAttribute>();
                object[]          dvalues = null;
                if (template.PropertyType.IsEnum)
                {
                    dvalues = Enum.GetNames(template.PropertyType);
                }
                else if (v.PropertyType.Equals(typeof(string[])))
                {
                    dvalues = (string[])v.GetValue(owner);
                }
                if (da != null && da.Values != null && da.Values.Length > 0)
                {
                    dvalues = da.Values;
                }
                if (da != null)
                {
                    return(new DropDown(dvalues, owner, v, da.OutputProperty, da.IsEditable));
                }

                return(new DropDown(dvalues, owner, v));

            case ParameterInputType.Color:
                return(new ColorSelect(v, owner));

            case ParameterInputType.Curves:
                return(new UICurves(v, owner));

            case ParameterInputType.Levels:
                Imaging.RawBitmap raw = null;
                if (owner is ImageNode)
                {
                    byte[] bits = (owner as ImageNode).GetPreview(256, 256);
                    if (bits != null)
                    {
                        raw = new Imaging.RawBitmap(256, 256, bits);
                    }
                }
                return(new UILevels(raw, owner, v));

            case ParameterInputType.Map:
                object mo = v.GetValue(owner);
                if (mo is Dictionary <string, GraphParameterValue> && owner is GraphInstanceNode)
                {
                    return(new ParameterMap((owner as GraphInstanceNode).GraphInst, mo as Dictionary <string, GraphParameterValue>));
                }
                else if (mo is List <GraphParameterValue> && owner is Node)
                {
                    return(new ParameterMap(owner as Node, mo as List <GraphParameterValue>));
                }
                else if (mo is List <GraphParameterValue> )
                {
                    return(new ParameterMap(null, mo as List <GraphParameterValue>));
                }
                return(null);

            case ParameterInputType.MapEdit:
                object meo = v.GetValue(owner);
                if (meo is Dictionary <string, GraphParameterValue> && owner is Graph && !(owner is FunctionGraph))
                {
                    return(new GraphParameterEditor(owner as Graph, meo as Dictionary <string, GraphParameterValue>));
                }
                else if (meo is List <GraphParameterValue> && owner is Graph && !(owner is FunctionGraph))
                {
                    return(new CustomParameterEditor(owner as Graph));
                }
                else if (meo is List <FunctionGraph> && owner is Graph && !(owner is FunctionGraph))
                {
                    return(new CustomFunctionEditor(owner as Graph));
                }
                else if (meo is  Dictionary <string, FunctionGraph> && !(owner is FunctionGraph))
                {
                    return(new GraphFunctionEditor(owner as Graph));
                }
                return(null);

            case ParameterInputType.MeshFile:
                return(new FileSelector(v, owner, "Mesh Files|*.fbx;*.obj"));

            case ParameterInputType.ImageFile:
                return(new FileSelector(v, owner, "Image Files|*.png;*.jpg;*.tif;*.bmp;*.jpeg"));

            case ParameterInputType.GraphFile:
                return(new FileSelector(v, owner, "Materia Graph|*.mtg"));

            case ParameterInputType.Text:
                return(new PropertyInput(v, owner, template.GetCustomAttribute <ReadOnlyAttribute>() != null));

            case ParameterInputType.MultiText:
                return(new PropertyInput(v, owner, template.GetCustomAttribute <ReadOnlyAttribute>() != null, true));

            case ParameterInputType.Toggle:
                return(new ToggleControl(edit.Name, v, owner));

            case ParameterInputType.Gradient:
                return(new GradientEditor(v, owner));

            case ParameterInputType.Float2Input:
                return(new VectorInput(v, owner, NodeType.Float2));

            case ParameterInputType.Float2Slider:
                return(new VectorSlider(v, owner, edit.Min, edit.Max, NodeType.Float2));

            case ParameterInputType.Float3Input:
                return(new VectorInput(v, owner, NodeType.Float3));

            case ParameterInputType.Float3Slider:
                return(new VectorSlider(v, owner, edit.Min, edit.Max, NodeType.Float3));

            case ParameterInputType.Float4Input:
                return(new VectorInput(v, owner, NodeType.Float4));

            case ParameterInputType.Float4Slider:
                return(new VectorSlider(v, owner, edit.Min, edit.Max, NodeType.Float4));

            case ParameterInputType.Int2Input:
                return(new VectorInput(v, owner, NodeType.Float2, NumberInputType.Int));

            case ParameterInputType.Int2Slider:
                return(new VectorSlider(v, owner, edit.Min, edit.Max, NodeType.Float2, true));

            case ParameterInputType.Int3Input:
                return(new VectorInput(v, owner, NodeType.Float3, NumberInputType.Int));

            case ParameterInputType.Int3Slider:
                return(new VectorSlider(v, owner, edit.Min, edit.Max, NodeType.Float3, true));

            case ParameterInputType.Int4Input:
                return(new VectorInput(v, owner, NodeType.Float4, NumberInputType.Int));

            case ParameterInputType.Int4Slider:
                return(new VectorSlider(v, owner, edit.Min, edit.Max, NodeType.Float4, true));
            }

            return(null);
        }
예제 #12
0
            public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
            {
                DropdownAttribute dropdown = (DropdownAttribute)attribute;

                //based on property type
                switch (property.propertyType)
                {
                case SerializedPropertyType.Integer:
                    string[] displayedOptions = dropdown.options.Select(x => x.ToString()).ToArray();

                    int match = 0;

                    for (int o = 0; o < dropdown.options.Length; o++)
                    {
                        if (property.intValue == (int)dropdown.options[o])
                        {
                            //found match in options
                            match = o;
                        }
                    }

                    property.intValue = (int)dropdown.options[EditorGUI.Popup(position, match, displayedOptions)];
                    break;

                case SerializedPropertyType.Boolean:
                    displayedOptions = dropdown.options.Select(x => x.ToString()).ToArray();

                    match = 0;

                    for (int o = 0; o < dropdown.options.Length; o++)
                    {
                        if (property.boolValue == (bool)dropdown.options[o])
                        {
                            //found match in options
                            match = o;
                        }
                    }

                    property.boolValue = (bool)dropdown.options[EditorGUI.Popup(position, match, displayedOptions)];
                    break;

                case SerializedPropertyType.Float:
                    displayedOptions = dropdown.options.Select(x => x.ToString()).ToArray();

                    match = 0;

                    for (int o = 0; o < dropdown.options.Length; o++)
                    {
                        if (property.floatValue == (float)dropdown.options[o])
                        {
                            //found match in options
                            match = o;
                        }
                    }

                    property.floatValue = (float)dropdown.options[EditorGUI.Popup(position, match, displayedOptions)];
                    break;

                case SerializedPropertyType.String:
                    displayedOptions = dropdown.options.Select(x => x.ToString()).ToArray();

                    match = 0;

                    for (int o = 0; o < dropdown.options.Length; o++)
                    {
                        if (property.stringValue == (string)dropdown.options[o])
                        {
                            //found match in options
                            match = o;
                        }
                    }

                    property.stringValue = (string)dropdown.options[EditorGUI.Popup(position, match, displayedOptions)];
                    break;

                default:
                    EditorGUI.LabelField(position, "Use Dropdown with int, bool, float or string values only.");
                    break;
                }
            }
예제 #13
0
 public DropdownEditor() : base()
 {
     _attribute = (DropdownAttribute)attribute;
 }
예제 #14
0
 public DropdownDrawer(InspectorAttribute attribute) : base(attribute)
 {
     DAttribute = attribute as DropdownAttribute;
 }
예제 #15
0
        void CreateUIElement(Type t, PropertyInfo p, string name)
        {
            DropdownAttribute             dp   = p.GetCustomAttribute <DropdownAttribute>();
            LevelEditorAttribute          le   = p.GetCustomAttribute <LevelEditorAttribute>();
            CurveEditorAttribute          ce   = p.GetCustomAttribute <CurveEditorAttribute>();
            SliderAttribute               sl   = p.GetCustomAttribute <SliderAttribute>();
            FileSelectorAttribute         fsl  = p.GetCustomAttribute <FileSelectorAttribute>();
            HidePropertyAttribute         hp   = p.GetCustomAttribute <HidePropertyAttribute>();
            ColorPickerAttribute          cp   = p.GetCustomAttribute <ColorPickerAttribute>();
            TitleAttribute                ti   = p.GetCustomAttribute <TitleAttribute>();
            TextInputAttribute            tinp = p.GetCustomAttribute <TextInputAttribute>();
            GraphParameterEditorAttribute gpe  = p.GetCustomAttribute <GraphParameterEditorAttribute>();
            ParameterMapEditorAttribute   pme  = p.GetCustomAttribute <ParameterMapEditorAttribute>();
            PromoteAttribute              pro  = p.GetCustomAttribute <PromoteAttribute>();

            //handle very special stuff
            //exposed constant parameter variable names
            if (gpe != null)
            {
                if (node is Graph)
                {
                    Graph g = node as Graph;

                    GraphParameterEditor inp = new GraphParameterEditor(g, g.Parameters);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
            }
            //for graph instance exposed parameters from underlying graph
            else if (pme != null)
            {
                if (node is GraphInstanceNode)
                {
                    GraphInstanceNode gin = node as GraphInstanceNode;
                    ParameterMap      pm  = new ParameterMap(gin.GraphInst, gin.Parameters);
                    Stack.Children.Add(pm);
                    elementLookup[name] = pm;
                }
            }

            string title = name;

            if (ti != null)
            {
                title = ti.Title;
            }

            PropertyInfo op = null;

            //we don't create an element for this one
            //as it is hidden
            if (hp != null)
            {
                return;
            }

            try
            {
                if (ce != null)
                {
                    op = node.GetType().GetProperty(ce.OutputProperty);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }

            if (t.Equals(typeof(Vector4)))
            {
                if (cp != null)
                {
                    PropertyLabel l = null;
                    if (pro != null && node is Node)
                    {
                        l = new PropertyLabel(title, node as Node, name);
                    }
                    else
                    {
                        l       = new PropertyLabel();
                        l.Title = title;
                    }

                    labels.Add(l);
                    Stack.Children.Add(l);

                    ColorSelect cs = new ColorSelect(p, node);
                    Stack.Children.Add(cs);
                    elementLookup[name] = cs;
                }
            }
            else if (t.Equals(typeof(string[])))
            {
                if (dp != null)
                {
                    PropertyLabel l = new PropertyLabel();
                    l.Title = title;
                    labels.Add(l);
                    Stack.Children.Add(l);

                    DropDown inp = new DropDown((string[])p.GetValue(node), node, p, dp.OutputProperty);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
            }
            else if (t.Equals(typeof(bool)))
            {
                PropertyLabel l = null;
                if (pro != null && node is Node)
                {
                    l = new PropertyLabel(title, node as Node, name);
                }
                else
                {
                    l       = new PropertyLabel();
                    l.Title = title;
                }

                labels.Add(l);
                Stack.Children.Add(l);

                ToggleControl tg = new ToggleControl(name, p, node);
                Stack.Children.Add(tg);
                elementLookup[name] = tg;
            }
            else if (t.Equals(typeof(string)))
            {
                if (tinp != null)
                {
                    PropertyLabel l = new PropertyLabel();
                    l.Title = title;
                    labels.Add(l);
                    Stack.Children.Add(l);

                    PropertyInput ip = new PropertyInput(p, node);
                    Stack.Children.Add(ip);
                    elementLookup[name] = ip;
                }
                else if (fsl != null)
                {
                    PropertyLabel l = new PropertyLabel();
                    l.Title = title;
                    labels.Add(l);
                    Stack.Children.Add(l);

                    FileSelector inp = new FileSelector(p, node, fsl.Filter);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
                else if (dp != null)
                {
                    PropertyLabel l = new PropertyLabel();
                    l.Title = title;
                    labels.Add(l);
                    Stack.Children.Add(l);

                    object[] names = dp.Values;
                    DropDown inp   = new DropDown(names, node, p, dp.OutputProperty);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
            }
            if (t.Equals(typeof(float)))
            {
                if (sl != null)
                {
                    PropertyLabel l = null;
                    if (pro != null && node is Node)
                    {
                        l = new PropertyLabel(title, node as Node, name);
                    }
                    else
                    {
                        l       = new PropertyLabel();
                        l.Title = title;
                    }

                    labels.Add(l);
                    Stack.Children.Add(l);

                    NumberSlider inp = new NumberSlider(sl, p, node);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
                else
                {
                    PropertyLabel l = null;
                    if (pro != null && node is Node)
                    {
                        l = new PropertyLabel(title, node as Node, name);
                    }
                    else
                    {
                        l       = new PropertyLabel();
                        l.Title = title;
                    }

                    labels.Add(l);
                    Stack.Children.Add(l);

                    NumberInput inp = new NumberInput(NumberInputType.Float, node, p);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
            }
            else if (t.Equals(typeof(int)))
            {
                if (dp != null)
                {
                    PropertyLabel l = new PropertyLabel();
                    l.Title = title;
                    labels.Add(l);
                    Stack.Children.Add(l);

                    //do a dropdown
                    object[] names = dp.Values;
                    DropDown inp   = new DropDown(names, node, p, dp.OutputProperty);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
                else if (sl != null)
                {
                    PropertyLabel l = null;
                    if (pro != null && node is Node)
                    {
                        l = new PropertyLabel(title, node as Node, name);
                    }
                    else
                    {
                        l       = new PropertyLabel();
                        l.Title = title;
                    }

                    labels.Add(l);
                    Stack.Children.Add(l);

                    NumberSlider inp = new NumberSlider(sl, p, node);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
                else
                {
                    PropertyLabel l = null;
                    if (pro != null && node is Node)
                    {
                        l = new PropertyLabel(title, node as Node, name);
                    }
                    else
                    {
                        l       = new PropertyLabel();
                        l.Title = title;
                    }

                    labels.Add(l);
                    Stack.Children.Add(l);

                    NumberInput inp = new NumberInput(NumberInputType.Int, node, p);
                    Stack.Children.Add(inp);
                    elementLookup[name] = inp;
                }
            }
            else if (t.Equals(typeof(MultiRange)))
            {
                if (le != null)
                {
                    UILevels lv = null;
                    if (node is Node)
                    {
                        Node nd = (Node)node;
                        if (nd.Inputs.Count > 0 && nd.Inputs[0].Input != null)
                        {
                            var    n      = nd.Inputs[0].Input.Node;
                            byte[] result = n.GetPreview(n.Width, n.Height);

                            RawBitmap bit = null;

                            if (result != null)
                            {
                                bit = new RawBitmap(n.Width, n.Height, result);
                            }

                            lv = new UILevels(bit, node, p);
                        }
                        else
                        {
                            lv = new UILevels(null, node, p);
                        }
                        Stack.Children.Add(lv);
                        elementLookup[name] = lv;
                    }
                }
            }
            else if (op != null && ce != null)
            {
                UICurves cv = new UICurves(p, op, node);
                Stack.Children.Add(cv);
                elementLookup[name] = cv;
            }
            else if (t.IsEnum)
            {
                PropertyLabel l = new PropertyLabel();
                l.Title = title;
                labels.Add(l);
                Stack.Children.Add(l);

                string[] names = Enum.GetNames(t);
                DropDown inp   = new DropDown(names, node, p);
                Stack.Children.Add(inp);
                elementLookup[name] = inp;
            }
        }