Esempio n. 1
0
        private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            System.Drawing.Point targetPoint = treeView1.PointToClient(new System.Drawing.Point(e.X, e.Y));

            TreeNode targetNode = treeView1.GetNodeAt(targetPoint);

            TreeNode draggedNode = (TreeNode)e.Data.GetData(typeof(Bone));

            if (!draggedNode.Equals(targetNode) && targetNode != null && !isAChildOfB(targetNode, draggedNode))
            {
                int oldParent = (int)VBN.bones[VBN.boneIndex(draggedNode.Text)].parentIndex;
                //VBN.bones[oldParent].children.Remove(VBN.boneIndex(draggedNode.Text));
                int  newParent = VBN.boneIndex(targetNode.Text);
                Bone temp      = VBN.bones[VBN.boneIndex(draggedNode.Text)];
                temp.parentIndex = (int)newParent;
                VBN.bones[VBN.boneIndex(draggedNode.Text)] = temp;
                //VBN.bones[newParent].children.Add(VBN.boneIndex(draggedNode.Text));

                draggedNode.Remove();
                targetNode.Nodes.Add(draggedNode);

                targetNode.Expand();
                Edited = true;
            }
            if (targetNode == null)
            {
                draggedNode.Remove();
                treeView1.Nodes.Add(draggedNode);
                Edited = true;
            }
            VBN.reset();
        }
