Skip to content

Commit a51ae66

Browse files
committed
Add possibility to preview alpha channel
1 parent 7755573 commit a51ae66

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Editor/TexturePreview.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace TexPacker
55
{
66
public class TexturePreview
77
{
8+
private int toolbarItem = 0;
9+
810
public void Draw(TexturePacker texPacker)
911
{
1012
GUILayout.Label("Preview", TexturePackerStyles.Heading);
@@ -22,11 +24,19 @@ public void Draw(TexturePacker texPacker)
2224
texPacker.ClearProperties();
2325

2426
Texture2D preview = texPacker.Create();
25-
EditorGUI.DrawPreviewTexture(alphaRect, preview);
27+
preview.alphaIsTransparency = true;
28+
29+
if(toolbarItem == 0)
30+
EditorGUI.DrawPreviewTexture(alphaRect, preview);
31+
else
32+
EditorGUI.DrawTextureAlpha(alphaRect, preview);
2633

2734
GUILayout.FlexibleSpace();
2835
GUILayout.EndHorizontal();
2936

37+
string[] toolbarItems = { "RBG", "Alpha" };
38+
toolbarItem = GUILayout.Toolbar(toolbarItem, toolbarItems);
39+
3040
GUILayout.EndVertical();
3141
}
3242
}

0 commit comments

Comments
 (0)