mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
Merge branch 'pr/40' into AssetStudioMod
This commit is contained in:
commit
81a1eeb2d1
@ -2714,7 +2714,7 @@ namespace AssetStudioGUI
|
|||||||
GL.GenVertexArrays(1, out vao);
|
GL.GenVertexArrays(1, out vao);
|
||||||
GL.BindVertexArray(vao);
|
GL.BindVertexArray(vao);
|
||||||
CreateVBO(out var vboPositions, vertexData, attributeVertexPosition);
|
CreateVBO(out var vboPositions, vertexData, attributeVertexPosition);
|
||||||
if (normalMode == 0)
|
if (normalMode == 1)
|
||||||
{
|
{
|
||||||
CreateVBO(out var vboNormals, normal2Data, attributeNormalDirection);
|
CreateVBO(out var vboNormals, normal2Data, attributeNormalDirection);
|
||||||
}
|
}
|
||||||
|
@ -570,6 +570,8 @@ namespace AssetStudio
|
|||||||
|
|
||||||
private static Mesh GetMesh(Renderer meshR)
|
private static Mesh GetMesh(Renderer meshR)
|
||||||
{
|
{
|
||||||
|
GameObject m_GameObject;
|
||||||
|
|
||||||
if (meshR is SkinnedMeshRenderer sMesh)
|
if (meshR is SkinnedMeshRenderer sMesh)
|
||||||
{
|
{
|
||||||
if (sMesh.m_Mesh.TryGet(out var m_Mesh))
|
if (sMesh.m_Mesh.TryGet(out var m_Mesh))
|
||||||
@ -579,7 +581,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
meshR.m_GameObject.TryGet(out var m_GameObject);
|
meshR.m_GameObject.TryGet(out m_GameObject);
|
||||||
if (m_GameObject.m_MeshFilter != null)
|
if (m_GameObject.m_MeshFilter != null)
|
||||||
{
|
{
|
||||||
if (m_GameObject.m_MeshFilter.m_Mesh.TryGet(out var m_Mesh))
|
if (m_GameObject.m_MeshFilter.m_Mesh.TryGet(out var m_Mesh))
|
||||||
@ -589,6 +591,23 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Last resort
|
||||||
|
if (meshR.m_GameObject.TryGet(out m_GameObject))
|
||||||
|
{
|
||||||
|
Logger.Debug("Mesh Renderer had no Mesh attached, trying to find Mesh by name..");
|
||||||
|
var meshR_originalName = m_GameObject.m_Name;
|
||||||
|
foreach (var serializedFile in m_GameObject.assetsFile.assetsManager.assetsFileList)
|
||||||
|
{
|
||||||
|
var nameRelatedMesh = (Mesh)serializedFile.Objects.Find(x => x is Mesh m_Mesh && m_Mesh.m_Name == meshR_originalName);
|
||||||
|
if (nameRelatedMesh != null)
|
||||||
|
{
|
||||||
|
Logger.Debug($"Successfully found a Mesh replacement for the component \"{meshR_originalName}\"");
|
||||||
|
return nameRelatedMesh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Logger.Debug($"No Mesh was found for the component \"{meshR_originalName}\"");
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user