Esempio n. 2
0
        // I'm completely totally serious

        public static NUD Create(VBN vbn)
        {
            Dictionary <string, string> files = new Dictionary <string, string>();
            ZipArchive zip = ZipFile.OpenRead("lib\\Skapon.zip");

            Random random       = new Random();
            int    randomNumber = random.Next(0, 0xFFFFFF);

            NUT nut = new NUT();

            foreach (ZipArchiveEntry e in zip.Entries)
            {
                byte[] b;
                using (BinaryReader br = new BinaryReader(e.Open()))
                {
                    b = br.ReadBytes((int)e.Length);
                }
                var    stream = new StreamReader(new MemoryStream(b));
                string s      = stream.ReadToEnd();
                files.Add(e.Name, s);

                if (e.Name.EndsWith(".dds"))
                {
                    NutTexture tex = new DDS(new FileData(b)).ToNutTexture();
                    nut.Nodes.Add(tex);
                    tex.HashId = 0x40000000 + randomNumber;
                    nut.glTexByHashId.Add(tex.HashId, NUT.CreateTexture2D(tex));
                }
            }

            NUD nud = new NUD();

            NUD.Mesh head = new NUD.Mesh();
            nud.Nodes.Add(head);
            head.Text = "Skapon";

            head.Nodes.Add(setToBone(scale(readPoly(files["head.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("HeadN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["body.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("BustN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["hand.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("RHandN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["hand.obj"]), -1, -1, 1), vbn.bones[vbn.boneIndex("LHandN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["foot.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("RFootJ")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["foot.obj"]), -1, -1, -1), vbn.bones[vbn.boneIndex("LFootJ")], vbn));

            foreach (NUD.Polygon p in head.Nodes)
            {
                p.materials[0].textures[0].hash = 0x40000000 + randomNumber;
            }

            nud.UpdateRenderMeshes();

            return(nud);
        }
Esempio n. 3
0
        public static void CreateANIM(string fname, Animation a, VBN vbn)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
            {
                AnimHeader header = new AnimHeader();
                file.WriteLine("animVersion " + header.animVersion + ";");
                file.WriteLine("mayaVersion " + header.mayaVersion + ";");
                file.WriteLine("timeUnit " + header.timeUnit + ";");
                file.WriteLine("linearUnit " + header.linearUnit + ";");
                file.WriteLine("angularUnit " + header.angularUnit + ";");
                file.WriteLine("startTime " + 1 + ";");
                file.WriteLine("endTime " + a.FrameCount + ";");

                a.SetFrame(a.FrameCount - 1);             //from last frame
                for (int li = 0; li < a.FrameCount; ++li) //go through each frame with nextFrame
                {
                    a.NextFrame(vbn);
                }
                a.NextFrame(vbn);  //go on first frame

                int i = 0;

                // writing node attributes
                foreach (Bone b in vbn.getBoneTreeOrder())
                {
                    i = vbn.boneIndex(b.Text);

                    if (a.HasBone(b.Text))
                    {
                        // write the bone attributes
                        // count the attributes
                        Animation.KeyNode n = a.GetBone(b.Text);
                        int ac = 0;


                        if (n.XPOS.HasAnimation())
                        {
                            file.WriteLine("anim translate.translateX translateX " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.XPOS, n, a.Size(), "translateX");
                            file.WriteLine("}");
                        }
                        if (n.YPOS.HasAnimation())
                        {
                            file.WriteLine("anim translate.translateY translateY " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.YPOS, n, a.Size(), "translateY");
                            file.WriteLine("}");
                        }
                        if (n.ZPOS.HasAnimation())
                        {
                            file.WriteLine("anim translate.translateZ translateZ " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.ZPOS, n, a.Size(), "translateZ");
                            file.WriteLine("}");
                        }
                        if (n.XROT.HasAnimation())
                        {
                            file.WriteLine("anim rotate.rotateX rotateX " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.XROT, n, a.Size(), "rotateX");
                            file.WriteLine("}");
                        }
                        if (n.YROT.HasAnimation())
                        {
                            file.WriteLine("anim rotate.rotateY rotateY " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.YROT, n, a.Size(), "rotateY");
                            file.WriteLine("}");
                        }
                        if (n.ZROT.HasAnimation())
                        {
                            file.WriteLine("anim rotate.rotateZ rotateZ " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.ZROT, n, a.Size(), "rotateZ");
                            file.WriteLine("}");
                        }

                        if (n.XSCA.HasAnimation())
                        {
                            file.WriteLine("anim scale.scaleX scaleX " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.XSCA, n, a.Size(), "scaleX");
                            file.WriteLine("}");
                        }
                        if (n.YSCA.HasAnimation())
                        {
                            file.WriteLine("anim scale.scaleY scaleY " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.YSCA, n, a.Size(), "scaleY");
                            file.WriteLine("}");
                        }
                        if (n.ZSCA.HasAnimation())
                        {
                            file.WriteLine("anim scale.scaleZ scaleZ " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, n.ZSCA, n, a.Size(), "scaleZ");
                            file.WriteLine("}");
                        }
                    }
                    else
                    {
                        file.WriteLine("anim " + b.Text + " 0 0 0;");
                    }
                }
            }
        }
Esempio n. 4
0
        // I'm completely totally serious

        public static NUD Create(VBN vbn)
        {
            NUD nud = new NUD();

            NUD.Mesh head = new NUD.Mesh();
            nud.mesh.Add(head);
            head.Text = "Skapon";

            NUT nut = new NUT();

            NUT.NUD_Texture tex = new DDS(new FileData("Skapon//tex.dds")).toNUT_Texture();
            nut.textures.Add(tex);
            Random random       = new Random();
            int    randomNumber = random.Next(0, 0xFFFFFF);

            tex.id = 0x40000000 + randomNumber;
            nut.draw.Add(tex.id, NUT.loadImage(tex));

            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//head.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("HeadN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//body.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("BustN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//hand.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("RHandN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//hand.obj")), -1, -1, 1), vbn.bones[vbn.boneIndex("LHandN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//foot.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("RFootJ")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//foot.obj")), -1, -1, -1), vbn.bones[vbn.boneIndex("LFootJ")], vbn));

            foreach (NUD.Polygon p in head.polygons)
            {
                p.materials[0].textures[0].hash = tex.id;
            }

            return(nud);
        }
Esempio n. 5
0
        public void createANIM(string fname, VBN vbn)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
            {
                file.WriteLine("animVersion 1.1;");
                file.WriteLine("mayaVersion 2014 x64;\ntimeUnit ntscf;\nlinearUnit cm;\nangularUnit deg;\nstartTime 1;\nendTime " + (anim.frameCount + 1) + ";");

                int i = 0;

                // writing node attributes
                foreach (Bone b in vbn.getBoneTreeOrder())
                {
                    i = vbn.boneIndex(b.Text);

                    if (i < anim.nodes.Count)
                    {
                        // write the bone attributes
                        // count the attributes
                        List <DAT_Animation.DATAnimTrack> tracks = anim.nodes[i];

                        int tracknum = 0;
                        if (tracks.Count == 0)
                        {
                            file.WriteLine("anim " + b.Text + " 0 0 0;");
                        }

                        foreach (DAT_Animation.DATAnimTrack track in tracks)
                        {
                            switch (track.type)
                            {
                            case DAT_Animation.AnimType.XPOS:
                                file.WriteLine("anim translate.translateX translateX " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, false);
                                break;

                            case DAT_Animation.AnimType.YPOS:
                                file.WriteLine("anim translate.translateY translateY " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, false);
                                break;

                            case DAT_Animation.AnimType.ZPOS:
                                file.WriteLine("anim translate.translateZ translateZ " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, false);
                                break;

                            case DAT_Animation.AnimType.XROT:
                                file.WriteLine("anim rotate.rotateX rotateX " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, true);
                                break;

                            case DAT_Animation.AnimType.YROT:
                                file.WriteLine("anim rotate.rotateY rotateY " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, true);
                                break;

                            case DAT_Animation.AnimType.ZROT:
                                file.WriteLine("anim rotate.rotateZ rotateZ " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, true);
                                break;

                            case DAT_Animation.AnimType.XSCA:
                                file.WriteLine("anim scale.scaleX scaleX " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, false);
                                break;

                            case DAT_Animation.AnimType.YSCA:
                                file.WriteLine("anim scale.scaleY scaleY " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, false);
                                break;

                            case DAT_Animation.AnimType.ZSCA:
                                file.WriteLine("anim scale.scaleZ scaleZ " + b.Text + " 0 0 " + (tracknum++) + ";");
                                WriteAnimKey(file, i, track, false);
                                break;
                            }
                        }
                    }
                    else
                    {
                        file.WriteLine("anim " + b.Text + " 0 0 0;");
                    }
                }
            }
        }
Esempio n. 6
0
        public Animation toAnimation(VBN vbn)
        {
            Animation animation = new Animation(anim.Name);

            animation.FrameCount = anim.frameCount;

            int i = 0;

            foreach (Bone b in vbn.bones)
            {
                i = vbn.boneIndex(b.Text);

                if (i < anim.nodes.Count)
                {
                    List <DAT_Animation.DATAnimTrack> tracks = anim.nodes[i];

                    Animation.KeyNode node = new Animation.KeyNode(b.Text);
                    node.RotType = Animation.RotationType.EULER;

                    foreach (DAT_Animation.DATAnimTrack track in tracks)
                    {
                        switch (track.type)
                        {
                        case DAT_Animation.AnimType.XPOS:
                            node.XPOS = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.YPOS:
                            node.YPOS = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.ZPOS:
                            node.ZPOS = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.XROT:
                            node.XROT = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.YROT:
                            node.YROT = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.ZROT:
                            node.ZROT = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.XSCA:
                            node.XSCA = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.YSCA:
                            node.YSCA = CreateKeyGroup(i, track, false);
                            break;

                        case DAT_Animation.AnimType.ZSCA:
                            node.ZSCA = CreateKeyGroup(i, track, false);
                            break;
                        }
                    }

                    if (node.XSCA.HasAnimation() || node.YSCA.HasAnimation() || node.ZSCA.HasAnimation() ||
                        node.XPOS.HasAnimation() || node.YPOS.HasAnimation() || node.ZPOS.HasAnimation() ||
                        node.XROT.HasAnimation() || node.YROT.HasAnimation() || node.ZROT.HasAnimation())
                    {
                        animation.Bones.Add(node);
                    }
                }
            }

            return(animation);
        }
Esempio n. 7
0
        public static SkelAnimation read(string filename, VBN vbn)
        {
            StreamReader reader = File.OpenText(filename);
            string       line;

            bool isHeader = true;

            string          angularUnit, linearUnit, timeUnit;
            int             startTime = 0;
            int             endTime   = 0;
            List <AnimBone> bones     = new List <AnimBone>();
            AnimBone        current;
            AnimData        att    = new AnimData();
            bool            inKeys = false;

            while ((line = reader.ReadLine()) != null)
            {
                string[] args = line.Replace(";", "").TrimStart().Split(' ');

                if (isHeader)
                {
                    if (args [0].Equals("anim"))
                    {
                        isHeader = false;
                    }
                    else if (args [0].Equals("angularUnit"))
                    {
                        angularUnit = args [1];
                    }
                    else if (args [0].Equals("endTime"))
                    {
                        endTime = (int)Math.Ceiling(float.Parse(args [1]));
                    }
                    else if (args [0].Equals("startTime"))
                    {
                        startTime = (int)Math.Ceiling(float.Parse(args [1]));
                    }
                }

                if (!isHeader)
                {
                    if (inKeys)
                    {
                        if (args[0].Equals("}"))
                        {
                            inKeys = false;
                            continue;
                        }
                        AnimKey k = new AnimKey();
                        att.keys.Add(k);
                        k.input  = float.Parse(args [0]);
                        k.output = float.Parse(args [1]);
                        k.intan  = (args [2]);
                        k.outtan = (args [3]);
                        if (args.Length > 7 && att.weighted)
                        {
                            k.t1 = float.Parse(args[7]) * (float)(Math.PI / 180f);
                            k.w1 = float.Parse(args[8]);
                        }
                    }

                    if (args [0].Equals("anim"))
                    {
                        inKeys = false;
                        if (args.Length == 5)
                        {
                            //TODO: finish this type
                            // can be name of attribute
                        }
                        if (args.Length == 7)
                        {
                            // see of the bone of this attribute exists
                            current = null;
                            foreach (AnimBone b in bones)
                            {
                                if (b.name.Equals(args [3]))
                                {
                                    current = b;
                                    break;
                                }
                            }
                            if (current == null)
                            {
                                current = new AnimBone();
                                bones.Add(current);
                            }
                            current.name = args [3];

                            att      = new AnimData();
                            att.type = args [2];
                            current.atts.Add(att);

                            // row child attribute aren't needed here
                        }
                    }

                    if (args [0].Equals("input"))
                    {
                        att.input = args [1];
                    }
                    if (args [0].Equals("output"))
                    {
                        att.output = args [1];
                    }
                    if (args [0].Equals("weighted"))
                    {
                        att.weighted = args [1].Equals("1");
                    }
                    if (args [0].Equals("preInfinity"))
                    {
                        att.preInfinity = args [1];
                    }
                    if (args [0].Equals("postInfinity"))
                    {
                        att.postInfinity = args [1];
                    }

                    // begining keys section
                    if (args [0].Contains("keys"))
                    {
                        inKeys = true;
                    }
                }
            }

            SkelAnimation a = new SkelAnimation();

            for (int i = 0; i < endTime - startTime + 1; i++)
            {
                KeyFrame key = new KeyFrame();
                a.addKeyframe(key);

                foreach (AnimBone b in bones)
                {
                    KeyNode n = new KeyNode();
                    n.id = vbn.boneIndex(b.name);
                    if (n.id == -1)
                    {
                        continue;
                    }
                    else
                    {
                        n.hash = vbn.bones[n.id].boneId;
                    }
                    foreach (AnimData d in b.atts)
                    {
                        if (d.type.Contains("translate"))
                        {
                            n.t_type = KeyNode.INTERPOLATED;
                            if (d.type.Contains("X"))
                            {
                                n.t.X = d.getValue(i);
                            }
                            if (d.type.Contains("Y"))
                            {
                                n.t.Y = d.getValue(i);
                            }
                            if (d.type.Contains("Z"))
                            {
                                n.t.Z = d.getValue(i);
                            }
                        }
                        if (d.type.Contains("rotate"))
                        {
                            n.r_type = KeyNode.INTERPOLATED;
                            if (d.type.Contains("X"))
                            {
                                n.r.X = d.getValue(i) * (float)(Math.PI / 180f);
                            }
                            if (d.type.Contains("Y"))
                            {
                                n.r.Y = d.getValue(i) * (float)(Math.PI / 180f);
                            }
                            if (d.type.Contains("Z"))
                            {
                                n.r.Z = d.getValue(i) * (float)(Math.PI / 180f);
                            }
                        }
                        if (d.type.Contains("scale"))
                        {
                            n.s_type = KeyNode.INTERPOLATED;
                            if (d.type.Contains("X"))
                            {
                                n.s.X = d.getValue(i);
                            }
                            if (d.type.Contains("Y"))
                            {
                                n.s.Y = d.getValue(i);
                            }
                            if (d.type.Contains("Z"))
                            {
                                n.s.Z = d.getValue(i);
                            }
                        }
                    }
                    key.addNode(n);
                }
            }

            // keynode rotations need caluclation
            foreach (KeyFrame f in a.frames)
            {
                foreach (KeyNode n in f.nodes)
                {
                    n.r = VBN.FromEulerAngles(n.r.Z, n.r.Y, n.r.X);
                }
            }

            reader.Close();
            return(a);
        }
Esempio n. 8
0
        public static void createANIM(string fname, SkelAnimation a, VBN vbn)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
            {
                file.WriteLine("animVersion 1.1;");
                file.WriteLine("mayaVersion 2014 x64;\ntimeUnit ntscf;\nlinearUnit cm;\nangularUnit deg;\nstartTime 1;\nendTime " + (a.size()) + ";");

                a.setFrame(a.size() - 1);             //from last frame
                for (int li = 0; li < a.size(); ++li) //go through each frame with nextFrame
                {
                    a.nextFrame(vbn);
                }
                a.nextFrame(vbn);                         //go on first frame

                List <int> nodes = a.getNodes(true, vbn); //getting node indexes

                int i = 0;

                // writing node attributes
                foreach (Bone b in vbn.getBoneTreeOrder())
                {
                    i = vbn.boneIndex(b.Text);

                    if (nodes.Contains(i))
                    {
                        // write the bone attributes
                        // count the attributes
                        KeyNode n  = a.getNode(0, i);
                        int     ac = 0;
                        if (n.t_type != -1)
                        {
                            file.WriteLine("anim translate.translateX translateX " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "translateX", n.t_type);
                            file.WriteLine("}");
                            file.WriteLine("anim translate.translateY translateY " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "translateY", n.t_type);
                            file.WriteLine("}");
                            file.WriteLine("anim translate.translateZ translateZ " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "translateZ", n.t_type);
                            file.WriteLine("}");
                        }
                        if (n.r_type != -1)
                        {
                            file.WriteLine("anim rotate.rotateX rotateX " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "rotateX", n.r_type);
                            file.WriteLine("}");
                            file.WriteLine("anim rotate.rotateY rotateY " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "rotateY", n.r_type);
                            file.WriteLine("}");
                            file.WriteLine("anim rotate.rotateZ rotateZ " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "rotateZ", n.r_type);
                            file.WriteLine("}");
                        }
                        if (n.s_type != -1)
                        {
                            file.WriteLine("anim scale.scaleX scaleX " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "scaleX", n.s_type);
                            file.WriteLine("}");
                            file.WriteLine("anim scale.scaleY scaleY " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "scaleY", n.s_type);
                            file.WriteLine("}");
                            file.WriteLine("anim scale.scaleZ scaleZ " + b.Text + " 0 0 " + (ac++) + ";");
                            writeKey(file, a, i, "scaleZ", n.s_type);
                            file.WriteLine("}");
                        }
                    }
                    else
                    {
                        file.WriteLine("anim " + b.Text + " 0 0 0;");
                    }
                }
            }
        }
