Beispiel #1
0
        public List <KFAnimation> getAnimations()
        {
            if (anims != null)
            {
                return(anims);
            }

            if (kfm == null)
            {
                return(new List <KFAnimation>());
            }

            if (kfmfile == null)
            {
                kfmfile = new KFMFile(new MemoryStream(adb.extractUsingFilename(kfm)));
            }

            anims = new List <KFAnimation>();
            //System.Diagnostics.Stopwatch sp = System.Diagnostics.Stopwatch.StartNew();
            //sp.Start();
            foreach (KFAnimation anim in kfmfile.kfanimations)
            {
                int id = anim.id;
                //Debug.Log("[" + sp.ElapsedMilliseconds + "] check id[" + id + "]");
                byte[] data = getKFBData(id);
                if (data != null)
                {
                    anims.Add(anim);
                }
                //Debug.Log("Found anim [" + anim.id + "]:" + anim.sequenceFilename + ":" + anim.sequencename +": hasData:" + (data != null));
                // Debug.Log("[" + sp.ElapsedMilliseconds + "] done check id[" + id + "]");
            }

            return(anims);
        }
Beispiel #2
0
 public void setParams(AssetDatabase adb, string nif, string kfm, string kfb)
 {
     this.adb        = adb;
     this.nif        = nif;
     this.kfm        = kfm;
     this.kfb        = kfb;
     kfmfile         = null;
     kfbfile         = null;
     nifanimation    = null;
     activeAnimation = -1;
     skeletonRoot    = null;
     anims           = null;
     boneMap.Clear();
 }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        AssetDatabase db = AssetDatabaseInst.DB;

        KFMFile kfm     = new KFMFile(new FileStream(@"C:\Users\Spikeles\Documents\NetBeansProjects\TelaraDBExplorer\TelaraDBEditorCore\human_female_medium.kfm", FileMode.Open, FileAccess.Read, FileShare.Read));
        NIFFile kfbfile = new NIFFile(new FileStream(@"C:\Users\Spikeles\Documents\NetBeansProjects\TelaraDBExplorer\TelaraDBEditorCore\human_female_2h_shared.kfb", FileMode.Open, FileAccess.Read, FileShare.Read));

        // 230, string -> index 2

        List <KFAnimation> anims = kfm.kfanimations;
        int maxAnimID            = 0;

        foreach (KFAnimation anim in anims)
        {
            maxAnimID = Mathf.Max(anim.id, maxAnimID);
            //Debug.Log(anim.id + ":" + anim.sequenceFilename + ":" + anim.sequencename);
        }
        Debug.Log("maxAnimID:" + maxAnimID);

        for (int i = 0; i < kfbfile.numObjects; i += 4)
        {
            NiIntegerExtraData indexData = (NiIntegerExtraData)kfbfile.getObject(i);
            NiIntegerExtraData sizeData  = (NiIntegerExtraData)kfbfile.getObject(i + 1);
            NiBinaryExtraData  binData   = (NiBinaryExtraData)kfbfile.getObject(i + 2);
            NiBinaryExtraData  binData2  = (NiBinaryExtraData)kfbfile.getObject(i + 3);
            KFAnimation        anim      = anims.DefaultIfEmpty(null).FirstOrDefault(a => a.id == indexData.intExtraData);
            if (anim != null)
            {
                Debug.Log("kfb[" + indexData.intExtraData + "] match => [" + anim.id + "]" + anim.sequenceFilename);
            }
            else
            {
                Debug.Log("kfb[" + indexData.intExtraData + "] nomatch");
            }
        }
        Debug.Log("kfb objs:" + kfbfile.numObjects / 4);
        Debug.Log("anims:" + anims.Count);
        //File.WriteAllBytes("human_female.kfb" + i + "_0", binData.getData());
        //File.WriteAllBytes("human_female.kfb" + i + "_1", binData2.getData());
    }