mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-11-09 03:12:26 +00:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_reload_from_disk
This commit is contained in:
commit
20ee14a2b3
7 files changed
+8914
-8036
No files matched your search
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -151,7 +151,7 @@ bool stl_write_binary(stl_file *stl, const char *file, const char *label)
|
|||||||
memcpy(buffer, &stl->stats.number_of_facets, 4);
|
memcpy(buffer, &stl->stats.number_of_facets, 4);
|
||||||
stl_internal_reverse_quads(buffer, 4);
|
stl_internal_reverse_quads(buffer, 4);
|
||||||
fwrite(buffer, 4, 1, fp);
|
fwrite(buffer, 4, 1, fp);
|
||||||
for (i = 0; i < stl->stats.number_of_facets; ++ i) {
|
for (size_t i = 0; i < stl->stats.number_of_facets; ++ i) {
|
||||||
memcpy(buffer, stl->facet_start + i, 50);
|
memcpy(buffer, stl->facet_start + i, 50);
|
||||||
// Convert to little endian.
|
// Convert to little endian.
|
||||||
stl_internal_reverse_quads(buffer, 48);
|
stl_internal_reverse_quads(buffer, 48);
|
||||||
|
|||||||
@@ -159,9 +159,12 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
}
|
}
|
||||||
if (*line != 0)
|
// the following check is commented out because there may be obj files containing extra data, as those generated by Meshlab,
|
||||||
return false;
|
// see https://dev.prusa3d.com/browse/SPE-1019 for an example,
|
||||||
data.coordinates.push_back((float)x);
|
// and this would lead to a crash because no vertex would be stored
|
||||||
|
// if (*line != 0)
|
||||||
|
// return false;
|
||||||
|
data.coordinates.push_back((float)x);
|
||||||
data.coordinates.push_back((float)y);
|
data.coordinates.push_back((float)y);
|
||||||
data.coordinates.push_back((float)z);
|
data.coordinates.push_back((float)z);
|
||||||
data.coordinates.push_back((float)w);
|
data.coordinates.push_back((float)w);
|
||||||
@@ -210,16 +213,16 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vertex.coordIdx < 0)
|
if (vertex.coordIdx < 0)
|
||||||
vertex.coordIdx += data.coordinates.size() / 4;
|
vertex.coordIdx += (int)data.coordinates.size() / 4;
|
||||||
else
|
else
|
||||||
-- vertex.coordIdx;
|
-- vertex.coordIdx;
|
||||||
if (vertex.normalIdx < 0)
|
if (vertex.normalIdx < 0)
|
||||||
vertex.normalIdx += data.normals.size() / 3;
|
vertex.normalIdx += (int)data.normals.size() / 3;
|
||||||
else
|
else
|
||||||
-- vertex.normalIdx;
|
-- vertex.normalIdx;
|
||||||
if (vertex.textureCoordIdx < 0)
|
if (vertex.textureCoordIdx < 0)
|
||||||
vertex.textureCoordIdx += data.textureCoordinates.size() / 3;
|
vertex.textureCoordIdx += (int)data.textureCoordinates.size() / 3;
|
||||||
else
|
else
|
||||||
-- vertex.textureCoordIdx;
|
-- vertex.textureCoordIdx;
|
||||||
data.vertices.push_back(vertex);
|
data.vertices.push_back(vertex);
|
||||||
EATWS();
|
EATWS();
|
||||||
@@ -256,8 +259,8 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
// printf("usemtl %s\r\n", line);
|
// printf("usemtl %s\r\n", line);
|
||||||
EATWS();
|
EATWS();
|
||||||
ObjUseMtl usemtl;
|
ObjUseMtl usemtl;
|
||||||
usemtl.vertexIdxFirst = data.vertices.size();
|
usemtl.vertexIdxFirst = (int)data.vertices.size();
|
||||||
usemtl.name = line;
|
usemtl.name = line;
|
||||||
data.usemtls.push_back(usemtl);
|
data.usemtls.push_back(usemtl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -272,8 +275,8 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
if (*line != 0)
|
if (*line != 0)
|
||||||
return false;
|
return false;
|
||||||
ObjObject object;
|
ObjObject object;
|
||||||
object.vertexIdxFirst = data.vertices.size();
|
object.vertexIdxFirst = (int)data.vertices.size();
|
||||||
object.name = line;
|
object.name = line;
|
||||||
data.objects.push_back(object);
|
data.objects.push_back(object);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -282,8 +285,8 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
// g [group name]
|
// g [group name]
|
||||||
// printf("group %s\r\n", line);
|
// printf("group %s\r\n", line);
|
||||||
ObjGroup group;
|
ObjGroup group;
|
||||||
group.vertexIdxFirst = data.vertices.size();
|
group.vertexIdxFirst = (int)data.vertices.size();
|
||||||
group.name = line;
|
group.name = line;
|
||||||
data.groups.push_back(group);
|
data.groups.push_back(group);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -303,8 +306,8 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
if (*line != 0)
|
if (*line != 0)
|
||||||
return false;
|
return false;
|
||||||
ObjSmoothingGroup group;
|
ObjSmoothingGroup group;
|
||||||
group.vertexIdxFirst = data.vertices.size();
|
group.vertexIdxFirst = (int)data.vertices.size();
|
||||||
group.smoothingGroupID = g;
|
group.smoothingGroupID = g;
|
||||||
data.smoothingGroups.push_back(group);
|
data.smoothingGroups.push_back(group);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -341,8 +344,9 @@ bool objparse(const char *path, ObjData &data)
|
|||||||
lenPrev = len - lastLine;
|
lenPrev = len - lastLine;
|
||||||
memmove(buf, buf + lastLine, lenPrev);
|
memmove(buf, buf + lastLine, lenPrev);
|
||||||
}
|
}
|
||||||
} catch (std::bad_alloc &ex) {
|
}
|
||||||
printf("Out of memory\r\n");
|
catch (std::bad_alloc&) {
|
||||||
|
printf("Out of memory\r\n");
|
||||||
}
|
}
|
||||||
::fclose(pFile);
|
::fclose(pFile);
|
||||||
|
|
||||||
|
|||||||
@@ -2688,11 +2688,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||||||
// PrusaMultiMaterial::Writer may generate GCodeAnalyzer::Height_Tag and GCodeAnalyzer::Width_Tag lines without updating m_last_height and m_last_width
|
// PrusaMultiMaterial::Writer may generate GCodeAnalyzer::Height_Tag and GCodeAnalyzer::Width_Tag lines without updating m_last_height and m_last_width
|
||||||
// so, if the last role was erWipeTower we force export of GCodeAnalyzer::Height_Tag and GCodeAnalyzer::Width_Tag lines
|
// so, if the last role was erWipeTower we force export of GCodeAnalyzer::Height_Tag and GCodeAnalyzer::Width_Tag lines
|
||||||
bool last_was_wipe_tower = (m_last_analyzer_extrusion_role == erWipeTower);
|
bool last_was_wipe_tower = (m_last_analyzer_extrusion_role == erWipeTower);
|
||||||
|
char buf[64];
|
||||||
|
|
||||||
if (path.role() != m_last_analyzer_extrusion_role)
|
if (path.role() != m_last_analyzer_extrusion_role)
|
||||||
{
|
{
|
||||||
m_last_analyzer_extrusion_role = path.role();
|
m_last_analyzer_extrusion_role = path.role();
|
||||||
char buf[32];
|
|
||||||
sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), int(m_last_analyzer_extrusion_role));
|
sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), int(m_last_analyzer_extrusion_role));
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
@@ -2700,8 +2700,6 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||||||
if (last_was_wipe_tower || (m_last_mm3_per_mm != path.mm3_per_mm))
|
if (last_was_wipe_tower || (m_last_mm3_per_mm != path.mm3_per_mm))
|
||||||
{
|
{
|
||||||
m_last_mm3_per_mm = path.mm3_per_mm;
|
m_last_mm3_per_mm = path.mm3_per_mm;
|
||||||
|
|
||||||
char buf[32];
|
|
||||||
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Mm3_Per_Mm_Tag.c_str(), m_last_mm3_per_mm);
|
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Mm3_Per_Mm_Tag.c_str(), m_last_mm3_per_mm);
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
@@ -2709,8 +2707,6 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||||||
if (last_was_wipe_tower || (m_last_width != path.width))
|
if (last_was_wipe_tower || (m_last_width != path.width))
|
||||||
{
|
{
|
||||||
m_last_width = path.width;
|
m_last_width = path.width;
|
||||||
|
|
||||||
char buf[32];
|
|
||||||
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Width_Tag.c_str(), m_last_width);
|
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Width_Tag.c_str(), m_last_width);
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
@@ -2718,8 +2714,6 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||||||
if (last_was_wipe_tower || (m_last_height != path.height))
|
if (last_was_wipe_tower || (m_last_height != path.height))
|
||||||
{
|
{
|
||||||
m_last_height = path.height;
|
m_last_height = path.height;
|
||||||
|
|
||||||
char buf[32];
|
|
||||||
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Height_Tag.c_str(), m_last_height);
|
sprintf(buf, ";%s%f\n", GCodeAnalyzer::Height_Tag.c_str(), m_last_height);
|
||||||
gcode += buf;
|
gcode += buf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user