コード例 #1
0
        bool ZeroCheckAnimations(odfANIMSection animations)
        {
            bool result = true;

            foreach (odfTrack track in animations)
            {
                for (int i = 0; i < track.AlwaysZero16.Length; i++)
                {
                    if (track.AlwaysZero16[i] != 0)
                    {
                        Report.ReportLog("Zero check failed: Animation track " + track.BoneFrameId + " " + "AlwaysZero16" + " @" + i + " value=" + track.AlwaysZero16[i]);
                        result = false;
                    }
                }

                foreach (odfKeyframe keyframe in track.KeyframeList)
                {
                    for (int i = 0; i < keyframe.AlwaysZero88.Length; i++)
                    {
                        if (keyframe.AlwaysZero88[i] != 0)
                        {
                            Report.ReportLog("Zero check failed: Animation track " + track.BoneFrameId + " keyframe " + keyframe.Index + " " + "AlwaysZero88" + " @" + i + " value=" + keyframe.AlwaysZero88[i]);
                            result = false;
                        }
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        private static void ParseTracks(BinaryReader reader, int numTracks, odfANIMSection animSection)
        {
            for (int trackIdx = 0; trackIdx < numTracks; trackIdx++)
            {
                ObjectID id           = new ObjectID(reader.ReadBytes(4));
                byte[]   alwaysZero   = reader.ReadBytes(16);
                int      numKeyframes = reader.ReadInt32();
                odfTrack track        = new odfTrack(numKeyframes);
                track.BoneFrameId  = id;
                track.AlwaysZero16 = alwaysZero;
                for (int i = 0; i < numKeyframes; i++)
                {
                    odfKeyframe keyframe = new odfKeyframe();
                    keyframe.Index             = reader.ReadSingle();
                    keyframe.Unknown1          = reader.ReadInt32();
                    keyframe.FastTranslation   = reader.ReadVector3();
                    keyframe.Unknown2          = reader.ReadInt32();
                    keyframe.FastRotation      = reader.ReadVector3();
                    keyframe.Unknown3          = reader.ReadInt32();
                    keyframe.FastScaling       = reader.ReadVector3();
                    keyframe.Matrix            = reader.ReadMatrix();
                    keyframe.ExtraFastRotation = reader.ReadQuaternion();
                    keyframe.AlwaysZero88      = reader.ReadBytes(88);

                    track.KeyframeList.Add(keyframe);
                }

                animSection.AddChild(track);
            }
        }
コード例 #3
0
ファイル: Fbx.cs プロジェクト: kkdevs/sb3u
            public void ConvertAnimation(odfANIMSection anim, odfParser odaParser, bool odaSkeleton)
            {
                if (odaSkeleton)
                {
                    FrameList.Clear();
                    ConvertFrames(odaParser.FrameSection.RootFrame);
                }

                ImportedKeyframedAnimation iAnim = new ImportedKeyframedAnimation();

                AnimationList.Add(iAnim);
                iAnim.TrackList = new List <ImportedAnimationKeyframedTrack>(anim.Count);
                string notFound = String.Empty;

                foreach (odfTrack track in anim)
                {
                    odfFrame boneFrame = odf.FindFrame(track.BoneFrameId, odaParser.FrameSection.RootFrame);
                    if (boneFrame == null)
                    {
                        notFound += (notFound.Length > 0 ? ", " : "") + track.BoneFrameId;
                        continue;
                    }

                    ImportedAnimationKeyframedTrack iTrack = new ImportedAnimationKeyframedTrack();
                    iAnim.TrackList.Add(iTrack);
                    iTrack.Name      = boneFrame.Name;
                    iTrack.Keyframes = ConvertTrack(track.KeyframeList);
                }
                if (notFound.Length > 0)
                {
                    Report.ReportLog("Warning: Animations weren't converted for the following missing frame IDs: " + notFound);
                }
            }
コード例 #4
0
        private bool loadANIM(BinaryReader reader, odfFileSection fileSec)
        {
            ObjectName     name        = new ObjectName(reader.ReadBytes(64));
            ObjectID       id          = new ObjectID(reader.ReadBytes(4));
            int            numTracks   = reader.ReadInt32();
            odfANIMSection animSection = new odfANIMSection(id, numTracks);

            animSection.Name = name;
            ParseTracks(reader, numTracks, animSection);

            fileSec.Section = animSection;
            AnimSection     = animSection;
            return(true);
        }
コード例 #5
0
        public void SetAnimationClipName(string name, string newName)
        {
            odfANIMSection anim = odf.FindClip(name, Parser);

            anim.Name = new ObjectName(newName, null);
        }