Skip to content

Commit

Permalink
fixed an bug that CN plate name was not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftFever committed Aug 4, 2023
1 parent 5804247 commit 14f248f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/Format/bbs_3mf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
else if(key == PLATER_NAME_ATTR)
{
m_curr_plater->plate_name = value;
m_curr_plater->plate_name = value.c_str();
}
else if (key == LOCK_ATTR)
{
Expand Down
3 changes: 2 additions & 1 deletion src/slic3r/GUI/PartPlate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "GUI_ObjectList.hpp"
#include "Tab.hpp"
#include "format.hpp"
#include "slic3r/GUI/GUI.hpp"
#include <imgui/imgui_internal.h>

using boost::optional;
Expand Down Expand Up @@ -1571,7 +1572,7 @@ void PartPlate::generate_plate_name_texture()
{
// generate m_name_texture texture from m_name with generate_from_text_string
m_name_texture.reset();
auto text = m_name.empty()? _L("Untitled") : m_name;
auto text = m_name.empty()? _L("Untitled") : from_u8(m_name);
wxCoord w, h;

auto* font = &Label::Head_32;
Expand Down
13 changes: 7 additions & 6 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <wx/filedlg.h>
#include <wx/dnd.h>
#include <wx/progdlg.h>
#include <wx/string.h>
#include <wx/wupdlock.h>
#include <wx/numdlg.h>
#include <wx/debug.h>
Expand Down Expand Up @@ -6630,24 +6631,24 @@ wxString Plater::priv::get_export_gcode_filename(const wxString& extension, bool
auto full_filename = m_project_folder / std::string((m_project_name + extension).mb_str(wxConvUTF8));
return from_path(full_filename);
} else {
auto full_filename = m_project_folder / std::string((m_project_name + plate_index_str + extension).mb_str(wxConvUTF8));
auto full_filename = m_project_folder / std::string((m_project_name + from_u8(plate_index_str) + extension).mb_str(wxConvUTF8));
return from_path(full_filename);
}
} else {
if (export_all)
return m_project_name + wxString(plate_index_str) + extension;
return m_project_name + from_u8(plate_index_str) + extension;
else
return m_project_name + extension;
}
} else {
if (only_filename) {
if(m_project_name == _L("Untitled"))
return fs::path(model.objects.front()->name).replace_extension().c_str() + wxString(plate_index_str) + extension;
return wxString(fs::path(model.objects.front()->name).replace_extension().c_str()) + from_u8(plate_index_str) + extension;

if (export_all)
return m_project_name + extension;
else
return m_project_name + wxString(plate_index_str) + extension;
return m_project_name + from_u8(plate_index_str) + extension;
}
else
return "";
Expand Down Expand Up @@ -11799,7 +11800,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click)
else
dlg.sync_print_seq(0);

dlg.set_plate_name(curr_plate->get_plate_name());
dlg.set_plate_name(from_u8(curr_plate->get_plate_name()));

dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
PartPlate *curr_plate = p->partplate_list.get_curr_plate();
Expand All @@ -11825,7 +11826,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click)
update();
});
dlg.ShowModal();
curr_plate->set_plate_name(dlg.get_plate_name().ToStdString());
curr_plate->set_plate_name(dlg.get_plate_name().ToUTF8().data());

this->schedule_background_process();
}
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/SelectMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3069,7 +3069,7 @@ void SelectMachineDialog::set_default()
filename = m_plater->get_export_gcode_filename("", true);
}

fs::path filename_path(filename.ToStdWstring());
fs::path filename_path(filename.c_str());
m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
m_rename_text->SetLabelText(m_current_project_name);
m_rename_normal_panel->Layout();
Expand Down

0 comments on commit 14f248f

Please sign in to comment.