Add support for sprites with alpha mask

- Sprites with alpha mask can now be viewed and exported with transparency
- Added hotkeys to control display of an alpha mask  on the preview tab
- Added an option to the export settings to enable/disable export with alpha mask as well
- Prevented texture2D preview options from being changed with hotkeys outside of texture preview (e.g. when some other asset is selected)
This commit is contained in:
VaDiM
2022-11-21 01:52:40 +03:00
parent 7fa5b4f355
commit ea09a8de64
9 changed files with 208 additions and 104 deletions

View File

@ -231,9 +231,10 @@ namespace AssetStudioGUI
public static bool ExportSprite(AssetItem item, string exportPath)
{
var type = Properties.Settings.Default.convertType;
var alphaMask = Properties.Settings.Default.exportSpriteWithMask ? SpriteMaskMode.On : SpriteMaskMode.Off;
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
return false;
var image = ((Sprite)item.Asset).GetImage();
var image = ((Sprite)item.Asset).GetImage(alphaMask);
if (image != null)
{
using (image)