FIX:roload obj for disk

jira: STUDIO-7202
Change-Id: I6726a21176dfc9f545b58c5fe9f2ebf623b012d6
This commit is contained in:
zhou.xu 2024-05-30 17:58:00 +08:00 committed by SoftFever
parent 08751b0dee
commit 13c6914c64

View file

@ -5795,7 +5795,12 @@ void Plater::priv::reload_from_disk()
// load one file at a time
for (size_t i = 0; i < input_paths.size(); ++i) {
const auto& path = input_paths[i].string();
auto obj_color_fun = [this, &path](std::vector<RGBA> &input_colors, bool is_single_color, std::vector<unsigned char> &filament_ids, unsigned char &first_extruder_id) {
if (!boost::iends_with(path, ".obj")) { return; }
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
ObjColorDialog color_dlg(nullptr, input_colors, is_single_color, extruder_colours, filament_ids, first_extruder_id);
if (color_dlg.ShowModal() != wxID_OK) { filament_ids.clear(); }
};
wxBusyCursor wait;
wxBusyInfo info(_L("Reload from:") + " " + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas());
@ -5808,7 +5813,8 @@ 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);
new_model = Model::read_from_file(path, nullptr, nullptr, LoadStrategy::AddDefaultInstances | LoadStrategy::LoadModel, &plate_data, &project_presets, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, obj_color_fun);
for (ModelObject* model_object : new_model.objects)
{
model_object->center_around_origin();