Some improvements

This commit is contained in:
Perfare 2018-04-21 09:36:10 +08:00
parent a3c92ddb8f
commit 674c634c2c
17 changed files with 53 additions and 156 deletions

View File

@ -621,9 +621,8 @@ namespace AssetStudio
public GenericBinding FindBinding(int index)
{
int curves = 0;
for (int i = 0; i < genericBindings.Count; i++)
foreach (var b in genericBindings)
{
GenericBinding b = genericBindings[i];
curves += b.attribute == 2 ? 4 : b.attribute <= 4 ? 3 : 1;
if (curves > index)
{
@ -633,17 +632,6 @@ namespace AssetStudio
return null;
}
public GenericBinding FindBinding(uint path, uint attribute)
{
return genericBindings.Find
(
delegate (GenericBinding b)
{
return b.path == path && b.attribute == attribute;
}
);
}
}
public class AnimationClip

View File

@ -40,13 +40,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = reader.ReadAlignedString();
version5 = sourceFile.version[0] >= 5;
if (sourceFile.version[0] < 5)

View File

@ -15,13 +15,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = reader.ReadAlignedString();
if (readSwitch)

View File

@ -33,13 +33,6 @@ namespace AssetStudio
uniqueID = preloadData.uniqueID;
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
int m_Component_size = reader.ReadInt32();
for (int j = 0; j < m_Component_size; j++)
{

View File

@ -40,13 +40,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = reader.ReadAlignedString();
m_Shader = sourceFile.ReadPPtr();

View File

@ -16,13 +16,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_GameObject = sourceFile.ReadPPtr();
m_Mesh = sourceFile.ReadPPtr();
}

View File

@ -22,13 +22,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_GameObject = sourceFile.ReadPPtr();
if (sourceFile.version[0] < 5)

View File

@ -18,13 +18,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = reader.ReadAlignedString();
if (readSwitch)

View File

@ -17,13 +17,6 @@ namespace AssetStudio
var version = preloadData.sourceFile.version;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_GameObject = sourceFile.ReadPPtr();
if (sourceFile.version[0] < 5)
{

View File

@ -16,13 +16,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = reader.ReadAlignedString();
if (readSwitch)

View File

@ -45,13 +45,6 @@ namespace AssetStudio
var reader = preloadData.InitReader();
var version = sourceFile.version;
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = reader.ReadAlignedString();
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3))//2017.3 and up
{

View File

@ -19,13 +19,6 @@ namespace AssetStudio
var sourceFile = preloadData.sourceFile;
var reader = preloadData.InitReader();
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = reader.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_GameObject = sourceFile.ReadPPtr();
m_LocalRotation = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
m_LocalPosition = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };

View File

@ -967,9 +967,9 @@ namespace AssetStudio
else
{
lineSplit = ob.Length;
for (int i = 0; i < m_Mesh.m_materialIDs.Count; i++)
foreach (var m_materialID in m_Mesh.m_materialIDs)
{
ob.AppendFormat("{0},", m_Mesh.m_materialIDs[i]);
ob.AppendFormat("{0},", m_materialID);
if (ob.Length - lineSplit > 2000)
{

View File

@ -213,8 +213,6 @@ namespace AssetStudio
{
var submesh = mesh.m_SubMeshes[i];
var iSubmesh = new ImportedSubmesh();
iSubmesh.Index = i;
iSubmesh.Visible = true;
Material mat = null;
if (i < meshR.m_Materials.Length)
{
@ -867,9 +865,9 @@ namespace AssetStudio
private static ImportedVertex GetSourceVertex(List<ImportedSubmesh> submeshList, int morphVertIndex)
{
for (int i = 0; i < submeshList.Count; i++)
foreach (var submesh in submeshList)
{
List<ImportedVertex> vertList = submeshList[i].VertexList;
var vertList = submesh.VertexList;
if (morphVertIndex < vertList.Count)
{
return vertList[morphVertIndex];

View File

@ -414,12 +414,10 @@ namespace AssetStudio
ProgressBarPerformStep();
}
if (fileNode.Nodes.Count == 0)
if (fileNode.Nodes.Count > 0)
{
fileNode.Text += " (no children)";
fileNodes.Add(fileNode);
}
fileNodes.Add(fileNode);
}
if (File.Exists(mainPath + "\\materials.json"))

View File

@ -19,7 +19,6 @@ namespace AssetStudio
{
public string Name { get; set; }
public Matrix Matrix { get; set; }
public dynamic Parent { get; set; }
}
@ -35,9 +34,6 @@ namespace AssetStudio
public List<ImportedVertex> VertexList { get; set; }
public List<ImportedFace> FaceList { get; set; }
public string Material { get; set; }
public int Index { get; set; }
public bool WorldCoords { get; set; }
public bool Visible { get; set; }
}
public class ImportedVertex

View File

@ -5,67 +5,61 @@ using System.IO;
namespace AssetStudio
{
public interface IObjChild
{
dynamic Parent { get; set; }
}
public interface IObjChild
{
dynamic Parent { get; set; }
}
public abstract class ObjChildren<T> : IEnumerable<T> where T : IObjChild
{
protected List<T> children;
public abstract class ObjChildren<T> : IEnumerable<T> where T : IObjChild
{
protected List<T> children;
public T this[int i]
{
get { return (T)children[i]; }
}
public T this[int i] => children[i];
public int Count
{
get { return children.Count; }
}
public int Count => children.Count;
public void InitChildren(int count)
{
children = new List<T>(count);
}
public void InitChildren(int count)
{
children = new List<T>(count);
}
public void AddChild(T obj)
{
children.Add(obj);
obj.Parent = this;
}
public void AddChild(T obj)
{
children.Add(obj);
obj.Parent = this;
}
public void InsertChild(int i, T obj)
{
children.Insert(i, obj);
obj.Parent = this;
}
public void InsertChild(int i, T obj)
{
children.Insert(i, obj);
obj.Parent = this;
}
public void RemoveChild(T obj)
{
obj.Parent = null;
children.Remove(obj);
}
public void RemoveChild(T obj)
{
obj.Parent = null;
children.Remove(obj);
}
public void RemoveChild(int i)
{
children[i].Parent = null;
children.RemoveAt(i);
}
public void RemoveChild(int i)
{
children[i].Parent = null;
children.RemoveAt(i);
}
public int IndexOf(T obj)
{
return children.IndexOf(obj);
}
public int IndexOf(T obj)
{
return children.IndexOf(obj);
}
public IEnumerator<T> GetEnumerator()
{
return children.GetEnumerator();
}
public IEnumerator<T> GetEnumerator()
{
return children.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}