Skip to content

Commit e94b0fe

Browse files
olegullgritz
authored andcommitted
fix: Mute partio error prints (#1774)
Signed-off-by: Ole Gulbrandsen <[email protected]>
1 parent ee3403a commit e94b0fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/liboslexec/pointcloud.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
44

55
#include <cstdarg>
6+
#include <sstream>
67

78
#include "pointcloud.h"
89

@@ -29,7 +30,13 @@ PointCloud::get(ustringhash filename, bool write)
2930
// Not found. Create a new one.
3031
Partio::ParticlesDataMutable* partio_cloud = nullptr;
3132
if (!write) {
32-
partio_cloud = Partio::read(filename.c_str(), false);
33+
// Mute Partio error prints: by default Partio::read sends errors directly
34+
// to std::err, but in most cases we want errors to go via errorfmt so the
35+
// renderer can recognize the message as an error, as we do in
36+
// pointcloud_search and pointcloud_get.
37+
std::stringstream m_errorStream;
38+
39+
partio_cloud = Partio::read(filename.c_str(), false, m_errorStream);
3340
if (!partio_cloud)
3441
return nullptr;
3542
} else {

0 commit comments

Comments
 (0)