diff --git a/src/Snapmaker_Orca.cpp b/src/Snapmaker_Orca.cpp index b4f9b5cde80..16ca9445603 100644 --- a/src/Snapmaker_Orca.cpp +++ b/src/Snapmaker_Orca.cpp @@ -1427,9 +1427,13 @@ int CLI::run(int argc, char **argv) BOOST_LOG_TRIVIAL(info) << "object "<name <<", id :" << o->id().id << ", from bbl 3mf\n"; }*/ - Semver cli_ver = *Semver::parse(SLIC3R_VERSION); - if (!allow_newer_file && ((cli_ver.maj() != file_version.maj()) || (cli_ver.min() < file_version.min()))){ - BOOST_LOG_TRIVIAL(error) << boost::format("Version Check: File Version %1% not supported by current cli version %2%")%file_version.to_string() %SLIC3R_VERSION; + // Snapmaker_Orca: match upstream OrcaSlicer here. Two problems with the old code: + // SLIC3R_VERSION is a legacy constant inherited from BambuStudio (01.10.01.50) that + // does not track the product version, so every 2.x project file was rejected; and + // the comparison rejected older files too, rather than only newer ones. + Semver cli_ver = *Semver::parse(Snapmaker_VERSION); + if (!allow_newer_file && ((cli_ver.maj() < file_version.maj()) || ((cli_ver.maj() == file_version.maj()) && (cli_ver.min() < file_version.min())))){ + BOOST_LOG_TRIVIAL(error) << boost::format("Version Check: File Version %1% not supported by current cli version %2%")%file_version.to_string() %Snapmaker_VERSION; record_exit_reson(outfile_dir, CLI_FILE_VERSION_NOT_SUPPORTED, 0, cli_errors[CLI_FILE_VERSION_NOT_SUPPORTED], sliced_info); flush_and_exit(CLI_FILE_VERSION_NOT_SUPPORTED); } diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 9b8f578e5f7..33f6a28fc7e 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1348,6 +1348,12 @@ int PartPlate::picking_id_component(int idx) const static void expand_plate_extruders(std::vector& ids) { + // wxGetApp() dereferences the wx application object, which does not exist when running + // headless (CLI). There is no GUI preset bundle to expand virtual extruder ids against + // in that case, so leave the ids as they are rather than crashing. + if (wxTheApp == nullptr) + return; + const size_t num_physical = static_cast(std::max(wxGetApp().filaments_cnt(), 0)); if (num_physical > 0) { wxGetApp().preset_bundle->mixed_filaments.expand_virtual_extruder_ids(ids, num_physical); @@ -1913,6 +1919,14 @@ Vec3d PartPlate::get_center_origin() void PartPlate::generate_plate_name_texture() { + // There is no texture to generate without a 3D canvas, and in CLI mode wxGetApp() has no + // application object, so the em_unit() call below would dereference null. Matches upstream. + auto canvas = (this->m_partplate_list != nullptr && this->m_partplate_list->m_plater != nullptr) + ? this->m_partplate_list->m_plater->get_view3D_canvas3D() + : nullptr; + if (canvas == nullptr) + return; + m_plate_name_icon.reset(); // generate m_name_texture texture from m_name with generate_from_text_string @@ -1950,7 +1964,6 @@ void PartPlate::generate_plate_name_texture() if (!init_model_from_poly(m_plate_name_icon, poly, GROUND_Z)) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Unable to generate geometry buffers for icons\n"; - auto canvas = this->m_partplate_list->m_plater->get_view3D_canvas3D(); canvas->remove_raycasters_for_picking(SceneRaycaster::EType::Bed, picking_id_component(6)); calc_vertex_for_plate_name_edit_icon(&m_name_texture, 0, m_plate_name_edit_icon); register_model_for_picking(*canvas, m_plate_name_edit_icon, picking_id_component(6));