15 Commits

Author SHA1 Message Date
VaDiM
eab789939d listSearh fix 2020-08-01 21:14:42 +03:00
VaDiM
04266251aa add "Dump with PathID as filename" feature 2020-07-27 23:22:53 +03:00
VaDiM
c5f7ef6e91 add some features
- Export tex2D/sprites with PathID as a filename
- Dump selected assets from the context menu strip
- Drag&Drop support by Jayatubi
- Sort by PathID by Tahvohck
2020-07-26 23:40:19 +03:00
Perfare
4a81c461e8 Modify Sprite processing function as an extension function 2020-04-10 18:57:04 +08:00
Perfare
b10d03d50d fixed bug 2020-04-10 18:51:43 +08:00
Perfare
da98a0c5b8 fixed bug 2020-04-10 18:20:45 +08:00
Perfare
76d17bacf5 improve type read 2020-04-10 18:11:56 +08:00
Perfare
6678ce082b refactor BundleFile read 2020-04-07 16:13:04 +08:00
Perfare
07074b3deb improve SerializedFile read 2020-04-07 08:59:04 +08:00
Perfare
df5d9f90d4 Add copy function to assetListView 2020-04-07 08:55:51 +08:00
Perfare
4f2d30552a set UV1 to NormalMap channel 2020-04-07 08:23:13 +08:00
Perfare
d259c7a5cd multiple uv export 2020-04-06 19:29:15 +08:00
Perfare
c71ceb7ea6 improve SerializedType read 2020-04-06 19:21:48 +08:00
Perfare
85cf134a49 Fixed if the container has the same key 2020-03-30 09:01:25 +08:00
Perfare
687b1d3a0d Fixed get triangles of mesh #510 2020-03-30 08:52:16 +08:00
35 changed files with 928 additions and 769 deletions

View File

@@ -23,7 +23,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@@ -144,6 +144,7 @@
<Compile Include="SerializedFileHeader.cs" />
<Compile Include="SerializedType.cs" />
<Compile Include="SevenZipHelper.cs" />
<Compile Include="StreamFile.cs" />
<Compile Include="TypeTreeHelper.cs" />
<Compile Include="TypeTreeNode.cs" />
<Compile Include="UType.cs" />

View File

@@ -157,7 +157,7 @@ namespace AssetStudio
if (SerializedFile.IsSerializedFile(subReader))
{
var dummyPath = Path.GetDirectoryName(fullName) + Path.DirectorySeparatorChar + file.fileName;
LoadAssetsFromMemory(dummyPath, subReader, parentPath ?? fullName, bundleFile.versionEngine);
LoadAssetsFromMemory(dummyPath, subReader, parentPath ?? fullName, bundleFile.m_Header.unityRevision);
}
else
{

View File

@@ -1,248 +1,306 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Lz4;
namespace AssetStudio
{
public class StreamFile
public class BundleFile
{
public string fileName;
public Stream stream;
public class Header
{
public string signature;
public uint version;
public string unityVersion;
public string unityRevision;
public long size;
public uint compressedBlocksInfoSize;
public uint uncompressedBlocksInfoSize;
public uint flags;
}
public class BlockInfo
public class StorageBlock
{
public uint compressedSize;
public uint uncompressedSize;
public short flag;
public ushort flags;
}
public class BundleFile
public class Node
{
private string path;
public string versionPlayer;
public string versionEngine;
public List<StreamFile> fileList = new List<StreamFile>();
public long offset;
public long size;
public uint flags;
public string path;
}
public BundleFile(EndianBinaryReader bundleReader, string path)
public Header m_Header;
private StorageBlock[] m_BlocksInfo;
private Node[] m_DirectoryInfo;
public StreamFile[] fileList;
public BundleFile(EndianBinaryReader reader, string path)
{
this.path = path;
var signature = bundleReader.ReadStringToNull();
switch (signature)
m_Header = new Header();
m_Header.signature = reader.ReadStringToNull();
switch (m_Header.signature)
{
case "UnityArchive":
break; //TODO
case "UnityWeb":
case "UnityRaw":
case "\xFA\xFA\xFA\xFA\xFA\xFA\xFA\xFA":
ReadHeaderAndBlocksInfo(reader);
using (var blocksStream = CreateBlocksStream(path))
{
var format = bundleReader.ReadInt32();
versionPlayer = bundleReader.ReadStringToNull();
versionEngine = bundleReader.ReadStringToNull();
if (format < 6)
{
int bundleSize = bundleReader.ReadInt32();
}
else if (format == 6)
{
ReadFormat6(bundleReader, true);
return;
}
short dummy2 = bundleReader.ReadInt16();
int offset = bundleReader.ReadInt16();
int dummy3 = bundleReader.ReadInt32();
int lzmaChunks = bundleReader.ReadInt32();
int lzmaSize = 0;
long streamSize = 0;
for (int i = 0; i < lzmaChunks; i++)
{
lzmaSize = bundleReader.ReadInt32();
streamSize = bundleReader.ReadInt32();
}
bundleReader.Position = offset;
switch (signature)
{
case "\xFA\xFA\xFA\xFA\xFA\xFA\xFA\xFA": //.bytes
case "UnityWeb":
{
var lzmaBuffer = bundleReader.ReadBytes(lzmaSize);
using (var lzmaStream = new EndianBinaryReader(SevenZipHelper.StreamDecompress(new MemoryStream(lzmaBuffer))))
{
GetAssetsFiles(lzmaStream, 0);
ReadBlocksAndDirectory(reader, blocksStream);
ReadFiles(blocksStream, path);
}
break;
}
case "UnityRaw":
{
GetAssetsFiles(bundleReader, offset);
break;
}
}
break;
}
case "UnityFS":
ReadHeader(reader);
ReadBlocksInfoAndDirectory(reader);
using (var blocksStream = CreateBlocksStream(path))
{
var format = bundleReader.ReadInt32();
versionPlayer = bundleReader.ReadStringToNull();
versionEngine = bundleReader.ReadStringToNull();
if (format == 6)
{
ReadFormat6(bundleReader);
ReadBlocks(reader, blocksStream);
ReadFiles(blocksStream, path);
}
break;
}
}
}
private void GetAssetsFiles(EndianBinaryReader reader, int offset)
private void ReadHeaderAndBlocksInfo(EndianBinaryReader reader)
{
int fileCount = reader.ReadInt32();
for (int i = 0; i < fileCount; i++)
var isCompressed = m_Header.signature == "UnityWeb";
m_Header.version = reader.ReadUInt32();
m_Header.unityVersion = reader.ReadStringToNull();
m_Header.unityRevision = reader.ReadStringToNull();
if (m_Header.version >= 4)
{
var file = new StreamFile();
file.fileName = Path.GetFileName(reader.ReadStringToNull());
int fileOffset = reader.ReadInt32();
fileOffset += offset;
int fileSize = reader.ReadInt32();
long nextFile = reader.Position;
reader.Position = fileOffset;
var buffer = reader.ReadBytes(fileSize);
file.stream = new MemoryStream(buffer);
fileList.Add(file);
reader.Position = nextFile;
var hash = reader.ReadBytes(16);
var crc = reader.ReadUInt32();
}
}
private void ReadFormat6(EndianBinaryReader bundleReader, bool padding = false)
var minimumStreamedBytes = reader.ReadUInt32();
var headerSize = reader.ReadUInt32();
var numberOfLevelsToDownloadBeforeStreaming = reader.ReadUInt32();
var levelCount = reader.ReadInt32();
m_BlocksInfo = new StorageBlock[1];
for (int i = 0; i < levelCount; i++)
{
var bundleSize = bundleReader.ReadInt64();
int compressedSize = bundleReader.ReadInt32();
int uncompressedSize = bundleReader.ReadInt32();
int flag = bundleReader.ReadInt32();
if (padding)
bundleReader.ReadByte();
byte[] blocksInfoBytes;
if ((flag & 0x80) != 0)//at end of file
var storageBlock = new StorageBlock()
{
var position = bundleReader.Position;
bundleReader.Position = bundleReader.BaseStream.Length - compressedSize;
blocksInfoBytes = bundleReader.ReadBytes(compressedSize);
bundleReader.Position = position;
}
else
{
blocksInfoBytes = bundleReader.ReadBytes(compressedSize);
}
var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes);
MemoryStream blocksInfoDecompressedStream;
switch (flag & 0x3F)
{
default://None
{
blocksInfoDecompressedStream = blocksInfoCompressedStream;
break;
}
case 1://LZMA
{
blocksInfoDecompressedStream = SevenZipHelper.StreamDecompress(blocksInfoCompressedStream);
blocksInfoCompressedStream.Close();
break;
}
case 2://LZ4
case 3://LZ4HC
{
byte[] uncompressedBytes = new byte[uncompressedSize];
using (var decoder = new Lz4DecoderStream(blocksInfoCompressedStream))
{
decoder.Read(uncompressedBytes, 0, uncompressedSize);
}
blocksInfoDecompressedStream = new MemoryStream(uncompressedBytes);
break;
}
//case 4:LZHAM?
}
using (var blocksInfoReader = new EndianBinaryReader(blocksInfoDecompressedStream))
{
blocksInfoReader.Position = 0x10;
int blockcount = blocksInfoReader.ReadInt32();
var blockInfos = new BlockInfo[blockcount];
for (int i = 0; i < blockcount; i++)
{
blockInfos[i] = new BlockInfo
{
uncompressedSize = blocksInfoReader.ReadUInt32(),
compressedSize = blocksInfoReader.ReadUInt32(),
flag = blocksInfoReader.ReadInt16()
compressedSize = reader.ReadUInt32(),
uncompressedSize = reader.ReadUInt32(),
flags = (ushort)(isCompressed ? 1 : 0)
};
if (i == levelCount - 1)
{
m_BlocksInfo[0] = storageBlock;
}
Stream dataStream;
var uncompressedSizeSum = blockInfos.Sum(x => x.uncompressedSize);
if (uncompressedSizeSum > int.MaxValue)
}
if (m_Header.version >= 2)
{
var completeFileSize = reader.ReadUInt32();
}
if (m_Header.version >= 3)
{
var fileInfoHeaderSize = reader.ReadUInt32();
}
reader.Position = headerSize;
}
private Stream CreateBlocksStream(string path)
{
Stream blocksStream;
var uncompressedSizeSum = m_BlocksInfo.Sum(x => x.uncompressedSize);
if (uncompressedSizeSum >= int.MaxValue)
{
/*var memoryMappedFile = MemoryMappedFile.CreateNew(Path.GetFileName(path), uncompressedSizeSum);
assetsDataStream = memoryMappedFile.CreateViewStream();*/
dataStream = new FileStream(path + ".temp", FileMode.Create, FileAccess.ReadWrite, FileShare.None, 4096, FileOptions.DeleteOnClose);
blocksStream = new FileStream(path + ".temp", FileMode.Create, FileAccess.ReadWrite, FileShare.None, 4096, FileOptions.DeleteOnClose);
}
else
{
dataStream = new MemoryStream((int)uncompressedSizeSum);
blocksStream = new MemoryStream((int)uncompressedSizeSum);
}
foreach (var blockInfo in blockInfos)
{
switch (blockInfo.flag & 0x3F)
{
default://None
{
bundleReader.BaseStream.CopyTo(dataStream, blockInfo.compressedSize);
break;
return blocksStream;
}
case 1://LZMA
private void ReadBlocksAndDirectory(EndianBinaryReader reader, Stream blocksStream)
{
SevenZipHelper.StreamDecompress(bundleReader.BaseStream, dataStream, blockInfo.compressedSize, blockInfo.uncompressedSize);
break;
}
case 2://LZ4
case 3://LZ4HC
foreach (var blockInfo in m_BlocksInfo)
{
var lz4Stream = new Lz4DecoderStream(bundleReader.BaseStream, blockInfo.compressedSize);
lz4Stream.CopyTo(dataStream, blockInfo.uncompressedSize);
break;
}
//case 4:LZHAM?
var uncompressedBytes = reader.ReadBytes((int)blockInfo.compressedSize);
if (blockInfo.flags == 1)
{
using (var memoryStream = new MemoryStream(uncompressedBytes))
{
using (var decompressStream = SevenZipHelper.StreamDecompress(memoryStream))
{
uncompressedBytes = decompressStream.ToArray();
}
}
dataStream.Position = 0;
using (dataStream)
}
blocksStream.Write(uncompressedBytes, 0, uncompressedBytes.Length);
}
blocksStream.Position = 0;
var blocksReader = new EndianBinaryReader(blocksStream);
var nodesCount = blocksReader.ReadInt32();
m_DirectoryInfo = new Node[nodesCount];
for (int i = 0; i < nodesCount; i++)
{
var entryinfo_count = blocksInfoReader.ReadInt32();
for (int i = 0; i < entryinfo_count; i++)
m_DirectoryInfo[i] = new Node
{
path = blocksReader.ReadStringToNull(),
offset = blocksReader.ReadUInt32(),
size = blocksReader.ReadUInt32()
};
}
}
public void ReadFiles(Stream blocksStream, string path)
{
fileList = new StreamFile[m_DirectoryInfo.Length];
for (int i = 0; i < m_DirectoryInfo.Length; i++)
{
var node = m_DirectoryInfo[i];
var file = new StreamFile();
var entryinfo_offset = blocksInfoReader.ReadInt64();
var entryinfo_size = blocksInfoReader.ReadInt64();
flag = blocksInfoReader.ReadInt32();
file.fileName = Path.GetFileName(blocksInfoReader.ReadStringToNull());
if (entryinfo_size > int.MaxValue)
fileList[i] = file;
file.fileName = Path.GetFileName(node.path);
if (node.size >= int.MaxValue)
{
/*var memoryMappedFile = MemoryMappedFile.CreateNew(file.fileName, entryinfo_size);
file.stream = memoryMappedFile.CreateViewStream();*/
var extractPath = path + "_unpacked\\";
var extractPath = path + "_unpacked" + Path.DirectorySeparatorChar;
Directory.CreateDirectory(extractPath);
file.stream = File.Create(extractPath + file.fileName);
}
else
{
file.stream = new MemoryStream((int)entryinfo_size);
file.stream = new MemoryStream((int)node.size);
}
dataStream.Position = entryinfo_offset;
dataStream.CopyTo(file.stream, entryinfo_size);
blocksStream.Position = node.offset;
blocksStream.CopyTo(file.stream, node.size);
file.stream.Position = 0;
fileList.Add(file);
}
}
private void ReadHeader(EndianBinaryReader reader)
{
m_Header.version = reader.ReadUInt32();
m_Header.unityVersion = reader.ReadStringToNull();
m_Header.unityRevision = reader.ReadStringToNull();
m_Header.size = reader.ReadInt64();
m_Header.compressedBlocksInfoSize = reader.ReadUInt32();
m_Header.uncompressedBlocksInfoSize = reader.ReadUInt32();
m_Header.flags = reader.ReadUInt32();
}
private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader)
{
byte[] blocksInfoBytes;
if ((m_Header.flags & 0x80) != 0) //kArchiveBlocksInfoAtTheEnd
{
var position = reader.Position;
reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize;
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
reader.Position = position;
}
else //0x40 kArchiveBlocksAndDirectoryInfoCombined
{
if (m_Header.version >= 7)
{
reader.AlignStream(16);
}
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
}
var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes);
MemoryStream blocksInfoUncompresseddStream;
switch (m_Header.flags & 0x3F) //kArchiveCompressionTypeMask
{
default: //None
{
blocksInfoUncompresseddStream = blocksInfoCompressedStream;
break;
}
case 1: //LZMA
{
blocksInfoUncompresseddStream = SevenZipHelper.StreamDecompress(blocksInfoCompressedStream);
blocksInfoCompressedStream.Close();
break;
}
case 2: //LZ4
case 3: //LZ4HC
{
var uncompressedBytes = new byte[m_Header.uncompressedBlocksInfoSize];
using (var decoder = new Lz4DecoderStream(blocksInfoCompressedStream))
{
decoder.Read(uncompressedBytes, 0, uncompressedBytes.Length);
}
blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes);
break;
}
}
using (var blocksInfoReader = new EndianBinaryReader(blocksInfoUncompresseddStream))
{
var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
var blocksInfoCount = blocksInfoReader.ReadInt32();
m_BlocksInfo = new StorageBlock[blocksInfoCount];
for (int i = 0; i < blocksInfoCount; i++)
{
m_BlocksInfo[i] = new StorageBlock
{
uncompressedSize = blocksInfoReader.ReadUInt32(),
compressedSize = blocksInfoReader.ReadUInt32(),
flags = blocksInfoReader.ReadUInt16()
};
}
var nodesCount = blocksInfoReader.ReadInt32();
m_DirectoryInfo = new Node[nodesCount];
for (int i = 0; i < nodesCount; i++)
{
m_DirectoryInfo[i] = new Node
{
offset = blocksInfoReader.ReadInt64(),
size = blocksInfoReader.ReadInt64(),
flags = blocksInfoReader.ReadUInt32(),
path = blocksInfoReader.ReadStringToNull(),
};
}
}
}
private void ReadBlocks(EndianBinaryReader reader, Stream blocksStream)
{
foreach (var blockInfo in m_BlocksInfo)
{
switch (blockInfo.flags & 0x3F) //kStorageBlockCompressionTypeMask
{
default: //None
{
reader.BaseStream.CopyTo(blocksStream, blockInfo.compressedSize);
break;
}
case 1: //LZMA
{
SevenZipHelper.StreamDecompress(reader.BaseStream, blocksStream, blockInfo.compressedSize, blockInfo.uncompressedSize);
break;
}
case 2: //LZ4
case 3: //LZ4HC
{
var compressedStream = new MemoryStream(reader.ReadBytes((int)blockInfo.compressedSize));
using (var lz4Stream = new Lz4DecoderStream(compressedStream))
{
lz4Stream.CopyTo(blocksStream, blockInfo.uncompressedSize);
}
break;
}
}
}
blocksStream.Position = 0;
}
}
}

