public bool RemoveBone(int boneListIdx, int boneIdx) { odfBoneList boneList = Parser.EnvelopeSection[boneListIdx]; if (boneList.Count == 1) { Parser.EnvelopeSection.RemoveChild(boneList); return(true); } else { boneList.RemoveChild(boneIdx); return(false); } }
public static void MergeBoneLists(odfMesh mesh, Dictionary <ObjectID, ObjectID> submeshIDtrans, odfParser parser) { foreach (odfSubmesh submesh in mesh) { ObjectID baseSubmeshId = submeshIDtrans[submesh.Id]; for (int i = 0; i < parser.EnvelopeSection.Count; i++) { odfBoneList boneList = parser.EnvelopeSection[i]; if (boneList.SubmeshId == baseSubmeshId) { Dictionary <int, int> boneDic = new Dictionary <int, int>(boneList.Count); for (int j = 0; j < boneList.Count; j++) { odfBone bone = boneList[j]; boneDic.Add((int)bone.FrameId, j); } for (int j = i + 1; j < parser.EnvelopeSection.Count; j++) { odfBoneList boneList2 = parser.EnvelopeSection[j]; if (boneList2.SubmeshId == submesh.Id) { foreach (odfBone bone in boneList2) { int boneIdx; if (boneDic.TryGetValue((int)bone.FrameId, out boneIdx)) { boneList.RemoveChild(boneIdx); boneList.InsertChild(boneIdx, bone); } else { boneList.AddChild(bone); boneDic.Add((int)bone.FrameId, boneDic.Count); } } parser.EnvelopeSection.RemoveChild(boneList2); } } break; } else { Report.ReportLog("wrong"); } } } }