예제 #1
0
        public float RequireVersion(out bool isQDEF, out bool isExMorph, out bool isExJoint, out bool isSoftBody)
        {
            Func <bool> func = delegate
            {
                bool result4 = false;
                for (int k = 0; k < VertexList.Count; k++)
                {
                    if (VertexList[k].Deform == PmxVertex.DeformType.QDEF)
                    {
                        result4 = true;
                        break;
                    }
                }
                return(result4);
            };
            Func <bool> func2 = delegate
            {
                bool result3 = false;
                for (int j = 0; j < MorphList.Count; j++)
                {
                    PmxMorph pmxMorph = MorphList[j];
                    if (pmxMorph.IsFlip || pmxMorph.IsImpulse)
                    {
                        result3 = true;
                        break;
                    }
                }
                return(result3);
            };
            Func <bool> func3 = delegate
            {
                bool result2 = false;
                for (int i = 0; i < JointList.Count; i++)
                {
                    if (JointList[i].Kind != 0)
                    {
                        result2 = true;
                        break;
                    }
                }
                return(result2);
            };
            Func <bool> func4 = () => SoftBodyList.Count > 0;

            isQDEF     = func();
            isExMorph  = func2();
            isExJoint  = func3();
            isSoftBody = func4();
            float result = 2f;

            if (isQDEF | isExMorph | isExJoint | isSoftBody)
            {
                result = 2.1f;
            }
            return(result);
        }
예제 #2
0
        // Token: 0x060001F5 RID: 501 RVA: 0x00010E8C File Offset: 0x0000F08C
        public void FromPmxMorph(PmxMorph m, bool nonStr)
        {
            bool flag = !nonStr;

            if (flag)
            {
                this.Name  = m.Name;
                this.NameE = m.NameE;
            }
            this.Panel = m.Panel;
            this.Kind  = m.Kind;
            int count = m.OffsetList.Count;

            this.OffsetList = new List <PmxBaseMorph>(count);
            for (int i = 0; i < count; i++)
            {
                this.OffsetList.Add(m.OffsetList[i].Clone());
            }
        }
예제 #3
0
        public void FromPmxMorph(PmxMorph m, bool nonStr = false)
        {
            if (!nonStr)
            {
                Name  = m.Name;
                NameE = m.NameE;
            }
            Panel = m.Panel;
            Kind  = m.Kind;
            int count = m.OffsetList.Count;

            OffsetList.Clear();
            OffsetList.Capacity = count;
            for (int i = 0; i < count; i++)
            {
                OffsetList.Add(m.OffsetList[i].Clone());
            }
            FromID(m);
        }
예제 #4
0
 // Token: 0x060001F4 RID: 500 RVA: 0x00010E76 File Offset: 0x0000F076
 public PmxMorph(PmxMorph m, bool nonStr)
 {
     this.FromPmxMorph(m, nonStr);
 }
예제 #5
0
 public PmxMorph(PmxMorph m, bool nonStr = false)
     : this()
 {
     FromPmxMorph(m, nonStr);
 }
예제 #6
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;
        }
예제 #7
0
        // Token: 0x060000B9 RID: 185 RVA: 0x0000D684 File Offset: 0x0000B884
        public float RequireVersion(out bool isQDEF, out bool isExMorph, out bool isExJoint, out bool isSoftBody)
        {
            Func <bool> func = delegate()
            {
                bool result2 = false;
                for (int i = 0; i < this.VertexList.Count; i++)
                {
                    PmxVertex pmxVertex = this.VertexList[i];
                    bool      flag2     = pmxVertex.Deform == PmxVertex.DeformType.QDEF;
                    if (flag2)
                    {
                        result2 = true;
                        break;
                    }
                }
                return(result2);
            };
            Func <bool> func2 = delegate()
            {
                bool result2 = false;
                for (int i = 0; i < this.MorphList.Count; i++)
                {
                    PmxMorph pmxMorph = this.MorphList[i];
                    bool     flag2    = pmxMorph.IsFlip || pmxMorph.IsImpulse;
                    if (flag2)
                    {
                        result2 = true;
                        break;
                    }
                }
                return(result2);
            };
            Func <bool> func3 = delegate()
            {
                bool result2 = false;
                for (int i = 0; i < this.JointList.Count; i++)
                {
                    PmxJoint pmxJoint = this.JointList[i];
                    bool     flag2    = pmxJoint.Kind > PmxJoint.JointKind.Sp6DOF;
                    if (flag2)
                    {
                        result2 = true;
                        break;
                    }
                }
                return(result2);
            };
            Func <bool> func4 = () => this.SoftBodyList.Count > 0;

            isQDEF     = func();
            isExMorph  = func2();
            isExJoint  = func3();
            isSoftBody = func4();
            float result = 2f;
            bool  flag   = isQDEF | isExMorph | isExJoint | isSoftBody;

            if (flag)
            {
                result = 2.1f;
            }
            return(result);
        }
예제 #8
0
        // Token: 0x060000B2 RID: 178 RVA: 0x0000CC80 File Offset: 0x0000AE80
        public virtual void FromStreamEx(Stream s, PmxElementFormat f)
        {
            PmxHeader pmxHeader = new PmxHeader(2.1f);

            pmxHeader.FromStreamEx(s, null);
            this.Header.FromHeader(pmxHeader);
            this.ModelInfo.FromStreamEx(s, pmxHeader.ElementFormat);
            int num = PmxStreamHelper.ReadElement_Int32(s, 4, true);

            this.VertexList.Clear();
            this.VertexList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                PmxVertex pmxVertex = new PmxVertex();
                pmxVertex.FromStreamEx(s, pmxHeader.ElementFormat);
                this.VertexList.Add(pmxVertex);
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.FaceList.Clear();
            this.FaceList.Capacity = num;
            for (int j = 0; j < num; j++)
            {
                int item = PmxStreamHelper.ReadElement_Int32(s, pmxHeader.ElementFormat.VertexSize, false);
                this.FaceList.Add(item);
            }
            PmxTextureTable pmxTextureTable = new PmxTextureTable();

            pmxTextureTable.FromStreamEx(s, pmxHeader.ElementFormat);
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.MaterialList.Clear();
            this.MaterialList.Capacity = num;
            for (int k = 0; k < num; k++)
            {
                PmxMaterial pmxMaterial = new PmxMaterial();
                pmxMaterial.FromStreamEx_TexTable(s, pmxTextureTable, pmxHeader.ElementFormat);
                this.MaterialList.Add(pmxMaterial);
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.BoneList.Clear();
            this.BoneList.Capacity = num;
            for (int l = 0; l < num; l++)
            {
                PmxBone pmxBone = new PmxBone();
                pmxBone.FromStreamEx(s, pmxHeader.ElementFormat);
                this.BoneList.Add(pmxBone);
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.MorphList.Clear();
            this.MorphList.Capacity = num;
            for (int m = 0; m < num; m++)
            {
                PmxMorph pmxMorph = new PmxMorph();
                pmxMorph.FromStreamEx(s, pmxHeader.ElementFormat);
                this.MorphList.Add(pmxMorph);
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.NodeList.Clear();
            this.NodeList.Capacity = num;
            for (int n = 0; n < num; n++)
            {
                PmxNode pmxNode = new PmxNode();
                pmxNode.FromStreamEx(s, pmxHeader.ElementFormat);
                this.NodeList.Add(pmxNode);
                bool systemNode = this.NodeList[n].SystemNode;
                if (systemNode)
                {
                    bool flag = this.NodeList[n].Name == "Root";
                    if (flag)
                    {
                        this.RootNode = this.NodeList[n];
                    }
                    else
                    {
                        bool flag2 = this.NodeList[n].Name == "表情";
                        if (flag2)
                        {
                            this.ExpNode = this.NodeList[n];
                        }
                    }
                }
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.BodyList.Clear();
            this.BodyList.Capacity = num;
            for (int num2 = 0; num2 < num; num2++)
            {
                PmxBody pmxBody = new PmxBody();
                pmxBody.FromStreamEx(s, pmxHeader.ElementFormat);
                this.BodyList.Add(pmxBody);
            }
            num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
            this.JointList.Clear();
            this.JointList.Capacity = num;
            for (int num3 = 0; num3 < num; num3++)
            {
                PmxJoint pmxJoint = new PmxJoint();
                pmxJoint.FromStreamEx(s, pmxHeader.ElementFormat);
                this.JointList.Add(pmxJoint);
            }
            bool flag3 = pmxHeader.Ver >= 2.1f;

            if (flag3)
            {
                num = PmxStreamHelper.ReadElement_Int32(s, 4, true);
                this.SoftBodyList.Clear();
                this.SoftBodyList.Capacity = num;
                for (int num4 = 0; num4 < num; num4++)
                {
                    PmxSoftBody pmxSoftBody = new PmxSoftBody();
                    pmxSoftBody.FromStreamEx(s, pmxHeader.ElementFormat);
                    this.SoftBodyList.Add(pmxSoftBody);
                }
            }
        }