mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
Minor fixes
This commit is contained in:
parent
94c8b355fe
commit
cf67815d53
@ -25,11 +25,12 @@ namespace AssetStudioCLI
|
|||||||
{
|
{
|
||||||
logOutput = CLIOptions.o_logOutput.Value;
|
logOutput = CLIOptions.o_logOutput.Value;
|
||||||
logMinLevel = CLIOptions.o_logLevel.Value;
|
logMinLevel = CLIOptions.o_logLevel.Value;
|
||||||
LogName = $"AssetStudioCLI_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.log";
|
var appAssembly = typeof(Program).Assembly.GetName();
|
||||||
|
LogName = $"{appAssembly.Name}_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.log";
|
||||||
LogPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, LogName);
|
LogPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, LogName);
|
||||||
|
var arch = Environment.Is64BitProcess ? "x64" : "x32";
|
||||||
|
|
||||||
var ver = typeof(Program).Assembly.GetName().Version;
|
LogToFile(LoggerEvent.Verbose, $"---{appAssembly.Name} v{appAssembly.Version} [{arch}] | Logger launched---\n" +
|
||||||
LogToFile(LoggerEvent.Verbose, $"---AssetStudioCLI v{ver} | Logger launched---\n" +
|
|
||||||
$"CMD Args: {string.Join(" ", CLIOptions.cliArgs)}");
|
$"CMD Args: {string.Join(" ", CLIOptions.cliArgs)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,30 @@ namespace AssetStudioCLI
|
|||||||
var type = CLIOptions.o_imageFormat.Value;
|
var type = CLIOptions.o_imageFormat.Value;
|
||||||
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
|
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (CLIOptions.o_logLevel.Value <= LoggerEvent.Debug)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine($"Converting \"{m_Texture2D.m_Name}\" to {type}..");
|
||||||
|
sb.AppendLine($"Width: {m_Texture2D.m_Width}");
|
||||||
|
sb.AppendLine($"Height: {m_Texture2D.m_Height}");
|
||||||
|
sb.AppendLine($"Format: {m_Texture2D.m_TextureFormat}");
|
||||||
|
switch (m_Texture2D.m_TextureSettings.m_FilterMode)
|
||||||
|
{
|
||||||
|
case 0: sb.AppendLine("Filter Mode: Point "); break;
|
||||||
|
case 1: sb.AppendLine("Filter Mode: Bilinear "); break;
|
||||||
|
case 2: sb.AppendLine("Filter Mode: Trilinear "); break;
|
||||||
|
}
|
||||||
|
sb.AppendLine($"Anisotropic level: {m_Texture2D.m_TextureSettings.m_Aniso}");
|
||||||
|
sb.AppendLine($"Mip map bias: {m_Texture2D.m_TextureSettings.m_MipBias}");
|
||||||
|
switch (m_Texture2D.m_TextureSettings.m_WrapMode)
|
||||||
|
{
|
||||||
|
case 0: sb.AppendLine($"Wrap mode: Repeat"); break;
|
||||||
|
case 1: sb.AppendLine($"Wrap mode: Clamp"); break;
|
||||||
|
}
|
||||||
|
Logger.Debug(sb.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
var image = m_Texture2D.ConvertToImage(flip: true);
|
var image = m_Texture2D.ConvertToImage(flip: true);
|
||||||
if (image == null)
|
if (image == null)
|
||||||
{
|
{
|
||||||
@ -29,7 +53,7 @@ namespace AssetStudioCLI
|
|||||||
{
|
{
|
||||||
image.WriteToStream(file, type);
|
image.WriteToStream(file, type);
|
||||||
}
|
}
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +62,7 @@ namespace AssetStudioCLI
|
|||||||
if (!TryExportFile(exportPath, item, ".tex", out var exportFullPath))
|
if (!TryExportFile(exportPath, item, ".tex", out var exportFullPath))
|
||||||
return false;
|
return false;
|
||||||
File.WriteAllBytes(exportFullPath, m_Texture2D.image_data.GetData());
|
File.WriteAllBytes(exportFullPath, m_Texture2D.image_data.GetData());
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,6 +83,8 @@ namespace AssetStudioCLI
|
|||||||
if (!TryExportFile(exportPath, item, ".wav", out exportFullPath))
|
if (!TryExportFile(exportPath, item, ".wav", out exportFullPath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (CLIOptions.o_logLevel.Value <= LoggerEvent.Debug)
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine($"Converting \"{m_AudioClip.m_Name}\" to wav..");
|
sb.AppendLine($"Converting \"{m_AudioClip.m_Name}\" to wav..");
|
||||||
sb.AppendLine(m_AudioClip.version[0] < 5 ? $"AudioClip type: {m_AudioClip.m_Type}" : $"AudioClip compression format: {m_AudioClip.m_CompressionFormat}");
|
sb.AppendLine(m_AudioClip.version[0] < 5 ? $"AudioClip type: {m_AudioClip.m_Type}" : $"AudioClip compression format: {m_AudioClip.m_CompressionFormat}");
|
||||||
@ -66,6 +92,7 @@ namespace AssetStudioCLI
|
|||||||
sb.AppendLine($"AudioClip sample rate: {m_AudioClip.m_Frequency}");
|
sb.AppendLine($"AudioClip sample rate: {m_AudioClip.m_Frequency}");
|
||||||
sb.AppendLine($"AudioClip bit depth: {m_AudioClip.m_BitsPerSample}");
|
sb.AppendLine($"AudioClip bit depth: {m_AudioClip.m_BitsPerSample}");
|
||||||
Logger.Debug(sb.ToString());
|
Logger.Debug(sb.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
var buffer = converter.ConvertToWav(m_AudioData);
|
var buffer = converter.ConvertToWav(m_AudioData);
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
@ -82,7 +109,7 @@ namespace AssetStudioCLI
|
|||||||
File.WriteAllBytes(exportFullPath, m_AudioData);
|
File.WriteAllBytes(exportFullPath, m_AudioData);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,16 +121,19 @@ namespace AssetStudioCLI
|
|||||||
if (!TryExportFile(exportPath, item, Path.GetExtension(m_VideoClip.m_OriginalPath), out var exportFullPath))
|
if (!TryExportFile(exportPath, item, Path.GetExtension(m_VideoClip.m_OriginalPath), out var exportFullPath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (CLIOptions.o_logLevel.Value <= LoggerEvent.Debug)
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine($"VideoClip format: {m_VideoClip.m_Format}");
|
sb.AppendLine($"VideoClip format: {m_VideoClip.m_Format}");
|
||||||
sb.AppendLine($"VideoClip width: {m_VideoClip.Width}");
|
sb.AppendLine($"VideoClip width: {m_VideoClip.Width}");
|
||||||
sb.AppendLine($"VideoClip height: {m_VideoClip.Height}");
|
sb.AppendLine($"VideoClip height: {m_VideoClip.Height}");
|
||||||
sb.AppendLine($"VideoClip frame rate: {m_VideoClip.m_FrameRate}");
|
sb.AppendLine($"VideoClip frame rate: {m_VideoClip.m_FrameRate:.0##}");
|
||||||
sb.AppendLine($"VideoClip split alpha: {m_VideoClip.m_HasSplitAlpha}");
|
sb.AppendLine($"VideoClip split alpha: {m_VideoClip.m_HasSplitAlpha}");
|
||||||
Logger.Debug(sb.ToString());
|
Logger.Debug(sb.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
m_VideoClip.m_VideoData.WriteData(exportFullPath);
|
m_VideoClip.m_VideoData.WriteData(exportFullPath);
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -116,7 +146,7 @@ namespace AssetStudioCLI
|
|||||||
return false;
|
return false;
|
||||||
File.WriteAllBytes(exportFullPath, m_MovieTexture.m_MovieData);
|
File.WriteAllBytes(exportFullPath, m_MovieTexture.m_MovieData);
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +158,7 @@ namespace AssetStudioCLI
|
|||||||
var str = m_Shader.Convert();
|
var str = m_Shader.Convert();
|
||||||
File.WriteAllText(exportFullPath, str);
|
File.WriteAllText(exportFullPath, str);
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +186,7 @@ namespace AssetStudioCLI
|
|||||||
return false;
|
return false;
|
||||||
File.WriteAllBytes(exportFullPath, m_TextAsset.m_Script);
|
File.WriteAllBytes(exportFullPath, m_TextAsset.m_Script);
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +206,7 @@ namespace AssetStudioCLI
|
|||||||
var str = JsonConvert.SerializeObject(type, Formatting.Indented);
|
var str = JsonConvert.SerializeObject(type, Formatting.Indented);
|
||||||
File.WriteAllText(exportFullPath, str);
|
File.WriteAllText(exportFullPath, str);
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -196,7 +226,7 @@ namespace AssetStudioCLI
|
|||||||
return false;
|
return false;
|
||||||
File.WriteAllBytes(exportFullPath, m_Font.m_FontData);
|
File.WriteAllBytes(exportFullPath, m_Font.m_FontData);
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -217,7 +247,7 @@ namespace AssetStudioCLI
|
|||||||
{
|
{
|
||||||
image.WriteToStream(file, type);
|
image.WriteToStream(file, type);
|
||||||
}
|
}
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +260,7 @@ namespace AssetStudioCLI
|
|||||||
return false;
|
return false;
|
||||||
File.WriteAllBytes(exportFullPath, item.Asset.GetRawData());
|
File.WriteAllBytes(exportFullPath, item.Asset.GetRawData());
|
||||||
|
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +277,7 @@ namespace AssetStudioCLI
|
|||||||
if (str != null)
|
if (str != null)
|
||||||
{
|
{
|
||||||
File.WriteAllText(exportFullPath, str);
|
File.WriteAllText(exportFullPath, str);
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" saved to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" saved to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -365,7 +395,7 @@ namespace AssetStudioCLI
|
|||||||
|
|
||||||
sb.Replace("NaN", "0");
|
sb.Replace("NaN", "0");
|
||||||
File.WriteAllText(exportFullPath, sb.ToString());
|
File.WriteAllText(exportFullPath, sb.ToString());
|
||||||
Logger.Debug($"{item.TypeString}: \"{item.Text}\" exported to \"{exportFullPath}\"");
|
Logger.Debug($"{item.TypeString} \"{item.Text}\" exported to \"{exportFullPath}\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,7 +761,8 @@ namespace AssetStudioCLI.Options
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine($"# {appAssembly.Name}\n# Based on AssetStudioMod v{appAssembly.Version}\n");
|
var arch = Environment.Is64BitProcess ? "x64" : "x32";
|
||||||
|
Console.WriteLine($"# {appAssembly.Name} [{arch}]\n# Based on AssetStudioMod v{appAssembly.Version}\n");
|
||||||
Console.WriteLine($"{usage}\n\n{helpMessage}");
|
Console.WriteLine($"{usage}\n\n{helpMessage}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection.Emit;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AssetStudioGUI
|
namespace AssetStudioGUI
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using AssetStudio;
|
using AssetStudio;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics.OpenGL;
|
using OpenTK.Graphics.OpenGL;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -21,6 +20,7 @@ using static AssetStudioGUI.Studio;
|
|||||||
using Font = AssetStudio.Font;
|
using Font = AssetStudio.Font;
|
||||||
using Microsoft.WindowsAPICodePack.Taskbar;
|
using Microsoft.WindowsAPICodePack.Taskbar;
|
||||||
#if NET472
|
#if NET472
|
||||||
|
using OpenTK;
|
||||||
using Vector3 = OpenTK.Vector3;
|
using Vector3 = OpenTK.Vector3;
|
||||||
using Vector4 = OpenTK.Vector4;
|
using Vector4 = OpenTK.Vector4;
|
||||||
#else
|
#else
|
||||||
@ -785,42 +785,42 @@ namespace AssetStudioGUI
|
|||||||
return;
|
return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (assetItem.Asset)
|
switch (assetItem.Type)
|
||||||
{
|
{
|
||||||
case Texture2D m_Texture2D:
|
case ClassIDType.Texture2D:
|
||||||
PreviewTexture2D(assetItem, m_Texture2D);
|
PreviewTexture2D(assetItem, assetItem.Asset as Texture2D);
|
||||||
break;
|
break;
|
||||||
case AudioClip m_AudioClip:
|
case ClassIDType.AudioClip:
|
||||||
PreviewAudioClip(assetItem, m_AudioClip);
|
PreviewAudioClip(assetItem, assetItem.Asset as AudioClip);
|
||||||
break;
|
break;
|
||||||
case Shader m_Shader:
|
case ClassIDType.Shader:
|
||||||
PreviewShader(m_Shader);
|
PreviewShader(assetItem.Asset as Shader);
|
||||||
break;
|
break;
|
||||||
case TextAsset m_TextAsset:
|
case ClassIDType.TextAsset:
|
||||||
PreviewTextAsset(m_TextAsset);
|
PreviewTextAsset(assetItem.Asset as TextAsset);
|
||||||
break;
|
break;
|
||||||
case MonoBehaviour m_MonoBehaviour:
|
case ClassIDType.MonoBehaviour:
|
||||||
PreviewMonoBehaviour(m_MonoBehaviour);
|
PreviewMonoBehaviour(assetItem.Asset as MonoBehaviour);
|
||||||
break;
|
break;
|
||||||
case Font m_Font:
|
case ClassIDType.Font:
|
||||||
PreviewFont(m_Font);
|
PreviewFont(assetItem.Asset as Font);
|
||||||
break;
|
break;
|
||||||
case Mesh m_Mesh:
|
case ClassIDType.Mesh:
|
||||||
PreviewMesh(m_Mesh);
|
PreviewMesh(assetItem.Asset as Mesh);
|
||||||
break;
|
break;
|
||||||
case VideoClip m_VideoClip:
|
case ClassIDType.VideoClip:
|
||||||
PreviewVideoClip(assetItem, m_VideoClip);
|
PreviewVideoClip(assetItem, assetItem.Asset as VideoClip);
|
||||||
break;
|
break;
|
||||||
case MovieTexture _:
|
case ClassIDType.MovieTexture:
|
||||||
StatusStripUpdate("Only supported export.");
|
StatusStripUpdate("Only supported export.");
|
||||||
break;
|
break;
|
||||||
case Sprite m_Sprite:
|
case ClassIDType.Sprite:
|
||||||
PreviewSprite(assetItem, m_Sprite);
|
PreviewSprite(assetItem, assetItem.Asset as Sprite);
|
||||||
break;
|
break;
|
||||||
case Animator _:
|
case ClassIDType.Animator:
|
||||||
StatusStripUpdate("Can be exported to FBX file.");
|
StatusStripUpdate("Can be exported to FBX file.");
|
||||||
break;
|
break;
|
||||||
case AnimationClip _:
|
case ClassIDType.AnimationClip:
|
||||||
StatusStripUpdate("Can be exported with Animator or Objects");
|
StatusStripUpdate("Can be exported with Animator or Objects");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1029,7 +1029,7 @@ namespace AssetStudioGUI
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine($"Width: {m_VideoClip.Width}");
|
sb.AppendLine($"Width: {m_VideoClip.Width}");
|
||||||
sb.AppendLine($"Height: {m_VideoClip.Height}");
|
sb.AppendLine($"Height: {m_VideoClip.Height}");
|
||||||
sb.AppendLine($"Frame rate: {m_VideoClip.m_FrameRate}");
|
sb.AppendLine($"Frame rate: {m_VideoClip.m_FrameRate:.0##}");
|
||||||
sb.AppendLine($"Split alpha: {m_VideoClip.m_HasSplitAlpha}");
|
sb.AppendLine($"Split alpha: {m_VideoClip.m_HasSplitAlpha}");
|
||||||
assetItem.InfoText = sb.ToString();
|
assetItem.InfoText = sb.ToString();
|
||||||
|
|
||||||
|
@ -34,7 +34,11 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
if (m_Sprite.m_RD.texture.TryGet(out var m_Texture2D) && m_Sprite.m_RD.alphaTexture.TryGet(out var m_AlphaTexture2D) && spriteMaskMode != SpriteMaskMode.Off)
|
if (m_Sprite.m_RD.texture.TryGet(out var m_Texture2D) && m_Sprite.m_RD.alphaTexture.TryGet(out var m_AlphaTexture2D) && spriteMaskMode != SpriteMaskMode.Off)
|
||||||
{
|
{
|
||||||
var tex = CutImage(m_Sprite, m_Texture2D, m_Sprite.m_RD.textureRect, m_Sprite.m_RD.textureRectOffset, m_Sprite.m_RD.downscaleMultiplier, m_Sprite.m_RD.settingsRaw);
|
Image<Bgra32> tex = null;
|
||||||
|
if (spriteMaskMode != SpriteMaskMode.MaskOnly)
|
||||||
|
{
|
||||||
|
tex = CutImage(m_Sprite, m_Texture2D, m_Sprite.m_RD.textureRect, m_Sprite.m_RD.textureRectOffset, m_Sprite.m_RD.downscaleMultiplier, m_Sprite.m_RD.settingsRaw);
|
||||||
|
}
|
||||||
var alphaTex = CutImage(m_Sprite, m_AlphaTexture2D, m_Sprite.m_RD.textureRect, m_Sprite.m_RD.textureRectOffset, m_Sprite.m_RD.downscaleMultiplier, m_Sprite.m_RD.settingsRaw);
|
var alphaTex = CutImage(m_Sprite, m_AlphaTexture2D, m_Sprite.m_RD.textureRect, m_Sprite.m_RD.textureRectOffset, m_Sprite.m_RD.downscaleMultiplier, m_Sprite.m_RD.settingsRaw);
|
||||||
|
|
||||||
switch (spriteMaskMode)
|
switch (spriteMaskMode)
|
||||||
@ -46,7 +50,6 @@ namespace AssetStudio
|
|||||||
tex.ApplyRGBMask(alphaTex);
|
tex.ApplyRGBMask(alphaTex);
|
||||||
return tex;
|
return tex;
|
||||||
case SpriteMaskMode.MaskOnly:
|
case SpriteMaskMode.MaskOnly:
|
||||||
tex.Dispose();
|
|
||||||
return alphaTex;
|
return alphaTex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,8 +91,6 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var originalImage = m_Texture2D.ConvertToImage(false);
|
var originalImage = m_Texture2D.ConvertToImage(false);
|
||||||
if (originalImage != null)
|
if (originalImage != null)
|
||||||
{
|
|
||||||
using (originalImage)
|
|
||||||
{
|
{
|
||||||
if (downscaleMultiplier > 0f && downscaleMultiplier != 1f)
|
if (downscaleMultiplier > 0f && downscaleMultiplier != 1f)
|
||||||
{
|
{
|
||||||
@ -105,6 +106,7 @@ namespace AssetStudio
|
|||||||
rectBottom = Math.Min(rectBottom, originalImage.Height);
|
rectBottom = Math.Min(rectBottom, originalImage.Height);
|
||||||
var rect = new Rectangle(rectX, rectY, rectRight - rectX, rectBottom - rectY);
|
var rect = new Rectangle(rectX, rectY, rectRight - rectX, rectBottom - rectY);
|
||||||
var spriteImage = originalImage.Clone(x => x.Crop(rect));
|
var spriteImage = originalImage.Clone(x => x.Crop(rect));
|
||||||
|
originalImage.Dispose();
|
||||||
if (settingsRaw.packed == 1)
|
if (settingsRaw.packed == 1)
|
||||||
{
|
{
|
||||||
//RotateAndFlip
|
//RotateAndFlip
|
||||||
@ -175,7 +177,6 @@ namespace AssetStudio
|
|||||||
spriteImage.Mutate(x => x.Flip(FlipMode.Vertical));
|
spriteImage.Mutate(x => x.Flip(FlipMode.Vertical));
|
||||||
return spriteImage;
|
return spriteImage;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user