mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 00:11:57 +08:00
Fix SPE-2129
https://github.com/prusa3d/PrusaSlicer/issues/12157 (cherry picked from commit 309ec8c5fbcc0754f165b51e39e7c291da13ab77)
This commit is contained in:
parent
f64aea6499
commit
8dc1d70d85
@ -352,10 +352,18 @@ bool objparse(const char *path, ObjData &data)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
char buf[65536 * 2];
|
char buf[(65536+1) * 2];
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
size_t lenPrev = 0;
|
size_t lenPrev = 0;
|
||||||
while ((len = ::fread(buf + lenPrev, 1, 65536, pFile)) != 0) {
|
while ((len = ::fread(buf + lenPrev, 1, 65536, pFile)) != 0) {
|
||||||
|
if (std::feof(pFile)) {
|
||||||
|
// Fix issue with missing last trinagle in obj file:
|
||||||
|
// https://github.com/prusa3d/PrusaSlicer/issues/12157
|
||||||
|
// algorithm expect line endings after last face
|
||||||
|
// but file format support it
|
||||||
|
buf[len] = '\n';
|
||||||
|
++len;
|
||||||
|
}
|
||||||
len += lenPrev;
|
len += lenPrev;
|
||||||
size_t lastLine = 0;
|
size_t lastLine = 0;
|
||||||
for (size_t i = 0; i < len; ++ i)
|
for (size_t i = 0; i < len; ++ i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user