View File

@@ -396,11 +396,21 @@ namespace AssetStudio
}
}
public enum GfxPrimitiveType : int
{
kPrimitiveTriangles = 0,
kPrimitiveTriangleStrip = 1,
kPrimitiveQuads = 2,
kPrimitiveLines = 3,
kPrimitiveLineStrip = 4,
kPrimitivePoints = 5,
};
public class SubMesh
{
public uint firstByte;
public uint indexCount;
public int topology;
public GfxPrimitiveType topology;
public uint triangleCount;
public uint baseVertex;
public uint firstVertex;
@@ -413,7 +423,7 @@ namespace AssetStudio
firstByte = reader.ReadUInt32();
indexCount = reader.ReadUInt32();
topology = reader.ReadInt32();
topology = (GfxPrimitiveType)reader.ReadInt32();
if (version[0] < 4) //4.0 down
{
@@ -460,7 +470,7 @@ namespace AssetStudio
private CompressedMesh m_CompressedMesh;
private StreamingInfo m_StreamData;
public List<uint> m_Indices = new List<uint>(); //use a list because I don't always know the facecount for triangle strips
public List<uint> m_Indices = new List<uint>();
public Mesh(ObjectReader reader) : base(reader)
{
@@ -684,7 +694,7 @@ namespace AssetStudio
DecompressCompressedMesh();
}
BuildFaces();
GetTriangles();
}
private void ReadVertexData()
@@ -1037,7 +1047,7 @@ namespace AssetStudio
}
}
private void BuildFaces()
private void GetTriangles()
{
foreach (var m_SubMesh in m_SubMeshes)
{
@@ -1046,43 +1056,65 @@ namespace AssetStudio
{
firstIndex /= 2;
}
if (m_SubMesh.topology == 0)
var indexCount = m_SubMesh.indexCount;
var topology = m_SubMesh.topology;
if (topology == GfxPrimitiveType.kPrimitiveTriangles)
{
for (int i = 0; i < m_SubMesh.indexCount / 3; i++)
for (int i = 0; i < indexCount; i += 3)
{
m_Indices.Add(m_IndexBuffer[firstIndex + i * 3]);
m_Indices.Add(m_IndexBuffer[firstIndex + i * 3 + 1]);
m_Indices.Add(m_IndexBuffer[firstIndex + i * 3 + 2]);
m_Indices.Add(m_IndexBuffer[firstIndex + i]);
m_Indices.Add(m_IndexBuffer[firstIndex + i + 1]);
m_Indices.Add(m_IndexBuffer[firstIndex + i + 2]);
}
}
else if (version[0] < 4 || topology == GfxPrimitiveType.kPrimitiveTriangleStrip)
{
// de-stripify :
uint triIndex = 0;
for (int i = 0; i < indexCount - 2; i++)
{
var a = m_IndexBuffer[firstIndex + i];
var b = m_IndexBuffer[firstIndex + i + 1];
var c = m_IndexBuffer[firstIndex + i + 2];
// skip degenerates
if (a == b || a == c || b == c)
continue;
// do the winding flip-flop of strips :
if ((i & 1) == 1)
{
m_Indices.Add(b);
m_Indices.Add(a);
}
else
{
uint j = 0;
for (int i = 0; i < m_SubMesh.indexCount - 2; i++)
{
uint fa = m_IndexBuffer[firstIndex + i];
uint fb = m_IndexBuffer[firstIndex + i + 1];
uint fc = m_IndexBuffer[firstIndex + i + 2];
if ((fa != fb) && (fa != fc) && (fc != fb))
{
m_Indices.Add(fa);
if ((i % 2) == 0)
{
m_Indices.Add(fb);
m_Indices.Add(fc);
}
else
{
m_Indices.Add(fc);
m_Indices.Add(fb);
}
j++;
m_Indices.Add(a);
m_Indices.Add(b);
}
m_Indices.Add(c);
triIndex += 3;
}
//fix indexCount
m_SubMesh.indexCount = j * 3;
m_SubMesh.indexCount = triIndex;
}
else if (topology == GfxPrimitiveType.kPrimitiveQuads)
{
for (int q = 0; q < indexCount; q += 4)
{
m_Indices.Add(m_IndexBuffer[firstIndex + q]);
m_Indices.Add(m_IndexBuffer[firstIndex + q + 1]);
m_Indices.Add(m_IndexBuffer[firstIndex + q + 2]);
m_Indices.Add(m_IndexBuffer[firstIndex + q]);
m_Indices.Add(m_IndexBuffer[firstIndex + q + 2]);
m_Indices.Add(m_IndexBuffer[firstIndex + q + 3]);
}
//fix indexCount
m_SubMesh.indexCount = indexCount / 2 * 3;
}
else
{
throw new NotSupportedException("Failed getting triangles. Submesh topology is lines or points.");
}
}
}
@@ -1128,6 +1160,31 @@ namespace AssetStudio
throw new ArgumentOutOfRangeException();
}
}
public float[] GetUV(int uv)
{
switch (uv)
{
case 0:
return m_UV0;
case 1:
return m_UV1;
case 2:
return m_UV2;
case 3:
return m_UV3;
case 4:
return m_UV4;
case 5:
return m_UV5;
case 6:
return m_UV6;
case 7:
return m_UV7;
default:
throw new ArgumentOutOfRangeException();
}
}
}
public static class MeshHelper

View File

@@ -112,7 +112,8 @@ namespace AssetStudio
{1083, "BoundsInt"},
{1093, "m_CorrespondingSourceObject"},
{1121, "m_PrefabInstance"},
{1138, "m_PrefabAsset"}
{1138, "m_PrefabAsset"},
{1152, "FileSize"}
};
}
}

View File

@@ -135,7 +135,7 @@ namespace AssetStudio
public List<ImportedSubmesh> SubmeshList { get; set; }
public List<ImportedBone> BoneList { get; set; }
public bool hasNormal { get; set; }
public bool hasUV { get; set; }
public bool[] hasUV { get; set; }
public bool hasTangent { get; set; }
public bool hasColor { get; set; }
}
@@ -151,7 +151,7 @@ namespace AssetStudio
{
public Vector3 Vertex { get; set; }
public Vector3 Normal { get; set; }
public float[] UV { get; set; }
public float[][] UV { get; set; }
public Vector4 Tangent { get; set; }
public Color Color { get; set; }
public float[] Weights { get; set; }

View File

@@ -77,7 +77,7 @@ namespace AssetStudio
{
case "UnityWeb":
case "UnityRaw":
case "\xFA\xFA\xFA\xFA\xFA\xFA\xFA\xFA":
case "UnityArchive":
case "UnityFS":
return FileType.BundleFile;
case "UnityWebData1.0":

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.14.38.5")]
[assembly: AssemblyFileVersion("0.14.38.5")]

View File

@@ -24,6 +24,7 @@ namespace AssetStudio
public BuildTarget m_TargetPlatform = BuildTarget.UnknownPlatform;
private bool m_EnableTypeTree = true;
public List<SerializedType> m_Types;
public List<SerializedType> m_RefTypes;
public List<ObjectInfo> m_Objects;
private List<LocalSerializedObjectIdentifier> m_ScriptTypes;
public List<FileIdentifier> m_Externals;
@@ -93,9 +94,10 @@ namespace AssetStudio
m_Types.Add(ReadSerializedType());
}
var bigIDEnabled = 0;
if (header.m_Version >= 7 && header.m_Version < 14)
{
var bigIDEnabled = reader.ReadInt32();
bigIDEnabled = reader.ReadInt32();
}
//ReadObjects
@@ -106,7 +108,11 @@ namespace AssetStudio
for (int i = 0; i < objectCount; i++)
{
var objectInfo = new ObjectInfo();
if (header.m_Version < 14)
if (bigIDEnabled != 0)
{
objectInfo.m_PathID = reader.ReadInt64();
}
else if (header.m_Version < 14)
{
objectInfo.m_PathID = reader.ReadInt32();
}
@@ -128,7 +134,6 @@ namespace AssetStudio
{
objectInfo.classID = reader.ReadUInt16();
objectInfo.serializedType = m_Types.Find(x => x.classID == objectInfo.typeID);
var isDestroyed = reader.ReadUInt16();
}
else
{
@@ -136,6 +141,16 @@ namespace AssetStudio
objectInfo.serializedType = type;
objectInfo.classID = type.classID;
}
if (header.m_Version < 11)
{
var isDestroyed = reader.ReadUInt16();
}
if (header.m_Version >= 11 && header.m_Version < 17)
{
var m_ScriptTypeIndex = reader.ReadInt16();
if (objectInfo.serializedType != null)
objectInfo.serializedType.m_ScriptTypeIndex = m_ScriptTypeIndex;
}
if (header.m_Version == 15 || header.m_Version == 16)
{
var stripped = reader.ReadByte();
@@ -183,15 +198,22 @@ namespace AssetStudio
m_Externals.Add(m_External);
}
if (header.m_Version >= 5)
if (header.m_Version >= 20)
{
//var userInformation = reader.ReadStringToNull();
int refTypesCount = reader.ReadInt32();
m_RefTypes = new List<SerializedType>(refTypesCount);
for (int i = 0; i < refTypesCount; i++)
{
m_RefTypes.Add(ReadSerializedType());
}
}
if (header.m_Version >= 21)
if (header.m_Version >= 5)
{
//var unknown = reader.ReadInt32();
var userInformation = reader.ReadStringToNull();
}
//reader.AlignStream(16);
}
public void SetVersion(string stringVersion)
@@ -233,13 +255,18 @@ namespace AssetStudio
var typeTree = new List<TypeTreeNode>();
if (header.m_Version >= 12 || header.m_Version == 10)
{
ReadTypeTree5(typeTree);
TypeTreeBlobRead(typeTree);
}
else
{
ReadTypeTree(typeTree);
}
if (header.m_Version >= 21)
{
type.m_TypeDependencies = reader.ReadInt32Array();
}
type.m_Nodes = typeTree;
}
@@ -276,20 +303,10 @@ namespace AssetStudio
}
}
private void ReadTypeTree5(List<TypeTreeNode> typeTree)
private void TypeTreeBlobRead(List<TypeTreeNode> typeTree)
{
int numberOfNodes = reader.ReadInt32();
int stringBufferSize = reader.ReadInt32();
var nodeSize = 24;
if (header.m_Version > 17)
{
nodeSize = 32;
}
reader.Position += numberOfNodes * nodeSize;
using (var stringBufferReader = new BinaryReader(new MemoryStream(reader.ReadBytes(stringBufferSize))))
{
reader.Position -= numberOfNodes * nodeSize + stringBufferSize;
for (int i = 0; i < numberOfNodes; i++)
{
var typeTreeNode = new TypeTreeNode();
@@ -302,21 +319,23 @@ namespace AssetStudio
typeTreeNode.m_ByteSize = reader.ReadInt32();
typeTreeNode.m_Index = reader.ReadInt32();
typeTreeNode.m_MetaFlag = reader.ReadInt32();
if (header.m_Version > 17)
if (header.m_Version >= 19)
{
reader.Position += 8;
typeTreeNode.m_RefTypeHash = reader.ReadUInt64();
}
}
var m_StringBuffer = reader.ReadBytes(stringBufferSize);
using (var stringBufferReader = new BinaryReader(new MemoryStream(m_StringBuffer)))
{
for (int i = 0; i < numberOfNodes; i++)
{
var typeTreeNode = typeTree[i];
typeTreeNode.m_Type = ReadString(stringBufferReader, typeTreeNode.m_TypeStrOffset);
typeTreeNode.m_Name = ReadString(stringBufferReader, typeTreeNode.m_NameStrOffset);
}
reader.Position += stringBufferSize;
}
if (header.m_Version >= 21)
{
reader.Position += 4;
}
string ReadString(BinaryReader stringBufferReader, uint value)
{
var isOffset = (value & 0x80000000) == 0;
@@ -343,19 +362,31 @@ namespace AssetStudio
public static bool IsSerializedFile(EndianBinaryReader reader)
{
var fileSize = reader.BaseStream.Length;
if (fileSize < 16)
if (fileSize < 20)
{
return false;
}
var m_MetadataSize = reader.ReadUInt32();
var m_FileSize = reader.ReadUInt32();
long m_FileSize = reader.ReadUInt32();
var m_Version = reader.ReadUInt32();
long m_DataOffset = reader.ReadUInt32();
var m_Endianess = reader.ReadByte();
var m_Reserved = reader.ReadBytes(3);
if (m_Version >= 22)
{
if (fileSize < 48)
{
return false;
}
m_MetadataSize = reader.ReadUInt32();
m_FileSize = reader.ReadInt64();
m_DataOffset = reader.ReadInt64();
}
if (m_FileSize != fileSize)
{
reader.Position = 0;
return false;
}
var m_Version = reader.ReadUInt32();
var m_DataOffset = reader.ReadUInt32();
if (m_DataOffset > fileSize)
{
reader.Position = 0;

View File

@@ -13,5 +13,6 @@ namespace AssetStudio
public List<TypeTreeNode> m_Nodes;
public byte[] m_ScriptID; //Hash128
public byte[] m_OldTypeHash; //Hash128
public int[] m_TypeDependencies;
}
}

10
AssetStudio/StreamFile.cs Normal file
View File

@@ -0,0 +1,10 @@
using System.IO;
namespace AssetStudio
{
public class StreamFile
{
public string fileName;
public Stream stream;
}
}

View File

@@ -31,6 +31,7 @@ namespace AssetStudio
value = reader.ReadSByte();
break;
case "UInt8":
case "char":
value = reader.ReadByte();
break;
case "short":
@@ -56,6 +57,7 @@ namespace AssetStudio
break;
case "UInt64":
case "unsigned long long":
case "FileSize":
value = reader.ReadUInt64();
break;
case "float":
@@ -73,26 +75,6 @@ namespace AssetStudio
sb.AppendFormat("{0}{1} {2} = \"{3}\"\r\n", (new string('\t', level)), varTypeStr, varNameStr, str);
i += 3;
break;
case "vector":
{
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
align = true;
append = false;
sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level + 1)), "Array", "Array");
var size = reader.ReadInt32();
sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level + 1)), "int", "size", size);
var vector = GetMembers(members, level, i);
i += vector.Count - 1;
vector.RemoveRange(0, 3);
for (int j = 0; j < size; j++)
{
sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 2)), j);
int tmp = 0;
ReadStringValue(sb, vector, reader, ref tmp);
}
break;
}
case "map":
{
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
@@ -102,12 +84,11 @@ namespace AssetStudio
sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level + 1)), "Array", "Array");
var size = reader.ReadInt32();
sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level + 1)), "int", "size", size);
var map = GetMembers(members, level, i);
var map = GetMembers(members, i);
i += map.Count - 1;
map.RemoveRange(0, 4);
var first = GetMembers(map, map[0].m_Level, 0);
map.RemoveRange(0, first.Count);
var second = map;
var first = GetMembers(map, 4);
var next = 4 + first.Count;
var second = GetMembers(map, next);
for (int j = 0; j < size; j++)
{
sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 2)), j);
@@ -131,22 +112,39 @@ namespace AssetStudio
}
default:
{
if (i != members.Count && members[i + 1].m_Type == "Array")
if (i < members.Count - 1 && members[i + 1].m_Type == "Array") //Array
{
goto case "vector";
}
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
align = true;
append = false;
sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
var @class = GetMembers(members, level, i);
@class.RemoveAt(0);
i += @class.Count;
for (int j = 0; j < @class.Count; j++)
sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level + 1)), "Array", "Array");
var size = reader.ReadInt32();
sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level + 1)), "int", "size", size);
var vector = GetMembers(members, i);
i += vector.Count - 1;
for (int j = 0; j < size; j++)
{
sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 2)), j);
int tmp = 3;
ReadStringValue(sb, vector, reader, ref tmp);
}
break;
}
else //Class
{
append = false;
sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
var @class = GetMembers(members, i);
i += @class.Count - 1;
for (int j = 1; j < @class.Count; j++)
{
ReadStringValue(sb, @class, reader, ref j);
}
break;
}
}
}
if (append)
sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, value);
if (align)
@@ -168,7 +166,6 @@ namespace AssetStudio
private static object ReadValue(List<TypeTreeNode> members, BinaryReader reader, ref int i)
{
var member = members[i];
var level = member.m_Level;
var varTypeStr = member.m_Type;
object value;
var align = (member.m_MetaFlag & 0x4000) != 0;
@@ -178,6 +175,7 @@ namespace AssetStudio
value = reader.ReadSByte();
break;
case "UInt8":
case "char":
value = reader.ReadByte();
break;
case "short":
@@ -203,6 +201,7 @@ namespace AssetStudio
break;
case "UInt64":
case "unsigned long long":
case "FileSize":
value = reader.ReadUInt64();
break;
case "float":
@@ -222,14 +221,13 @@ namespace AssetStudio
{
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
align = true;
var map = GetMembers(members, i);
i += map.Count - 1;
var first = GetMembers(map, 4);
var next = 4 + first.Count;
var second = GetMembers(map, next);
var size = reader.ReadInt32();
var dic = new List<KeyValuePair<object, object>>(size);
var map = GetMembers(members, level, i);
i += map.Count - 1;
map.RemoveRange(0, 4);
var first = GetMembers(map, map[0].m_Level, 0);
map.RemoveRange(0, first.Count);
var second = map;
for (int j = 0; j < size; j++)
{
int tmp1 = 0;
@@ -248,18 +246,17 @@ namespace AssetStudio
}
default:
{
if (i != members.Count && members[i + 1].m_Type == "Array") //Array
if (i < members.Count - 1 && members[i + 1].m_Type == "Array") //Array
{
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
align = true;
var vector = GetMembers(members, i);
i += vector.Count - 1;
var size = reader.ReadInt32();
var list = new List<object>(size);
var vector = GetMembers(members, level, i);
i += vector.Count - 1;
vector.RemoveRange(0, 3);
for (int j = 0; j < size; j++)
{
int tmp = 0;
int tmp = 3;
list.Add(ReadValue(vector, reader, ref tmp));
}
value = list;
@@ -267,11 +264,10 @@ namespace AssetStudio
}
else //Class
{
var @class = GetMembers(members, level, i);
@class.RemoveAt(0);
i += @class.Count;
var @class = GetMembers(members, i);
i += @class.Count - 1;
var obj = new UType();
for (int j = 0; j < @class.Count; j++)
for (int j = 1; j < @class.Count; j++)
{
var classmember = @class[j];
var name = classmember.m_Name;
@@ -287,10 +283,11 @@ namespace AssetStudio
return value;
}
private static List<TypeTreeNode> GetMembers(List<TypeTreeNode> members, int level, int index)
private static List<TypeTreeNode> GetMembers(List<TypeTreeNode> members, int index)
{
var member2 = new List<TypeTreeNode>();
member2.Add(members[0]);
member2.Add(members[index]);
var level = members[index].m_Level;
for (int i = index + 1; i < members.Count; i++)
{
var member = members[i];
@@ -303,140 +300,5 @@ namespace AssetStudio
}
return member2;
}
public static byte[] WriteUType(UType obj, List<TypeTreeNode> members)
{
var stream = new MemoryStream();
var write = new BinaryWriter(stream);
for (int i = 0; i < members.Count; i++)
{
var member = members[i];
var varNameStr = member.m_Name;
WriteValue(obj[varNameStr], members, write, ref i);
}
return stream.ToArray();
}
private static void WriteValue(object value, List<TypeTreeNode> members, BinaryWriter write, ref int i)
{
var member = members[i];
var level = member.m_Level;
var varTypeStr = member.m_Type;
var align = (member.m_MetaFlag & 0x4000) != 0;
switch (varTypeStr)
{
case "SInt8":
write.Write((sbyte)value);
break;
case "UInt8":
write.Write((byte)value);
break;
case "short":
case "SInt16":
write.Write((short)value);
break;
case "UInt16":
case "unsigned short":
write.Write((ushort)value);
break;
case "int":
case "SInt32":
write.Write((int)value);
break;
case "UInt32":
case "unsigned int":
case "Type*":
write.Write((uint)value);
break;
case "long long":
case "SInt64":
write.Write((long)value);
break;
case "UInt64":
case "unsigned long long":
write.Write((ulong)value);
break;
case "float":
write.Write((float)value);
break;
case "double":
write.Write((double)value);
break;
case "bool":
write.Write((bool)value);
break;
case "string":
write.WriteAlignedString((string)value);
i += 3;
break;
case "map":
{
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
align = true;
var dic = (List<KeyValuePair<object, object>>)value;
var size = dic.Count;
write.Write(size);
var map = GetMembers(members, level, i);
i += map.Count - 1;
map.RemoveRange(0, 4);
var first = GetMembers(map, map[0].m_Level, 0);
map.RemoveRange(0, first.Count);
var second = map;
for (int j = 0; j < size; j++)
{
int tmp1 = 0;
int tmp2 = 0;
WriteValue(dic[j].Key, first, write, ref tmp1);
WriteValue(dic[j].Value, second, write, ref tmp2);
}
break;
}
case "TypelessData":
{
var bytes = ((object[])value).Cast<byte>().ToArray();
var size = bytes.Length;
write.Write(size);
write.Write(bytes);
i += 2;
break;
}
default:
{
if (i != members.Count && members[i + 1].m_Type == "Array") //Array
{
if ((members[i + 1].m_MetaFlag & 0x4000) != 0)
align = true;
var list = (List<object>)value;
var size = list.Count;
write.Write(size);
var vector = GetMembers(members, level, i);
i += vector.Count - 1;
vector.RemoveRange(0, 3);
for (int j = 0; j < size; j++)
{
int tmp = 0;
WriteValue(list[j], vector, write, ref tmp);
}
break;
}
else //Class
{
var @class = GetMembers(members, level, i);
@class.RemoveAt(0);
i += @class.Count;
var obj = (UType)value;
for (int j = 0; j < @class.Count; j++)
{
var classmember = @class[j];
var name = classmember.m_Name;
WriteValue(obj[name], @class, write, ref j);
}
break;
}
}
}
if (align)
write.AlignStream(4);
}
}
}

View File

@@ -11,11 +11,12 @@ namespace AssetStudio
public string m_Name;
public int m_ByteSize;
public int m_Index;
public int m_IsArray;
public int m_IsArray; //m_TypeFlags
public int m_Version;
public int m_MetaFlag;
public int m_Level;
public uint m_TypeStrOffset;
public uint m_NameStrOffset;
public ulong m_RefTypeHash;
}
}

View File

@@ -9,73 +9,37 @@ namespace AssetStudio
public class UType : IDictionary<string, object>
{
private List<string> keys;
private List<object> values;
private IDictionary<string, object> values;
public UType()
{
keys = new List<string>();
values = new List<object>();
}
private int GetValueIndex(string name)
{
for (int i = 0, n = keys.Count; i < n; i++)
{
if (string.Equals(keys[i], name, StringComparison.Ordinal))
{
return i;
}
}
return -1;
}
public bool TryGetValue<T>(string key, out T value)
{
var index = GetValueIndex(key);
if (index != -1)
{
value = (T)values[index];
return true;
}
else
{
value = default(T);
return false;
}
values = new Dictionary<string, object>();
}
public object this[string key]
{
get
{
var index = GetValueIndex(key);
if (index != -1)
{
return values[index];
}
else
if (!values.ContainsKey(key))
{
return null;
}
return values[key];
}
set
{
var index = GetValueIndex(key);
if (index == -1)
if (!values.ContainsKey(key))
{
keys.Add(key);
values.Add(value);
}
else
{
values[index] = value;
}
values[key] = value;
}
}
public ICollection<string> Keys => keys;
public ICollection<object> Values => values;
public ICollection<object> Values => values.Values;
public int Count => keys.Count;
@@ -84,13 +48,13 @@ namespace AssetStudio
public void Add(string key, object value)
{
keys.Add(key);
values.Add(value);
values.Add(key, value);
}
public void Add(KeyValuePair<string, object> item)
{
keys.Add(item.Key);
values.Add(item.Value);
values.Add(item);
}
public void Clear()
@@ -101,55 +65,44 @@ namespace AssetStudio
public bool Contains(KeyValuePair<string, object> item)
{
throw new NotImplementedException();
return values.Contains(item);
}
public bool ContainsKey(string key)
{
return GetValueIndex(key) != -1;
return values.ContainsKey(key);
}
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
{
throw new NotImplementedException();
values.CopyTo(array, arrayIndex);
}
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
for (int i = 0, n = keys.Count; i < n; i++)
{
yield return new KeyValuePair<string, object>(keys[i], values[i]);
}
return values.GetEnumerator();
}
public bool Remove(string key)
{
throw new NotImplementedException();
keys.Remove(key);
return values.Remove(key);
}
public bool Remove(KeyValuePair<string, object> item)
{
throw new NotImplementedException();
keys.Remove(item.Key);
return values.Remove(item);
}
public bool TryGetValue(string key, out object value)
{
var index = GetValueIndex(key);
if (index != -1)
{
value = values[index];
return true;
}
else
{
value = null;
return false;
}
return values.TryGetValue(key, out value);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
return values.GetEnumerator();
}
}
}

View File

@@ -12,7 +12,7 @@ namespace AssetStudio
{
public static byte[] gzipMagic = { 0x1f, 0x8b };
public static byte[] brotliMagic = { 0x62, 0x72, 0x6F, 0x74, 0x6C, 0x69 };
public List<StreamFile> fileList = new List<StreamFile>();
public StreamFile[] fileList;
private class WebData
{
@@ -78,14 +78,15 @@ namespace AssetStudio
data.path = Encoding.UTF8.GetString(reader.ReadBytes(pathLength));
dataList.Add(data);
}
foreach (var data in dataList)
fileList = new StreamFile[dataList.Count];
for (int i = 0; i < dataList.Count; i++)
{
var data = dataList[i];
var file = new StreamFile();
file.fileName = Path.GetFileName(data.path);
reader.BaseStream.Position = data.dataOffset;
file.stream = new MemoryStream(reader.ReadBytes(data.dataLength));
fileList.Add(file);
fileList[i] = file;
}
}
}

View File

@@ -24,34 +24,34 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>AssetStudioFBX</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@@ -381,14 +381,30 @@ namespace AssetStudio
lGeometryElementNormal->SetReferenceMode(FbxGeometryElement::eDirect);
}
FbxGeometryElementUV* lGeometryElementUV = NULL;
if (iMesh->hasUV)
if (iMesh->hasUV[0])
{
lGeometryElementUV = pMesh->CreateElementUV("UV0");
auto lGeometryElementUV = pMesh->CreateElementUV("UV0", FbxLayerElement::eTextureDiffuse);
lGeometryElementUV->SetMappingMode(FbxGeometryElement::eByControlPoint);
lGeometryElementUV->SetReferenceMode(FbxGeometryElement::eDirect);
}
if (iMesh->hasUV[1])
{
auto lGeometryElementUV = pMesh->CreateElementUV("UV1", FbxLayerElement::eTextureNormalMap);
lGeometryElementUV->SetMappingMode(FbxGeometryElement::eByControlPoint);
lGeometryElementUV->SetReferenceMode(FbxGeometryElement::eDirect);
}
/*for (int uv = 0; uv < 8; uv++)
{
if (iMesh->hasUV[uv])
{
auto lGeometryElementUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv));
lGeometryElementUV->SetMappingMode(FbxGeometryElement::eByControlPoint);
lGeometryElementUV->SetReferenceMode(FbxGeometryElement::eDirect);
}
}*/
FbxGeometryElementTangent* lGeometryElementTangent = NULL;
if (iMesh->hasTangent)
{
@@ -468,7 +484,7 @@ namespace AssetStudio
bool hasTexture = false;
for each (ImportedMaterialTexture^ texture in mat->Textures)
for each (ImportedMaterialTexture ^ texture in mat->Textures)
{
auto pTexture = ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList));
if (pTexture != NULL)
@@ -520,10 +536,15 @@ namespace AssetStudio
lGeometryElementNormal->GetDirectArray().Add(FbxVector4(normal.X, normal.Y, normal.Z, 0));
}
if (iMesh->hasUV)
//for (int uv = 0; uv < 8; uv++)
for (int uv = 0; uv < 2; uv++)
{
array<float>^ uv = iVertex->UV;
lGeometryElementUV->GetDirectArray().Add(FbxVector2(uv[0], uv[1]));
if (iMesh->hasUV[uv])
{
auto m_UV = iVertex->UV[uv];
auto lGeometryElementUV = pMesh->GetElementUV(uv);
lGeometryElementUV->GetDirectArray().Add(FbxVector2(m_UV[0], m_UV[1]));
}
}
if (iMesh->hasTangent)
@@ -841,7 +862,7 @@ namespace AssetStudio
{
return;
}
for each (ImportedMorph^ morph in imported->MorphList)
for each (ImportedMorph ^ morph in imported->MorphList)
{
auto frame = imported->RootFrame->FindFrameByPath(morph->Path);
if (frame != nullptr)
@@ -865,7 +886,7 @@ namespace AssetStudio
);
lBlendShape->AddBlendShapeChannel(lBlendShapeChannel);
for each(ImportedMorphKeyframe^ keyframe in channel->KeyframeList)
for each (ImportedMorphKeyframe ^ keyframe in channel->KeyframeList)
{
FbxShape* lShape = FbxShape::Create(pScene, FbxString(keyframe->Weight));
lBlendShapeChannel->AddTargetShape(lShape, keyframe->Weight);

View File

@@ -12,6 +12,7 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
@@ -28,7 +29,7 @@
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
@@ -50,7 +51,7 @@
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>

View File

@@ -111,7 +111,9 @@
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dumpSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.goToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -145,7 +147,7 @@
this.debugMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1264, 25);
this.menuStrip1.Size = new System.Drawing.Size(1264, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@@ -158,39 +160,39 @@
this.extractFileToolStripMenuItem,
this.extractFolderToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(39, 21);
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// loadFileToolStripMenuItem
//
this.loadFileToolStripMenuItem.Name = "loadFileToolStripMenuItem";
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.loadFileToolStripMenuItem.Text = "Load file";
this.loadFileToolStripMenuItem.Click += new System.EventHandler(this.loadFile_Click);
//
// loadFolderToolStripMenuItem
//
this.loadFolderToolStripMenuItem.Name = "loadFolderToolStripMenuItem";
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.loadFolderToolStripMenuItem.Text = "Load folder";
this.loadFolderToolStripMenuItem.Click += new System.EventHandler(this.loadFolder_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(151, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(141, 6);
//
// extractFileToolStripMenuItem
//
this.extractFileToolStripMenuItem.Name = "extractFileToolStripMenuItem";
this.extractFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.extractFileToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.extractFileToolStripMenuItem.Text = "Extract file";
this.extractFileToolStripMenuItem.Click += new System.EventHandler(this.extractFileToolStripMenuItem_Click);
//
// extractFolderToolStripMenuItem
//
this.extractFolderToolStripMenuItem.Name = "extractFolderToolStripMenuItem";
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.extractFolderToolStripMenuItem.Text = "Extract folder";
this.extractFolderToolStripMenuItem.Click += new System.EventHandler(this.extractFolderToolStripMenuItem_Click);
//
@@ -202,14 +204,14 @@
this.displayInfo,
this.showExpOpt});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "Options";
//
// displayAll
//
this.displayAll.CheckOnClick = true;
this.displayAll.Name = "displayAll";
this.displayAll.Size = new System.Drawing.Size(223, 22);
this.displayAll.Size = new System.Drawing.Size(207, 22);
this.displayAll.Text = "Display all assets";
this.displayAll.ToolTipText = "Check this option will display all types assets. Not extractable assets can expor" +
"t the RAW file.";
@@ -221,7 +223,7 @@
this.enablePreview.CheckOnClick = true;
this.enablePreview.CheckState = System.Windows.Forms.CheckState.Checked;
this.enablePreview.Name = "enablePreview";
this.enablePreview.Size = new System.Drawing.Size(223, 22);
this.enablePreview.Size = new System.Drawing.Size(207, 22);
this.enablePreview.Text = "Enable preview";
this.enablePreview.ToolTipText = "Toggle the loading and preview of readable assets, such as images, sounds, text, " +
"etc.\r\nDisable preview if you have performance or compatibility issues.";
@@ -233,7 +235,7 @@
this.displayInfo.CheckOnClick = true;
this.displayInfo.CheckState = System.Windows.Forms.CheckState.Checked;
this.displayInfo.Name = "displayInfo";
this.displayInfo.Size = new System.Drawing.Size(223, 22);
this.displayInfo.Size = new System.Drawing.Size(207, 22);
this.displayInfo.Text = "Display asset infromation";
this.displayInfo.ToolTipText = "Toggle the overlay that shows information about each asset, eg. image size, forma" +
"t, audio bitrate, etc.";
@@ -242,7 +244,7 @@
// showExpOpt
//
this.showExpOpt.Name = "showExpOpt";
this.showExpOpt.Size = new System.Drawing.Size(223, 22);
this.showExpOpt.Size = new System.Drawing.Size(207, 22);
this.showExpOpt.Text = "Export options";
this.showExpOpt.Click += new System.EventHandler(this.showExpOpt_Click);
//
@@ -256,46 +258,46 @@
this.exportSelectedObjectsmergeToolStripMenuItem,
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem});
this.modelToolStripMenuItem.Name = "modelToolStripMenuItem";
this.modelToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
this.modelToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
this.modelToolStripMenuItem.Text = "Model";
//
// exportAllObjectssplitToolStripMenuItem1
//
this.exportAllObjectssplitToolStripMenuItem1.Name = "exportAllObjectssplitToolStripMenuItem1";
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(417, 22);
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(382, 22);
this.exportAllObjectssplitToolStripMenuItem1.Text = "Export all objects (split)";
this.exportAllObjectssplitToolStripMenuItem1.Click += new System.EventHandler(this.exportAllObjectssplitToolStripMenuItem1_Click);
//
// exportSelectedObjectsToolStripMenuItem
//
this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem";
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
this.exportSelectedObjectsToolStripMenuItem.Text = "Export selected objects (split)";
this.exportSelectedObjectsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsToolStripMenuItem_Click);
//
// exportSelectedObjectsWithAnimationClipToolStripMenuItem
//
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsWithAnimationClipToolStripMenuItem";
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Text = "Export selected objects (split) + selected AnimationClips";
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(414, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(379, 6);
//
// exportSelectedObjectsmergeToolStripMenuItem
//
this.exportSelectedObjectsmergeToolStripMenuItem.Name = "exportSelectedObjectsmergeToolStripMenuItem";
this.exportSelectedObjectsmergeToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsmergeToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
this.exportSelectedObjectsmergeToolStripMenuItem.Text = "Export selected objects (merge)";
this.exportSelectedObjectsmergeToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsmergeToolStripMenuItem_Click);
//
// exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem
//
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem";
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Text = "Export selected objects (merge) + selected AnimationClips";
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem_Click);
//
@@ -311,46 +313,46 @@
this.toolStripMenuItem2,
this.toolStripMenuItem3});
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
this.exportToolStripMenuItem.Text = "Export";
//
// exportAllAssetsMenuItem
//
this.exportAllAssetsMenuItem.Name = "exportAllAssetsMenuItem";
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(266, 22);
this.exportAllAssetsMenuItem.Text = "All assets";
this.exportAllAssetsMenuItem.Click += new System.EventHandler(this.exportAllAssetsMenuItem_Click);
//
// exportSelectedAssetsMenuItem
//
this.exportSelectedAssetsMenuItem.Name = "exportSelectedAssetsMenuItem";
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(266, 22);
this.exportSelectedAssetsMenuItem.Text = "Selected assets";
this.exportSelectedAssetsMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsMenuItem_Click);
//
// exportFilteredAssetsMenuItem
//
this.exportFilteredAssetsMenuItem.Name = "exportFilteredAssetsMenuItem";
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(266, 22);
this.exportFilteredAssetsMenuItem.Text = "Filtered assets";
this.exportFilteredAssetsMenuItem.Click += new System.EventHandler(this.exportFilteredAssetsMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(281, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(263, 6);
//
// exportAnimatorWithSelectedAnimationClipToolStripMenuItem
//
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Name = "exportAnimatorWithSelectedAnimationClipToolStripMenuItem";
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(266, 22);
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Text = "Animator + selected AnimationClips";
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(281, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(263, 6);
//
// toolStripMenuItem2
//
@@ -359,27 +361,27 @@
this.toolStripMenuItem5,
this.toolStripMenuItem6});
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItem2.Size = new System.Drawing.Size(266, 22);
this.toolStripMenuItem2.Text = "Raw";
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem4.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem4.Text = "All assets";
this.toolStripMenuItem4.Click += new System.EventHandler(this.toolStripMenuItem4_Click);
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem5.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem5.Text = "Selected assets";
this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem6.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem6.Text = "Filtered assets";
this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click);
//
@@ -390,27 +392,27 @@
this.toolStripMenuItem8,
this.toolStripMenuItem9});
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItem3.Size = new System.Drawing.Size(266, 22);
this.toolStripMenuItem3.Text = "Dump";
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem7.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem7.Text = "All assets";
this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem8.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem8.Text = "Selected assets";
this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
//
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem9.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem9.Text = "Filtered assets";
this.toolStripMenuItem9.Click += new System.EventHandler(this.toolStripMenuItem9_Click);
//
@@ -419,7 +421,7 @@
this.filterTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.allToolStripMenuItem});
this.filterTypeToolStripMenuItem.Name = "filterTypeToolStripMenuItem";
this.filterTypeToolStripMenuItem.Size = new System.Drawing.Size(80, 21);
this.filterTypeToolStripMenuItem.Size = new System.Drawing.Size(72, 20);
this.filterTypeToolStripMenuItem.Text = "Filter Type";
//
// allToolStripMenuItem
@@ -428,7 +430,7 @@
this.allToolStripMenuItem.CheckOnClick = true;
this.allToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.allToolStripMenuItem.Name = "allToolStripMenuItem";
this.allToolStripMenuItem.Size = new System.Drawing.Size(90, 22);
this.allToolStripMenuItem.Size = new System.Drawing.Size(88, 22);
this.allToolStripMenuItem.Text = "All";
this.allToolStripMenuItem.Click += new System.EventHandler(this.typeToolStripMenuItem_Click);
//
@@ -437,13 +439,13 @@
this.debugMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportClassStructuresMenuItem});
this.debugMenuItem.Name = "debugMenuItem";
this.debugMenuItem.Size = new System.Drawing.Size(59, 21);
this.debugMenuItem.Size = new System.Drawing.Size(54, 20);
this.debugMenuItem.Text = "Debug";
//
// exportClassStructuresMenuItem
//
this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem";
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(207, 22);
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(191, 22);
this.exportClassStructuresMenuItem.Text = "Export class structures";
this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click);
//
@@ -451,7 +453,7 @@
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 25);
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
@@ -466,7 +468,7 @@
this.splitContainer1.Panel2.Controls.Add(this.classPreviewPanel);
this.splitContainer1.Panel2.Controls.Add(this.statusStrip1);
this.splitContainer1.Panel2MinSize = 400;
this.splitContainer1.Size = new System.Drawing.Size(1264, 656);
this.splitContainer1.Size = new System.Drawing.Size(1264, 657);
this.splitContainer1.SplitterDistance = 482;
this.splitContainer1.TabIndex = 2;
this.splitContainer1.TabStop = false;
@@ -481,7 +483,7 @@
this.tabControl1.Name = "tabControl1";
this.tabControl1.Padding = new System.Drawing.Point(17, 3);
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(480, 634);
this.tabControl1.Size = new System.Drawing.Size(480, 633);
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabControl1.TabIndex = 0;
this.tabControl1.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabPageSelected);
@@ -492,7 +494,7 @@
this.tabPage1.Controls.Add(this.treeSearch);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(472, 608);
this.tabPage1.Size = new System.Drawing.Size(472, 607);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Scene Hierarchy";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -502,7 +504,7 @@
this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false;
this.sceneTreeView.Location = new System.Drawing.Point(0, 21);
this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(472, 587);
this.sceneTreeView.TabIndex = 1;
@@ -514,7 +516,7 @@
this.treeSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.treeSearch.Location = new System.Drawing.Point(0, 0);
this.treeSearch.Name = "treeSearch";
this.treeSearch.Size = new System.Drawing.Size(472, 21);
this.treeSearch.Size = new System.Drawing.Size(472, 20);
this.treeSearch.TabIndex = 0;
this.treeSearch.Text = " Search ";
this.treeSearch.TextChanged += new System.EventHandler(this.treeSearch_TextChanged);
@@ -528,7 +530,7 @@
this.tabPage2.Controls.Add(this.listSearch);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(472, 608);
this.tabPage2.Size = new System.Drawing.Size(472, 664);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Asset List";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -545,10 +547,9 @@
this.assetListView.FullRowSelect = true;
this.assetListView.GridLines = true;
this.assetListView.HideSelection = false;
this.assetListView.LabelEdit = true;
this.assetListView.Location = new System.Drawing.Point(0, 21);
this.assetListView.Location = new System.Drawing.Point(0, 20);
this.assetListView.Name = "assetListView";
this.assetListView.Size = new System.Drawing.Size(472, 587);
this.assetListView.Size = new System.Drawing.Size(472, 644);
this.assetListView.TabIndex = 1;
this.assetListView.UseCompatibleStateImageBehavior = false;
this.assetListView.View = System.Windows.Forms.View.Details;
@@ -588,7 +589,7 @@
this.listSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.listSearch.Location = new System.Drawing.Point(0, 0);
this.listSearch.Name = "listSearch";
this.listSearch.Size = new System.Drawing.Size(472, 21);
this.listSearch.Size = new System.Drawing.Size(472, 20);
this.listSearch.TabIndex = 0;
this.listSearch.Text = " Filter ";
this.listSearch.TextChanged += new System.EventHandler(this.ListSearchTextChanged);
@@ -600,7 +601,7 @@
this.tabPage3.Controls.Add(this.classesListView);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(472, 608);
this.tabPage3.Size = new System.Drawing.Size(472, 664);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Asset Classes";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -616,7 +617,7 @@
this.classesListView.Location = new System.Drawing.Point(0, 0);
this.classesListView.MultiSelect = false;
this.classesListView.Name = "classesListView";
this.classesListView.Size = new System.Drawing.Size(472, 608);
this.classesListView.Size = new System.Drawing.Size(472, 664);
this.classesListView.TabIndex = 0;
this.classesListView.UseCompatibleStateImageBehavior = false;
this.classesListView.View = System.Windows.Forms.View.Details;
@@ -638,18 +639,18 @@
//
this.progressbarPanel.Controls.Add(this.progressBar1);
this.progressbarPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.progressbarPanel.Location = new System.Drawing.Point(0, 634);
this.progressbarPanel.Location = new System.Drawing.Point(0, 633);
this.progressbarPanel.Name = "progressbarPanel";
this.progressbarPanel.Padding = new System.Windows.Forms.Padding(1, 3, 1, 1);
this.progressbarPanel.Size = new System.Drawing.Size(480, 20);
this.progressbarPanel.Size = new System.Drawing.Size(480, 22);
this.progressbarPanel.TabIndex = 2;
//
// progressBar1
//
this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.progressBar1.Location = new System.Drawing.Point(1, 2);
this.progressBar1.Location = new System.Drawing.Point(1, 3);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(478, 17);
this.progressBar1.Size = new System.Drawing.Size(478, 18);
this.progressBar1.Step = 1;
this.progressBar1.TabIndex = 1;
//
@@ -666,7 +667,7 @@
this.previewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.previewPanel.Location = new System.Drawing.Point(0, 0);
this.previewPanel.Name = "previewPanel";
this.previewPanel.Size = new System.Drawing.Size(776, 632);
this.previewPanel.Size = new System.Drawing.Size(776, 633);
this.previewPanel.TabIndex = 1;
this.previewPanel.Resize += new System.EventHandler(this.preview_Resize);
//
@@ -675,9 +676,9 @@
this.assetInfoLabel.AutoSize = true;
this.assetInfoLabel.BackColor = System.Drawing.Color.Transparent;
this.assetInfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.assetInfoLabel.Location = new System.Drawing.Point(4, 7);
this.assetInfoLabel.Location = new System.Drawing.Point(4, 8);
this.assetInfoLabel.Name = "assetInfoLabel";
this.assetInfoLabel.Size = new System.Drawing.Size(0, 12);
this.assetInfoLabel.Size = new System.Drawing.Size(0, 13);
this.assetInfoLabel.TabIndex = 0;
//
// FMODpanel
@@ -696,7 +697,7 @@
this.FMODpanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.FMODpanel.Location = new System.Drawing.Point(0, 0);
this.FMODpanel.Name = "FMODpanel";
this.FMODpanel.Size = new System.Drawing.Size(776, 632);
this.FMODpanel.Size = new System.Drawing.Size(776, 633);
this.FMODpanel.TabIndex = 2;
this.FMODpanel.Visible = false;
//
@@ -704,9 +705,9 @@
//
this.FMODcopyright.AutoSize = true;
this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight;
this.FMODcopyright.Location = new System.Drawing.Point(232, 350);
this.FMODcopyright.Location = new System.Drawing.Point(232, 379);
this.FMODcopyright.Name = "FMODcopyright";
this.FMODcopyright.Size = new System.Drawing.Size(341, 12);
this.FMODcopyright.Size = new System.Drawing.Size(283, 13);
this.FMODcopyright.TabIndex = 9;
this.FMODcopyright.Text = "Audio Engine supplied by FMOD by Firelight Technologies.";
//
@@ -714,17 +715,17 @@
//
this.FMODinfoLabel.AutoSize = true;
this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODinfoLabel.Location = new System.Drawing.Point(287, 248);
this.FMODinfoLabel.Location = new System.Drawing.Point(287, 269);
this.FMODinfoLabel.Name = "FMODinfoLabel";
this.FMODinfoLabel.Size = new System.Drawing.Size(0, 12);
this.FMODinfoLabel.Size = new System.Drawing.Size(0, 13);
this.FMODinfoLabel.TabIndex = 8;
//
// FMODtimerLabel
//
this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODtimerLabel.Location = new System.Drawing.Point(422, 248);
this.FMODtimerLabel.Location = new System.Drawing.Point(422, 269);
this.FMODtimerLabel.Name = "FMODtimerLabel";
this.FMODtimerLabel.Size = new System.Drawing.Size(155, 12);
this.FMODtimerLabel.Size = new System.Drawing.Size(155, 13);
this.FMODtimerLabel.TabIndex = 7;
this.FMODtimerLabel.Text = "0:00.0 / 0:00.0";
this.FMODtimerLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
@@ -732,19 +733,19 @@
// FMODstatusLabel
//
this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODstatusLabel.Location = new System.Drawing.Point(231, 248);
this.FMODstatusLabel.Location = new System.Drawing.Point(231, 269);
this.FMODstatusLabel.Name = "FMODstatusLabel";
this.FMODstatusLabel.Size = new System.Drawing.Size(50, 12);
this.FMODstatusLabel.Size = new System.Drawing.Size(50, 13);
this.FMODstatusLabel.TabIndex = 6;
this.FMODstatusLabel.Text = "Stopped";
//
// FMODprogressBar
//
this.FMODprogressBar.AutoSize = false;
this.FMODprogressBar.Location = new System.Drawing.Point(231, 266);
this.FMODprogressBar.Location = new System.Drawing.Point(231, 288);
this.FMODprogressBar.Maximum = 1000;
this.FMODprogressBar.Name = "FMODprogressBar";
this.FMODprogressBar.Size = new System.Drawing.Size(350, 22);
this.FMODprogressBar.Size = new System.Drawing.Size(350, 24);
this.FMODprogressBar.TabIndex = 5;
this.FMODprogressBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.FMODprogressBar.Scroll += new System.EventHandler(this.FMODprogressBar_Scroll);
@@ -754,7 +755,7 @@
// FMODvolumeBar
//
this.FMODvolumeBar.LargeChange = 2;
this.FMODvolumeBar.Location = new System.Drawing.Point(478, 293);
this.FMODvolumeBar.Location = new System.Drawing.Point(478, 317);
this.FMODvolumeBar.Name = "FMODvolumeBar";
this.FMODvolumeBar.Size = new System.Drawing.Size(104, 45);
this.FMODvolumeBar.TabIndex = 4;
@@ -765,9 +766,9 @@
// FMODloopButton
//
this.FMODloopButton.Appearance = System.Windows.Forms.Appearance.Button;
this.FMODloopButton.Location = new System.Drawing.Point(417, 293);
this.FMODloopButton.Location = new System.Drawing.Point(417, 317);
this.FMODloopButton.Name = "FMODloopButton";
this.FMODloopButton.Size = new System.Drawing.Size(55, 42);
this.FMODloopButton.Size = new System.Drawing.Size(55, 46);
this.FMODloopButton.TabIndex = 3;
this.FMODloopButton.Text = "Loop";
this.FMODloopButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -776,9 +777,9 @@
//
// FMODstopButton
//
this.FMODstopButton.Location = new System.Drawing.Point(356, 293);
this.FMODstopButton.Location = new System.Drawing.Point(356, 317);
this.FMODstopButton.Name = "FMODstopButton";
this.FMODstopButton.Size = new System.Drawing.Size(55, 42);
this.FMODstopButton.Size = new System.Drawing.Size(55, 46);
this.FMODstopButton.TabIndex = 2;
this.FMODstopButton.Text = "Stop";
this.FMODstopButton.UseVisualStyleBackColor = true;
@@ -786,9 +787,9 @@
//
// FMODpauseButton
//
this.FMODpauseButton.Location = new System.Drawing.Point(295, 293);
this.FMODpauseButton.Location = new System.Drawing.Point(295, 317);
this.FMODpauseButton.Name = "FMODpauseButton";
this.FMODpauseButton.Size = new System.Drawing.Size(55, 42);
this.FMODpauseButton.Size = new System.Drawing.Size(55, 46);
this.FMODpauseButton.TabIndex = 1;
this.FMODpauseButton.Text = "Pause";
this.FMODpauseButton.UseVisualStyleBackColor = true;
@@ -796,9 +797,9 @@
//
// FMODplayButton
//
this.FMODplayButton.Location = new System.Drawing.Point(234, 293);
this.FMODplayButton.Location = new System.Drawing.Point(234, 317);
this.FMODplayButton.Name = "FMODplayButton";
this.FMODplayButton.Size = new System.Drawing.Size(55, 42);
this.FMODplayButton.Size = new System.Drawing.Size(55, 46);
this.FMODplayButton.TabIndex = 0;
this.FMODplayButton.Text = "Play";
this.FMODplayButton.UseVisualStyleBackColor = true;
@@ -811,7 +812,7 @@
this.fontPreviewBox.Location = new System.Drawing.Point(0, 0);
this.fontPreviewBox.Name = "fontPreviewBox";
this.fontPreviewBox.ReadOnly = true;
this.fontPreviewBox.Size = new System.Drawing.Size(776, 632);
this.fontPreviewBox.Size = new System.Drawing.Size(776, 633);
this.fontPreviewBox.TabIndex = 0;
this.fontPreviewBox.Text = resources.GetString("fontPreviewBox.Text");
this.fontPreviewBox.Visible = false;
@@ -826,7 +827,7 @@
this.textPreviewBox.Name = "textPreviewBox";
this.textPreviewBox.ReadOnly = true;
this.textPreviewBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textPreviewBox.Size = new System.Drawing.Size(776, 632);
this.textPreviewBox.Size = new System.Drawing.Size(776, 633);
this.textPreviewBox.TabIndex = 2;
this.textPreviewBox.Visible = false;
this.textPreviewBox.WordWrap = false;
@@ -837,7 +838,7 @@
this.glControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.glControl1.Location = new System.Drawing.Point(0, 0);
this.glControl1.Name = "glControl1";
this.glControl1.Size = new System.Drawing.Size(776, 632);
this.glControl1.Size = new System.Drawing.Size(776, 633);
this.glControl1.TabIndex = 4;
this.glControl1.Visible = false;
this.glControl1.VSync = false;
@@ -854,7 +855,7 @@
this.classPreviewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.classPreviewPanel.Location = new System.Drawing.Point(0, 0);
this.classPreviewPanel.Name = "classPreviewPanel";
this.classPreviewPanel.Size = new System.Drawing.Size(776, 632);
this.classPreviewPanel.Size = new System.Drawing.Size(776, 633);
this.classPreviewPanel.TabIndex = 3;
this.classPreviewPanel.Visible = false;
//
@@ -866,7 +867,7 @@
this.classTextBox.Name = "classTextBox";
this.classTextBox.ReadOnly = true;
this.classTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.classTextBox.Size = new System.Drawing.Size(776, 632);
this.classTextBox.Size = new System.Drawing.Size(776, 633);
this.classTextBox.TabIndex = 3;
this.classTextBox.WordWrap = false;
//
@@ -874,7 +875,7 @@
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1});
this.statusStrip1.Location = new System.Drawing.Point(0, 632);
this.statusStrip1.Location = new System.Drawing.Point(0, 633);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(776, 22);
this.statusStrip1.TabIndex = 2;
@@ -910,24 +911,40 @@
//
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem,
this.exportSelectedAssetsToolStripMenuItem,
this.dumpSelectedAssetsToolStripMenuItem,
this.exportAnimatorwithselectedAnimationClipMenuItem,
this.goToSceneHierarchyToolStripMenuItem,
this.showOriginalFileToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(327, 92);
this.contextMenuStrip1.Size = new System.Drawing.Size(304, 136);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// exportSelectedAssetsToolStripMenuItem
//
this.exportSelectedAssetsToolStripMenuItem.Name = "exportSelectedAssetsToolStripMenuItem";
this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
this.exportSelectedAssetsToolStripMenuItem.Text = "Export selected assets";
this.exportSelectedAssetsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsToolStripMenuItem_Click);
//
// dumpSelectedAssetsToolStripMenuItem
//
this.dumpSelectedAssetsToolStripMenuItem.Name = "dumpSelectedAssetsToolStripMenuItem";
this.dumpSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
this.dumpSelectedAssetsToolStripMenuItem.Text = "Dump selected assets";
this.dumpSelectedAssetsToolStripMenuItem.Click += new System.EventHandler(this.dumpSelectedAssetsToolStripMenuItem_Click);
//
// exportAnimatorwithselectedAnimationClipMenuItem
//
this.exportAnimatorwithselectedAnimationClipMenuItem.Name = "exportAnimatorwithselectedAnimationClipMenuItem";
this.exportAnimatorwithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(326, 22);
this.exportAnimatorwithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(303, 22);
this.exportAnimatorwithselectedAnimationClipMenuItem.Text = "Export Animator + selected AnimationClips";
this.exportAnimatorwithselectedAnimationClipMenuItem.Visible = false;
this.exportAnimatorwithselectedAnimationClipMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click);
@@ -935,7 +952,7 @@
// goToSceneHierarchyToolStripMenuItem
//
this.goToSceneHierarchyToolStripMenuItem.Name = "goToSceneHierarchyToolStripMenuItem";
this.goToSceneHierarchyToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.goToSceneHierarchyToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
this.goToSceneHierarchyToolStripMenuItem.Text = "Go to scene hierarchy";
this.goToSceneHierarchyToolStripMenuItem.Visible = false;
this.goToSceneHierarchyToolStripMenuItem.Click += new System.EventHandler(this.goToSceneHierarchyToolStripMenuItem_Click);
@@ -943,14 +960,14 @@
// showOriginalFileToolStripMenuItem
//
this.showOriginalFileToolStripMenuItem.Name = "showOriginalFileToolStripMenuItem";
this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
this.showOriginalFileToolStripMenuItem.Text = "Show original file";
this.showOriginalFileToolStripMenuItem.Visible = false;
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
//
// AssetStudioGUIForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1264, 681);
this.Controls.Add(this.splitContainer1);
@@ -958,7 +975,7 @@
this.Icon = global::AssetStudioGUI.Properties.Resources._as;
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(620, 372);
this.MinimumSize = new System.Drawing.Size(620, 400);
this.Name = "AssetStudioGUIForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AssetStudioGUI";
@@ -1080,6 +1097,8 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
private System.Windows.Forms.ColumnHeader columnHeaderContainer;
private System.Windows.Forms.ColumnHeader columnHeaderPathID;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem dumpSelectedAssetsToolStripMenuItem;
}
}

