Unity 5 support

This commit is contained in:
RaduMCosma 2015-11-02 10:11:26 +02:00
parent ee040bdd71
commit 66fa804819
14 changed files with 639 additions and 262 deletions

View File

@ -14,13 +14,11 @@ namespace Unity_Studio
public int Type1; public int Type1;
public ushort Type2; public ushort Type2;
//public string m_Name = "";
public string TypeString; public string TypeString;
public int exportSize; public int exportSize;
public string InfoText; public string InfoText;
public AssetsFile sourceFile; public AssetsFile sourceFile;
public int specificIndex = -1; //index in specific asset list
public string uniqueID; public string uniqueID;
} }
} }

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Diagnostics; //remove this later //using System.Diagnostics; //remove this later
namespace Unity_Studio namespace Unity_Studio
{ {
@ -19,15 +19,15 @@ namespace Unity_Studio
//public EndianType endianType = EndianType.BigEndian; //public EndianType endianType = EndianType.BigEndian;
//public List<AssetPreloadData> preloadTable = new List<AssetPreloadData>(); //public List<AssetPreloadData> preloadTable = new List<AssetPreloadData>();
public Dictionary<long, AssetPreloadData> preloadTable = new Dictionary<long, AssetPreloadData>(); public Dictionary<long, AssetPreloadData> preloadTable = new Dictionary<long, AssetPreloadData>();
public List<GameObject> GameObjectList = new List<GameObject>(); public Dictionary<long, GameObject> GameObjectList = new Dictionary<long, GameObject>();
public List<Transform> TransformList = new List<Transform>(); public Dictionary<long, Transform> TransformList = new Dictionary<long, Transform>();
//public List<RectTransform> RectTransformList = new List<RectTransform>();
//public List<MeshFilter> MeshFilterList = new List<MeshFilter>();
//public List<SkinnedMeshRenderer> SkinnedMeshList = new List<SkinnedMeshRenderer>();
public List<AssetPreloadData> exportableAssets = new List<AssetPreloadData>(); public List<AssetPreloadData> exportableAssets = new List<AssetPreloadData>();
public List<UnityShared> sharedAssetsList = new List<UnityShared>() {new UnityShared()}; public List<UnityShared> sharedAssetsList = new List<UnityShared>() {new UnityShared()};
private ClassIDReference UnityClassID = new ClassIDReference(); private ClassIDReference UnityClassID = new ClassIDReference();
public SortedDictionary<int, ClassStrStruct> ClassStructures = new SortedDictionary<int, ClassStrStruct>();
private bool baseDefinitions = false; private bool baseDefinitions = false;
public class UnityShared public class UnityShared
@ -58,7 +58,7 @@ namespace Unity_Studio
a_Stream.Position += 1; a_Stream.Position += 1;
break; break;
} }
case 7://beta case 7://Unity 3 beta
{ {
a_Stream.Position = (dataEnd - tableSize); a_Stream.Position = (dataEnd - tableSize);
a_Stream.Position += 1; a_Stream.Position += 1;
@ -81,7 +81,7 @@ namespace Unity_Studio
break; break;
} }
case 14: case 14:
case 15://not fully tested!s case 15://not fully tested!
{ {
a_Stream.Position += 4;//azero a_Stream.Position += 4;//azero
m_Version = a_Stream.ReadStringToNull(); m_Version = a_Stream.ReadStringToNull();
@ -125,8 +125,18 @@ namespace Unity_Studio
{ {
if (fileGen < 14) if (fileGen < 14)
{ {
int baseType = a_Stream.ReadInt32(); int classID = a_Stream.ReadInt32();
readBase(); string baseType = a_Stream.ReadStringToNull();
string baseName = a_Stream.ReadStringToNull();
a_Stream.Position += 20;
int memberCount = a_Stream.ReadInt32();
StringBuilder cb = new StringBuilder();
for (int m = 0; m < memberCount; m++) { readBase(cb, 1); }
var aClass = new ClassStrStruct() { ID = classID, Text = (baseType + " " + baseName), members = cb.ToString() };
aClass.SubItems.Add(classID.ToString());
ClassStructures.Add(classID, aClass);
} }
else { readBase5(); } else { readBase5(); }
} }
@ -134,12 +144,15 @@ namespace Unity_Studio
if (fileGen >= 7 && fileGen < 14) {a_Stream.Position += 4;}//azero if (fileGen >= 7 && fileGen < 14) {a_Stream.Position += 4;}//azero
int assetCount = a_Stream.ReadInt32(); int assetCount = a_Stream.ReadInt32();
if (fileGen >= 14) { a_Stream.AlignStream(4); }
#region asset preload table
string assetIDfmt = "D" + assetCount.ToString().Length.ToString(); //format for unique ID string assetIDfmt = "D" + assetCount.ToString().Length.ToString(); //format for unique ID
for (int i = 0; i < assetCount; i++) for (int i = 0; i < assetCount; i++)
{ {
//each table entry is aligned individually, not the whole table
if (fileGen >= 14) { a_Stream.AlignStream(4); }
AssetPreloadData asset = new AssetPreloadData(); AssetPreloadData asset = new AssetPreloadData();
if (fileGen < 14) { asset.m_PathID = a_Stream.ReadInt32(); } if (fileGen < 14) { asset.m_PathID = a_Stream.ReadInt32(); }
else { asset.m_PathID = a_Stream.ReadInt64(); } else { asset.m_PathID = a_Stream.ReadInt64(); }
@ -149,7 +162,17 @@ namespace Unity_Studio
asset.Type1 = a_Stream.ReadInt32(); asset.Type1 = a_Stream.ReadInt32();
asset.Type2 = a_Stream.ReadUInt16(); asset.Type2 = a_Stream.ReadUInt16();
a_Stream.Position += 2; a_Stream.Position += 2;
if (fileGen >= 15) { int azero = a_Stream.ReadInt32(); } if (fileGen >= 15)
{
byte unknownByte = a_Stream.ReadByte();
//this is a single byte, not an int32
//the next entry is aligned after this
//but not the last!
if (unknownByte != 0)
{
bool investigate = true;
}
}
asset.TypeString = asset.Type2.ToString(); asset.TypeString = asset.Type2.ToString();
if (UnityClassID.Names[asset.Type2] != null) if (UnityClassID.Names[asset.Type2] != null)
@ -164,7 +187,7 @@ namespace Unity_Studio
preloadTable.Add(asset.m_PathID, asset); preloadTable.Add(asset.m_PathID, asset);
//this should be among the first nodes in mainData and it contains the version - useful for unity 2.x files #region read BuildSettings to get version for unity 2.x files
if (asset.Type2 == 141 && fileGen == 6) if (asset.Type2 == 141 && fileGen == 6)
{ {
long nextAsset = a_Stream.Position; long nextAsset = a_Stream.Position;
@ -174,7 +197,9 @@ namespace Unity_Studio
a_Stream.Position = nextAsset; a_Stream.Position = nextAsset;
} }
#endregion
} }
#endregion
buildType = m_Version.Split(new string[] { ".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, StringSplitOptions.RemoveEmptyEntries); buildType = m_Version.Split(new string[] { ".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, StringSplitOptions.RemoveEmptyEntries);
string[] strver = (m_Version.Split(new string[] { ".", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\n" }, StringSplitOptions.RemoveEmptyEntries)); string[] strver = (m_Version.Split(new string[] { ".", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\n" }, StringSplitOptions.RemoveEmptyEntries));
@ -182,8 +207,14 @@ namespace Unity_Studio
if (fileGen >= 14) if (fileGen >= 14)
{ {
//this looks like a list of assets that need to be preloaded in memory before anytihng else
int someCount = a_Stream.ReadInt32(); int someCount = a_Stream.ReadInt32();
a_Stream.Position += someCount * 12; for (int i = 0; i < someCount; i++)
{
int num1 = a_Stream.ReadInt32();
a_Stream.AlignStream(4);
long m_PathID = a_Stream.ReadInt64();
}
} }
int sharedFileCount = a_Stream.ReadInt32(); int sharedFileCount = a_Stream.ReadInt32();
@ -198,20 +229,28 @@ namespace Unity_Studio
} }
} }
private void readBase() private void readBase(StringBuilder cb, int level)
{ {
string baseFormat = a_Stream.ReadStringToNull(); string varType = a_Stream.ReadStringToNull();
string baseName = a_Stream.ReadStringToNull(); string varName = a_Stream.ReadStringToNull();
a_Stream.Position += 20; //a_Stream.Position += 20;
int size = a_Stream.ReadInt32();
int index = a_Stream.ReadInt32();
int isArray = a_Stream.ReadInt32();
int num0 = a_Stream.ReadInt32();
int num1 = a_Stream.ReadInt16();
int num2 = a_Stream.ReadInt16();
int childrenCount = a_Stream.ReadInt32(); int childrenCount = a_Stream.ReadInt32();
//Debug.WriteLine(baseFormat + " " + baseName + " " + childrenCount); //Debug.WriteLine(baseFormat + " " + baseName + " " + childrenCount);
for (int i = 0; i < childrenCount; i++) { readBase(); } cb.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level)), varType, varName, size);
for (int i = 0; i < childrenCount; i++) { readBase(cb, level + 1); }
} }
private void readBase5() private void readBase5()
{ {
int baseType = a_Stream.ReadInt32(); int classID = a_Stream.ReadInt32();
if (baseType < 0) { a_Stream.Position += 16; } if (classID < 0) { a_Stream.Position += 16; }
a_Stream.Position += 16; a_Stream.Position += 16;
if (baseDefinitions) if (baseDefinitions)
@ -281,8 +320,10 @@ namespace Unity_Studio
a_Stream.Position += varCount * 24; a_Stream.Position += varCount * 24;
string varStrings = Encoding.UTF8.GetString(a_Stream.ReadBytes(stringSize)); string varStrings = Encoding.UTF8.GetString(a_Stream.ReadBytes(stringSize));
string className = "";
StringBuilder classVarStr = new StringBuilder();
//can skip this //build Class Structures
a_Stream.Position -= varCount * 24 + stringSize; a_Stream.Position -= varCount * 24 + stringSize;
for (int i = 0; i < varCount; i++) for (int i = 0; i < varCount; i++)
{ {
@ -308,11 +349,19 @@ namespace Unity_Studio
int index = a_Stream.ReadInt32(); int index = a_Stream.ReadInt32();
int num1 = a_Stream.ReadInt32(); int num1 = a_Stream.ReadInt32();
for (int t = 0; t < level; t++) { Debug.Write("\t"); } if (index == 0) { className = varTypeStr + " " + varNameStr; }
Debug.WriteLine(varTypeStr + " " + varNameStr + " " + size); else { classVarStr.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, size); }
//for (int t = 0; t < level; t++) { Debug.Write("\t"); }
//Debug.WriteLine(varTypeStr + " " + varNameStr + " " + size);
} }
a_Stream.Position += stringSize; a_Stream.Position += stringSize;
var aClass = new ClassStrStruct() { ID = classID, Text = className, members = classVarStr.ToString() };
aClass.SubItems.Add(classID.ToString());
ClassStructures.Add(classID, aClass);
} }
} }
} }

View File

@ -2,10 +2,17 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms;
namespace Unity_Studio namespace Unity_Studio
{ {
class ClassIDReference public class ClassStrStruct : ListViewItem
{
public int ID;
public string members;
}
public class ClassIDReference
{ {
public string[] Names = new string[1121]; public string[] Names = new string[1121];

View File

@ -48,6 +48,15 @@ namespace Unity_Studio
if (sourceFile.version[0] > 4 || (sourceFile.version[0] == 4 && sourceFile.version[1] >= 3)) { m_CustomRenderQueue = a_Stream.ReadInt32(); } if (sourceFile.version[0] > 4 || (sourceFile.version[0] == 4 && sourceFile.version[1] >= 3)) { m_CustomRenderQueue = a_Stream.ReadInt32(); }
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 1)
{
string[][] stringTagMap = new string[a_Stream.ReadInt32()][];
for (int i = 0; i < stringTagMap.Length; i++)
{
stringTagMap[i] = new string[2] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()), a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
}
}
//m_SavedProperties //m_SavedProperties
m_TexEnvs = new TexEnv[a_Stream.ReadInt32()]; m_TexEnvs = new TexEnv[a_Stream.ReadInt32()];
for (int i = 0; i < m_TexEnvs.Length; i++) for (int i = 0; i < m_TexEnvs.Length; i++)

View File

@ -334,6 +334,10 @@ namespace Unity_Studio
} }
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
if (m_Name == "holotable_glow_mesh")
{
bool stop = true;
}
if (version[0] < 3 || (version[0] == 3 && version[1] < 5)) if (version[0] < 3 || (version[0] == 3 && version[1] < 5))
{ {
m_Use16BitIndices = a_Stream.ReadBoolean(); m_Use16BitIndices = a_Stream.ReadBoolean();
@ -781,6 +785,7 @@ namespace Unity_Studio
m_UV_Packed.m_Start = a_Stream.ReadSingle(); m_UV_Packed.m_Start = a_Stream.ReadSingle();
m_UV_Packed.m_Data = new byte[a_Stream.ReadInt32()]; m_UV_Packed.m_Data = new byte[a_Stream.ReadInt32()];
a_Stream.Read(m_UV_Packed.m_Data, 0, m_UV_Packed.m_Data.Length); a_Stream.Read(m_UV_Packed.m_Data, 0, m_UV_Packed.m_Data.Length);
a_Stream.AlignStream(4);
m_UV_Packed.m_BitSize = a_Stream.ReadByte(); m_UV_Packed.m_BitSize = a_Stream.ReadByte();
a_Stream.Position += 3; //4 byte alignment a_Stream.Position += 3; //4 byte alignment
@ -788,7 +793,7 @@ namespace Unity_Studio
{ {
uint[] m_UV_Unpacked = UnpackBitVector(m_UV_Packed); uint[] m_UV_Unpacked = UnpackBitVector(m_UV_Packed);
int bitmax = 0; int bitmax = 0;
for (int b = 0; b < m_Vertices_Packed.m_BitSize; b++) { bitmax |= (1 << b); } for (int b = 0; b < m_UV_Packed.m_BitSize; b++) { bitmax |= (1 << b); }
m_UV1 = new float[m_VertexCount * 2]; m_UV1 = new float[m_VertexCount * 2];
@ -896,7 +901,7 @@ namespace Unity_Studio
{ {
uint[] m_FloatColors_Unpacked = UnpackBitVector(m_FloatColors); uint[] m_FloatColors_Unpacked = UnpackBitVector(m_FloatColors);
int bitmax = 0; int bitmax = 0;
for (int b = 0; b < m_Vertices_Packed.m_BitSize; b++) { bitmax |= (1 << b); } for (int b = 0; b < m_FloatColors.m_BitSize; b++) { bitmax |= (1 << b); }
m_Colors = new float[m_FloatColors.m_NumItems]; m_Colors = new float[m_FloatColors.m_NumItems];

View File

@ -23,9 +23,16 @@ namespace Unity_Studio
int defaultScreenOrientation = a_Stream.ReadInt32(); int defaultScreenOrientation = a_Stream.ReadInt32();
int targetDevice = a_Stream.ReadInt32(); int targetDevice = a_Stream.ReadInt32();
int targetGlesGraphics = a_Stream.ReadInt32();
if (sourceFile.version[0] == 5 || (sourceFile.version[0] == 4 && sourceFile.version[1] == 6 && sourceFile.version[2] >= 3)) if (sourceFile.version[0] < 5 || (sourceFile.version[0] == 5 && sourceFile.version[1] < 1))
{ int targetGlesGraphics = a_Stream.ReadInt32(); }
if ((sourceFile.version[0] == 5 && sourceFile.version[1] < 1) || (sourceFile.version[0] == 4 && sourceFile.version[1] == 6 && sourceFile.version[2] >= 3))
{ int targetIOSGraphics = a_Stream.ReadInt32(); } { int targetIOSGraphics = a_Stream.ReadInt32(); }
if (sourceFile.version[0] == 5 && (sourceFile.version[1] > 2 || (sourceFile.version[1] == 2 && sourceFile.version[2] >= 1)))
{ bool useOnDemandResources = a_Stream.ReadBoolean(); a_Stream.AlignStream(4); }
int targetResolution = a_Stream.ReadInt32(); int targetResolution = a_Stream.ReadInt32();
if (sourceFile.version[0] == 3 && sourceFile.version[1] <= 1) { bool OverrideIPodMusic = a_Stream.ReadBoolean(); a_Stream.AlignStream(4); } if (sourceFile.version[0] == 3 && sourceFile.version[1] <= 1) { bool OverrideIPodMusic = a_Stream.ReadBoolean(); a_Stream.AlignStream(4); }

View File

@ -6,11 +6,11 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Unity Studio")] [assembly: AssemblyTitle("Unity Studio")]
[assembly: AssemblyDescription("- Compatible with all Unity versions from 2.5.0 to 4.6.9\r\n- Compatible with Web, PC, iOS, Android, PS3, Xbox 360, OSX and Linux games/apps\r\n- Automatically merges .split\r\n- 3D objets exported to FBX\r\n- Able to load audio streams from .resS files\r\n- Real-time preview window and export function for textures, audio clips, shaders and fonts\r\n - Textures: DDS (Alpha8bpp, ARGB16bpp, RGB24bpp, ARGB32bpp, BGRA32bpp, RGB565, DXT1, DXT5, RGBA16bpp)\r\n PVR (PVRTC_RGB2, PVRTC_RGBA2, PVRTC_RGBA4, PVRTC_RGB4, ETC_RGB4)\r\n - Audio clips: mp3, ogg, wav, xbox wav\r\n - Shader files are exported in plain-text\r\n - Fonts: ttf, otf")] [assembly: AssemblyDescription("- Compatible with all Unity versions from 2.5.0 to 5.2.2\r\n- Compatible with Web, PC, iOS, Android, PS3, Xbox 360, OSX and Linux games/apps\r\n- Automatically merges .split\r\n- 3D objets exported to FBX\r\n- Able to load audio streams from .resS files\r\n- Real-time preview window and export function for textures, audio clips, shaders and fonts\r\n - Textures: DDS (Alpha8bpp, ARGB16bpp, RGB24bpp, ARGB32bpp, BGRA32bpp, RGB565, DXT1, DXT5, RGBA16bpp)\r\n PVR (PVRTC_RGB2, PVRTC_RGBA2, PVRTC_RGBA4, PVRTC_RGB4, ETC_RGB4)\r\n - Audio clips: mp3, ogg, wav, xbox wav\r\n - Shader files are exported in plain-text\r\n - Fonts: ttf, otf")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Unity Studio")] [assembly: AssemblyProduct("Unity Studio")]
[assembly: AssemblyCopyright("Copyright © 2014 Chipicao")] [assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.6.9")] [assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.4.6.9")] [assembly: AssemblyFileVersion("0.0.0.0")]

View File

@ -29,13 +29,22 @@ namespace Unity_Studio
} }
m_GameObject = sourceFile.ReadPPtr(); m_GameObject = sourceFile.ReadPPtr();
if (sourceFile.version[0] < 5)
{
m_Enabled = a_Stream.ReadBoolean(); m_Enabled = a_Stream.ReadBoolean();
m_CastShadows = a_Stream.ReadByte(); m_CastShadows = a_Stream.ReadByte();
m_ReceiveShadows = a_Stream.ReadBoolean(); m_ReceiveShadows = a_Stream.ReadBoolean();
if (sourceFile.version[0] < 5) { m_LightmapIndex = a_Stream.ReadByte(); } m_LightmapIndex = a_Stream.ReadByte();
}
else else
{ {
a_Stream.Position += 5; //suspicious alignment, could be 2 alignments between bools m_Enabled = a_Stream.ReadBoolean();
a_Stream.AlignStream(4);
m_CastShadows = a_Stream.ReadByte();
m_ReceiveShadows = a_Stream.ReadBoolean();
a_Stream.AlignStream(4);
m_LightmapIndex = a_Stream.ReadUInt16(); m_LightmapIndex = a_Stream.ReadUInt16();
m_LightmapIndexDynamic = a_Stream.ReadUInt16(); m_LightmapIndexDynamic = a_Stream.ReadUInt16();
} }

View File

@ -9,7 +9,7 @@ namespace Unity_Studio
{ {
public PPtr m_GameObject; public PPtr m_GameObject;
public bool m_Enabled; public bool m_Enabled;
public bool m_CastShadows; public byte m_CastShadows;
public bool m_ReceiveShadows; public bool m_ReceiveShadows;
public ushort m_LightmapIndex; public ushort m_LightmapIndex;
public ushort m_LightmapIndexDynamic; public ushort m_LightmapIndexDynamic;
@ -31,18 +31,27 @@ namespace Unity_Studio
} }
m_GameObject = sourceFile.ReadPPtr(); m_GameObject = sourceFile.ReadPPtr();
if (sourceFile.version[0] < 5)
{
m_Enabled = a_Stream.ReadBoolean(); m_Enabled = a_Stream.ReadBoolean();
m_CastShadows = a_Stream.ReadBoolean(); m_CastShadows = a_Stream.ReadByte();
m_ReceiveShadows = a_Stream.ReadBoolean(); m_ReceiveShadows = a_Stream.ReadBoolean();
if (sourceFile.version[0] < 5) { m_LightmapIndex = a_Stream.ReadByte(); } m_LightmapIndex = a_Stream.ReadByte();
}
else else
{ {
a_Stream.Position += 5; //suspicious alignment, could be 2 alignments between bools m_Enabled = a_Stream.ReadBoolean();
a_Stream.AlignStream(4);
m_CastShadows = a_Stream.ReadByte();
m_ReceiveShadows = a_Stream.ReadBoolean();
a_Stream.AlignStream(4);
m_LightmapIndex = a_Stream.ReadUInt16(); m_LightmapIndex = a_Stream.ReadUInt16();
m_LightmapIndexDynamic = a_Stream.ReadUInt16(); m_LightmapIndexDynamic = a_Stream.ReadUInt16();
} }
if (version[0] >= 3) { a_Stream.Position += 16; } //m_LightmapTilingOffset vector4d if (version[0] >= 3) { a_Stream.Position += 16; } //m_LightmapTilingOffset vector4d
if (sourceFile.version[0] >= 5) { a_Stream.Position += 16; } //Vector4f m_LightmapTilingOffsetDynamic
m_Materials = new PPtr[a_Stream.ReadInt32()]; m_Materials = new PPtr[a_Stream.ReadInt32()];
for (int m = 0; m < m_Materials.Length; m++) for (int m = 0; m < m_Materials.Length; m++)

View File

@ -12,7 +12,7 @@ namespace Unity_Studio
public int m_Height; public int m_Height;
public int m_CompleteImageSize; public int m_CompleteImageSize;
public int m_TextureFormat; public int m_TextureFormat;
public bool m_MipMap; public bool m_MipMap = false;
public bool m_IsReadable; public bool m_IsReadable;
public bool m_ReadAllowed; public bool m_ReadAllowed;
public int m_ImageCount; public int m_ImageCount;
@ -81,10 +81,19 @@ namespace Unity_Studio
else if (m_TextureFormat < 35) { extension = ".pvr"; } else if (m_TextureFormat < 35) { extension = ".pvr"; }
else { extension = "_" + m_Width.ToString() + "x" + m_Height.ToString() + "." + m_TextureFormat.ToString() + ".tex"; } else { extension = "_" + m_Width.ToString() + "x" + m_Height.ToString() + "." + m_TextureFormat.ToString() + ".tex"; }
m_MipMap = a_Stream.ReadBoolean(); if (sourceFile.version[0] < 5 || (sourceFile.version[0] == 5 && sourceFile.version[1] < 2))
{ m_MipMap = a_Stream.ReadBoolean(); }
else
{
dwFlags += 0x20000;
dwMipMapCount = a_Stream.ReadInt32();//is this with or without main image?
dwCaps += 0x400008;
}
m_IsReadable = a_Stream.ReadBoolean(); //2.6.0 and up m_IsReadable = a_Stream.ReadBoolean(); //2.6.0 and up
m_ReadAllowed = a_Stream.ReadBoolean(); //3.0.0 and up m_ReadAllowed = a_Stream.ReadBoolean(); //3.0.0 and up
a_Stream.Position += 1; //4 byte alignment a_Stream.AlignStream(4);
m_ImageCount = a_Stream.ReadInt32(); m_ImageCount = a_Stream.ReadInt32();
m_TextureDimension = a_Stream.ReadInt32(); m_TextureDimension = a_Stream.ReadInt32();
//m_TextureSettings //m_TextureSettings

View File

@ -37,6 +37,12 @@
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.extractBundleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.extractBundleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extractFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.extractFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.debugMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buildClassStructuresMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dontLoadAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dontBuildHierarchyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.exportClassStructuresMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.uniqueNames = new System.Windows.Forms.ToolStripMenuItem(); this.uniqueNames = new System.Windows.Forms.ToolStripMenuItem();
this.enablePreview = new System.Windows.Forms.ToolStripMenuItem(); this.enablePreview = new System.Windows.Forms.ToolStripMenuItem();
@ -56,13 +62,16 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.treeSearch = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.assetListView = new System.Windows.Forms.ListView(); this.assetListView = new System.Windows.Forms.ListView();
this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.listSearch = new System.Windows.Forms.TextBox(); this.listSearch = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.classesListView = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.progressbarPanel = new System.Windows.Forms.Panel(); this.progressbarPanel = new System.Windows.Forms.Panel();
this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.previewPanel = new System.Windows.Forms.Panel(); this.previewPanel = new System.Windows.Forms.Panel();
@ -79,8 +88,11 @@
this.FMODplayButton = new System.Windows.Forms.Button(); this.FMODplayButton = new System.Windows.Forms.Button();
this.fontPreviewBox = new System.Windows.Forms.RichTextBox(); this.fontPreviewBox = new System.Windows.Forms.RichTextBox();
this.textPreviewBox = new System.Windows.Forms.TextBox(); this.textPreviewBox = new System.Windows.Forms.TextBox();
this.classPreviewPanel = new System.Windows.Forms.Panel();
this.classTextBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.treeSearch = new System.Windows.Forms.TextBox();
this.timer = new System.Windows.Forms.Timer(this.components); this.timer = new System.Windows.Forms.Timer(this.components);
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog();
@ -94,13 +106,14 @@
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.progressbarPanel.SuspendLayout(); this.progressbarPanel.SuspendLayout();
this.previewPanel.SuspendLayout(); this.previewPanel.SuspendLayout();
this.FMODpanel.SuspendLayout(); this.FMODpanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).BeginInit();
this.classPreviewPanel.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -108,6 +121,7 @@
// //
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.debugMenuItem,
this.optionsToolStripMenuItem, this.optionsToolStripMenuItem,
this.exportToolStripMenuItem, this.exportToolStripMenuItem,
this.helpToolStripMenuItem}); this.helpToolStripMenuItem});
@ -162,6 +176,53 @@
this.extractFolderToolStripMenuItem.Text = "Extract folder..."; this.extractFolderToolStripMenuItem.Text = "Extract folder...";
this.extractFolderToolStripMenuItem.Click += new System.EventHandler(this.extractFolderToolStripMenuItem_Click); this.extractFolderToolStripMenuItem.Click += new System.EventHandler(this.extractFolderToolStripMenuItem_Click);
// //
// debugMenuItem
//
this.debugMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.buildClassStructuresMenuItem,
this.dontLoadAssetsMenuItem,
this.dontBuildHierarchyMenuItem,
this.toolStripSeparator2,
this.exportClassStructuresMenuItem});
this.debugMenuItem.Name = "debugMenuItem";
this.debugMenuItem.Size = new System.Drawing.Size(80, 20);
this.debugMenuItem.Text = "Diagnostics";
this.debugMenuItem.Visible = false;
//
// buildClassStructuresMenuItem
//
this.buildClassStructuresMenuItem.CheckOnClick = true;
this.buildClassStructuresMenuItem.Name = "buildClassStructuresMenuItem";
this.buildClassStructuresMenuItem.Size = new System.Drawing.Size(208, 22);
this.buildClassStructuresMenuItem.Text = "Build class structures";
//
// dontLoadAssetsMenuItem
//
this.dontLoadAssetsMenuItem.CheckOnClick = true;
this.dontLoadAssetsMenuItem.Name = "dontLoadAssetsMenuItem";
this.dontLoadAssetsMenuItem.Size = new System.Drawing.Size(208, 22);
this.dontLoadAssetsMenuItem.Text = "Don\'t load assets";
this.dontLoadAssetsMenuItem.CheckedChanged += new System.EventHandler(this.dontLoadAssetsMenuItem_CheckedChanged);
//
// dontBuildHierarchyMenuItem
//
this.dontBuildHierarchyMenuItem.CheckOnClick = true;
this.dontBuildHierarchyMenuItem.Name = "dontBuildHierarchyMenuItem";
this.dontBuildHierarchyMenuItem.Size = new System.Drawing.Size(208, 22);
this.dontBuildHierarchyMenuItem.Text = "Don\'t build hierarchy tree";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(205, 6);
//
// exportClassStructuresMenuItem
//
this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem";
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(208, 22);
this.exportClassStructuresMenuItem.Text = "Export class structures";
this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click);
//
// optionsToolStripMenuItem // optionsToolStripMenuItem
// //
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -321,6 +382,7 @@
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.previewPanel); this.splitContainer1.Panel2.Controls.Add(this.previewPanel);
this.splitContainer1.Panel2.Controls.Add(this.classPreviewPanel);
this.splitContainer1.Panel2.Controls.Add(this.statusStrip1); this.splitContainer1.Panel2.Controls.Add(this.statusStrip1);
this.splitContainer1.Panel2MinSize = 400; this.splitContainer1.Panel2MinSize = 400;
this.splitContainer1.Size = new System.Drawing.Size(1264, 658); this.splitContainer1.Size = new System.Drawing.Size(1264, 658);
@ -334,6 +396,7 @@
// //
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
//this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
@ -355,20 +418,6 @@
this.tabPage1.Text = "Scene Hierarchy"; this.tabPage1.Text = "Scene Hierarchy";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// treeSearch
//
this.treeSearch.Dock = System.Windows.Forms.DockStyle.Top;
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(410, 20);
this.treeSearch.TabIndex = 0;
this.treeSearch.Text = " Search ";
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter);
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown);
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave);
this.treeSearch.MouseEnter += new System.EventHandler(this.treeSearch_MouseEnter);
//
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.assetListView); this.tabPage2.Controls.Add(this.assetListView);
@ -429,6 +478,43 @@
this.listSearch.Enter += new System.EventHandler(this.listSearch_Enter); this.listSearch.Enter += new System.EventHandler(this.listSearch_Enter);
this.listSearch.Leave += new System.EventHandler(this.listSearch_Leave); this.listSearch.Leave += new System.EventHandler(this.listSearch_Leave);
// //
// tabPage3
//
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(410, 608);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Asset Classes";
this.tabPage3.UseVisualStyleBackColor = true;
//
// classesListView
//
this.classesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.classesListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.classesListView.FullRowSelect = true;
this.classesListView.Location = new System.Drawing.Point(0, 0);
this.classesListView.MultiSelect = false;
this.classesListView.Name = "classesListView";
this.classesListView.Size = new System.Drawing.Size(410, 608);
this.classesListView.TabIndex = 0;
this.classesListView.UseCompatibleStateImageBehavior = false;
this.classesListView.View = System.Windows.Forms.View.Details;
this.classesListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.classesListView_ItemSelectionChanged);
//
// columnHeader1
//
this.columnHeader1.DisplayIndex = 1;
this.columnHeader1.Text = "Name";
this.columnHeader1.Width = 328;
//
// columnHeader2
//
this.columnHeader2.DisplayIndex = 0;
this.columnHeader2.Text = "ID";
//
// progressbarPanel // progressbarPanel
// //
this.progressbarPanel.Controls.Add(this.progressBar1); this.progressbarPanel.Controls.Add(this.progressBar1);
@ -613,6 +699,28 @@
this.textPreviewBox.Visible = false; this.textPreviewBox.Visible = false;
this.textPreviewBox.WordWrap = false; this.textPreviewBox.WordWrap = false;
// //
// classPreviewPanel
//
this.classPreviewPanel.Controls.Add(this.classTextBox);
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(838, 634);
this.classPreviewPanel.TabIndex = 3;
this.classPreviewPanel.Visible = false;
//
// classTextBox
//
this.classTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.classTextBox.Location = new System.Drawing.Point(0, 0);
this.classTextBox.Multiline = true;
this.classTextBox.Name = "classTextBox";
this.classTextBox.ReadOnly = true;
this.classTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.classTextBox.Size = new System.Drawing.Size(838, 634);
this.classTextBox.TabIndex = 3;
this.classTextBox.WordWrap = false;
//
// statusStrip1 // statusStrip1
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -632,6 +740,20 @@
this.toolStripStatusLabel1.Text = "Ready to go"; this.toolStripStatusLabel1.Text = "Ready to go";
this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// treeSearch
//
this.treeSearch.Dock = System.Windows.Forms.DockStyle.Top;
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(410, 20);
this.treeSearch.TabIndex = 0;
this.treeSearch.Text = " Search ";
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter);
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown);
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave);
this.treeSearch.MouseEnter += new System.EventHandler(this.treeSearch_MouseEnter);
//
// timer // timer
// //
this.timer.Interval = 10; this.timer.Interval = 10;
@ -640,8 +762,8 @@
// openFileDialog1 // openFileDialog1
// //
this.openFileDialog1.Filter = "Unity asset files|level*; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *." + this.openFileDialog1.Filter = "Unity asset files|level*; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *." +
"assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundle; *.bundle; *." + "assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundl" +
"bytes"; "e; *.bundle; *.bytes";
this.openFileDialog1.Multiselect = true; this.openFileDialog1.Multiselect = true;
this.openFileDialog1.RestoreDirectory = true; this.openFileDialog1.RestoreDirectory = true;
// //
@ -672,6 +794,7 @@
this.sceneTreeView.CheckBoxes = true; this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill; this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false; this.sceneTreeView.HideSelection = false;
this.sceneTreeView.LineColor = System.Drawing.Color.Empty;
this.sceneTreeView.Location = new System.Drawing.Point(0, 20); this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
this.sceneTreeView.Name = "sceneTreeView"; this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(410, 588); this.sceneTreeView.Size = new System.Drawing.Size(410, 588);
@ -686,11 +809,13 @@
this.Controls.Add(this.splitContainer1); this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(620, 400); this.MinimumSize = new System.Drawing.Size(620, 400);
this.Name = "UnityStudioForm"; this.Name = "UnityStudioForm";
this.Text = "Unity Studio"; this.Text = "Unity Studio";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UnityStudioForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UnityStudioForm_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.UnityStudioForm_KeyDown);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false);
@ -699,10 +824,9 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false); this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout(); this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.progressbarPanel.ResumeLayout(false); this.progressbarPanel.ResumeLayout(false);
this.previewPanel.ResumeLayout(false); this.previewPanel.ResumeLayout(false);
this.previewPanel.PerformLayout(); this.previewPanel.PerformLayout();
@ -710,6 +834,8 @@
this.FMODpanel.PerformLayout(); this.FMODpanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).EndInit();
this.classPreviewPanel.ResumeLayout(false);
this.classPreviewPanel.PerformLayout();
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -777,6 +903,18 @@
private System.Windows.Forms.ToolStripMenuItem showExpOpt; private System.Windows.Forms.ToolStripMenuItem showExpOpt;
private GOHierarchy sceneTreeView; private GOHierarchy sceneTreeView;
private System.Windows.Forms.ToolTip treeTip; private System.Windows.Forms.ToolTip treeTip;
private System.Windows.Forms.ToolStripMenuItem debugMenuItem;
private System.Windows.Forms.ToolStripMenuItem buildClassStructuresMenuItem;
private System.Windows.Forms.ToolStripMenuItem dontLoadAssetsMenuItem;
private System.Windows.Forms.ToolStripMenuItem dontBuildHierarchyMenuItem;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.ListView classesListView;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.Panel classPreviewPanel;
private System.Windows.Forms.TextBox classTextBox;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem exportClassStructuresMenuItem;
} }
} }

