public static KeyframeArray DecodeSHP0Keyframes(SHP0KeyframeEntries *entry, SHP0Node node) { //If the node is null, assume the programmer has created a new entry and accessed //the keyframe collection for the first time before assigning the parent and will //set the frame count later manually. int numFrames = node == null ? 1 : node.FrameCount + (node.Loop ? 1 : 0); KeyframeArray kf = new KeyframeArray(numFrames) { Loop = node.Loop }; if (entry == null) { return(kf); } int fCount = entry->_numEntries; BVec3 *vec = entry->Entries; for (int i = 0; i < fCount; i++, vec++) { kf.SetFrameValue((int)vec->_y, vec->_z, true)._tangent = vec->_x; } return(kf); }
public override void OnRebuild(VoidPtr address, int length, bool force) { SHP0KeyframeEntries *header = (SHP0KeyframeEntries *)address; header->_numEntries = (short)Keyframes._keyCount; header->_unk1 = 0; BVec3 * entry = header->Entries; KeyframeEntry frame, root = Keyframes._keyRoot; for (frame = root._next; frame._index != -1; frame = frame._next) { *entry++ = new Vector3(frame._tangent, frame._index, frame._value); } }