Example #1
0
 public void Draw(Rect rect, bool selected, AssetIconsCompiledStyle style)
 {
     if (wrappedDrawer != null)
     {
         wrappedDrawer.Draw(rect, selected, style);
     }
 }
Example #2
0
            public void Draw(Rect rect, bool selected, AssetIconsCompiledStyle style)
            {
                var drawRect = AssetIconsGUIUtility.AreaToIconRect(rect, style.MaxSize);

                if (currentValue != null && currentValue.box != null)
                {
                    currentValue.box.Draw(rect, text, 0, selected);
                }
            }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            if (previewGraphicStyle == null)
            {
                previewGraphicStyle = new AssetIconsCompiledStyle(new AssetIconsStyle()
                {
                    MaxSize = 64
                });

                smallLabelRect = new GUIStyle(EditorStyles.centeredGreyMiniLabel)
                {
                    alignment = TextAnchor.MiddleCenter
                };
            }

            var sliderRect        = new Rect(position.x, position.y + 6, position.width, EditorGUIUtility.singleLineHeight);
            var labelRect         = EditorGUI.PrefixLabel(sliderRect, spaceContent);
            var previewBackground = new Rect(labelRect.xMin, sliderRect.yMax + 4,
                                             labelRect.width, position.yMax - 12 - sliderRect.yMax);

            var previewArea = new Rect(
                previewBackground.x + 8, previewBackground.y + 8,
                previewBackground.width - 16, previewBackground.height - 10);

            var normalRect   = new Rect(previewArea.x, previewArea.y, (previewArea.width * 0.5f) - 3.0f, previewArea.height - 18.0f);
            var selectedRect = new Rect(normalRect.xMax + 6.0f, previewArea.y, normalRect.width, previewArea.height - 18.0f);

            var normalLabelRect   = new Rect(normalRect.x, normalRect.yMax + 2.0f, normalRect.width, 14.0f);
            var selectedLabelRect = new Rect(selectedRect.x, selectedRect.yMax + 2.0f, selectedRect.width, 14.0f);

            var tintStrengthProperty = property.FindPropertyRelative("tintStrength");

            tintStrengthProperty.floatValue = EditorGUI.Slider(sliderRect, label,
                                                               tintStrengthProperty.floatValue, 0.0f, 1.0f);

            if (Event.current.type == EventType.Repaint)
            {
                EditorGUI.HelpBox(previewBackground, " ", MessageType.None);

                AssetIconsGUI.DrawSprite(normalRect, AssetIconsResources.CurrentTheme.SampleImage, previewGraphicStyle, false);
                AssetIconsGUI.DrawSprite(selectedRect, AssetIconsResources.CurrentTheme.SampleImage, previewGraphicStyle, true);
            }

            EditorGUI.LabelField(normalLabelRect, normalContent, smallLabelRect);
            EditorGUI.LabelField(selectedLabelRect, selectedContent, smallLabelRect);

            EditorGUI.EndProperty();
        }
            public void Draw(Rect rect, bool selected, AssetIconsCompiledStyle style)
            {
                var drawRect = AssetIconsGUIUtility.AreaToIconRect(rect, style.MaxSize);

                if (currentValue != null)
                {
                    var col = AssetIconsGUI.BackgroundColor;
                    col = new Color(col.r, col.g, col.b, 0);

                    var setup = new AssetIconsCameraSetup()
                    {
                        BackgroundColor       = col,
                        TransparentBackground = true,
                        Orthographic          = style.Projection == IconProjection.Orthographic,

                        PreviewDirection = new Vector3(-1.0f, -1.0f, -1.0f)
                    };

                    var thumbnail = AssetIconsRenderCache.GetTexture(setup, currentValue);

                    AssetIconsGUI.DrawTexture(rect, thumbnail, style, selected);
                }
            }
            public void Draw(Rect rect, bool selected, AssetIconsCompiledStyle style)
            {
                var drawRect = AssetIconsGUIUtility.AreaToIconRect(rect, style.MaxSize);

                AssetIconsGUI.DrawColor(drawRect, color, style, selected);
            }
 public FieldGraphicSource(AssetIconsCompiledStyle style, FieldInfo field)
     : base(style)
 {
     this.field = field;
 }
 /// <summary>
 /// <para>Constructs a new instance of the <see cref="MethodGraphicProvider"/>.</para>
 /// </summary>
 /// <param name="style">A style to use to draw graphics provided by this <see cref="GraphicSource"/>.</param>
 /// <param name="method">A method that's invoked to provide the graphic.</param>
 public MethodGraphicProvider(AssetIconsCompiledStyle style, MethodInfo method)
     : base(style)
 {
     this.method = method;
 }
            public void Draw(Rect rect, bool selected, AssetIconsCompiledStyle style)
            {
                var drawRect = AssetIconsGUIUtility.AreaToIconRect(rect, style.MaxSize);

                AssetIconsGUI.DrawTexture(drawRect, currentValue, style, selected);
            }
Example #9
0
 public GraphicSource(AssetIconsCompiledStyle style)
 {
     this.style = style;
 }