FIX:STEP mesh crashes in specific language

1.fix dark model

2.fix reload file

3.fix macos ui

jira: STUDIO-8722
Change-Id: I17c723cbf88b97b187c72fbc6f65fc2da591465f
(cherry picked from commit 6c48a8e40b3a28859d5883b13106683cbe61c73d)
This commit is contained in:
Mack 2024-11-13 15:27:44 +08:00 committed by Noisyfox
parent 0bc2444079
commit 9b439ff5a2
4 changed files with 36 additions and 32 deletions

View file

@ -4156,10 +4156,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
filament_ids.clear();
}
};
if (boost::algorithm::iends_with(path.string(), ".stp") ||
boost::algorithm::iends_with(path.string(), ".step")) {
double linear = std::stod(wxGetApp().app_config->get("linear_defletion"));
double angle = std::stod(wxGetApp().app_config->get("angle_defletion"));
if (boost::iends_with(path.string(), ".stp") ||
boost::iends_with(path.string(), ".step")) {
double linear = string_to_double_decimal_point(wxGetApp().app_config->get("linear_defletion"));
double angle = string_to_double_decimal_point(wxGetApp().app_config->get("angle_defletion"));
model = Slic3r::Model:: read_from_step(path.string(), strategy,
[this, &dlg, real_filename, &progress_percent, &file_percent, step_percent, INPUT_FILES_RATIO, total_files, i](int load_stage, int current, int total, bool &cancel)
{
@ -4187,7 +4187,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
},
[this, &path, &is_user_cancel, &linear, &angle](Slic3r::Step& file, double& linear_value, double& angle_value)-> int {
if (wxGetApp().app_config->get_bool("enable_step_mesh_setting")) {
StepMeshDialog mesh_dlg(nullptr, file);
StepMeshDialog mesh_dlg(nullptr, file, linear, angle);
if (mesh_dlg.ShowModal() == wxID_OK) {
linear_value = mesh_dlg.get_linear_defletion();
angle_value = mesh_dlg.get_angle_defletion();
@ -5960,8 +5960,16 @@ void Plater::priv::reload_from_disk()
std::vector<Preset*> project_presets;
// BBS: backup
new_model = Model::read_from_file(path, nullptr, nullptr, LoadStrategy::AddDefaultInstances | LoadStrategy::LoadModel, &plate_data, &project_presets, nullptr,
nullptr, nullptr, nullptr, nullptr, 0, obj_color_fun);
if (boost::iends_with(path, ".stp") ||
boost::iends_with(path, ".step")) {
double linear = string_to_double_decimal_point(wxGetApp().app_config->get("linear_defletion"));
double angle = string_to_double_decimal_point(wxGetApp().app_config->get("angle_defletion"));
new_model = Model::read_from_step(path, LoadStrategy::AddDefaultInstances | LoadStrategy::LoadModel, nullptr, nullptr, nullptr, linear, angle);
}else {
new_model = Model::read_from_file(path, nullptr, nullptr, LoadStrategy::AddDefaultInstances | LoadStrategy::LoadModel, &plate_data, &project_presets, nullptr, nullptr, nullptr, nullptr, nullptr, 0, obj_color_fun);
}
for (ModelObject* model_object : new_model.objects)
{
model_object->center_around_origin();