Code cleaning: Deleted code which was commented till the testing some time ago

This commit is contained in:
YuSanka 2023-09-21 10:22:32 +02:00
parent a05a4f2a5d
commit a9eebb27f8
4 changed files with 4 additions and 82 deletions

View File

@ -791,15 +791,10 @@ void GUI_App::post_init()
this->mainframe->load_config_file(this->init_params->load_configs.back()); this->mainframe->load_config_file(this->init_params->load_configs.back());
// If loading a 3MF file, the config is loaded from the last one. // If loading a 3MF file, the config is loaded from the last one.
if (!this->init_params->input_files.empty()) { if (!this->init_params->input_files.empty()) {
#if 1 // #ysFIXME_delete_after_test_of
wxArrayString fns; wxArrayString fns;
for (const std::string& name : this->init_params->input_files) for (const std::string& name : this->init_params->input_files)
fns.Add(from_u8(name)); fns.Add(from_u8(name));
if (plater()->load_files(fns) && this->init_params->input_files.size() == 1) { if (plater()->load_files(fns) && this->init_params->input_files.size() == 1) {
#else
const std::vector<size_t> res = this->plater()->load_files(this->init_params->input_files, true, true);
if (!res.empty() && this->init_params->input_files.size() == 1) {
#endif
// Update application titlebar when opening a project file // Update application titlebar when opening a project file
const std::string& filename = this->init_params->input_files.front(); const std::string& filename = this->init_params->input_files.front();
if (boost::algorithm::iends_with(filename, ".amf") || if (boost::algorithm::iends_with(filename, ".amf") ||
@ -1247,7 +1242,6 @@ bool GUI_App::on_init_inner()
if (! older_data_dir_path.empty()) { if (! older_data_dir_path.empty()) {
preset_bundle->import_newer_configs(older_data_dir_path); preset_bundle->import_newer_configs(older_data_dir_path);
//app_config->save(); // It looks like redundant call of save. ysFIXME delete after testing
} }
if (is_editor()) { if (is_editor()) {

View File

@ -1518,12 +1518,7 @@ void ObjectList::load_subobject(ModelVolumeType type, bool from_galery/* = false
take_snapshot((type == ModelVolumeType::MODEL_PART) ? _L("Load Part") : _L("Load Modifier")); take_snapshot((type == ModelVolumeType::MODEL_PART) ? _L("Load Part") : _L("Load Modifier"));
std::vector<ModelVolume*> volumes; std::vector<ModelVolume*> volumes;
// ! ysFIXME - delete commented code after testing and rename "load_modifier" to something common load_from_files(input_files, *(*m_objects)[obj_idx], volumes, type, from_galery);
/*
if (type == ModelVolumeType::MODEL_PART)
load_part(*(*m_objects)[obj_idx], volumes, type, from_galery);
else*/
load_modifier(input_files, *(*m_objects)[obj_idx], volumes, type, from_galery);
if (volumes.empty()) if (volumes.empty())
return; return;
@ -1543,72 +1538,9 @@ void ObjectList::load_subobject(ModelVolumeType type, bool from_galery/* = false
selection_changed(); selection_changed();
} }
/*
void ObjectList::load_part(ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false) void ObjectList::load_from_files(const wxArrayString& input_files, ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery)
{ {
if (type != ModelVolumeType::MODEL_PART)
return;
wxWindow* parent = wxGetApp().tab_panel()->GetPage(0);
wxArrayString input_files;
if (from_galery) {
GalleryDialog dlg(this);
if (dlg.ShowModal() == wxID_CLOSE)
return;
dlg.get_input_files(input_files);
if (input_files.IsEmpty())
return;
}
else
wxGetApp().import_model(parent, input_files);
wxProgressDialog dlg(_L("Loading") + dots, "", 100, wxGetApp().mainframe wxPD_AUTO_HIDE);
wxBusyCursor busy;
for (size_t i = 0; i < input_files.size(); ++i) {
std::string input_file = input_files.Item(i).ToUTF8().data();
dlg.Update(static_cast<int>(100.0f * static_cast<float>(i) / static_cast<float>(input_files.size())),
_L("Loading file") + ": " + from_path(boost::filesystem::path(input_file).filename()));
dlg.Fit();
Model model;
try {
model = Model::read_from_file(input_file);
}
catch (std::exception &e) {
auto msg = _L("Error!") + " " + input_file + " : " + e.what() + ".";
show_error(parent, msg);
exit(1);
}
for (auto object : model.objects) {
Vec3d delta = Vec3d::Zero();
if (model_object.origin_translation != Vec3d::Zero()) {
object->center_around_origin();
delta = model_object.origin_translation - object->origin_translation;
}
for (auto volume : object->volumes) {
volume->translate(delta);
auto new_volume = model_object.add_volume(*volume, type);
new_volume->name = boost::filesystem::path(input_file).filename().string();
// set a default extruder value, since user can't add it manually
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
added_volumes.push_back(new_volume);
}
}
}
}
*/
void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery)
{
// ! ysFIXME - delete commented code after testing and rename "load_modifier" to something common
//if (type == ModelVolumeType::MODEL_PART)
// return;
wxWindow* parent = wxGetApp().tab_panel()->GetPage(0); wxWindow* parent = wxGetApp().tab_panel()->GetPage(0);
wxProgressDialog dlg(_L("Loading") + dots, "", 100, wxGetApp().mainframe, wxPD_AUTO_HIDE); wxProgressDialog dlg(_L("Loading") + dots, "", 100, wxGetApp().mainframe, wxPD_AUTO_HIDE);

View File

@ -255,9 +255,7 @@ public:
bool is_instance_or_object_selected(); bool is_instance_or_object_selected();
bool is_selected_object_cut(); bool is_selected_object_cut();
void load_subobject(ModelVolumeType type, bool from_galery = false); void load_subobject(ModelVolumeType type, bool from_galery = false);
// ! ysFIXME - delete commented code after testing and rename "load_modifier" to something common void load_from_files(const wxArrayString& input_files, ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false);
//void load_part(ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false);
void load_modifier(const wxArrayString& input_files, ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false);
void load_generic_subobject(const std::string& type_name, const ModelVolumeType type); void load_generic_subobject(const std::string& type_name, const ModelVolumeType type);
void load_shape_object(const std::string &type_name); void load_shape_object(const std::string &type_name);
void load_shape_object_from_gallery(); void load_shape_object_from_gallery();

View File

@ -208,11 +208,9 @@ public:
wxStaticText *info_size; wxStaticText *info_size;
wxStaticText *info_volume; wxStaticText *info_volume;
wxStaticText *info_facets; wxStaticText *info_facets;
// wxStaticText *info_materials;
wxStaticText *info_manifold; wxStaticText *info_manifold;
wxStaticText *label_volume; wxStaticText *label_volume;
// wxStaticText *label_materials; // ysFIXME - delete after next release if anyone will not complain about this
std::vector<wxStaticText *> sla_hidden_items; std::vector<wxStaticText *> sla_hidden_items;
bool showing_manifold_warning_icon; bool showing_manifold_warning_icon;