Esempio n. 9
0
        public static void read(string fname, SkelAnimation a, VBN v)
        {
            StreamReader reader = File.OpenText(fname);
            string       line;

            string   current = "";
            bool     readBones = false;
            int      frame = 0, prevframe = 0;
            KeyFrame k = new KeyFrame();

            VBN vbn = v;

            if (v.bones.Count == 0)
            {
                readBones = true;
            }
            else
            {
                vbn = new VBN();
            }

            while ((line = reader.ReadLine()) != null)
            {
                line = Regex.Replace(line, @"\s+", " ");
                string[] args = line.Replace(";", "").TrimStart().Split(' ');

                if (args[0].Equals("nodes") || args[0].Equals("skeleton") || args[0].Equals("end") || args[0].Equals("time"))
                {
                    current = args[0];
                    if (args.Length > 1)
                    {
                        prevframe = frame;
                        frame     = int.Parse(args[1]);

                        /*if (frame != prevframe + 1) {
                         *                              Console.WriteLine ("Needs interpolation " + frame);
                         *                      }*/

                        k       = new KeyFrame();
                        k.frame = frame;
                        a.addKeyframe(k);
                    }
                    continue;
                }

                if (current.Equals("nodes"))
                {
                    Bone b = new Bone(vbn);
                    b.Text        = args[1].Replace("\"", "");
                    b.parentIndex = int.Parse(args[2]);
                    //b.children = new System.Collections.Generic.List<int> ();
                    vbn.totalBoneCount++;
                    vbn.bones.Add(b);
                }

                if (current.Equals("time"))
                {
                    KeyNode n = new KeyNode();
                    n.id = v.boneIndex(vbn.bones[int.Parse(args[0])].Text);
                    if (n.id == -1)
                    {
                        continue;
                    }
                    else
                    {
                        n.hash = v.bones[n.id].boneId;
                    }

                    // only if it finds the node
                    k.addNode(n);

                    // reading the skeleton if this isn't an animation
                    if (readBones && frame == 0)
                    {
                        Bone b = vbn.bones[n.id];
                        b.position    = new float[3];
                        b.rotation    = new float[3];
                        b.scale       = new float[3];
                        b.position[0] = float.Parse(args[1]);
                        b.position[1] = float.Parse(args[2]);
                        b.position[2] = float.Parse(args[3]);
                        b.rotation[0] = float.Parse(args[4]);
                        b.rotation[1] = float.Parse(args[5]);
                        b.rotation[2] = float.Parse(args[6]);
                        b.scale[0]    = 1f;
                        b.scale[1]    = 1f;
                        b.scale[2]    = 1f;

                        b.pos = new Vector3(float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3]));
                        b.rot = VBN.FromEulerAngles(float.Parse(args[6]), float.Parse(args[5]), float.Parse(args[4]));

                        //if(b.parentIndex!=-1)
                        //	vbn.bones [b.parentIndex].children.Add (int.Parse(args[0]));
                    }

                    n.t_type = KeyNode.INTERPOLATED;
                    n.t      = new Vector3(float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3]));
                    n.r_type = KeyNode.INTERPOLATED;
                    n.r      = VBN.FromEulerAngles(float.Parse(args[6]), float.Parse(args[5]), float.Parse(args[4]));
                }
            }

            v.boneCountPerType[0] = (uint)vbn.bones.Count;
            v.update();
            a.bakeFramesLinear();
        }