mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-16 08:52:43 +00:00
fix: harden CLI export without OpenGL thumbnails (#13532)
## Summary - skip CLI thumbnail generation when an OpenGL/GLFW context cannot be created, allowing export workflows to continue in headless/automation environments - guard filament variant remapping against missing config options and out-of-range variant indexes - log warnings instead of dereferencing invalid config state during CLI/profile-driven export ## Context These guards came out of automating OrcaSlicer CLI exports for printer workflows. In that flow, slicing/export can still be valid even when thumbnail rendering is unavailable, but the current path can proceed into OpenGL thumbnail setup after context creation fails. Separately, malformed or mismatched filament/profile state can index past option vectors during multi-filament value remapping. ## Test plan - `git diff --check` - `cmake --build build/arm64 --config RelWithDebInfo --target OrcaSlicer -- -j4`
This commit is contained in:
committed by
GitHub
parent
c965b2a5b3
commit
bcbc581417
@@ -6435,6 +6435,7 @@ int CLI::run(int argc, char **argv)
|
||||
glfwGetVersion(&gl_major, &gl_minor, &gl_verbos);
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("opengl version %1%.%2%.%3%")%gl_major %gl_minor %gl_verbos;
|
||||
|
||||
bool thumbnail_opengl_ready = false;
|
||||
glfwSetErrorCallback(glfw_callback);
|
||||
int ret = glfwInit();
|
||||
if (ret == GLFW_FALSE) {
|
||||
@@ -6463,13 +6464,22 @@ int CLI::run(int argc, char **argv)
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "base_window", NULL, NULL);
|
||||
if (window == NULL)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to create GLFW window" << std::endl;
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to create GLFW window; skipping thumbnail rendering for CLI export" << std::endl;
|
||||
}
|
||||
else
|
||||
else {
|
||||
glfwMakeContextCurrent(window);
|
||||
thumbnail_opengl_ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
//opengl manager related logic
|
||||
if (!thumbnail_opengl_ready) {
|
||||
BOOST_LOG_TRIVIAL(error) << "OpenGL context unavailable; skip thumbnail generating" << std::endl;
|
||||
need_create_thumbnail_group = false;
|
||||
need_create_no_light_group = false;
|
||||
need_create_top_group = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI::OpenGLManager opengl_mgr;
|
||||
bool opengl_valid = opengl_mgr.init_gl(false);
|
||||
|
||||
Reference in New Issue
Block a user