MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXPT / ScriptMainUI

Method ScriptMainUI

Rtxpt/SampleCommon/CaptureScriptManager.cpp:93–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void CaptureScriptManager::ScriptMainUI(const ImVec4 & warnColor, const ImVec4 & categoryColor, float indent, float currentScale)
94{
95 assert( !m_active && !m_start ); // this point should never be reached if m_active because ScritProgressUI should be up instead
96
97 ImGui::TextColored(categoryColor, "Options");
98
99 if (ImGui::Combo("Capture type", &m_type, "SimpleScreenshot\0SequenceCapture\0Benchmark\00" ))
100 m_type = dm::clamp(m_type, 0, 0 );
101
102 if( m_type == 0 )
103 {
104 ImGui::Checkbox("ResetAndWarmup", &m_resetAndWarmup);
105 if (ImGui::IsItemHovered()) ImGui::SetTooltip("When 'Save screenshot' is used, all subsystem's temporal histories will first be reset,\nfollowed by a selected number of frames before saving the screenshot.\nIf animation is running, it will keep running - if not, it won't.");
106 {
107 UI_SCOPED_DISABLE(!m_resetAndWarmup);
108 ImGui::SameLine();
109 ImGui::PushItemWidth(-90.0f * currentScale);
110 ImGui::InputInt("delay frames", &m_resetAndWarmupFrames); m_resetAndWarmupFrames = dm::clamp(m_resetAndWarmupFrames, 0, 10000);
111 ImGui::PopItemWidth();
112 }
113 }
114
115 // ImGui::Checkbox("Sequence ", &m_screenshotMiniSequence);
116 // if (ImGui::IsItemHovered()) ImGui::SetTooltip("When 'Save screenshot' used, a sequence of screenshots will be recorded instead of saving\na single one. Can work together with ResetAndDelay.");
117 // {
118 // UI_SCOPED_DISABLE(!m_screenshotMiniSequence);
119 // ImGui::SameLine();
120 // ImGui::PushItemWidth(-90.0f * currentScale);
121 // ImGui::InputInt("length", &m_screenshotMiniSequenceFrames); m_screenshotMiniSequenceFrames = dm::clamp(m_screenshotMiniSequenceFrames, 1, 999);
122 // ImGui::PopItemWidth();
123 // }
124
125 float w = ImGui::GetContentRegionAvail().x;
126
127 ImGui::TextColored(categoryColor, "Output file(s) path:");
128 ImGui::SameLine(w * 0.65f);
129 if (ImGui::Button("[ select path ]"))
130 {
131 std::string fileName;
132 if (FileDialog(false, "PNG files\0*.png\0BMP files\0*.bmp\0All files\0*.*\0\0", fileName))
133 m_screenshotFileName = fileName;
134 }
135
136 {
137 RAII_SCOPE(ImGui::Indent(indent);, ImGui::Unindent(indent); );
138 RAII_SCOPE(ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); , ImGui::PopItemWidth(); );
139 std::string pathStr = m_screenshotFileName.string();
140 ImGui::InputText("##path", (char*)pathStr.c_str(), pathStr.length()+1, /*ImVec2(0, 0),*/ ImGuiInputTextFlags_ReadOnly);
141 }
142
143 {
144 UI_SCOPED_DISABLE(m_screenshotFileName.empty());
145
146 std::string cmd = "";
147 if (m_type == 0)
148 cmd += "--captureSimple ";
149 cmd += "--capturePath " + (m_screenshotFileName.empty()?"<error, empty>":m_screenshotFileName.string());
150

Callers 1

buildUIMethod · 0.80

Calls 2

ButtonClass · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected