private void tbFaceKnown_Click(object sender, RoutedEventArgs e) { if ((bool)tbFaceKnown.IsChecked) { FaceList.Clear(); faceRec.FaceList?.ForEach((face) => { FaceList.Add(face); }); } }
public virtual void Clear() { Header.ElementFormat.Ver = 2.1f; Header.ElementFormat.UVACount = 0; ModelInfo.Clear(); VertexList.Clear(); FaceList.Clear(); MaterialList.Clear(); BoneList.Clear(); MorphList.Clear(); BodyList.Clear(); JointList.Clear(); SoftBodyList.Clear(); InitializeSystemNode(); FilePath = ""; LoadErrCount = 0; }
public virtual void FromStream(Stream s, bool id) { Action <Action> action = delegate(Action a) { try { a(); } catch (Exception) { LoadErrCount++; } }; PmxHeader head = new PmxHeader(); head.FromStreamEx(s); Header.FromHeader(head); head.ElementFormat.WithID = id; action(delegate { ModelInfo.FromStreamEx(s, head.ElementFormat); }); int count = 0; action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); VertexList.Clear(); VertexList.Capacity = count; for (int k = 0; k < count; k++) { PmxVertex v = new PmxVertex(); action(delegate { v.FromStreamEx(s, head.ElementFormat); }); VertexList.Add(v); } action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); FaceList.Clear(); FaceList.Capacity = count; for (int l = 0; l < count; l++) { int ix = 0; action(delegate { ix = PmxStreamHelper.ReadElement_Int32(s, head.ElementFormat.VertexSize, signed: false); }); FaceList.Add(ix); } PmxTextureTable tx = new PmxTextureTable(); action(delegate { tx.FromStreamEx(s, head.ElementFormat); }); action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); MaterialList.Clear(); MaterialList.Capacity = count; for (int m = 0; m < count; m++) { PmxMaterial j = new PmxMaterial(); action(delegate { j.FromStreamEx_TexTable(s, tx, head.ElementFormat); }); MaterialList.Add(j); } action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); BoneList.Clear(); BoneList.Capacity = count; for (int n = 0; n < count; n++) { PmxBone b = new PmxBone(); action(delegate { b.FromStreamEx(s, head.ElementFormat); }); BoneList.Add(b); } action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); MorphList.Clear(); MorphList.Capacity = count; for (int num = 0; num < count; num++) { PmxMorph morph = new PmxMorph(); action(delegate { morph.FromStreamEx(s, head.ElementFormat); }); MorphList.Add(morph); } action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); NodeList.Clear(); NodeList.Capacity = count; for (int num2 = 0; num2 < count; num2++) { PmxNode node = new PmxNode(); action(delegate { node.FromStreamEx(s, head.ElementFormat); }); NodeList.Add(node); if (NodeList[num2].SystemNode) { if (NodeList[num2].Name == "Root") { RootNode = NodeList[num2]; } else if (NodeList[num2].Name == "表情") { ExpNode = NodeList[num2]; } } } action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); BodyList.Clear(); BodyList.Capacity = count; for (int num3 = 0; num3 < count; num3++) { PmxBody b2 = new PmxBody(); action(delegate { b2.FromStreamEx(s, head.ElementFormat); }); BodyList.Add(b2); } action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); JointList.Clear(); JointList.Capacity = count; for (int num4 = 0; num4 < count; num4++) { PmxJoint i = new PmxJoint(); action(delegate { i.FromStreamEx(s, head.ElementFormat); }); JointList.Add(i); } if (head.Ver >= 2.1f) { action(delegate { count = PmxStreamHelper.ReadElement_Int32(s); }); SoftBodyList.Clear(); SoftBodyList.Capacity = count; for (int num5 = 0; num5 < count; num5++) { PmxSoftBody b3 = new PmxSoftBody(); action(delegate { b3.FromStreamEx(s, head.ElementFormat); }); SoftBodyList.Add(b3); } } if (id) { action(delegate { FilePath = PmxStreamHelper.ReadString(s, head.ElementFormat); }); } head.ElementFormat.WithID = false; }