コード例 #1
0
 public void FromStreamEx(Stream s, PmxElementFormat f = null)
 {
     Name     = PmxStreamHelper.ReadString(s, f);
     NameE    = PmxStreamHelper.ReadString(s, f);
     Position = V3_BytesConvert.FromStream(s);
     Parent   = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
     Level    = PmxStreamHelper.ReadElement_Int32(s);
     Flags    = (BoneFlags)PmxStreamHelper.ReadElement_Int32(s, 2, signed: false);
     if (GetFlag(BoneFlags.ToBone))
     {
         To_Bone = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
     }
     else
     {
         To_Offset = V3_BytesConvert.FromStream(s);
     }
     if (GetFlag(BoneFlags.AddRotation) || GetFlag(BoneFlags.AddTranslation))
     {
         AddParent = PmxStreamHelper.ReadElement_Int32(s, f.BoneSize);
         AddRatio  = PmxStreamHelper.ReadElement_Float(s);
     }
     if (GetFlag(BoneFlags.FixAxis))
     {
         Axis = V3_BytesConvert.FromStream(s);
     }
     if (GetFlag(BoneFlags.LocalFrame))
     {
         LocalX = V3_BytesConvert.FromStream(s);
         LocalZ = V3_BytesConvert.FromStream(s);
         if (!f.WithID)
         {
             NormalizeLocal();
         }
     }
     if (GetFlag(BoneFlags.ExtParent))
     {
         ExtKey = PmxStreamHelper.ReadElement_Int32(s);
     }
     if (GetFlag(BoneFlags.IK))
     {
         IK.FromStreamEx(s, f);
     }
     if (f.WithID)
     {
         base.UID = PmxStreamHelper.ReadElement_UInt(s);
         base.CID = PmxStreamHelper.ReadElement_UInt(s);
     }
 }