diff --git a/renderdocui/Windows/EventBrowser.Designer.cs b/renderdocui/Windows/EventBrowser.Designer.cs
index 8c5af25be..f3286f3b3 100644
--- a/renderdocui/Windows/EventBrowser.Designer.cs
+++ b/renderdocui/Windows/EventBrowser.Designer.cs
@@ -60,6 +60,8 @@
this.bookmarkStrip = new System.Windows.Forms.ToolStrip();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toggleBookmark = new System.Windows.Forms.ToolStripButton();
+ this.export = new System.Windows.Forms.ToolStripButton();
+ this.exportDialog = new System.Windows.Forms.SaveFileDialog();
toolStripLabel3 = new System.Windows.Forms.ToolStripLabel();
toolStripLabel4 = new System.Windows.Forms.ToolStripLabel();
this.toolStripContainer1.ContentPanel.SuspendLayout();
@@ -196,7 +198,8 @@
this.jumpEventButton,
this.timeDraws,
this.selectColumnsButton,
- this.toggleBookmark});
+ this.toggleBookmark,
+ this.export});
this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
@@ -370,6 +373,22 @@
this.toggleBookmark.Text = "Toggle Bookmark";
this.toggleBookmark.Click += new System.EventHandler(this.toggleBookmark_Click);
//
+ // export
+ //
+ this.export.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.export.Image = global::renderdocui.Properties.Resources.save;
+ this.export.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.export.Name = "export";
+ this.export.Size = new System.Drawing.Size(23, 22);
+ this.export.Text = "Export";
+ this.export.Click += new System.EventHandler(this.export_Click);
+ //
+ // exportDialog
+ //
+ this.exportDialog.DefaultExt = "txt";
+ this.exportDialog.Filter = "Text Files (*.txt)|*.txt";
+ this.exportDialog.Title = "Save Event List";
+ //
// EventBrowser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -428,6 +447,8 @@
private System.Windows.Forms.ToolStripButton toggleBookmark;
private System.Windows.Forms.ToolStripMenuItem expandAll;
private System.Windows.Forms.ToolStripMenuItem collapseAll;
+ private System.Windows.Forms.ToolStripButton export;
+ private System.Windows.Forms.SaveFileDialog exportDialog;
}
}
\ No newline at end of file
diff --git a/renderdocui/Windows/EventBrowser.cs b/renderdocui/Windows/EventBrowser.cs
index 32750987b..46b2f0760 100644
--- a/renderdocui/Windows/EventBrowser.cs
+++ b/renderdocui/Windows/EventBrowser.cs
@@ -86,6 +86,7 @@ namespace renderdocui.Windows
jumpEventButton.Enabled = false;
timeDraws.Enabled = false;
toggleBookmark.Enabled = false;
+ export.Enabled = false;
}
public class PersistData
@@ -420,6 +421,7 @@ namespace renderdocui.Windows
jumpEventButton.Enabled = false;
timeDraws.Enabled = false;
toggleBookmark.Enabled = false;
+ export.Enabled = false;
}
public void OnLogfileLoaded()
@@ -428,6 +430,7 @@ namespace renderdocui.Windows
jumpEventButton.Enabled = true;
timeDraws.Enabled = true;
toggleBookmark.Enabled = true;
+ export.Enabled = true;
ClearBookmarks();
@@ -1158,5 +1161,73 @@ namespace renderdocui.Windows
eventView.Invalidate();
}
+
+ private string GetExportDrawcallString(int indent, bool firstchild, FetchDrawcall drawcall)
+ {
+ string prefix = new string(' ', indent * 2 - (firstchild ? 1 : 0));
+ if(firstchild)
+ prefix += '\\';
+
+ return String.Format("{0}- {1}", prefix, drawcall.name);
+ }
+
+ private void GetMaxNameLength(ref int maxNameLength, int indent, bool firstchild, FetchDrawcall drawcall)
+ {
+ string nameString = GetExportDrawcallString(indent, firstchild, drawcall);
+
+ maxNameLength = Math.Max(maxNameLength, nameString.Length);
+
+ for (int i = 0; i < drawcall.children.Length; i++)
+ GetMaxNameLength(ref maxNameLength, indent + 1, i == 0, drawcall.children[i]);
+ }
+
+ private void ExportDrawcall(StreamWriter sw, int maxNameLength, int indent, bool firstchild, FetchDrawcall drawcall)
+ {
+ string eidString = drawcall.children.Length > 0 ? "" : drawcall.eventID.ToString();
+
+ string nameString = GetExportDrawcallString(indent, firstchild, drawcall);
+
+ sw.WriteLine(String.Format("{0,-5} | {1,-" + maxNameLength + "} | {2,-5}", eidString, nameString, drawcall.drawcallID));
+
+ for (int i = 0; i < drawcall.children.Length; i++)
+ ExportDrawcall(sw, maxNameLength, indent + 1, i == 0, drawcall.children[i]);
+ }
+
+ private void export_Click(object sender, EventArgs e)
+ {
+ DialogResult res = exportDialog.ShowDialog();
+
+ if (res == DialogResult.OK)
+ {
+ try
+ {
+ using (Stream s = new FileStream(exportDialog.FileName, FileMode.Create))
+ {
+ StreamWriter sw = new StreamWriter(s);
+
+ sw.WriteLine(String.Format("{0} - Frame #{1}", m_Core.LogFileName, m_Core.FrameInfo.frameNumber));
+ sw.WriteLine("");
+
+ int maxNameLength = 0;
+
+ foreach (FetchDrawcall d in m_Core.GetDrawcalls())
+ GetMaxNameLength(ref maxNameLength, 0, false, d);
+
+ sw.WriteLine(String.Format(" EID | {0,-" + maxNameLength + "} | Draw #", "Event"));
+ sw.WriteLine(String.Format("--------{0}-----------", new string('-', maxNameLength)));
+
+ foreach (FetchDrawcall d in m_Core.GetDrawcalls())
+ ExportDrawcall(sw, maxNameLength, 0, false, d);
+
+ sw.Dispose();
+ }
+ }
+ catch (System.Exception ex)
+ {
+ MessageBox.Show("Couldn't save to " + exportDialog.FileName + Environment.NewLine + ex.ToString(), "Cannot save",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
}
}
diff --git a/renderdocui/Windows/EventBrowser.resx b/renderdocui/Windows/EventBrowser.resx
index 1f7d92808..1ff1220a4 100644
--- a/renderdocui/Windows/EventBrowser.resx
+++ b/renderdocui/Windows/EventBrowser.resx
@@ -141,4 +141,7 @@
459, 17
+
+ 697, 17
+
\ No newline at end of file