mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-14 11:18:47 -05:00
Add option to export images in "assetName@hash" name format
- Redesigned spriteHelper & texture2DConverter - Improved speed of texture2D preview a bit
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ZstdSharp.Port" Version="0.8.6" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="10.0.4" />
|
||||
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace AssetStudio
|
||||
public ResourceReader image_data;
|
||||
public StreamingInfo m_StreamData;
|
||||
public StreamingInfo m_DataStreamData; //Tuanjie
|
||||
[JsonIgnore]
|
||||
private ulong dataHash; //we need to store hashes because of sprites
|
||||
|
||||
public Texture2D() { }
|
||||
|
||||
@@ -179,6 +181,28 @@ namespace AssetStudio
|
||||
: new ResourceReader(reader, reader.BaseStream.Position, image_data_size);
|
||||
}
|
||||
|
||||
public ulong GetImageDataHash()
|
||||
{
|
||||
if (dataHash != 0)
|
||||
return dataHash;
|
||||
|
||||
if (image_data.Size == 0)
|
||||
return 0;
|
||||
|
||||
var buff = BigArrayPool<byte>.Shared.Rent(image_data.Size);
|
||||
try
|
||||
{
|
||||
_ = image_data.GetData(buff);
|
||||
dataHash = System.IO.Hashing.XxHash3.HashToUInt64(buff.AsSpan(0, image_data.Size));
|
||||
}
|
||||
finally
|
||||
{
|
||||
BigArrayPool<byte>.Shared.Return(buff);
|
||||
}
|
||||
|
||||
return dataHash;
|
||||
}
|
||||
|
||||
// https://docs.unity3d.com/2023.3/Documentation/Manual/class-TextureImporterOverride.html
|
||||
private int GetImageDataSize(TextureFormat textureFormat)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user