示例#1
0
 public static string ShaderPopup(GUIContent label, string selected, GUIStyle style)
 {
     return(SwGui.ShaderPopup(EditorGUILayout.GetControlRect(), label, selected, style));
 }
示例#2
0
 public static string ShaderPopup(string selected, GUIStyle style)
 {
     return(SwGui.ShaderPopup(EditorGUILayout.GetControlRect(false), (GUIContent)null, selected, style));
 }
示例#3
0
 public static string ShaderPopup(string selected)
 {
     return(SwGui.ShaderPopup(EditorGUILayout.GetControlRect(false), selected, EditorStyles.popup));
 }
示例#4
0
        private void DrawPropertySpecific(Rect labelRect, Rect miscRect, Rect defaultRect, ShaderProperty element)
        {
            switch (element.PropertyType)
            {
            // Range
            case PropertyType.Range:
                var rangeProperty = (RangeProperty)element;
                EditorGUI.LabelField(labelRect, "Range");
                var labelWidth1 = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = Utils.TextWidth("Min: ");
                rangeProperty.MinValue      =
                    EditorGUI.FloatField(Utils.Pad(Utils.ShareRect(miscRect, 2, 0), Padding, Padding), "Min: ",
                                         rangeProperty.MinValue);
                EditorGUIUtility.labelWidth = Utils.TextWidth("Max: ");
                rangeProperty.MaxValue      = EditorGUI.FloatField(
                    Utils.Pad(Utils.ShareRect(miscRect, 2, 1), Padding, 0), "Max: ",
                    rangeProperty.MaxValue);
                EditorGUIUtility.labelWidth = labelWidth1;
                rangeProperty.DefaultValue  = EditorGUI.Slider(defaultRect, rangeProperty.DefaultValue,
                                                               rangeProperty.MinValue,
                                                               rangeProperty.MaxValue);
                break;

            // Color
            case PropertyType.Color:
                var colorProperty = (ColorProperty)element;
                EditorGUI.LabelField(labelRect, "Color");
                colorProperty.DefaultValue = EditorGUI.ColorField(defaultRect, colorProperty.DefaultValue);
                break;

            // Texture
            case PropertyType.Texture:
                var texProperty = (TextureProperty)element;
                EditorGUI.LabelField(labelRect, "Texture");
                labelWidth1 = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = Utils.TextWidth("Auto UV: ");
                texProperty.TexGenMode      =
                    (TexGenMode)EditorGUI.EnumPopup(miscRect, "Auto UV: ", texProperty.TexGenMode);
                EditorGUIUtility.labelWidth = labelWidth1;
                texProperty.DefaultValue    =
                    (DefaultTexture)EditorGUI.EnumPopup(defaultRect, texProperty.DefaultValue);
                break;

            // Float
            case PropertyType.Float:
                var floatProperty = (FloatProperty)element;
                EditorGUI.LabelField(labelRect, "Float");
                floatProperty.DefaultValue = EditorGUI.FloatField(defaultRect, floatProperty.DefaultValue);
                break;

            // Vector
            case PropertyType.Vector:
                var vecProperty = (VectorProperty)element;
                EditorGUI.LabelField(labelRect, "Vector");
                vecProperty.DefaultValue = SwGui.Vector4Field(defaultRect, vecProperty.DefaultValue);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }