mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-14 02:54:16 -04:00
- export mesh deformers with dummies or bones
- FBX code re-arranged to get object count - changed the way FBX ASCII lines are split at every ~2000 chars - added option to export tangents - fixed a problem with treeview continuous search
This commit is contained in:
60
Unity Studio/Unity Classes/TextAsset.cs
Normal file
60
Unity Studio/Unity Classes/TextAsset.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Unity_Studio
|
||||
{
|
||||
class TextAsset
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_Script;
|
||||
public string m_PathName;
|
||||
|
||||
public int exportSize;
|
||||
public string extension = ".txt";
|
||||
|
||||
public TextAsset(AssetPreloadData preloadData, bool readSwitch)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var a_Stream = preloadData.sourceFile.a_Stream;
|
||||
a_Stream.Position = preloadData.Offset;
|
||||
|
||||
if (sourceFile.platform == -2)
|
||||
{
|
||||
uint m_ObjectHideFlags = a_Stream.ReadUInt32();
|
||||
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
|
||||
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||
|
||||
int m_Script_size = a_Stream.ReadInt32();
|
||||
|
||||
if (readSwitch) //asset is read for preview or export
|
||||
{
|
||||
m_Script = new byte[m_Script_size];
|
||||
a_Stream.Read(m_Script, 0, m_Script_size);
|
||||
|
||||
if (m_Script[0] == 93) { m_Script = SevenZip.Compression.LZMA.SevenZipHelper.Decompress(m_Script); }
|
||||
if (m_Script[0] == 60 || (m_Script[0] == 239 && m_Script[1] == 187 && m_Script[2] == 191 && m_Script[3] == 60)) { extension = ".xml"; }
|
||||
}
|
||||
else
|
||||
{
|
||||
byte lzmaTest = a_Stream.ReadByte();
|
||||
if (lzmaTest == 93)
|
||||
{
|
||||
a_Stream.Position += 4;
|
||||
exportSize = a_Stream.ReadInt32(); //actualy int64
|
||||
a_Stream.Position -= 8;
|
||||
}
|
||||
else { exportSize = m_Script_size; }
|
||||
|
||||
a_Stream.Position += m_Script_size - 1;
|
||||
}
|
||||
a_Stream.AlignStream(4);
|
||||
|
||||
m_PathName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user