View File

@@ -29,6 +29,7 @@ namespace AssetStudioGUI
private AssetItem lastSelectedItem;
private AssetItem lastLoadedAsset;
private Bitmap imageTexture;
private string tempClipboard;
private FMOD.System system;
private FMOD.Sound sound;
@@ -98,6 +99,35 @@ namespace AssetStudioGUI
Logger.Default = new GUILogger(StatusStripUpdate);
Progress.Default = new GUIProgress(SetProgressBarValue);
Studio.StatusStripUpdate = StatusStripUpdate;
this.AllowDrop = true;
this.DragEnter += AssetStudioGUIForm_DragEnter;
this.DragDrop += AssetStudioGUIForm_DragDrop;
}
private void AssetStudioGUIForm_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Move;
}
private async void AssetStudioGUIForm_DragDrop(object sender, DragEventArgs e)
{
string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (paths.Length > 0)
{
ResetForm();
if (paths.Length == 1 && Directory.Exists(paths[0]))
{
await Task.Run(() => assetsManager.LoadFolder(paths[0]));
}
else
{
await Task.Run(() => assetsManager.LoadFiles(paths));
}
BuildAssetStructures();
}
}
private async void loadFile_Click(object sender, EventArgs e)
@@ -441,7 +471,7 @@ namespace AssetStudioGUI
private void treeSearch_Leave(object sender, EventArgs e)
{
if (treeSearch.Text == "")
if (string.IsNullOrEmpty(treeSearch.Text))
{
treeSearch.Text = " Search ";
treeSearch.ForeColor = SystemColors.GrayText;
@@ -511,7 +541,7 @@ namespace AssetStudioGUI
private void listSearch_Leave(object sender, EventArgs e)
{
if (listSearch.Text == "")
if (string.IsNullOrEmpty(listSearch.Text))
{
enableFiltering = false;
listSearch.Text = " Filter ";
@@ -563,6 +593,15 @@ namespace AssetStudioGUI
return reverseSort ? bsf.CompareTo(asf) : asf.CompareTo(bsf);
});
}
else if (sortColumn == 3) // PathID
{
visibleAssets.Sort((x, y) =>
{
long pathID_X = x.m_PathID;
long pathID_Y = y.m_PathID;
return reverseSort ? pathID_Y.CompareTo(pathID_X) : pathID_X.CompareTo(pathID_Y);
});
}
else
{
visibleAssets.Sort((a, b) =>
@@ -1081,7 +1120,7 @@ namespace AssetStudioGUI
private void PreviewSprite(AssetItem assetItem, Sprite m_Sprite)
{
var bitmap = SpriteHelper.GetImageFromSprite(m_Sprite);
var bitmap = m_Sprite.GetImage();
if (bitmap != null)
{
assetItem.InfoText = $"Width: {bitmap.Width}\nHeight: {bitmap.Height}\n";
@@ -1160,6 +1199,8 @@ namespace AssetStudioGUI
reverseSort = false;
enableFiltering = false;
listSearch.Text = " Filter ";
if (tabControl1.SelectedIndex == 1)
assetListView.Select();
var count = filterTypeToolStripMenuItem.DropDownItems.Count;
for (var i = 1; i < count; i++)
@@ -1198,15 +1239,26 @@ namespace AssetStudioGUI
}
}
tempClipboard = assetListView.HitTest(new Point(e.X, e.Y)).SubItem.Text;
contextMenuStrip1.Show(assetListView, e.X, e.Y);
}
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(tempClipboard);
}
private void exportSelectedAssetsToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportAssets(2, ExportType.Convert);
}
private void dumpSelectedAssetsToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportAssets(2, ExportType.Dump);
}
private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e)
{
var selectasset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]];

View File

@@ -40,7 +40,7 @@ namespace AssetStudioGUI
hItem = node.Handle,
mask = TVIF_STATE,
stateMask = TVIS_STATEIMAGEMASK,
state = 0
state = node.StateImageIndex //freeze bugfix (no)
};
SendMessage(node.TreeView.Handle, TVM_SETITEM, IntPtr.Zero, ref tvi);
}

View File

