private void WritePropertyList(PropertyList props, BCFWriteProxy io, bool shortPairs) { if (!shortPairs) { io.WriteUInt32((uint)props.Items.Length); } foreach (var prop in props.Items) { io.WriteUInt32((uint)prop.KeyPairs.Count); foreach (var pair in prop.KeyPairs) { io.WritePascalString(pair.Key); io.WritePascalString(pair.Value); } } }
public void Write(BCFWriteProxy io, bool bcf) { if (!bcf) { io.WriteUInt32(1); //version } io.WritePascalString(Name); io.WriteInt16((short)Bones.Length); foreach (var bone in Bones) { WriteBone(bone, io, bcf); } }
public void WriteBCF(BCFWriteProxy io) { io.WritePascalString(Name); io.WriteInt32(Type); io.WriteInt32(Zero); io.WriteUInt32((uint)Bindings.Length); foreach (var binding in Bindings) { io.WritePascalString(binding.RealBinding.Bone); io.WritePascalString(binding.RealBinding.MeshName); io.WriteInt32(binding.RealBinding.CensorFlagBits); io.WriteInt32(binding.RealBinding.Zero); } }
public void Write(BCFWriteProxy io, bool bcf) { if (bcf) { io.WritePascalString(Name); io.WritePascalString(XSkillName); } else { io.WriteUInt32(2); io.WriteLongPascalString(Name); } io.WriteFloat(Duration); io.WriteFloat(Distance); if (bcf) { io.WriteInt32(IsMoving); } else { io.WriteByte(IsMoving); } io.WriteUInt32(TranslationCount); io.SetGrouping(3); if (!bcf) { for (var i = 0; i < TranslationCount; i++) { var trans = Translations[i]; io.WriteFloat(-trans.X); io.WriteFloat(trans.Y); io.WriteFloat(trans.Z); } } io.SetGrouping(1); io.WriteUInt32(RotationCount); io.SetGrouping(4); if (!bcf) { for (var i = 0; i < RotationCount; i++) { var rot = Rotations[i]; io.WriteFloat(rot.X); io.WriteFloat(-rot.Y); io.WriteFloat(-rot.Z); io.WriteFloat(-rot.W); } } io.SetGrouping(1); io.WriteUInt32((uint)Motions.Length); foreach (var motion in Motions) { if (!bcf) { io.WriteUInt32(0); //unknown } io.WritePascalString(motion.BoneName); io.WriteUInt32(motion.FrameCount); io.WriteFloat(motion.Duration); if (bcf) { io.WriteInt32(motion.HasTranslation ? 1 : 0); io.WriteInt32(motion.HasRotation ? 1 : 0); } else { io.WriteByte((byte)(motion.HasTranslation ? 1 : 0)); io.WriteByte((byte)(motion.HasRotation ? 1 : 0)); } io.WriteUInt32(motion.FirstTranslationIndex); io.WriteUInt32(motion.FirstRotationIndex); if (!bcf) { io.WriteByte(1); //has props } //write props list var props = motion.Properties; io.WriteUInt32((uint)props.Length); foreach (var prop in props) { //write property list WritePropertyList(prop, io, bcf); } if (!bcf) { io.WriteByte(1); //has time props } //write time props list var timePropsList = motion.TimeProperties; io.WriteUInt32((uint)timePropsList.Length); foreach (var list in timePropsList) { io.WriteUInt32((uint)list.Items.Length); foreach (var item in list.Items) { io.WriteInt32(item.ID); WritePropertyList(item.Properties, io, bcf); } } } }