Exemplo n.º 1
0
        public void LoadInterpData(int idx, PCCObject pccobject)
        {
            TimeScale.RemoveAllChildren();
            TimeScale.Width = 3600;
            TimelineView.RemoveAllChildren();
            TimelineView.Width = 3600;
            scrollbarH.Maximum = 3600;
            PPath line;
            SText text;

            for (int i = 0; i < TimeScale.Width; i += 60)
            {
                line          = PPath.CreateLine(i, 1, i, Timeline.InfoHeight);
                line.Pickable = false;
                line.Pen      = new Pen(Color.FromArgb(110, 110, 110));
                TimeScale.AddChild(line);
                text          = new SText(i / 60 - 1 + ".00", Color.FromArgb(175, 175, 175), false);
                text.Pickable = false;
                text.TranslateBy(i + 2, Timeline.InfoHeight - text.Height);
                TimeScale.AddChild(text);
            }

            pcc   = pccobject;
            index = idx;
            foreach (InterpGroup g in InterpGroups)
            {
                RemoveChild(g.listEntry);
            }
            InterpGroups.Clear();

            BitConverter.IsLittleEndian = true;
            List <PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[index]);
            List <int> groups = new List <int>();

            foreach (PropertyReader.Property p in props)
            {
                if (pcc.getNameEntry(p.Name) == "InterpLength")
                {
                    InterpLength = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "EdSectionStart")
                {
                    EdSectionStart = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "EdSectionEnd")
                {
                    EdSectionEnd = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "m_nBioCutSceneVersion")
                {
                    m_nBioCutSceneVersion = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "m_pSFXSceneData")
                {
                    m_pSFXSceneData = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "ObjInstanceVersion")
                {
                    ObjInstanceVersion = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "ParentSequence")
                {
                    ParentSequence = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "InterpGroups")
                {
                    for (int i = 0; i < p.Value.Array.Count; i += 4)
                    {
                        groups.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1);
                    }
                }
            }
            foreach (int i in groups)
            {
                if (pcc.Exports[i].ClassName.StartsWith("InterpGroup"))
                {
                    addGroup(new InterpGroup(i, pcc));
                }
            }
            TimeScale.MoveToFront();
            PPath startmark = PPath.CreatePolygon(53, 1, 61, 1, 61, 9);

            startmark.Pen      = null;
            startmark.Brush    = new SolidBrush(Color.FromArgb(255, 80, 80));
            startmark.Pickable = false;
            TimeScale.AddChild(startmark);
            endmark       = PPath.CreatePolygon(InterpLength * 60 + 61, 1, InterpLength * 60 + 69, 1, InterpLength * 60 + 61, 9);
            endmark.Pen   = null;
            endmark.Brush = startmark.Brush;
            TimeScale.AddChild(endmark);
            foreach (InterpGroup g in InterpGroups)
            {
                foreach (InterpTrack t in g.InterpTracks)
                {
                    t.GetKeyFrames();
                    t.DrawKeyFrames();
                    TimelineView.AddChild(t.timelineEntry);
                }
            }
        }