public InterpGroup(int idx, PCCObject pccobj) : base() { index = idx; pcc = pccobj; title = new SText(""); if (pcc.Exports[index].ClassName == "InterpGroupDirector") { GroupName = "DirGroup"; } listEntry = PPath.CreateRectangle(0, 0, Timeline.ListWidth, Timeline.TrackHeight); listEntry.Brush = GroupBrush; listEntry.Pen = null; PPath p = PPath.CreatePolygon(7, 5, 12, 10, 7, 15); p.Brush = Brushes.Black; listEntry.AddChild(p); listEntry.AddChild(PPath.CreateLine(0, listEntry.Bounds.Bottom, Timeline.ListWidth, listEntry.Bounds.Bottom)); colorAccent = new PNode(); colorAccent.Brush = null; colorAccent.Bounds = new RectangleF(Timeline.ListWidth - 10, 0, 10, listEntry.Bounds.Bottom); listEntry.AddChild(colorAccent); title.TranslateBy(20, 3); listEntry.AddChild(title); listEntry.MouseDown += listEntry_MouseDown; collapsed = true; InterpTracks = new List <InterpTrack>(); LoadData(); }
void scrollbarH_Scroll(object sender, ScrollEventArgs e) { TimelineView.OffsetX = -e.NewValue + Timeline.ListWidth; TimeScale.OffsetX = -e.NewValue + Timeline.ListWidth; if (e.NewValue > TimelineView.Width / 2 && TimelineView.Width < InterpLength * 60 + 600) { TimelineView.Width += 600; TimeScale.Width += 600; scrollbarH.Maximum = (int)TimelineView.Width; SText text; PPath p; for (int i = (int)TimeScale.Width - 600; i < TimeScale.Width; i += 60) { p = PPath.CreateLine(i, 0, i, Timeline.InfoHeight); p.Pickable = false; p.Pen = new Pen(Color.FromArgb(110, 110, 110)); TimeScale.AddChild(p); text = new SText(i / 60 - 1 + ".00", Color.FromArgb(175, 175, 175), false); text.Pickable = false; text.TranslateBy(i, Timeline.InfoHeight - text.Height); TimeScale.AddChild(text); } } }
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); } } }