Fix model initialization without a wx application (#15866)

Guard the smooth-normals preference read when CLI thumbnail generation initializes geometry without a wx application. Use the existing flat-normal path in that case and preserve GUI preferences.
This commit is contained in:
Chris Bennight
2026-09-27 18:53:11 +03:00
committed by GitHub
parent bd65cce3f4
commit ea471dc82d
+3 -2
View File
@@ -456,8 +456,9 @@ void GLModel::init_from(const indexed_triangle_set& its)
data.reserve_vertices(3 * its.indices.size()); data.reserve_vertices(3 * its.indices.size());
data.reserve_indices(3 * its.indices.size()); data.reserve_indices(3 * its.indices.size());
// Read user preference: smooth normals enabled // CLI thumbnail generation can initialize models without a wx application.
const bool smooth_normals_enabled = wxGetApp().app_config != nullptr && wxGetApp().app_config->get_bool(SETTING_OPENGL_PHONG_SMOOTH_NORMALS); const bool smooth_normals_enabled = wxApp::GetInstance() != nullptr && wxGetApp().app_config != nullptr &&
wxGetApp().app_config->get_bool(SETTING_OPENGL_PHONG_SMOOTH_NORMALS);
if (smooth_normals_enabled) { if (smooth_normals_enabled) {
// Use per-corner smooth normals (via IGL) // Use per-corner smooth normals (via IGL)