private static void DrawObjectFieldLargeThumb(Rect position, int id, Object obj, GUIContent content)
{
GUIStyle thumbStyle = EditorStyles.objectFieldThumb;
thumbStyle.Draw(position, GUIContent.none, id, DragAndDrop.activeControlID == id, position.Contains(Event.current.mousePosition));
if (obj != null && !showMixedValue)
{
bool isCubemap = obj is Cubemap;
bool isSprite = obj is Sprite;
Rect thumbRect = thumbStyle.padding.Remove(position);
if (isCubemap || isSprite)
{
Texture2D t2d = AssetPreview.GetAssetPreview(obj);
if (t2d != null)
{
if (isSprite || t2d.alphaIsTransparency)
{
DrawTextureTransparent(thumbRect, t2d);
}
else
{
DrawPreviewTexture(thumbRect, t2d);
}
}
else
{
// Preview not loaded -> Draw icon
thumbRect.x += (thumbRect.width - content.image.width) / 2f;
thumbRect.y += (thumbRect.height - content.image.width) / 2f;
GUIStyle.none.Draw(thumbRect, content.image, false, false, false, false);
// Keep repaint until the object field has a proper preview
HandleUtility.Repaint();
}
}
else
{
// Draw texture
Texture2D t2d = content.image as Texture2D;
if (t2d != null && t2d.alphaIsTransparency)
{
DrawTextureTransparent(thumbRect, t2d);
}
else
{
DrawPreviewTexture(thumbRect, content.image);
}
}
}
else
{
GUIStyle s2 = thumbStyle.name + "Overlay";
BeginHandleMixedValueContentColor();
s2.Draw(position, content, id);
EndHandleMixedValueContentColor();
}
GUIStyle s3 = thumbStyle.name + "Overlay2";
s3.Draw(position, s_Select, id);
}