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
This commit is contained in:
parent
0d81a5fbcb
commit
6c48a8e40b
|
@ -1,5 +1,5 @@
|
||||||
<svg width="407" height="141" viewBox="0 0 407 141" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="407" height="141" viewBox="0 0 407 141" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M29.635 14.6721L70.408 1.42417L111.181 14.6721L136.38 49.3557V92.2269L111.181 126.91L70.408 140.158L29.635 126.91L4.43594 92.2269V49.3557L29.635 14.6721Z" stroke="#262E30"/>
|
<path d="M377.365 14.672L336.592 1.42407L295.819 14.672L270.62 49.3556V92.2268L295.819 126.91L336.592 140.158L377.365 126.91L402.564 92.2268V49.3556L377.365 14.672Z" stroke="#262E30"/>
|
||||||
<path d="M309.925 6.6897L336.476 1.40823L363.028 6.6897L385.538 21.7301L400.578 44.2396L405.859 70.7913L400.578 97.343L385.538 119.852L363.028 134.893L336.476 140.174L309.925 134.893L287.415 119.852L272.375 97.343L267.093 70.7913L272.375 44.2395L287.415 21.7301L309.925 6.6897Z" stroke="#262E30"/>
|
<path d="M97.075 6.68967L70.524 1.4082L43.972 6.68967L21.462 21.7301L6.42197 44.2396L1.14096 70.7913L6.42197 97.343L21.462 119.852L43.972 134.893L70.524 140.174L97.075 134.893L119.585 119.852L134.625 97.343L139.907 70.7913L134.625 44.2395L119.585 21.7301L97.075 6.68967Z" stroke="#262E30"/>
|
||||||
<path d="M257.937 80.4962C258.328 80.1057 258.328 79.4725 257.937 79.082L251.573 72.718C251.183 72.3275 250.549 72.3275 250.159 72.718C249.768 73.1085 249.768 73.7417 250.159 74.1322L255.816 79.7891L250.159 85.4459C249.768 85.8364 249.768 86.4696 250.159 86.8601C250.549 87.2507 251.183 87.2507 251.573 86.8601L257.937 80.4962ZM152 80.7891L257.23 80.7891L257.23 78.7891L152 78.7891L152 80.7891Z" fill="#262E30"/>
|
<path d="M149.063 80.4961C148.672 80.1056 148.672 79.4724 149.063 79.0819L155.427 72.7179C155.817 72.3274 156.451 72.3274 156.841 72.7179C157.232 73.1084 157.232 73.7416 156.841 74.1321L151.184 79.789L156.841 85.4458C157.232 85.8363 157.232 86.4695 156.841 86.86C156.451 87.2506 155.817 87.2506 155.427 86.86L149.063 80.4961ZM255 80.789H149.77V78.789H255V80.789Z" fill="#262E30"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 1001 B After Width: | Height: | Size: 964 B |
|
@ -4021,10 +4021,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||||
filament_ids.clear();
|
filament_ids.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (boost::algorithm::iends_with(path.string(), ".stp") ||
|
if (boost::iends_with(path.string(), ".stp") ||
|
||||||
boost::algorithm::iends_with(path.string(), ".step")) {
|
boost::iends_with(path.string(), ".step")) {
|
||||||
double linear = std::stod(wxGetApp().app_config->get("linear_defletion"));
|
double linear = string_to_double_decimal_point(wxGetApp().app_config->get("linear_defletion"));
|
||||||
double angle = std::stod(wxGetApp().app_config->get("angle_defletion"));
|
double angle = string_to_double_decimal_point(wxGetApp().app_config->get("angle_defletion"));
|
||||||
model = Slic3r::Model:: read_from_step(path.string(), strategy,
|
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)
|
[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)
|
||||||
{
|
{
|
||||||
|
@ -4043,7 +4043,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 {
|
[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")) {
|
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) {
|
if (mesh_dlg.ShowModal() == wxID_OK) {
|
||||||
linear_value = mesh_dlg.get_linear_defletion();
|
linear_value = mesh_dlg.get_linear_defletion();
|
||||||
angle_value = mesh_dlg.get_angle_defletion();
|
angle_value = mesh_dlg.get_angle_defletion();
|
||||||
|
@ -5846,8 +5846,16 @@ void Plater::priv::reload_from_disk()
|
||||||
std::vector<Preset*> project_presets;
|
std::vector<Preset*> project_presets;
|
||||||
|
|
||||||
// BBS: backup
|
// BBS: backup
|
||||||
new_model = Model::read_from_file(path, nullptr, nullptr, LoadStrategy::AddDefaultInstances | LoadStrategy::LoadModel, &plate_data, &project_presets, nullptr,
|
if (boost::iends_with(path, ".stp") ||
|
||||||
nullptr, nullptr, nullptr, nullptr, 0, obj_color_fun);
|
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)
|
for (ModelObject* model_object : new_model.objects)
|
||||||
{
|
{
|
||||||
model_object->center_around_origin();
|
model_object->center_around_origin();
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool StepMeshDialog:: validate_number_range(const wxString& value, double min, d
|
||||||
return (num >= min && num <= max);
|
return (num >= min && num <= max);
|
||||||
}
|
}
|
||||||
|
|
||||||
StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
|
StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double linear_init, double angle_init)
|
||||||
: DPIDialog(parent ? parent : static_cast<wxWindow *>(wxGetApp().mainframe),
|
: DPIDialog(parent ? parent : static_cast<wxWindow *>(wxGetApp().mainframe),
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
_(L("Step file import parameters")),
|
_(L("Step file import parameters")),
|
||||||
|
@ -74,6 +74,9 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
|
||||||
wxDefaultSize,
|
wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE /* | wxRESIZE_BORDER*/), m_file(file)
|
wxDEFAULT_DIALOG_STYLE /* | wxRESIZE_BORDER*/), m_file(file)
|
||||||
{
|
{
|
||||||
|
m_linear_last = wxString::Format("%.3f", linear_init);
|
||||||
|
m_angle_last = wxString::Format("%.2f", angle_init);
|
||||||
|
|
||||||
Bind(wxEVT_THREAD_DONE, &StepMeshDialog::on_task_done, this);
|
Bind(wxEVT_THREAD_DONE, &StepMeshDialog::on_task_done, this);
|
||||||
|
|
||||||
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico")
|
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico")
|
||||||
|
@ -85,17 +88,16 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
|
||||||
wxBoxSizer* bSizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* bSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
bSizer->SetMinSize(wxSize(MIN_DIALOG_WIDTH, -1));
|
bSizer->SetMinSize(wxSize(MIN_DIALOG_WIDTH, -1));
|
||||||
|
|
||||||
auto image_bitmap = create_scaled_bitmap("step_mesh_info", this, FromDIP(120), false, std::string(), false, false, true);
|
auto image_bitmap = create_scaled_bitmap("step_mesh_info", this, FromDIP(120));
|
||||||
int image_width = image_bitmap.GetWidth();
|
|
||||||
int image_height = image_bitmap.GetHeight();
|
wxPanel* overlay_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(image_bitmap.GetWidth()), FromDIP(image_bitmap.GetHeight())), wxTAB_TRAVERSAL);
|
||||||
wxPanel* overlay_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, image_bitmap.GetSize(), wxTAB_TRAVERSAL);
|
|
||||||
overlay_panel->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
overlay_panel->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
wxStaticBitmap *image = new wxStaticBitmap(overlay_panel, wxID_ANY, image_bitmap, wxDefaultPosition, wxDefaultSize, 0);
|
wxStaticBitmap *image = new wxStaticBitmap(overlay_panel, wxID_ANY, image_bitmap, wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
|
||||||
CenteredStaticText* text_1 = new CenteredStaticText (overlay_panel, wxID_ANY, _L("Rough"),
|
CenteredStaticText* text_1 = new CenteredStaticText (overlay_panel, wxID_ANY, _L("Smooth"),
|
||||||
wxPoint(overlay_panel->GetSize().GetWidth() / 6,
|
wxPoint(overlay_panel->GetSize().GetWidth() / 6,
|
||||||
overlay_panel->GetSize().GetHeight() / 2));
|
overlay_panel->GetSize().GetHeight() / 2));
|
||||||
CenteredStaticText* text_2 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Smooth"),
|
CenteredStaticText* text_2 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Rough"),
|
||||||
wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6,
|
wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6,
|
||||||
overlay_panel->GetSize().GetHeight() / 2));
|
overlay_panel->GetSize().GetHeight() / 2));
|
||||||
CenteredStaticText* text_3 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Linear"),
|
CenteredStaticText* text_3 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Linear"),
|
||||||
|
@ -104,10 +106,10 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
|
||||||
CenteredStaticText* text_4 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Angle"),
|
CenteredStaticText* text_4 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Angle"),
|
||||||
wxPoint(overlay_panel->GetSize().GetWidth() / 2,
|
wxPoint(overlay_panel->GetSize().GetWidth() / 2,
|
||||||
overlay_panel->GetSize().GetHeight() * 2 / 3));
|
overlay_panel->GetSize().GetHeight() * 2 / 3));
|
||||||
CenteredStaticText* text_5 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Fewer faces"),
|
CenteredStaticText* text_5 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("More faces"),
|
||||||
wxPoint(overlay_panel->GetSize().GetWidth() / 6,
|
wxPoint(overlay_panel->GetSize().GetWidth() / 6,
|
||||||
overlay_panel->GetSize().GetHeight() * 2.8 / 3));
|
overlay_panel->GetSize().GetHeight() * 2.8 / 3));
|
||||||
CenteredStaticText* text_6 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("More faces"),
|
CenteredStaticText* text_6 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Fewer faces"),
|
||||||
wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6,
|
wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6,
|
||||||
overlay_panel->GetSize().GetHeight() * 2.8 / 3));
|
overlay_panel->GetSize().GetHeight() * 2.8 / 3));
|
||||||
|
|
||||||
|
@ -251,8 +253,8 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
|
||||||
if (m_checkbox->IsChecked()) {
|
if (m_checkbox->IsChecked()) {
|
||||||
wxGetApp().app_config->set_bool("enable_step_mesh_setting", false);
|
wxGetApp().app_config->set_bool("enable_step_mesh_setting", false);
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->set("linear_defletion", std::to_string(get_linear_defletion()));
|
wxGetApp().app_config->set("linear_defletion", float_to_string_decimal_point(get_linear_defletion(), 3));
|
||||||
wxGetApp().app_config->set("angle_defletion", std::to_string(get_angle_defletion()));
|
wxGetApp().app_config->set("angle_defletion", float_to_string_decimal_point(get_angle_defletion(), 2));
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,14 @@ class Button;
|
||||||
class StepMeshDialog : public Slic3r::GUI::DPIDialog
|
class StepMeshDialog : public Slic3r::GUI::DPIDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StepMeshDialog(wxWindow* parent, Slic3r::Step& file);
|
StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double linear_init, double angle_init);
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||||
inline double get_linear_init() {
|
|
||||||
return std::stod(Slic3r::GUI::wxGetApp().app_config->get("linear_defletion"));
|
|
||||||
}
|
|
||||||
inline double get_angle_init() {
|
|
||||||
return std::stod(Slic3r::GUI::wxGetApp().app_config->get("angle_defletion"));
|
|
||||||
}
|
|
||||||
inline double get_linear_defletion() {
|
inline double get_linear_defletion() {
|
||||||
double value;
|
double value;
|
||||||
if (m_linear_last.ToDouble(&value)) {
|
if (m_linear_last.ToDouble(&value)) {
|
||||||
return value;
|
return value;
|
||||||
}else {
|
}else {
|
||||||
return get_linear_init();
|
return m_last_linear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline double get_angle_defletion() {
|
inline double get_angle_defletion() {
|
||||||
|
@ -33,7 +27,7 @@ public:
|
||||||
if (m_angle_last.ToDouble(&value)) {
|
if (m_angle_last.ToDouble(&value)) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
} else {
|
||||||
return get_angle_init();
|
return m_last_angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
@ -41,8 +35,8 @@ private:
|
||||||
Button* m_button_ok = nullptr;
|
Button* m_button_ok = nullptr;
|
||||||
Button* m_button_cancel = nullptr;
|
Button* m_button_cancel = nullptr;
|
||||||
wxCheckBox* m_checkbox = nullptr;
|
wxCheckBox* m_checkbox = nullptr;
|
||||||
wxString m_linear_last = wxString::Format("%.3f", get_linear_init());
|
wxString m_linear_last;
|
||||||
wxString m_angle_last = wxString::Format("%.2f", get_angle_init());
|
wxString m_angle_last;
|
||||||
wxStaticText* mesh_face_number_text;
|
wxStaticText* mesh_face_number_text;
|
||||||
double m_last_linear;
|
double m_last_linear;
|
||||||
double m_last_angle;
|
double m_last_angle;
|
||||||
|
|
Loading…
Reference in New Issue