View File

@ -34,6 +34,7 @@ namespace Unity_Studio
private string productName = ""; private string productName = "";
Dictionary<string, Dictionary<string, string>> jsonMats; Dictionary<string, Dictionary<string, string>> jsonMats;
Dictionary<string, SortedDictionary<int, ClassStrStruct>> AllClassStructures = new Dictionary<string, SortedDictionary<int, ClassStrStruct>>();
private FMOD.System system = null; private FMOD.System system = null;
private FMOD.Sound sound = null; private FMOD.Sound sound = null;
@ -56,6 +57,10 @@ namespace Unity_Studio
private int lastAFile = 0; private int lastAFile = 0;
private int lastGObject = 0; private int lastGObject = 0;
//counters for progress bar
private int totalAssetCount = 0;
private int totalTreeNodes = 0;
[DllImport("gdi32.dll")] [DllImport("gdi32.dll")]
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts); private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);
@ -96,6 +101,8 @@ namespace Unity_Studio
} }
} }
progressBar1.Value = 0;
BuildAssetStrucutres(); BuildAssetStrucutres();
} }
} }
@ -162,6 +169,8 @@ namespace Unity_Studio
LoadAssetsFile(fileName); LoadAssetsFile(fileName);
} }
progressBar1.Value = 0;
BuildAssetStrucutres(); BuildAssetStrucutres();
} }
else { StatusStripUpdate("Selected path deos not exist."); } else { StatusStripUpdate("Selected path deos not exist."); }
@ -203,6 +212,8 @@ namespace Unity_Studio
AssetsFile assetsFile = new AssetsFile(fileName, new EndianStream(File.OpenRead(fileName), EndianType.BigEndian)); AssetsFile assetsFile = new AssetsFile(fileName, new EndianStream(File.OpenRead(fileName), EndianType.BigEndian));
//if (Path.GetFileName(fileName) == "mainData") { mainDataFile = assetsFile; } //if (Path.GetFileName(fileName) == "mainData") { mainDataFile = assetsFile; }
totalAssetCount += assetsFile.preloadTable.Count;
assetsfileList.Add(assetsFile); assetsfileList.Add(assetsFile);
#region for 2.6.x find mainData and get string version #region for 2.6.x find mainData and get string version
if (assetsFile.fileGen == 6 && Path.GetFileName(fileName) != "mainData") if (assetsFile.fileGen == 6 && Path.GetFileName(fileName) != "mainData")
@ -404,6 +415,69 @@ namespace Unity_Studio
private void UnityStudioForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.Alt && e.KeyCode == Keys.D)
{
debugMenuItem.Visible = !debugMenuItem.Visible;
buildClassStructuresMenuItem.Checked = debugMenuItem.Visible;
dontLoadAssetsMenuItem.Checked = debugMenuItem.Visible;
dontBuildHierarchyMenuItem.Checked = debugMenuItem.Visible;
if (tabControl1.TabPages.Contains(tabPage3)) { tabControl1.TabPages.Remove(tabPage3); }
else { tabControl1.TabPages.Add(tabPage3); }
}
}
private void dontLoadAssetsMenuItem_CheckedChanged(object sender, EventArgs e)
{
if (dontLoadAssetsMenuItem.Checked)
{
dontBuildHierarchyMenuItem.Checked = true;
dontBuildHierarchyMenuItem.Enabled = false;
}
else { dontBuildHierarchyMenuItem.Enabled = true; }
}
private void exportClassStructuresMenuItem_Click(object sender, EventArgs e)
{
if (AllClassStructures.Count > 0)
{
if (saveFolderDialog1.ShowDialog() == DialogResult.OK)
{
progressBar1.Value = 0;
progressBar1.Maximum = AllClassStructures.Count;
var savePath = saveFolderDialog1.FileName;
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
foreach (var version in AllClassStructures)
{
if (version.Value.Count > 0)
{
string versionPath = savePath + "\\" + version.Key;
Directory.CreateDirectory(versionPath);
foreach (var uclass in version.Value)
{
string saveFile = versionPath + "\\" + uclass.Key + " " + uclass.Value.Text + ".txt";
using (StreamWriter TXTwriter = new StreamWriter(saveFile))
{
TXTwriter.Write(uclass.Value.members);
}
}
}
progressBar1.PerformStep();
}
StatusStripUpdate("Finished exporting class structures");
progressBar1.Value = 0;
}
}
}
private void enablePreview_Check(object sender, EventArgs e) private void enablePreview_Check(object sender, EventArgs e)
{ {
if (lastLoadedAsset != null) if (lastLoadedAsset != null)
@ -523,8 +597,12 @@ namespace Unity_Studio
private void BuildAssetStrucutres() private void BuildAssetStrucutres()
{ {
#region first loop - read asset data & create list #region first loop - read asset data & create list
if (!dontLoadAssetsMenuItem.Checked)
{
StatusStripUpdate("Building asset list..."); StatusStripUpdate("Building asset list...");
assetListView.BeginUpdate(); assetListView.BeginUpdate();
progressBar1.Value = 0;
progressBar1.Maximum = totalAssetCount;
string fileIDfmt = "D" + assetsfileList.Count.ToString().Length.ToString(); string fileIDfmt = "D" + assetsfileList.Count.ToString().Length.ToString();
@ -538,6 +616,7 @@ namespace Unity_Studio
//ListViewGroup assetGroup = new ListViewGroup(Path.GetFileName(assetsFile.filePath)); //ListViewGroup assetGroup = new ListViewGroup(Path.GetFileName(assetsFile.filePath));
foreach (var asset in assetsFile.preloadTable.Values) foreach (var asset in assetsFile.preloadTable.Values)
{ {
asset.uniqueID = fileID + asset.uniqueID; asset.uniqueID = fileID + asset.uniqueID;
@ -548,26 +627,20 @@ namespace Unity_Studio
case 1: //GameObject case 1: //GameObject
{ {
GameObject m_GameObject = new GameObject(asset); GameObject m_GameObject = new GameObject(asset);
assetsFile.GameObjectList.Add(asset.m_PathID, m_GameObject);
//asset.Text = m_GameObject.m_Name; totalTreeNodes++;
asset.specificIndex = assetsFile.GameObjectList.Count;
assetsFile.GameObjectList.Add(m_GameObject);
break; break;
} }
case 4: //Transform case 4: //Transform
{ {
Transform m_Transform = new Transform(asset); Transform m_Transform = new Transform(asset);
assetsFile.TransformList.Add(asset.m_PathID, m_Transform);
asset.specificIndex = assetsFile.TransformList.Count;
assetsFile.TransformList.Add(m_Transform);
break; break;
} }
case 224: //RectTransform case 224: //RectTransform
{ {
RectTransform m_Rect = new RectTransform(asset); RectTransform m_Rect = new RectTransform(asset);
assetsFile.TransformList.Add(asset.m_PathID, m_Rect.m_Transform);
asset.specificIndex = assetsFile.TransformList.Count;
assetsFile.TransformList.Add(m_Rect.m_Transform);
break; break;
} }
//case 21: //Material //case 21: //Material
@ -658,6 +731,8 @@ namespace Unity_Studio
if (asset.Text == "") { asset.Text = asset.TypeString + " #" + asset.uniqueID; } if (asset.Text == "") { asset.Text = asset.TypeString + " #" + asset.uniqueID; }
asset.SubItems.AddRange(new string[] { asset.TypeString, asset.exportSize.ToString() }); asset.SubItems.AddRange(new string[] { asset.TypeString, asset.exportSize.ToString() });
progressBar1.PerformStep();
} }
exportableAssets.AddRange(assetsFile.exportableAssets); exportableAssets.AddRange(assetsFile.exportableAssets);
@ -672,17 +747,24 @@ namespace Unity_Studio
resizeNameColumn(); resizeNameColumn();
assetListView.EndUpdate(); assetListView.EndUpdate();
progressBar1.Value = 0;
}
#endregion #endregion
#region second loop - build tree structure #region second loop - build tree structure
if (!dontBuildHierarchyMenuItem.Checked)
{
StatusStripUpdate("Building tree structure..."); StatusStripUpdate("Building tree structure...");
sceneTreeView.BeginUpdate(); sceneTreeView.BeginUpdate();
progressBar1.Value = 0;
progressBar1.Maximum = totalTreeNodes;
foreach (var assetsFile in assetsfileList) foreach (var assetsFile in assetsfileList)
{ {
GameObject fileNode = new GameObject(null); GameObject fileNode = new GameObject(null);
fileNode.Text = Path.GetFileName(assetsFile.filePath); fileNode.Text = Path.GetFileName(assetsFile.filePath);
foreach (var m_GameObject in assetsFile.GameObjectList) foreach (var m_GameObject in assetsFile.GameObjectList.Values)
{ {
var parentNode = fileNode; var parentNode = fileNode;
@ -701,6 +783,7 @@ namespace Unity_Studio
} }
parentNode.Nodes.Add(m_GameObject); parentNode.Nodes.Add(m_GameObject);
progressBar1.PerformStep();
} }
@ -708,7 +791,7 @@ namespace Unity_Studio
sceneTreeView.Nodes.Add(fileNode); sceneTreeView.Nodes.Add(fileNode);
} }
sceneTreeView.EndUpdate(); sceneTreeView.EndUpdate();
#endregion progressBar1.Value = 0;
if (File.Exists(mainPath + "\\materials.json")) if (File.Exists(mainPath + "\\materials.json"))
{ {
@ -719,6 +802,41 @@ namespace Unity_Studio
jsonMats = new JavaScriptSerializer().Deserialize<Dictionary<string, Dictionary<string, string>>>(matLine); jsonMats = new JavaScriptSerializer().Deserialize<Dictionary<string, Dictionary<string, string>>>(matLine);
//var jsonMats = new JavaScriptSerializer().DeserializeObject(matLine); //var jsonMats = new JavaScriptSerializer().DeserializeObject(matLine);
} }
}
#endregion
#region build list of class strucutres
if (buildClassStructuresMenuItem.Checked)
{
//group class structures by versionv
foreach (var assetsFile in assetsfileList)
{
SortedDictionary<int, ClassStrStruct> curVer;
if (AllClassStructures.TryGetValue(assetsFile.m_Version, out curVer))
{
foreach (var uClass in assetsFile.ClassStructures)
{
curVer[uClass.Key] = uClass.Value;
}
}
else { AllClassStructures.Add(assetsFile.m_Version, assetsFile.ClassStructures); }
}
classesListView.BeginUpdate();
foreach (var version in AllClassStructures)
{
ListViewGroup versionGroup = new ListViewGroup(version.Key);
classesListView.Groups.Add(versionGroup);
foreach (var uclass in version.Value)
{
uclass.Value.Group = versionGroup;
classesListView.Items.Add(uclass.Value);
}
}
classesListView.EndUpdate();
}
#endregion
StatusStripUpdate("Finished loading " + assetsfileList.Count.ToString() + " files with " + (assetListView.Items.Count + sceneTreeView.Nodes.Count).ToString() + " exportable assets."); StatusStripUpdate("Finished loading " + assetsfileList.Count.ToString() + " files with " + (assetListView.Items.Count + sceneTreeView.Nodes.Count).ToString() + " exportable assets.");
@ -733,11 +851,21 @@ namespace Unity_Studio
} }
private void tabPageSelected(object sender, TabControlEventArgs e) private void tabPageSelected(object sender, TabControlEventArgs e)
{ {
if (e.TabPageIndex == 0) { treeSearch.Select(); } switch (e.TabPageIndex)
else if (e.TabPageIndex == 1) { listSearch.Select(); } {
case 0: treeSearch.Select(); break;
case 1:
classPreviewPanel.Visible = false;
previewPanel.Visible = true;
listSearch.Select();
break;
case 2:
previewPanel.Visible = false;
classPreviewPanel.Visible = true;
break;
}
} }
private void recurseTreeCheck(TreeNodeCollection start) private void recurseTreeCheck(TreeNodeCollection start)
@ -780,7 +908,7 @@ namespace Unity_Studio
{ {
if (e.KeyCode == Keys.Enter) if (e.KeyCode == Keys.Enter)
{ {
if (e.Modifiers == Keys.Control) //toggle all matching nodes //skip children? if (e.Control) //toggle all matching nodes //skip children?
{ {
sceneTreeView.BeginUpdate(); sceneTreeView.BeginUpdate();
//loop assetsFileList? //loop assetsFileList?
@ -956,14 +1084,29 @@ namespace Unity_Studio
} }
private void classesListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (e.IsSelected)
{
classTextBox.Text = ((ClassStrStruct)classesListView.SelectedItems[0]).members;
}
}
private void splitContainer1_Resize(object sender, EventArgs e) private void splitContainer1_Resize(object sender, EventArgs e)
{ {
resizeNameColumn(); switch (tabControl1.TabIndex)
{
case 1: resizeNameColumn(); break;
}
} }
private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
{ {
resizeNameColumn(); switch (tabControl1.TabIndex)
{
case 1: resizeNameColumn(); break;
}
} }
@ -1645,7 +1788,7 @@ namespace Unity_Studio
#region write Models, collect Mesh & Material objects #region write Models, collect Mesh & Material objects
foreach (var assetsFile in assetsfileList) foreach (var assetsFile in assetsfileList)
{ {
foreach (var m_GameObject in assetsFile.GameObjectList) foreach (var m_GameObject in assetsFile.GameObjectList.Values)
{ {
if (m_GameObject.Checked || allNodes) if (m_GameObject.Checked || allNodes)
{ {
@ -2819,7 +2962,10 @@ namespace Unity_Studio
assetListView.VirtualListSize = 0; assetListView.VirtualListSize = 0;
assetListView.Items.Clear(); assetListView.Items.Clear();
assetListView.Groups.Clear(); //assetListView.Groups.Clear();
classesListView.Items.Clear();
classesListView.Groups.Clear();
previewPanel.BackgroundImage = global::Unity_Studio.Properties.Resources.preview; previewPanel.BackgroundImage = global::Unity_Studio.Properties.Resources.preview;
previewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; previewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
@ -2830,7 +2976,7 @@ namespace Unity_Studio
lastSelectedItem = null; lastSelectedItem = null;
lastLoadedAsset = null; lastLoadedAsset = null;
FMODinit(); //FMODinit();
} }

View File

@ -299,9 +299,6 @@ Check this option to add a unique numeric identifier at the end of each filename
B4miQIUoSo42AAAAAElFTkSuQmCC B4miQIUoSo42AAAAAElFTkSuQmCC
</value> </value>
</data> </data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>440, 17</value>
</metadata>
<data name="fontPreviewBox.Text" xml:space="preserve"> <data name="fontPreviewBox.Text" xml:space="preserve">
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ <value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
1234567890.:,;'\"(!?)+-*/= 1234567890.:,;'\"(!?)+-*/=
@ -320,6 +317,9 @@ The quick brown fox jumps over the lazy dog. 1234567890
The quick brown fox jumps over the lazy dog. 1234567890</value> The quick brown fox jumps over the lazy dog. 1234567890</value>
</data> </data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>440, 17</value>
</metadata>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>556, 17</value> <value>556, 17</value>
</metadata> </metadata>

View File

@ -40,10 +40,7 @@ namespace Unity_Studio
AssetsFile sourceFile = assetsfileList[m_elm.m_FileID]; AssetsFile sourceFile = assetsfileList[m_elm.m_FileID];
//TryGetValue should be safe because m_PathID is 0 when initialized and PathID values range from 1 //TryGetValue should be safe because m_PathID is 0 when initialized and PathID values range from 1
if (sourceFile.preloadTable.TryGetValue(m_elm.m_PathID, out result)) if (sourceFile.preloadTable.TryGetValue(m_elm.m_PathID, out result)) { return true; }
{
return true;
}
} }
return false; return false;
@ -53,14 +50,11 @@ namespace Unity_Studio
{ {
m_Transform = null; m_Transform = null;
AssetPreloadData TransformPD; if (m_elm != null && m_elm.m_FileID >= 0 && m_elm.m_FileID < assetsfileList.Count)
if (assetsfileList.TryGetPD(m_elm, out TransformPD))
{ {
if (TransformPD.specificIndex >= 0 && TransformPD.specificIndex < TransformPD.sourceFile.TransformList.Count) AssetsFile sourceFile = assetsfileList[m_elm.m_FileID];
{
m_Transform = TransformPD.sourceFile.TransformList[TransformPD.specificIndex]; if (sourceFile.TransformList.TryGetValue(m_elm.m_PathID, out m_Transform)) { return true; }
return true;
}
} }
return false; return false;
@ -70,14 +64,11 @@ namespace Unity_Studio
{ {
m_GameObject = null; m_GameObject = null;
AssetPreloadData GameObjectPD; if (m_elm != null && m_elm.m_FileID >= 0 && m_elm.m_FileID < assetsfileList.Count)
if (assetsfileList.TryGetPD(m_elm, out GameObjectPD))
{ {
if (GameObjectPD.specificIndex >= 0 && GameObjectPD.specificIndex < GameObjectPD.sourceFile.GameObjectList.Count) AssetsFile sourceFile = assetsfileList[m_elm.m_FileID];
{
m_GameObject = GameObjectPD.sourceFile.GameObjectList[GameObjectPD.specificIndex]; if (sourceFile.GameObjectList.TryGetValue(m_elm.m_PathID, out m_GameObject)) { return true; }
return true;
}
} }
return false; return false;