Skip to content

Adding new UI window

baldurk edited this page Apr 16, 2014 · 1 revision

Adding a new UI window is fairly straight forward, and you can look at some of the simpler ones like APIInspector to see how it's done.

Basically you want to take a Core parameter in your constructor and hold onto it, as this is how you'll access the main interface when you want to do anything. When you get a callback from OnEventSelected you can do Core.Renderer.BeginInvoke to get a callback on the render thread with a handle to the ReplayRenderer to do things. Do not cache this handle, and only access it inside these callbacks. NOTE: When on the render thread you cannot access your UI directly, you must invoke back onto the UI thread or otherwise post a message to be picked up by the UI.

  • If you want to be notified about log changes, you can implement ILogViewerForm. Make sure that you call m_Core.AddLogViewer(YourWindow) when it's created, and m_Core.RemoveLogViewer when the window is closed/discarded so that you don't get any more callbacks.

  • If your window is created on the fly from some UI element, just create it there. If it's created free from the main window just add a menu item for it in MainWindow. Depending on whether or not you only want one to be open at once, you can add it as an accessor in the Core (similar to GetAPIInpector() or GetTextureViewer()).

  • If you want your window to persist between sessions then you will need to implement a case in MainWindow.GetContentFromPersistString() for your type. You can also have layout details persist within your window via this mechanism - see TextureViewer or EventBrowser to see how they persist their layout within their window.

  • If your window should be loaded by default when someone runs renderdoc for the first time (think carefully about if this is REALLY required) the default layout is set up in MainWindow_Load.

  • Please test your windows with no log loaded, as it's very easy to assume a log is present and deref a null pointer trying to access the current pipeline state or list of textures (this has happened many times before.. oops).

Clone this wiki locally