Skip to content

Commit

Permalink
fix exporter topology issue
Browse files Browse the repository at this point in the history
  • Loading branch information
i-saint committed Feb 5, 2018
1 parent c7ad7fd commit 7fc71fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public override void OnInspectorGUI()
EditorGUILayout.LabelField("Capture Settings", EditorStyles.boldLabel);
t.m_scope = (AlembicExporter.Scope)EditorGUILayout.EnumPopup("Scope", t.m_scope);
t.m_ignoreDisabled = EditorGUILayout.Toggle("Ignore Disabled", t.m_ignoreDisabled);
t.m_assumeTopologiesAreConstant = EditorGUILayout.Toggle("Assume Topologies Are Constant", t.m_assumeTopologiesAreConstant);
t.m_assumeNonSkinnedMeshesAreConstant = EditorGUILayout.Toggle("Assume Non-Skinned Meshes Are Constant", t.m_assumeNonSkinnedMeshesAreConstant);
GUILayout.Space(5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public partial class AlembicExporter : MonoBehaviour
public bool m_fixDeltaTime = true;

public bool m_ignoreDisabled = true;
public bool m_assumeTopologiesAreConstant = true;
public bool m_assumeNonSkinnedMeshesAreConstant = true;

public bool m_captureMeshRenderer = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void SetupSubmeshes(aeObject abc, Mesh mesh, Material[] materials)
}
}

public void Capture(Mesh mesh, bool topology,
public void Capture(Mesh mesh,
bool captureNormals, bool captureUV0, bool captureUV1, bool captureColors)
{
points.LockList(ls => mesh.GetVertices(ls));
Expand All @@ -67,7 +67,6 @@ public void Capture(Mesh mesh, bool topology,
else
colors.Clear();

if (topology)
{
int submeshCount = mesh.subMeshCount;
if (submeshCount == 1)
Expand All @@ -93,16 +92,11 @@ public void Capture(Mesh mesh, bool topology,
}
}
}
else
{
indices.Clear();
facesets.Clear();
}
}

public void Capture(Mesh mesh, bool topology, AlembicExporter exp)
public void Capture(Mesh mesh, AlembicExporter exp)
{
Capture(mesh, topology, exp.m_meshNormals, exp.m_meshUV0, exp.m_meshUV1, exp.m_meshColors);
Capture(mesh, exp.m_meshNormals, exp.m_meshUV0, exp.m_meshUV1, exp.m_meshColors);
}


Expand Down Expand Up @@ -143,7 +137,7 @@ public class ClothBuffer
[DllImport("abci")] static extern void aeApplyMatrixV(IntPtr dstVectors, int num, ref Matrix4x4 mat);
void GenerateRemapIndices(Mesh mesh, MeshBuffer mbuf)
{
mbuf.Capture(mesh, true, false, false, false, false);
mbuf.Capture(mesh, false, false, false, false);
var weights4 = new PinnedList<BoneWeight>();
weights4.LockList(l => { mesh.GetBoneWeights(l); });

Expand Down Expand Up @@ -349,8 +343,7 @@ public override void Capture()
if (mesh == null || (m_exporter.m_assumeNonSkinnedMeshesAreConstant && m_mbuf.points.Capacity != 0))
return;

bool topology = !m_exporter.m_assumeTopologiesAreConstant || m_mbuf.indices.Capacity == 0;
m_mbuf.Capture(mesh, topology, m_exporter);
m_mbuf.Capture(mesh, m_exporter);
m_mbuf.WriteSample(abc);
}
}
Expand Down Expand Up @@ -391,10 +384,6 @@ public SkinnedMeshCapturer(AlembicExporter exp, ComponentCapturer parent, Skinne
tc.captureScale = false;
}
}
else
{
m_meshBake = new Mesh();
}
}

public override void Capture()
Expand All @@ -408,11 +397,12 @@ public override void Capture()
}
else
{
if (m_meshBake == null)
m_meshBake = new Mesh();
m_meshBake.Clear();
m_target.BakeMesh(m_meshBake);

bool topology = !m_exporter.m_assumeTopologiesAreConstant || m_mbuf.indices.Capacity == 0;
m_mbuf.Capture(m_meshBake, topology, m_exporter);

m_mbuf.Capture(m_meshBake, m_exporter);
m_mbuf.WriteSample(m_abc);
}
}
Expand Down
1 change: 0 additions & 1 deletion Plugin/abci/Importer/aiPolyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ void aiPolyMesh::readSampleBody(Sample& sample, uint64_t idx)
auto& refiner = topology.m_refiner;
auto& summary = m_summary;

sample.reset();
if (m_varying_topology)
topology.clear();

Expand Down

0 comments on commit 7fc71fb

Please sign in to comment.