@@ -31,6 +31,8 @@
this.OKbutton = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pathIDAsDumpName = new System.Windows.Forms.CheckBox();
this.pathIDAsImageName = new System.Windows.Forms.CheckBox();
this.openAfterExport = new System.Windows.Forms.CheckBox();
this.restoreExtensionName = new System.Windows.Forms.CheckBox();
this.assetGroupOptions = new System.Windows.Forms.ComboBox();
@@ -69,9 +71,9 @@
//
// OKbutton
//
this.OKbutton.Location = new System.Drawing.Point(308, 320);
this.OKbutton.Location = new System.Drawing.Point(308, 347);
this.OKbutton.Name = "OKbutton";
this.OKbutton.Size = new System.Drawing.Size(75, 21);
this.OKbutton.Size = new System.Drawing.Size(75, 23);
this.OKbutton.TabIndex = 6;
this.OKbutton.Text = "OK";
this.OKbutton.UseVisualStyleBackColor = true;
@@ -80,9 +82,9 @@
// Cancel
//
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(389, 320);
this.Cancel.Location = new System.Drawing.Point(389, 347);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 21);
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 7;
this.Cancel.Text = "Cancel";
this.Cancel.UseVisualStyleBackColor = true;
@@ -91,6 +93,8 @@
// groupBox1
//
this.groupBox1.AutoSize = true;
this.groupBox1.Controls.Add(this.pathIDAsDumpName);
this.groupBox1.Controls.Add(this.pathIDAsImageName);
this.groupBox1.Controls.Add(this.openAfterExport);
this.groupBox1.Controls.Add(this.restoreExtensionName);
this.groupBox1.Controls.Add(this.assetGroupOptions);
@@ -98,21 +102,45 @@
this.groupBox1.Controls.Add(this.convertAudio);
this.groupBox1.Controls.Add(this.panel1);
this.groupBox1.Controls.Add(this.converttexture);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Location = new System.Drawing.Point(12, 13);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(232, 302);
this.groupBox1.Size = new System.Drawing.Size(246, 327);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Export";
//
// pathIDAsDumpName
//
this.pathIDAsDumpName.AutoSize = true;
this.pathIDAsDumpName.Checked = true;
this.pathIDAsDumpName.CheckState = System.Windows.Forms.CheckState.Checked;
this.pathIDAsDumpName.Location = new System.Drawing.Point(6, 217);
this.pathIDAsDumpName.Name = "pathIDAsDumpName";
this.pathIDAsDumpName.Size = new System.Drawing.Size(201, 17);
this.pathIDAsDumpName.TabIndex = 12;
this.pathIDAsDumpName.Text = "Dump assets with PathID as filename";
this.pathIDAsDumpName.UseVisualStyleBackColor = true;
//
// pathIDAsImageName
//
this.pathIDAsImageName.AutoSize = true;
this.pathIDAsImageName.Checked = true;
this.pathIDAsImageName.CheckState = System.Windows.Forms.CheckState.Checked;
this.pathIDAsImageName.Location = new System.Drawing.Point(6, 196);
this.pathIDAsImageName.Name = "pathIDAsImageName";
this.pathIDAsImageName.Size = new System.Drawing.Size(234, 17);
this.pathIDAsImageName.TabIndex = 11;
this.pathIDAsImageName.Text = "Export image assets with PathID as filename";
this.pathIDAsImageName.UseVisualStyleBackColor = true;
//
// openAfterExport
//
this.openAfterExport.AutoSize = true;
this.openAfterExport.Checked = true;
this.openAfterExport.CheckState = System.Windows.Forms.CheckState.Checked;
this.openAfterExport.Location = new System.Drawing.Point(6, 160);
this.openAfterExport.Location = new System.Drawing.Point(6, 173);
this.openAfterExport.Name = "openAfterExport";
this.openAfterExport.Size = new System.Drawing.Size(168, 16);
this.openAfterExport.Size = new System.Drawing.Size(137, 17);
this.openAfterExport.TabIndex = 10;
this.openAfterExport.Text = "Open folder after export";
this.openAfterExport.UseVisualStyleBackColor = true;
@@ -122,9 +150,9 @@
this.restoreExtensionName.AutoSize = true;
this.restoreExtensionName.Checked = true;
this.restoreExtensionName.CheckState = System.Windows.Forms.CheckState.Checked;
this.restoreExtensionName.Location = new System.Drawing.Point(6, 58);
this.restoreExtensionName.Location = new System.Drawing.Point(6, 63);
this.restoreExtensionName.Name = "restoreExtensionName";
this.restoreExtensionName.Size = new System.Drawing.Size(216, 16);
this.restoreExtensionName.Size = new System.Drawing.Size(190, 17);
this.restoreExtensionName.TabIndex = 9;
this.restoreExtensionName.Text = "Restore TextAsset extension name";
this.restoreExtensionName.UseVisualStyleBackColor = true;
@@ -138,17 +166,17 @@
"container path",
"source file name",
"do not group"});
this.assetGroupOptions.Location = new System.Drawing.Point(6, 32);
this.assetGroupOptions.Location = new System.Drawing.Point(6, 35);
this.assetGroupOptions.Name = "assetGroupOptions";
this.assetGroupOptions.Size = new System.Drawing.Size(149, 20);
this.assetGroupOptions.Size = new System.Drawing.Size(149, 21);
this.assetGroupOptions.TabIndex = 8;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 17);
this.label6.Location = new System.Drawing.Point(6, 18);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(149, 12);
this.label6.Size = new System.Drawing.Size(127, 13);
this.label6.TabIndex = 7;
this.label6.Text = "Group exported assets by";
//
@@ -157,9 +185,9 @@
this.convertAudio.AutoSize = true;
this.convertAudio.Checked = true;
this.convertAudio.CheckState = System.Windows.Forms.CheckState.Checked;
this.convertAudio.Location = new System.Drawing.Point(6, 138);
this.convertAudio.Location = new System.Drawing.Point(6, 150);
this.convertAudio.Name = "convertAudio";
this.convertAudio.Size = new System.Drawing.Size(198, 16);
this.convertAudio.Size = new System.Drawing.Size(179, 17);
this.convertAudio.TabIndex = 6;
this.convertAudio.Text = "Convert AudioClip to WAV(PCM)";
this.convertAudio.UseVisualStyleBackColor = true;
@@ -170,17 +198,17 @@
this.panel1.Controls.Add(this.tojpg);
this.panel1.Controls.Add(this.topng);
this.panel1.Controls.Add(this.tobmp);
this.panel1.Location = new System.Drawing.Point(20, 102);
this.panel1.Location = new System.Drawing.Point(20, 111);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(202, 30);
this.panel1.Size = new System.Drawing.Size(202, 33);
this.panel1.TabIndex = 5;
//
// totga
//
this.totga.AutoSize = true;
this.totga.Location = new System.Drawing.Point(150, 6);
this.totga.Location = new System.Drawing.Point(150, 7);
this.totga.Name = "totga";
this.totga.Size = new System.Drawing.Size(41, 16);
this.totga.Size = new System.Drawing.Size(47, 17);
this.totga.TabIndex = 2;
this.totga.Text = "TGA";
this.totga.UseVisualStyleBackColor = true;
@@ -188,9 +216,9 @@
// tojpg
//
this.tojpg.AutoSize = true;
this.tojpg.Location = new System.Drawing.Point(97, 6);
this.tojpg.Location = new System.Drawing.Point(97, 7);
this.tojpg.Name = "tojpg";
this.tojpg.Size = new System.Drawing.Size(47, 16);
this.tojpg.Size = new System.Drawing.Size(52, 17);
this.tojpg.TabIndex = 4;
this.tojpg.Text = "JPEG";
this.tojpg.UseVisualStyleBackColor = true;
@@ -199,9 +227,9 @@
//
this.topng.AutoSize = true;
this.topng.Checked = true;
this.topng.Location = new System.Drawing.Point(50, 6);
this.topng.Location = new System.Drawing.Point(50, 7);
this.topng.Name = "topng";
this.topng.Size = new System.Drawing.Size(41, 16);
this.topng.Size = new System.Drawing.Size(48, 17);
this.topng.TabIndex = 3;
this.topng.TabStop = true;
this.topng.Text = "PNG";
@@ -210,9 +238,9 @@
// tobmp
//
this.tobmp.AutoSize = true;
this.tobmp.Location = new System.Drawing.Point(3, 6);
this.tobmp.Location = new System.Drawing.Point(3, 7);
this.tobmp.Name = "tobmp";
this.tobmp.Size = new System.Drawing.Size(41, 16);
this.tobmp.Size = new System.Drawing.Size(48, 17);
this.tobmp.TabIndex = 2;
this.tobmp.Text = "BMP";
this.tobmp.UseVisualStyleBackColor = true;
@@ -222,9 +250,9 @@
this.converttexture.AutoSize = true;
this.converttexture.Checked = true;
this.converttexture.CheckState = System.Windows.Forms.CheckState.Checked;
this.converttexture.Location = new System.Drawing.Point(6, 80);
this.converttexture.Location = new System.Drawing.Point(6, 87);
this.converttexture.Name = "converttexture";
this.converttexture.Size = new System.Drawing.Size(126, 16);
this.converttexture.Size = new System.Drawing.Size(116, 17);
this.converttexture.TabIndex = 1;
this.converttexture.Text = "Convert Texture2D";
this.converttexture.UseVisualStyleBackColor = true;
@@ -248,9 +276,9 @@
this.groupBox2.Controls.Add(this.castToBone);
this.groupBox2.Controls.Add(this.exportAllNodes);
this.groupBox2.Controls.Add(this.eulerFilter);
this.groupBox2.Location = new System.Drawing.Point(250, 12);
this.groupBox2.Location = new System.Drawing.Point(258, 13);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(214, 302);
this.groupBox2.Size = new System.Drawing.Size(206, 327);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Fbx";
@@ -260,9 +288,9 @@
this.exportBlendShape.AutoSize = true;
this.exportBlendShape.Checked = true;
this.exportBlendShape.CheckState = System.Windows.Forms.CheckState.Checked;
this.exportBlendShape.Location = new System.Drawing.Point(6, 127);
this.exportBlendShape.Location = new System.Drawing.Point(6, 138);
this.exportBlendShape.Name = "exportBlendShape";
this.exportBlendShape.Size = new System.Drawing.Size(126, 16);
this.exportBlendShape.Size = new System.Drawing.Size(114, 17);
this.exportBlendShape.TabIndex = 22;
this.exportBlendShape.Text = "Export blendshape";
this.exportBlendShape.UseVisualStyleBackColor = true;
@@ -272,9 +300,9 @@
this.exportAnimations.AutoSize = true;
this.exportAnimations.Checked = true;
this.exportAnimations.CheckState = System.Windows.Forms.CheckState.Checked;
this.exportAnimations.Location = new System.Drawing.Point(6, 105);
this.exportAnimations.Location = new System.Drawing.Point(6, 114);
this.exportAnimations.Name = "exportAnimations";
this.exportAnimations.Size = new System.Drawing.Size(126, 16);
this.exportAnimations.Size = new System.Drawing.Size(109, 17);
this.exportAnimations.TabIndex = 21;
this.exportAnimations.Text = "Export animations";
this.exportAnimations.UseVisualStyleBackColor = true;
@@ -287,9 +315,9 @@
0,
0,
131072});
this.scaleFactor.Location = new System.Drawing.Point(83, 202);
this.scaleFactor.Location = new System.Drawing.Point(83, 219);
this.scaleFactor.Name = "scaleFactor";
this.scaleFactor.Size = new System.Drawing.Size(60, 21);
this.scaleFactor.Size = new System.Drawing.Size(60, 20);
this.scaleFactor.TabIndex = 20;
this.scaleFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.scaleFactor.Value = new decimal(new int[] {
@@ -301,9 +329,9 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 204);
this.label5.Location = new System.Drawing.Point(6, 221);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(71, 12);
this.label5.Size = new System.Drawing.Size(64, 13);
this.label5.TabIndex = 19;
this.label5.Text = "ScaleFactor";
//
@@ -314,17 +342,17 @@
this.fbxFormat.Items.AddRange(new object[] {
"Binary",
"Ascii"});
this.fbxFormat.Location = new System.Drawing.Point(77, 233);
this.fbxFormat.Location = new System.Drawing.Point(77, 252);
this.fbxFormat.Name = "fbxFormat";
this.fbxFormat.Size = new System.Drawing.Size(61, 20);
this.fbxFormat.Size = new System.Drawing.Size(61, 21);
this.fbxFormat.TabIndex = 18;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 236);
this.label4.Location = new System.Drawing.Point(6, 256);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.Size = new System.Drawing.Size(59, 13);
this.label4.TabIndex = 17;
this.label4.Text = "FBXFormat";
//
@@ -339,25 +367,25 @@
"7.3",
"7.4",
"7.5"});
this.fbxVersion.Location = new System.Drawing.Point(77, 262);
this.fbxVersion.Location = new System.Drawing.Point(77, 284);
this.fbxVersion.Name = "fbxVersion";
this.fbxVersion.Size = new System.Drawing.Size(47, 20);
this.fbxVersion.Size = new System.Drawing.Size(47, 21);
this.fbxVersion.TabIndex = 16;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 265);
this.label3.Location = new System.Drawing.Point(6, 287);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.Size = new System.Drawing.Size(62, 13);
this.label3.TabIndex = 15;
this.label3.Text = "FBXVersion";
//
// boneSize
//
this.boneSize.Location = new System.Drawing.Point(65, 175);
this.boneSize.Location = new System.Drawing.Point(65, 190);
this.boneSize.Name = "boneSize";
this.boneSize.Size = new System.Drawing.Size(46, 21);
this.boneSize.Size = new System.Drawing.Size(46, 20);
this.boneSize.TabIndex = 11;
this.boneSize.Value = new decimal(new int[] {
10,
@@ -368,9 +396,9 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 177);
this.label2.Location = new System.Drawing.Point(6, 192);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.Size = new System.Drawing.Size(52, 13);
this.label2.TabIndex = 10;
this.label2.Text = "BoneSize";
//
@@ -379,9 +407,9 @@
this.exportSkins.AutoSize = true;
this.exportSkins.Checked = true;
this.exportSkins.CheckState = System.Windows.Forms.CheckState.Checked;
this.exportSkins.Location = new System.Drawing.Point(6, 83);
this.exportSkins.Location = new System.Drawing.Point(6, 90);
this.exportSkins.Name = "exportSkins";
this.exportSkins.Size = new System.Drawing.Size(96, 16);
this.exportSkins.Size = new System.Drawing.Size(83, 17);
this.exportSkins.TabIndex = 8;
this.exportSkins.Text = "Export skins";
this.exportSkins.UseVisualStyleBackColor = true;
@@ -389,9 +417,9 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 39);
this.label1.Location = new System.Drawing.Point(26, 42);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(95, 12);
this.label1.Size = new System.Drawing.Size(72, 13);
this.label1.TabIndex = 7;
this.label1.Text = "FilterPrecision";
//
@@ -403,9 +431,9 @@
0,
0,
131072});
this.filterPrecision.Location = new System.Drawing.Point(127, 37);
this.filterPrecision.Location = new System.Drawing.Point(127, 40);
this.filterPrecision.Name = "filterPrecision";
this.filterPrecision.Size = new System.Drawing.Size(51, 21);
this.filterPrecision.Size = new System.Drawing.Size(51, 20);
this.filterPrecision.TabIndex = 6;
this.filterPrecision.Value = new decimal(new int[] {
25,
@@ -416,9 +444,9 @@
// castToBone
//
this.castToBone.AutoSize = true;
this.castToBone.Location = new System.Drawing.Point(6, 149);
this.castToBone.Location = new System.Drawing.Point(6, 161);
this.castToBone.Name = "castToBone";
this.castToBone.Size = new System.Drawing.Size(156, 16);
this.castToBone.Size = new System.Drawing.Size(131, 17);
this.castToBone.TabIndex = 5;
this.castToBone.Text = "All nodes cast to bone";
this.castToBone.UseVisualStyleBackColor = true;
@@ -428,9 +456,9 @@
this.exportAllNodes.AutoSize = true;
this.exportAllNodes.Checked = true;
this.exportAllNodes.CheckState = System.Windows.Forms.CheckState.Checked;
this.exportAllNodes.Location = new System.Drawing.Point(6, 61);
this.exportAllNodes.Location = new System.Drawing.Point(6, 66);
this.exportAllNodes.Name = "exportAllNodes";
this.exportAllNodes.Size = new System.Drawing.Size(120, 16);
this.exportAllNodes.Size = new System.Drawing.Size(101, 17);
this.exportAllNodes.TabIndex = 4;
this.exportAllNodes.Text = "Export all nodes";
this.exportAllNodes.UseVisualStyleBackColor = true;
@@ -440,9 +468,9 @@
this.eulerFilter.AutoSize = true;
this.eulerFilter.Checked = true;
this.eulerFilter.CheckState = System.Windows.Forms.CheckState.Checked;
this.eulerFilter.Location = new System.Drawing.Point(6, 20);
this.eulerFilter.Location = new System.Drawing.Point(6, 22);
this.eulerFilter.Name = "eulerFilter";
this.eulerFilter.Size = new System.Drawing.Size(90, 16);
this.eulerFilter.Size = new System.Drawing.Size(72, 17);
this.eulerFilter.TabIndex = 3;
this.eulerFilter.Text = "EulerFilter";
this.eulerFilter.UseVisualStyleBackColor = true;
@@ -450,10 +478,10 @@
// ExportOptions
//
this.AcceptButton = this.OKbutton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(477, 351);
this.ClientSize = new System.Drawing.Size(477, 380);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.Cancel);
@@ -512,5 +540,7 @@
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox restoreExtensionName;
private System.Windows.Forms.CheckBox openAfterExport;
private System.Windows.Forms.CheckBox pathIDAsImageName;
private System.Windows.Forms.CheckBox pathIDAsDumpName;
}
}

