Calibration: now doesn't change the "last directory used" anymore

This commit is contained in:
supermerill 2020-06-14 23:28:15 +02:00
parent c07354ac81
commit 2b04548ecb
8 changed files with 19 additions and 15 deletions

View File

@ -36,7 +36,7 @@ void CalibrationBedDialog::create_geometry(wxCommandEvent& event_args) {
Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf",
Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf",
Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf", Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf",
Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf"}, true, false); Slic3r::resources_dir()+"/calibration/bed_leveling/patch.amf"}, true, false, false);
assert(objs_idx.size() == 5); assert(objs_idx.size() == 5);
const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config();

View File

@ -59,7 +59,7 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool
std::vector<std::string> items; std::vector<std::string> items;
for (size_t i = 0; i < nb_items; i++) for (size_t i = 0; i < nb_items; i++)
items.emplace_back(Slic3r::resources_dir()+"/calibration/bridge_flow/bridge_test.amf"); items.emplace_back(Slic3r::resources_dir()+"/calibration/bridge_flow/bridge_test.amf");
std::vector<size_t> objs_idx = plat->load_files(items, true, false); std::vector<size_t> objs_idx = plat->load_files(items, true, false, false);
assert(objs_idx.size() == nb_items); assert(objs_idx.size() == nb_items);
const DynamicPrintConfig* print_config = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); const DynamicPrintConfig* print_config = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config();

View File

@ -54,7 +54,7 @@ void CalibrationCubeDialog::create_geometry(std::string calibration_path) {
Model& model = plat->model(); Model& model = plat->model();
plat->reset(); plat->reset();
std::vector<size_t> objs_idx = plat->load_files(std::vector<std::string>{ std::vector<size_t> objs_idx = plat->load_files(std::vector<std::string>{
Slic3r::resources_dir()+"/calibration/cube/"+ calibration_path}, true, false); Slic3r::resources_dir()+"/calibration/cube/"+ calibration_path}, true, false, false);
assert(objs_idx.size() == 1); assert(objs_idx.size() == 1);
const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config();

View File

@ -40,7 +40,7 @@ void CalibrationFlowDialog::create_geometry(float start, float delta) {
Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf",
Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf",
Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf", Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf",
Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf"}, true, false); Slic3r::resources_dir()+"/calibration/filament_flow/filament_flow_test_cube.amf"}, true, false, false);
assert(objs_idx.size() == 5); assert(objs_idx.size() == 5);

View File

@ -37,7 +37,7 @@ void CalibrationOverBridgeDialog::create_geometry(wxCommandEvent& event_args) {
Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf", Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf",
Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf", Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf",
Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf", Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf",
Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf"}, true, false); Slic3r::resources_dir()+"/calibration/over-bridge_tuning/over-bridge_flow_ratio_test.amf"}, true, false, false);
assert(objs_idx.size() == 6); assert(objs_idx.size() == 6);
const DynamicPrintConfig* print_config = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); const DynamicPrintConfig* print_config = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config();

View File

@ -54,7 +54,7 @@ void CalibrationTempDialog::create_geometry(wxCommandEvent& event_args) {
Model& model = plat->model(); Model& model = plat->model();
plat->reset(); plat->reset();
std::vector<size_t> objs_idx = plat->load_files(std::vector<std::string>{ std::vector<size_t> objs_idx = plat->load_files(std::vector<std::string>{
Slic3r::resources_dir()+"/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf"}, true, false); Slic3r::resources_dir()+"/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf"}, true, false, false);
assert(objs_idx.size() == 1); assert(objs_idx.size() == 1);
const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config(); const DynamicPrintConfig* printConfig = this->gui_app->get_tab(Preset::TYPE_PRINT)->get_config();

View File

@ -1883,7 +1883,7 @@ struct Plater::priv
arrangement::BedShapeHint get_bed_shape_hint() const; arrangement::BedShapeHint get_bed_shape_hint() const;
void find_new_position(const ModelInstancePtrs &instances, coord_t min_d); void find_new_position(const ModelInstancePtrs &instances, coord_t min_d);
std::vector<size_t> load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config); std::vector<size_t> load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool update_dirs = true);
std::vector<size_t> load_model_objects(const ModelObjectPtrs &model_objects); std::vector<size_t> load_model_objects(const ModelObjectPtrs &model_objects);
wxString get_export_file(GUI::FileType file_type); wxString get_export_file(GUI::FileType file_type);
@ -2349,7 +2349,7 @@ BoundingBox Plater::priv::scaled_bed_shape_bb() const
return bed_shape.bounding_box(); return bed_shape.bounding_box();
} }
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config) std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool update_dirs)
{ {
if (input_files.empty()) { return std::vector<size_t>(); } if (input_files.empty()) { return std::vector<size_t>(); }
@ -2428,7 +2428,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
wxGetApp().load_current_presets(); wxGetApp().load_current_presets();
is_project_file = true; is_project_file = true;
} }
wxGetApp().app_config->update_config_dir(path.parent_path().string()); if(update_dirs)
wxGetApp().app_config->update_config_dir(path.parent_path().string());
} }
} }
else { else {
@ -2516,7 +2517,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
if (load_model) if (load_model)
{ {
wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().string()); if(update_dirs)
wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().string());
// XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames... // XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames...
statusbar()->set_status_text(_(L("Loaded"))); statusbar()->set_status_text(_(L("Loaded")));
} }
@ -4737,16 +4739,18 @@ void Plater::extract_config_from_project()
load_files(input_paths, false, true); load_files(input_paths, false, true);
} }
std::vector<size_t> Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config) { return p->load_files(input_files, load_model, load_config); } std::vector<size_t> Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool update_dirs) {
return p->load_files(input_files, load_model, load_config, update_dirs);
}
// To be called when providing a list of files to the GUI slic3r on command line. // To be called when providing a list of files to the GUI slic3r on command line.
std::vector<size_t> Plater::load_files(const std::vector<std::string>& input_files, bool load_model, bool load_config) std::vector<size_t> Plater::load_files(const std::vector<std::string>& input_files, bool load_model, bool load_config, bool update_dirs)
{ {
std::vector<fs::path> paths; std::vector<fs::path> paths;
paths.reserve(input_files.size()); paths.reserve(input_files.size());
for (const std::string& path : input_files) for (const std::string& path : input_files)
paths.emplace_back(path); paths.emplace_back(path);
return p->load_files(paths, load_model, load_config); return p->load_files(paths, load_model, load_config, update_dirs);
} }
void Plater::update() { p->update(); } void Plater::update() { p->update(); }

View File

@ -157,9 +157,9 @@ public:
void add_model(); void add_model();
void extract_config_from_project(); void extract_config_from_project();
std::vector<size_t> load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true); std::vector<size_t> load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true, bool update_dirs = true);
// To be called when providing a list of files to the GUI slic3r on command line. // To be called when providing a list of files to the GUI slic3r on command line.
std::vector<size_t> load_files(const std::vector<std::string>& input_files, bool load_model = true, bool load_config = true); std::vector<size_t> load_files(const std::vector<std::string>& input_files, bool load_model = true, bool load_config = true, bool update_dirs = true);
void update(); void update();
void stop_jobs(); void stop_jobs();