mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 08:41:11 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
ce32d68368
16 changed files with 984 additions and 1266 deletions
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#else
|
||||
|
@ -22,7 +24,7 @@ bool load_obj(const char *path, TriangleMesh *meshptr)
|
|||
// Parse the OBJ file.
|
||||
ObjParser::ObjData data;
|
||||
if (! ObjParser::objparse(path, data)) {
|
||||
// die "Failed to parse $file\n" if !-e $path;
|
||||
BOOST_LOG_TRIVIAL(error) << "load_obj: failed to parse " << path;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,8 @@ bool load_obj(const char *path, TriangleMesh *meshptr)
|
|||
++ num_normals;
|
||||
}
|
||||
}
|
||||
if (data.vertices[i].coordIdx != -1) {
|
||||
// Result of obj_parseline() call is not checked, thus not all vertices are necessarily finalized with coord_Idx == -1.
|
||||
if (i < data.vertices.size() && data.vertices[i].coordIdx != -1) {
|
||||
// This is a quad. Produce the other triangle.
|
||||
stl_facet &facet2 = stl.facet_start[i_face++];
|
||||
facet2.vertex[0] = facet.vertex[0];
|
||||
|
@ -102,7 +105,7 @@ bool load_obj(const char *path, TriangleMesh *meshptr)
|
|||
stl_get_size(&stl);
|
||||
mesh.repair();
|
||||
if (mesh.facets_count() == 0) {
|
||||
// die "This OBJ file couldn't be read because it's empty.\n"
|
||||
BOOST_LOG_TRIVIAL(error) << "load_obj: This OBJ file couldn't be read because it's empty. " << path;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
|
||||
#include "objparser.hpp"
|
||||
|
@ -312,7 +313,7 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
printf("ObjParser: Unknown command: %c\r\n", c1);
|
||||
BOOST_LOG_TRIVIAL(error) << "ObjParser: Unknown command: " << c1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -338,15 +339,22 @@ bool objparse(const char *path, ObjData &data)
|
|||
char *c = buf + lastLine;
|
||||
while (*c == ' ' || *c == '\t')
|
||||
++ c;
|
||||
//FIXME check the return value and exit on error?
|
||||
// Will it break parsing of some obj files?
|
||||
obj_parseline(c, data);
|
||||
lastLine = i + 1;
|
||||
}
|
||||
lenPrev = len - lastLine;
|
||||
if (lenPrev > 65536) {
|
||||
BOOST_LOG_TRIVIAL(error) << "ObjParser: Excessive line length";
|
||||
::fclose(pFile);
|
||||
return false;
|
||||
}
|
||||
memmove(buf, buf + lastLine, lenPrev);
|
||||
}
|
||||
}
|
||||
catch (std::bad_alloc&) {
|
||||
printf("Out of memory\r\n");
|
||||
BOOST_LOG_TRIVIAL(error) << "ObjParser: Out of memory";
|
||||
}
|
||||
::fclose(pFile);
|
||||
|
||||
|
@ -378,7 +386,8 @@ bool objparse(std::istream &stream, ObjData &data)
|
|||
}
|
||||
}
|
||||
catch (std::bad_alloc&) {
|
||||
printf("Out of memory\r\n");
|
||||
BOOST_LOG_TRIVIAL(error) << "ObjParser: Out of memory";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
#include "slic3r/Config/Snapshot.hpp"
|
||||
#include "slic3r/Utils/PresetUpdater.hpp"
|
||||
|
||||
#if defined(__linux__) && defined(__WXGTK3__)
|
||||
#define wxLinux_gtk3 true
|
||||
#else
|
||||
#define wxLinux_gtk3 false
|
||||
#endif //defined(__linux__) && defined(__WXGTK3__)
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
@ -409,7 +414,11 @@ ConfigWizardPage::ConfigWizardPage(ConfigWizard *parent, wxString title, wxStrin
|
|||
|
||||
SetSizer(sizer);
|
||||
|
||||
this->Hide();
|
||||
// There is strange layout on Linux with GTK3,
|
||||
// see https://github.com/prusa3d/PrusaSlicer/issues/5103 and https://github.com/prusa3d/PrusaSlicer/issues/4861
|
||||
// So, non-active pages will be hidden later, on wxEVT_SHOW, after completed Layout() for all pages
|
||||
if (!wxLinux_gtk3)
|
||||
this->Hide();
|
||||
|
||||
Bind(wxEVT_SIZE, [this](wxSizeEvent &event) {
|
||||
this->Layout();
|
||||
|
@ -2642,6 +2651,20 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
|||
|
||||
Layout();
|
||||
});
|
||||
|
||||
if (wxLinux_gtk3)
|
||||
this->Bind(wxEVT_SHOW, [this, vsizer](const wxShowEvent& e) {
|
||||
ConfigWizardPage* active_page = p->index->active_page();
|
||||
if (!active_page)
|
||||
return;
|
||||
for (auto page : p->all_pages)
|
||||
if (page != active_page)
|
||||
page->Hide();
|
||||
// update best size for the dialog after hiding of the non-active pages
|
||||
vsizer->SetSizeHints(this);
|
||||
// set initial dialog size
|
||||
p->init_dialog_size();
|
||||
});
|
||||
}
|
||||
|
||||
ConfigWizard::~ConfigWizard() {}
|
||||
|
|
|
@ -660,6 +660,8 @@ void ModeButton::focus_button(const bool focus)
|
|||
SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT :
|
||||
#if defined (__linux__) && defined (__WXGTK3__)
|
||||
wxSYS_COLOUR_GRAYTEXT
|
||||
#elif defined (__linux__) && defined (__WXGTK2__)
|
||||
wxSYS_COLOUR_BTNTEXT
|
||||
#else
|
||||
wxSYS_COLOUR_BTNSHADOW
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue