fixed some bug

This commit is contained in:
Perfare 2018-01-19 10:25:37 +08:00
parent 0cd8d51526
commit 7e67f354e4
2 changed files with 33 additions and 21 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity Studio", "Unity Studio\Unity Studio.csproj", "{24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}"
EndProject
@ -25,4 +25,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F5C476A6-2B3B-416F-8BD5-6FE454FF3972}
EndGlobalSection
EndGlobal

View File

@ -311,24 +311,24 @@ namespace Unity_Studio
exportable = true;
break;
}
/*case 21: //Material
case 74: //AnimationClip
case 90: //Avatar
case 91: //AnimatorController
case 115: //MonoScript
case 687078895: //SpriteAtlas
{
if (asset.Offset + 4 > asset.sourceFile.a_Stream.BaseStream.Length)
break;
asset.sourceFile.a_Stream.Position = asset.Offset;
var len = asset.sourceFile.a_Stream.ReadInt32();
if (len > 0 && len < asset.Size - 4)
/*case 21: //Material
case 74: //AnimationClip
case 90: //Avatar
case 91: //AnimatorController
case 115: //MonoScript
case 687078895: //SpriteAtlas
{
var bytes = asset.sourceFile.a_Stream.ReadBytes(len);
asset.Text = Encoding.UTF8.GetString(bytes);
}
break;
}*/
if (asset.Offset + 4 > asset.sourceFile.a_Stream.BaseStream.Length)
break;
asset.sourceFile.a_Stream.Position = asset.Offset;
var len = asset.sourceFile.a_Stream.ReadInt32();
if (len > 0 && len < asset.Size - 4)
{
var bytes = asset.sourceFile.a_Stream.ReadBytes(len);
asset.Text = Encoding.UTF8.GetString(bytes);
}
break;
}*/
}
if (!exportable && displayAll)
{
@ -1797,12 +1797,21 @@ namespace Unity_Studio
#endregion
#region Face
for (int f = 0; f < m_Mesh.m_Indices.Count / 3; f++)
int sum = 0;
for (var i = 0; i < m_Mesh.m_SubMeshes.Count; i++)
{
sb.AppendFormat("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\r\n", m_Mesh.m_Indices[f * 3 + 2] + 1, m_Mesh.m_Indices[f * 3 + 1] + 1, m_Mesh.m_Indices[f * 3] + 1);
sb.AppendLine($"g {m_Mesh.m_Name}_{i}");
int indexCount = (int)m_Mesh.m_SubMeshes[i].indexCount;
var end = sum + indexCount / 3;
for (int f = sum; f < end; f++)
{
sb.AppendFormat("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\r\n", m_Mesh.m_Indices[f * 3 + 2] + 1, m_Mesh.m_Indices[f * 3 + 1] + 1, m_Mesh.m_Indices[f * 3] + 1);
}
sum = end;
}
#endregion
sb.Replace("NaN", "0");
File.WriteAllText(exportFullName, sb.ToString());
return true;
}