View File

@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AssetStudioGUI
@@ -40,6 +33,8 @@ namespace AssetStudioGUI
scaleFactor.Value = Properties.Settings.Default.scaleFactor;
fbxVersion.SelectedIndex = Properties.Settings.Default.fbxVersion;
fbxFormat.SelectedIndex = Properties.Settings.Default.fbxFormat;
pathIDAsImageName.Checked = Properties.Settings.Default.pathIDAsImageName;
pathIDAsDumpName.Checked = Properties.Settings.Default.pathIDAsDumpName;
}
private void OKbutton_Click(object sender, EventArgs e)
@@ -68,6 +63,8 @@ namespace AssetStudioGUI
Properties.Settings.Default.scaleFactor = scaleFactor.Value;
Properties.Settings.Default.fbxVersion = fbxVersion.SelectedIndex;
Properties.Settings.Default.fbxFormat = fbxFormat.SelectedIndex;
Properties.Settings.Default.pathIDAsImageName = pathIDAsImageName.Checked;
Properties.Settings.Default.pathIDAsDumpName = pathIDAsDumpName.Checked;
Properties.Settings.Default.Save();
DialogResult = DialogResult.OK;
Close();

View File

@@ -12,6 +12,7 @@ namespace AssetStudioGUI
{
public static bool ExportTexture2D(AssetItem item, string exportPathName)
{
string exportFullName;
var m_Texture2D = (Texture2D)item.Asset;
if (Properties.Settings.Default.convertTexture)
{
@@ -36,7 +37,10 @@ namespace AssetStudioGUI
tga = true;
break;
}
var exportFullName = exportPathName + item.Text + "." + ext.ToLower();
if (Properties.Settings.Default.pathIDAsImageName)
exportFullName = exportPathName + item.m_PathID.ToString() + "." + ext.ToLower();
else
exportFullName = exportPathName + item.Text + "." + ext.ToLower();
if (ExportFileExists(exportFullName))
return false;
if (tga)
@@ -51,7 +55,10 @@ namespace AssetStudioGUI
}
else
{
var exportFullName = exportPathName + item.Text + ".tex";
if (Properties.Settings.Default.pathIDAsImageName)
exportFullName = exportPathName + item.m_PathID.ToString() + ".tex";
else
exportFullName = exportPathName + item.Text + ".tex";
if (ExportFileExists(exportFullName))
return false;
File.WriteAllBytes(exportFullName, m_Texture2D.image_data.GetData());
@@ -66,7 +73,7 @@ namespace AssetStudioGUI
if (m_AudioData == null || m_AudioData.Length == 0)
return false;
var converter = new AudioClipConverter(m_AudioClip);
if (Properties.Settings.Default.convertAudio && converter.IsFMODSupport)
if (Properties.Settings.Default.convertAudio && converter.IsSupport)
{
var exportFullName = exportPath + item.Text + ".wav";
if (ExportFileExists(exportFullName))
@@ -267,6 +274,7 @@ namespace AssetStudioGUI
public static bool ExportSprite(AssetItem item, string exportPath)
{
ImageFormat format = null;
string exportFullName;
var type = Properties.Settings.Default.convertType;
bool tga = false;
switch (type)
@@ -284,10 +292,13 @@ namespace AssetStudioGUI
tga = true;
break;
}
var exportFullName = exportPath + item.Text + "." + type.ToLower();
if (Properties.Settings.Default.pathIDAsImageName)
exportFullName = exportPath + item.m_PathID.ToString() + "." + type.ToLower();
else
exportFullName = exportPath + item.Text + "." + type.ToLower();
if (ExportFileExists(exportFullName))
return false;
var bitmap = SpriteHelper.GetImageFromSprite((Sprite)item.Asset);
var bitmap = ((Sprite)item.Asset).GetImage();
if (bitmap != null)
{
if (tga)
@@ -364,7 +375,15 @@ namespace AssetStudioGUI
public static bool ExportDumpFile(AssetItem item, string exportPath)
{
var exportFullName = exportPath + item.Text + ".txt";
string exportFullName;
if (Properties.Settings.Default.pathIDAsDumpName)
{
exportFullName = exportPath + item.m_PathID.ToString() + ".txt";
}
else
{
exportFullName = exportPath + item.Text + ".txt";
}
if (ExportFileExists(exportFullName))
return false;
var str = item.Asset.Dump();

View File

@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AssetStudioGUI")]
[assembly: AssemblyTitle("AssetStudioGUI Mod by VaDiM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.14.38.5")]
[assembly: AssemblyFileVersion("0.14.38.5")]

View File

@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -12,7 +12,7 @@ namespace AssetStudioGUI.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -262,5 +262,29 @@ namespace AssetStudioGUI.Properties {
this["restoreExtensionName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool pathIDAsImageName {
get {
return ((bool)(this["pathIDAsImageName"]));
}
set {
this["pathIDAsImageName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool pathIDAsDumpName {
get {
return ((bool)(this["pathIDAsDumpName"]));
}
set {
this["pathIDAsDumpName"] = value;
}
}
}
}

View File

@@ -62,5 +62,11 @@
<Setting Name="restoreExtensionName" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="pathIDAsImageName" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="pathIDAsDumpName" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -55,7 +55,7 @@ namespace AssetStudioGUI
StatusStripUpdate($"Decompressing {Path.GetFileName(bundleFileName)} ...");
var bundleFile = new BundleFile(reader, bundleFileName);
reader.Dispose();
if (bundleFile.fileList.Count > 0)
if (bundleFile.fileList.Length > 0)
{
var extractPath = bundleFileName + "_unpacked\\";
return ExtractStreamFile(extractPath, bundleFile.fileList);
@@ -68,7 +68,7 @@ namespace AssetStudioGUI
StatusStripUpdate($"Decompressing {Path.GetFileName(webFileName)} ...");
var webFile = new WebFile(reader);
reader.Dispose();
if (webFile.fileList.Count > 0)
if (webFile.fileList.Length > 0)
{
var extractPath = webFileName + "_unpacked\\";
return ExtractStreamFile(extractPath, webFile.fileList);
@@ -76,7 +76,7 @@ namespace AssetStudioGUI
return 0;
}
private static int ExtractStreamFile(string extractPath, List<StreamFile> fileList)
private static int ExtractStreamFile(string extractPath,StreamFile[] fileList)
{
int extractedCount = 0;
foreach (var file in fileList)
@@ -174,7 +174,11 @@ namespace AssetStudioGUI
productName = m_PlayerSettings.productName;
break;
case AssetBundle m_AssetBundle:
containers = m_AssetBundle.m_Container.ToDictionary(x => x.Value.asset.m_PathID, x => x.Key);
containers = new Dictionary<long, string>();
foreach (var m_Container in m_AssetBundle.m_Container)
{
containers[m_Container.Value.asset.m_PathID] = m_Container.Key;
}
assetItem.Text = m_AssetBundle.m_Name;
break;
case NamedObject m_NamedObject:

View File

@@ -70,6 +70,12 @@
<setting name="restoreExtensionName" serializeAs="String">
<value>True</value>
</setting>
<setting name="pathIDAsImageName" serializeAs="String">
<value>False</value>
</setting>
<setting name="pathIDAsDumpName" serializeAs="String">
<value>False</value>
</setting>
</AssetStudioGUI.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -27,7 +27,7 @@
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>

View File

@@ -116,24 +116,24 @@ namespace AssetStudio
case AudioCompressionFormat.MP3:
return ".fsb";
case AudioCompressionFormat.VAG:
return ".vag";
return ".fsb";
case AudioCompressionFormat.HEVAG:
return ".vag";
return ".fsb";
case AudioCompressionFormat.XMA:
return ".wav";
return ".fsb";
case AudioCompressionFormat.AAC:
return ".m4a";
case AudioCompressionFormat.GCADPCM:
return ".fsb";
case AudioCompressionFormat.ATRAC9:
return ".at9";
return ".fsb";
}
}
return ".AudioClip";
}
public bool IsFMODSupport
public bool IsSupport
{
get
{
@@ -147,7 +147,6 @@ namespace AssetStudio
case AudioType.S3M:
case AudioType.XM:
case AudioType.XMA:
case AudioType.VAG:
case AudioType.AUDIOQUEUE:
return true;
default:
@@ -162,11 +161,7 @@ namespace AssetStudio
case AudioCompressionFormat.Vorbis:
case AudioCompressionFormat.ADPCM:
case AudioCompressionFormat.MP3:
case AudioCompressionFormat.VAG:
case AudioCompressionFormat.HEVAG:
case AudioCompressionFormat.XMA:
case AudioCompressionFormat.GCADPCM:
case AudioCompressionFormat.ATRAC9:
return true;
default:
return false;

View File

@@ -285,7 +285,11 @@ namespace AssetStudio
}
iMesh.hasNormal = mesh.m_Normals?.Length > 0;
iMesh.hasUV = mesh.m_UV0?.Length > 0;
iMesh.hasUV = new bool[8];
for (int uv = 0; uv < 8; uv++)
{
iMesh.hasUV[uv] = mesh.GetUV(uv)?.Length > 0;
}
iMesh.hasTangent = mesh.m_Tangents != null && mesh.m_Tangents.Length == mesh.m_VertexCount * 4;
iMesh.hasColor = mesh.m_Colors?.Length > 0;
@@ -335,17 +339,22 @@ namespace AssetStudio
iVertex.Normal = new Vector3(-mesh.m_Normals[j * c], mesh.m_Normals[j * c + 1], mesh.m_Normals[j * c + 2]);
}
//UV
if (iMesh.hasUV)
iVertex.UV = new float[8][];
for (int uv = 0; uv < 8; uv++)
{
if (mesh.m_UV0.Length == mesh.m_VertexCount * 2)
if (iMesh.hasUV[uv])
{
var m_UV = mesh.GetUV(uv);
if (m_UV.Length == mesh.m_VertexCount * 2)
{
c = 2;
}
else if (mesh.m_UV0.Length == mesh.m_VertexCount * 3)
else if (m_UV.Length == mesh.m_VertexCount * 3)
{
c = 3;
}
iVertex.UV = new[] { mesh.m_UV0[j * c], mesh.m_UV0[j * c + 1] };
iVertex.UV[uv] = new[] { m_UV[j * c], m_UV[j * c + 1] };
}
}
//Tangent
if (iMesh.hasTangent)

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.14.38.5")]
[assembly: AssemblyFileVersion("0.14.38.5")]

View File

@@ -9,7 +9,7 @@ namespace AssetStudio
{
public static class SpriteHelper
{
public static Bitmap GetImageFromSprite(Sprite m_Sprite)
public static Bitmap GetImage(this Sprite m_Sprite)
{
if (m_Sprite.m_SpriteAtlas != null && m_Sprite.m_SpriteAtlas.TryGet(out var m_SpriteAtlas))
{

View File

@@ -24,34 +24,34 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>Texture2DDecoder</RootNamespace>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>