public void MergeFrame(odfFrame srcFrame, odfParser srcParser, int destParentIdx) { List <ObjectID> newMeshIDs = new List <ObjectID>(); odfFrame newFrame = srcFrame.Clone(true, newMeshIDs, true); List <odfMesh> newMeshes = new List <odfMesh>(newMeshIDs.Count); List <odfBoneList> newBoneLists = new List <odfBoneList>(srcParser.EnvelopeSection != null ? srcParser.EnvelopeSection.Count : 0); string boneWarning = String.Empty; foreach (ObjectID meshID in newMeshIDs) { odfMesh srcMesh = odf.FindMeshListSome(meshID, srcParser.MeshSection); odfMesh mesh = srcMesh.Clone(); newMeshes.Add(mesh); if (srcParser.EnvelopeSection != null) { foreach (odfSubmesh submesh in mesh) { odfBoneList boneList = odf.FindBoneList(submesh.Id, srcParser.EnvelopeSection); if (boneList != null) { if (Parser.EnvelopeSection != null) { odfBoneList copy = boneList.Clone(); newBoneLists.Add(copy); } else { boneWarning += (boneWarning != String.Empty ? ", " : "") + mesh.ToString(); break; } } } } } MergeFrame(newFrame, destParentIdx); foreach (odfMesh mesh in newMeshes) { Parser.MeshSection.AddChild(mesh); } if (Parser.EnvelopeSection != null) { foreach (odfBoneList boneList in newBoneLists) { Parser.EnvelopeSection.AddChild(boneList); } } Parser.CollectObjectIDs(); if (boneWarning != String.Empty) { Report.ReportLog("Warning! Bones of " + boneWarning + " dropped because the destination had no Envelope section."); } }
public void ReplaceFrame(odfFrame srcFrame, odfParser srcParser, int destParentIdx, bool deleteMorphs) { List <ObjectID> meshIDs = new List <ObjectID>(); odfFrame newFrame = srcFrame.Clone(true, meshIDs, true); ReplaceFrame(newFrame, destParentIdx, deleteMorphs); string boneWarning = String.Empty; foreach (ObjectID meshID in meshIDs) { odfMesh srcMesh = odf.FindMeshListSome(meshID, srcParser.MeshSection); odfMesh mesh = srcMesh.Clone(); Parser.MeshSection.AddChild(mesh); if (srcParser.EnvelopeSection != null) { foreach (odfSubmesh submesh in mesh) { odfBoneList boneList = odf.FindBoneList(submesh.Id, srcParser.EnvelopeSection); if (boneList != null) { if (Parser.EnvelopeSection != null) { odfBoneList copy = boneList.Clone(); Parser.EnvelopeSection.AddChild(copy); } else { boneWarning += (boneWarning != String.Empty ? ", " : "") + mesh.ToString(); break; } } } } } Parser.CollectObjectIDs(); if (boneWarning != String.Empty) { Report.ReportLog("Warning! Bones of " + boneWarning + " dropped because the destination had no Envelope section."); } }