Fixed bug

This commit is contained in:
Perfare 2018-07-24 20:48:09 +08:00
parent 21ff88c890
commit d523862fac
3 changed files with 11 additions and 6 deletions

View File

@ -8,7 +8,7 @@ namespace AssetStudio
class Avatar
{
public string m_Name;
private List<KeyValuePair<uint, string>> m_TOS;
public List<KeyValuePair<uint, string>> m_TOS;
public Avatar(AssetPreloadData preloadData)
{

View File

@ -9,7 +9,7 @@ namespace AssetStudio
public class GameObject : TreeNode
{
public AssetPreloadData asset;
public List<PPtr> m_Components = new List<PPtr>();
public List<PPtr> m_Components;
public int m_Layer;
public string m_Name;
public ushort m_Tag;
@ -34,6 +34,7 @@ namespace AssetStudio
uniqueID = preloadData.uniqueID;
int m_Component_size = reader.ReadInt32();
m_Components = new List<PPtr>(m_Component_size);
for (int j = 0; j < m_Component_size; j++)
{
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up

View File

@ -65,7 +65,6 @@ namespace AssetStudio
private void InitWithAnimator(Animator m_Animator)
{
//In fact, doesn't need this.
if (assetsfileList.TryGetPD(m_Animator.m_Avatar, out var m_Avatar))
avatar = new Avatar(m_Avatar);
@ -231,8 +230,10 @@ namespace AssetStudio
iMesh.SubmeshList = new List<ImportedSubmesh>();
var subHashSet = new HashSet<int>();
var combine = false;
int firstSubMesh = 0;
if (meshR.m_StaticBatchInfo != null && meshR.m_StaticBatchInfo.subMeshCount > 0)
{
firstSubMesh = meshR.m_StaticBatchInfo.firstSubMesh;
var finalSubMesh = meshR.m_StaticBatchInfo.firstSubMesh + meshR.m_StaticBatchInfo.subMeshCount;
for (int i = meshR.m_StaticBatchInfo.firstSubMesh; i < finalSubMesh; i++)
{
@ -242,6 +243,7 @@ namespace AssetStudio
}
else if (meshR.m_SubsetIndices != null)
{
firstSubMesh = (int)meshR.m_SubsetIndices.Min(x => x);
foreach (var index in meshR.m_SubsetIndices)
{
subHashSet.Add((int)index);
@ -260,9 +262,9 @@ namespace AssetStudio
var submesh = mesh.m_SubMeshes[i];
var iSubmesh = new ImportedSubmesh();
Material mat = null;
if (i < meshR.m_Materials.Length)
if (i - firstSubMesh < meshR.m_Materials.Length)
{
if (assetsfileList.TryGetPD(meshR.m_Materials[i], out var MaterialPD))
if (assetsfileList.TryGetPD(meshR.m_Materials[i - firstSubMesh], out var MaterialPD))
{
mat = new Material(MaterialPD);
}
@ -379,7 +381,8 @@ namespace AssetStudio
}
if (string.IsNullOrEmpty(bone.Name))
{
throw new Exception("A Bone could neither be found by hash in Avatar nor by index in SkinnedMeshRenderer.");
//throw new Exception("A Bone could neither be found by hash in Avatar nor by index in SkinnedMeshRenderer.");
continue;
}
}
@ -459,6 +462,7 @@ namespace AssetStudio
}
}
}
//TODO
if (combine)
{