MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / GLFW_KeyCallBack

Method GLFW_KeyCallBack

samples/luxcoreui/uikeys.cpp:108–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void LuxCoreApp::GLFW_KeyCallBack(GLFWwindow *window, int key, int scanCode, int action, int mods) {
109 ImGui_ImplGlFw_KeyCallback(window, key, scanCode, action, mods);
110
111 if (ImGui::GetIO().WantCaptureKeyboard)
112 return;
113
114 LuxCoreApp *app = (LuxCoreApp *)glfwGetWindowUserPointer(window);
115
116 //--------------------------------------------------------------------------
117 // Application related keys
118 //--------------------------------------------------------------------------
119
120 if (action == GLFW_PRESS) {
121 switch (key) {
122 case GLFW_KEY_ESCAPE:
123 glfwSetWindowShouldClose(window, GL_TRUE);
124 break;
125 default:
126 break;
127 }
128 }
129
130 //--------------------------------------------------------------------------
131 // RenderSession related keys
132 //--------------------------------------------------------------------------
133
134 if (!app->session)
135 return;
136
137 if (action == GLFW_PRESS) {
138 ImGuiIO &io = ImGui::GetIO();
139
140 switch (key) {
141 case GLFW_KEY_P: {
142 if (io.KeyShift)
143 app->session->GetFilm().SaveFilm("film.flm");
144 else
145 app->session->GetFilm().SaveOutputs();
146 break;
147 }
148 case GLFW_KEY_SPACE: {
149 // Restart rendering
150 app->session->Stop();
151 app->session->Start();
152
153 // For some test with lux-hdr scene
154
155 /*app->session->BeginSceneEdit();
156 app->session->GetFilm().DeleteAllImagePipelines();
157 app->session->Parse(Properties().SetFromString(
158 "film.imagepipelines.0.0.type = NOP\n"
159 "film.imagepipelines.0.1.type = TONEMAP_LINEAR\n"
160 "film.imagepipelines.0.1.scale = 0.50000002374872565\n"
161 "film.imagepipelines.0.radiancescales.0.enabled = 1\n"
162 "film.imagepipelines.0.radiancescales.0.globalscale = 1\n"
163 "film.imagepipelines.0.radiancescales.1.enabled = 0\n"
164 "film.imagepipelines.0.radiancescales.1.globalscale = 1\n"
165 "film.imagepipelines.0.radiancescales.1.rgbscale = 1 1 1\n"

Callers

nothing calls this directly

Calls 12

glfwGetWindowUserPointerFunction · 0.85
glfwSetWindowShouldCloseFunction · 0.85
SaveOutputsMethod · 0.80
ToggleMethod · 0.80
SaveFilmMethod · 0.45
StopMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected