protected SObj(int idx, IMEPackage p) { pcc = p; index = idx; export = pcc.getExport(index); comment = new SText(GetComment(), commentColor, false); comment.X = 0; comment.Y = 0 - comment.Height; comment.Pickable = false; this.AddChild(comment); this.Pickable = true; }
public SObj(int idx, float x, float y, PCCObject p) : base() { pcc = p; index = idx; comment = new SText(GetComment(index), commentColor, false); comment.X = 0; comment.Y = 0 - comment.Height; comment.Pickable = false; this.AddChild(comment); this.Pickable = true; }
public void AddInputLink() { int count = InLinks.Count; InputLink l = new InputLink(); l.node = PPath.CreateRectangle(0, -4, 10, 8); l.node.Brush = outputBrush; l.node.MouseEnter += new PInputEventHandler(OnMouseEnter); l.node.MouseLeave += new PInputEventHandler(OnMouseLeave); l.node.AddInputEventListener(new InputDragHandler()); l.Desc = ":" + count; l.index = count; l.hasName = false; InLinks.Add(l); SText t2 = new SText(InLinks[count].Desc); t2.X = 0; if (count > 0) { t2.Y = InLinks[count - 1].node.Y + t2.Height; box.Height += t2.Height; bounds.Height += t2.Height; varLinkBox.TranslateBy(0, t2.Height); } else { t2.Y = 8; if (Outlinks.Count == 0) { box.Height += t2.Height; bounds.Height += t2.Height; varLinkBox.TranslateBy(0, t2.Height); } } t2.Pickable = false; InLinks[count].node.X = -10; InLinks[count].node.Y = t2.Y + t2.Height / 2 - 5; t2.AddChild(InLinks[count].node); inputLinkBox.AddChild(t2); InvalidatePaint(); }
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].Data); 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); } } }
public DlgStart(int idx, float x, float y, ME3BioConversation bc, DialogVis dialogvis) : base(idx, x, y, bc, dialogvis) { outlinePen = new Pen(Color.Black); GetOutputLinks(); SText title = new SText("Start: " + index, titleBrush); title.TextAlignment = StringAlignment.Center; title.X = 5; title.Y = 3; title.Pickable = false; box = PPath.CreateRectangle(0, 0, title.Width + 10, title.Height + 5); box.Pen = outlinePen; box.Brush = nodeBrush; box.AddChild(title); this.AddChild(box); this.TranslateBy(x, y); }
public SEvent(int idx, float x, float y, IMEPackage p, GraphEditor grapheditor) : base(idx, p, grapheditor) { outlinePen = new Pen(Color.FromArgb(214, 30, 28)); string s = export.ObjectName; s = s.Replace("BioSeqEvt_", ""); s = s.Replace("SFXSeqEvt_", ""); s = s.Replace("SeqEvt_", ""); s = s.Replace("SeqEvent_", ""); float starty = 0; float w = 15; float midW = 0; varLinkBox = new PPath(); GetVarLinks(); for (int i = 0; i < Varlinks.Count; i++) { string d = ""; foreach (int l in Varlinks[i].Links) d = d + "#" + l + ","; d = d.Remove(d.Length - 1); SText t2 = new SText( d + "\n" + Varlinks[i].Desc); t2.X = w; t2.Y = 0; w += t2.Width + 20; t2.Pickable = false; Varlinks[i].node.TranslateBy(t2.X + t2.Width / 2, t2.Y + t2.Height); t2.AddChild(Varlinks[i].node); varLinkBox.AddChild(t2); } if(Varlinks.Count != 0) varLinkBox.AddRectangle(0, 0, w, varLinkBox[0].Height); varLinkBox.Pickable = false; varLinkBox.Pen = outlinePen; varLinkBox.Brush = nodeBrush; GetOutputLinks(); outLinkBox = new PPath(); for (int i = 0; i < Outlinks.Count(); i++) { SText t2 = new SText(Outlinks[i].Desc); if(t2.Width + 10 > midW) midW = t2.Width + 10; //t2.TextAlignment = StringAlignment.Far; //t2.ConstrainWidthToTextWidth = false; t2.X = 0 - t2.Width; t2.Y = starty + 3; starty += t2.Height + 6; t2.Pickable = false; Outlinks[i].node.TranslateBy(0, t2.Y + t2.Height / 2); t2.AddChild(Outlinks[i].node); outLinkBox.AddChild(t2); } outLinkBox.AddPolygon(new PointF[] { new PointF(0, 0), new PointF(0, starty), new PointF(-0.5f*midW, starty+30), new PointF(0 - midW, starty), new PointF(0 - midW, 0), new PointF(midW/-2, -30) }); outLinkBox.Pickable = false; outLinkBox.Pen = outlinePen; outLinkBox.Brush = nodeBrush; var props = export.GetProperties(); foreach (var prop in props) { if (prop.Name.Name.Contains("EventName") || prop.Name == "sScriptName") s += "\n\"" + (prop as NameProperty) + "\""; else if (prop.Name == "InputLabel" || prop.Name == "sEvent") s += "\n\"" + (prop as StrProperty) + "\""; } float tW = GetTitleBox(s, w); if (tW > w) { if (midW > tW) { w = midW; titleBox.Width = w; } else { w = tW; } varLinkBox.Width = w; } float h = titleBox.Height + 1; outLinkBox.TranslateBy(titleBox.Width/2 + midW/2, h + 30); h += outLinkBox.Height + 1; varLinkBox.TranslateBy(0, h); h += varLinkBox.Height; this.bounds = new RectangleF(0, 0, w, h); this.AddChild(titleBox); this.AddChild(varLinkBox); this.AddChild(outLinkBox); this.TranslateBy(x, y); }
protected float GetTitleBox(string s, float w) { s = "#" + index + " : " + s; SText title = new SText(s,titleBrush); title.TextAlignment = StringAlignment.Center; title.ConstrainWidthToTextWidth = false; if (title.Width + 20 > w) { w = title.Width + 20; } title.Width = w; title.X = 0; title.Y = 3; title.Pickable = false; titleBox = PPath.CreateRectangle(0, 0, w, title.Height + 5); titleBox.Pen = outlinePen; titleBox.Brush = titleBoxBrush; titleBox.AddChild(title); titleBox.Pickable = false; return w; }
protected void MakeTitleBox(string s) { s = "#" + index + " : " + s; SText title = new SText(s, Color.FromArgb(255, 255, 128)); title.TextAlignment = StringAlignment.Center; title.ConstrainWidthToTextWidth = false; title.Width += 20; title.X = 0; title.Y = 3; title.Pickable = false; titleBox = PPath.CreateRectangle(0, 0, title.Width, title.Height + 5); titleBox.Pen = outlinePen; titleBox.Brush = new SolidBrush(Color.FromArgb(112, 112, 112)); titleBox.AddChild(title); titleBox.Pickable = false; }
public SVar(int idx, float x, float y, IMEPackage p, GraphEditor grapheditor) : base(idx, p, grapheditor) { string s = export.ObjectName; s = s.Replace("BioSeqVar_", ""); s = s.Replace("SFXSeqVar_", ""); s = s.Replace("SeqVar_", ""); type = getType(s); float w = 60; float h = 60; shape = PPath.CreateEllipse(0, 0, w, h); outlinePen = new Pen(getColor(type)); shape.Pen = outlinePen; shape.Brush = nodeBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, w, h); val = new SText(GetValue()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = w / 2 - val.Width / 2; val.Y = h / 2 - val.Height / 2; this.AddChild(val); var props = export.GetProperties(); foreach (var prop in props) { if (prop.Name == "VarName" || prop.Name == "varName") { SText VarName = new SText((prop as NameProperty).Value, Color.Red, false); VarName.Pickable = false; VarName.TextAlignment = StringAlignment.Center; VarName.X = w / 2 - VarName.Width / 2; VarName.Y = h; this.AddChild(VarName); break; } } this.TranslateBy(x, y); this.MouseEnter += OnMouseEnter; this.MouseLeave += OnMouseLeave; }
public override void Layout(float x, float y) { if (pcc.Game == MEGame.ME1) { // == if (Math.Abs(x - -0.1f) < float.Epsilon) x = originalX; // == if (Math.Abs(y - -0.1f) < float.Epsilon) y = originalY; } else { // == if (Math.Abs(originalX - -1) > float.Epsilon) x = originalX; // == if (Math.Abs(originalY - -1) > float.Epsilon) y = originalY; } outlinePen = new Pen(Color.Black); string s = export.ObjectName; s = s.Replace("BioSeqAct_", ""); s = s.Replace("SFXSeqAct_", ""); s = s.Replace("SeqAct_", ""); s = s.Replace("SeqCond_", ""); float starty = 8; float w = 20; varLinkBox = new PPath(); for (int i = 0; i < Varlinks.Count(); i++) { string d = ""; foreach (int l in Varlinks[i].Links) d = d + "#" + l + ","; d = d.Remove(d.Length - 1); SText t2 = new SText(d + "\n" + Varlinks[i].Desc); t2.X = w; t2.Y = 0; w += t2.Width + 20; t2.Pickable = false; Varlinks[i].node.TranslateBy(t2.X + t2.Width / 2, t2.Y + t2.Height); t2.AddChild(Varlinks[i].node); varLinkBox.AddChild(t2); } if (Varlinks.Count != 0) varLinkBox.Height = varLinkBox[0].Height; varLinkBox.Width = w; varLinkBox.Pickable = false; outLinkBox = new PPath(); float outW = 0; for (int i = 0; i < Outlinks.Count(); i++) { SText t2 = new SText(Outlinks[i].Desc); if (t2.Width + 10 > outW) outW = t2.Width + 10; t2.X = 0 - t2.Width; t2.Y = starty; starty += t2.Height; t2.Pickable = false; Outlinks[i].node.TranslateBy(0, t2.Y + t2.Height / 2); t2.AddChild(Outlinks[i].node); outLinkBox.AddChild(t2); } outLinkBox.Pickable = false; inputLinkBox = new PNode(); GetInputLinks(); float inW = 0; float inY = 8; for (int i = 0; i < InLinks.Count(); i++) { SText t2 = new SText(InLinks[i].Desc); if (t2.Width > inW) inW = t2.Width; t2.X = 3; t2.Y = inY; inY += t2.Height; t2.Pickable = false; InLinks[i].node.X = -10; InLinks[i].node.Y = t2.Y + t2.Height / 2 - 5; t2.AddChild(InLinks[i].node); inputLinkBox.AddChild(t2); } inputLinkBox.Pickable = false; if (inY > starty) starty = inY; if (inW + outW + 10 > w) w = inW + outW + 10; var props = export.GetProperties(); foreach (var prop in props) { if (prop.Name == "oSequenceReference") { ObjectProperty objectProperty = (prop as ObjectProperty); if (pcc.Game == MEGame.ME1) { if (objectProperty.Value > 0) { string seqName = pcc.getEntry(objectProperty.Value).ObjectName; if (seqName == "Sequence") { var objNameProp = pcc.getExport(objectProperty.Value - 1).GetProperty<StrProperty>("ObjName"); if (objNameProp != null) { seqName = objNameProp; } } s += "\n\"" + seqName + "\""; } else { s += "\n\"" + pcc.getEntry(objectProperty.Value).ObjectName + "\""; } } else { s += "\n\"" + pcc.getEntry(objectProperty.Value).ObjectName + "\""; } } else if (prop.Name == "EventName" || prop.Name == "StateName") s += "\n\"" + (prop as NameProperty) + "\""; else if (prop.Name == "OutputLabel" || prop.Name == "m_sMovieName") s += "\n\"" + (prop as StrProperty) + "\""; else if (prop.Name == "m_pEffect") { s += "\n\"" + pcc.getEntry((prop as ObjectProperty).Value).ObjectName + "\""; } } float tW = GetTitleBox(s, w); if (tW > w) { w = tW; titleBox.Width = w; } titleBox.X = 0; titleBox.Y = 0; float h = titleBox.Height + 2; inputLinkBox.TranslateBy(0, h); outLinkBox.TranslateBy(w, h); h += starty + 8; varLinkBox.TranslateBy(varLinkBox.Width < w ? (w - varLinkBox.Width) / 2 : 0, h); h += varLinkBox.Height; box = PPath.CreateRectangle(0, titleBox.Height + 2, w, h - (titleBox.Height + 2)); box.Brush = nodeBrush; box.Pen = outlinePen; box.Pickable = false; this.Bounds = new RectangleF(0, 0, w, h); this.AddChild(box); this.AddChild(titleBox); this.AddChild(varLinkBox); this.AddChild(outLinkBox); this.AddChild(inputLinkBox); this.TranslateBy(x, y); }
public SVar(int idx, float x, float y, PCCObject p, GraphEditor grapheditor) : base(idx, x, y, p, grapheditor) { string s = pcc.Exports[index].ObjectName; s = s.Replace("BioSeqVar_", ""); s = s.Replace("SFXSeqVar_", ""); s = s.Replace("SeqVar_", ""); type = getType(s); float w = 60; float h = 60; shape = PPath.CreateEllipse(0, 0, w, h); outlinePen = new Pen(getColor(type)); shape.Pen = outlinePen; shape.Brush = nodeBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, w, h); val = new SText(GetValue()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = w / 2 - val.Width / 2; val.Y = h / 2 - val.Height / 2; this.AddChild(val); List<PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[index].Data); foreach (PropertyReader.Property prop in props) { if (pcc.getNameEntry(prop.Name) == "VarName" || pcc.getNameEntry(prop.Name) == "varName") { SText VarName = new SText(pcc.getNameEntry(prop.Value.IntValue), Color.Red, false); VarName.Pickable = false; VarName.TextAlignment = StringAlignment.Center; VarName.X = w / 2 - VarName.Width / 2; VarName.Y = h; this.AddChild(VarName); break; } } this.TranslateBy(x, y); this.MouseEnter += new PInputEventHandler(OnMouseEnter); this.MouseLeave += new PInputEventHandler(OnMouseLeave); }
public override void Layout(float x, float y) { if (originalX != -1) x = originalX; if (originalY != -1) y = originalY; outlinePen = new Pen(Color.Black); string s = pcc.Exports[index].ObjectName; s = s.Replace("BioSeqAct_", ""); s = s.Replace("SFXSeqAct_", ""); s = s.Replace("SeqAct_", ""); s = s.Replace("SeqCond_", ""); float starty = 8; float w = 15; varLinkBox = new PPath(); for (int i = 0; i < Varlinks.Count(); i++) { string d = ""; foreach (int l in Varlinks[i].Links) d = d + "#" + l + ","; d = d.Remove(d.Length - 1); SText t2 = new SText(d + "\n" + Varlinks[i].Desc); t2.X = w; t2.Y = 0; w += t2.Width + 20; t2.Pickable = false; Varlinks[i].node.TranslateBy(t2.X + t2.Width / 2, t2.Y + t2.Height); t2.AddChild(Varlinks[i].node); varLinkBox.AddChild(t2); } if (Varlinks.Count != 0) varLinkBox.Height = varLinkBox[0].Height; varLinkBox.Width = w; varLinkBox.Pickable = false; outLinkBox = new PPath(); for (int i = 0; i < Outlinks.Count(); i++) { SText t2 = new SText(Outlinks[i].Desc); if (t2.Width + 10 > w) w = t2.Width + 10; t2.X = 0 - t2.Width; t2.Y = starty; starty += t2.Height; t2.Pickable = false; Outlinks[i].node.TranslateBy(0, t2.Y + t2.Height / 2); t2.AddChild(Outlinks[i].node); outLinkBox.AddChild(t2); } outLinkBox.Pickable = false; inputLinkBox = new PNode(); GetInputLinks(); float inW = 0; float inY = 8; for (int i = 0; i < InLinks.Count(); i++) { SText t2 = new SText(InLinks[i].Desc); if (t2.Width > inW) inW = t2.Width; t2.X = 3; t2.Y = inY; inY += t2.Height; t2.Pickable = false; InLinks[i].node.X = -10; InLinks[i].node.Y = t2.Y + t2.Height / 2 - 5; t2.AddChild(InLinks[i].node); inputLinkBox.AddChild(t2); } inputLinkBox.Pickable = false; if (inY > starty) starty = inY; w += inW; List<PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[index].Data); foreach (PropertyReader.Property prop in props) { if (pcc.getNameEntry(prop.Name) == "oSequenceReference") s += "\n\"" + pcc.Exports[prop.Value.IntValue - 1].ObjectName + "\""; else if (pcc.getNameEntry(prop.Name) == "EventName" || pcc.getNameEntry(prop.Name) == "StateName") s += "\n\"" + pcc.getNameEntry(prop.Value.IntValue) + "\""; else if (pcc.getNameEntry(prop.Name) == "OutputLabel" || pcc.getNameEntry(prop.Name) == "m_sMovieName") s += "\n\"" + prop.Value.StringValue + "\""; else if (pcc.getNameEntry(prop.Name) == "m_pEffect") if(prop.Value.IntValue > 0) s += "\n\"" + pcc.Exports[prop.Value.IntValue - 1].ObjectName + "\""; else s += "\n\"" + pcc.Imports[-prop.Value.IntValue - 1].ObjectName + "\""; } float tW = GetTitleBox(s, w); if (tW > w) { w = tW; titleBox.Width = w; } titleBox.X = 0; titleBox.Y = 0; float h = titleBox.Height + 2; inputLinkBox.TranslateBy(0, h); outLinkBox.TranslateBy(w, h); h += starty + 8; varLinkBox.TranslateBy(varLinkBox.Width < w ? (w - varLinkBox.Width) / 2 : 0, h); h += varLinkBox.Height; box = PPath.CreateRectangle(0, titleBox.Height + 2, w, h - (titleBox.Height + 2)); box.Brush = nodeBrush; box.Pen = outlinePen; box.Pickable = false; this.Bounds = new RectangleF(0, 0, w, h); this.AddChild(box); this.AddChild(titleBox); this.AddChild(varLinkBox); this.AddChild(outLinkBox); this.AddChild(inputLinkBox); this.TranslateBy(x, y); }
public InterpTrack(int idx, PCCObject pccobj) { index = idx; pcc = pccobj; title = new SText(""); listEntry = PPath.CreateRectangle(0, 0, Timeline.ListWidth, Timeline.TrackHeight); listEntry.Brush = TrackListBrush; listEntry.Pen = null; listEntry.MouseDown += listEntry_MouseDown; PPath p = PPath.CreateLine(9, 2, 9, 12); p.AddLine(9, 12, 31, 12); p.Brush = null; listEntry.AddChild(p); listEntry.AddChild(PPath.CreateLine(0, listEntry.Bounds.Bottom, Timeline.ListWidth, listEntry.Bounds.Bottom)); title.TranslateBy(30, 3); listEntry.AddChild(title); timelineEntry = new PNode(); //timelineEntry.Brush = Brushes.Green; LoadGenericData(); }