MCPcopy Create free account
hub / github.com/baldurk/renderdoc / LoadEdits

Method LoadEdits

qrenderdoc/Code/CaptureContext.cpp:1999–2032  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1997}
1998
1999void CaptureContext::LoadEdits(const QString &data)
2000{
2001 QVariantMap root = JSONToVariant(data);
2002
2003 QVariantList editors = root[lit("editors")].toList();
2004
2005 auto replaceSaveCallback = [this](ICaptureContext *ctx, IShaderViewer *viewer, ResourceId id,
2006 ShaderStage stage, ShaderEncoding shaderEncoding,
2007 ShaderCompileFlags flags, rdcstr entryFunc, bytebuf shaderBytes) {
2008 ApplyShaderEdit(viewer, id, stage, shaderEncoding, flags, entryFunc, shaderBytes);
2009 };
2010
2011 auto replaceRevertCallback = [this](ICaptureContext *ctx, IShaderViewer *view, ResourceId id) {
2012 RevertShaderEdit(view, id);
2013 };
2014
2015 for(QVariant e : editors)
2016 {
2017 ShaderViewer *edit = ShaderViewer::LoadEditor(
2018 *this, e.toMap(), replaceSaveCallback, replaceRevertCallback,
2019 [this](ShaderViewer *view, bool closed) {
2020 SetModification(CaptureModifications::EditedShaders);
2021 if(closed)
2022 m_ShaderEditors.removeOne(view);
2023 },
2024 m_MainWindow->Widget());
2025
2026 if(edit)
2027 {
2028 AddDockWindow(edit->Widget(), DockReference::MainToolArea, NULL);
2029 m_ShaderEditors.push_back(edit);
2030 }
2031 }
2032}
2033
2034void CaptureContext::ClearReplayCache()
2035{

Callers

nothing calls this directly

Calls 5

JSONToVariantFunction · 0.85
toListMethod · 0.45
removeOneMethod · 0.45
WidgetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected