@@ -107,17 +107,22 @@ struct ReadTopologyOp
107107 using LeafT = typename TreeT::LeafNodeType;
108108 using StorageValueT = typename StorageTreeT::ValueType;
109109
110- ReadTopologyOp (std::istream& _is, bool _saveFloatAsHalf)
110+ ReadTopologyOp (std::istream& _is, bool _saveFloatAsHalf, io::ReadDiagnostics& _diagnostics,
111+ const std::string& _gridName)
111112 : is(_is)
112- , saveFloatAsHalf(_saveFloatAsHalf) { }
113+ , saveFloatAsHalf(_saveFloatAsHalf)
114+ , diagnostics(_diagnostics)
115+ , gridName(_gridName) { }
113116
114117 void operator ()(RootT& root)
115118 {
116119 using ChildT = typename RootT::ChildNodeType;
117120
118121 int32_t bufferCount;
119122 is.read (reinterpret_cast <char *>(&bufferCount), sizeof (int32_t ));
120- if (bufferCount != 1 ) OPENVDB_LOG_WARN (" multi-buffer trees are no longer supported" );
123+ if (bufferCount != 1 ) {
124+ diagnostics.addWarning (gridName, " multi-buffer trees are no longer supported" );
125+ }
121126
122127 // Delete the existing tree.
123128 root.clear ();
@@ -216,6 +221,8 @@ struct ReadTopologyOp
216221 std::istream& is;
217222 bool saveFloatAsHalf;
218223 ValueT background;
224+ io::ReadDiagnostics& diagnostics;
225+ std::string gridName;
219226}; // struct ReadTopologyOp
220227
221228template <typename TreeT>
@@ -264,14 +271,14 @@ void setTilesToBackground(TreeT& tree)
264271
265272// Free-standing function for read case (supports type conversion via StorageGridT)
266273template <typename GridT, typename StorageGridT = GridT>
267- void topologyCodecReadTopology (GridBase& gridBase, std::istream& is, const io::ReadOptions& options)
274+ void topologyCodecReadTopology (GridBase& gridBase, std::istream& is, const io::ReadOptions& options, io::ReadDiagnostics& diagnostics )
268275{
269276 io::checkFormatVersion (is);
270277
271278 GridT& grid = static_cast <GridT&>(gridBase);
272279 grid.tree ().clearAllAccessors ();
273280
274- internal::ReadTopologyOp<typename GridT::TreeType, typename StorageGridT::TreeType> readTopologyOp (is, grid.saveFloatAsHalf ());
281+ internal::ReadTopologyOp<typename GridT::TreeType, typename StorageGridT::TreeType> readTopologyOp (is, grid.saveFloatAsHalf (), diagnostics, grid. getName () );
275282 readTopologyOp (grid.tree ().root ());
276283
277284 if (options.readMode == io::ReadMode::TopologyOnly) {
@@ -307,9 +314,10 @@ struct OPENVDB_API TopologyCodec : public io::Codec
307314 return data;
308315 }
309316
310- void readTopology (std::istream& is, io::CodecData& data, const io::ReadOptions& options) final
317+ void readTopology (std::istream& is, io::CodecData& data, const io::ReadOptions& options,
318+ io::ReadDiagnostics& diagnostics) final
311319 {
312- internal::topologyCodecReadTopology<GridT, StorageGridT>(*data.grid , is, options);
320+ internal::topologyCodecReadTopology<GridT, StorageGridT>(*data.grid , is, options, diagnostics );
313321 }
314322
315323 void writeTopology (std::ostream& os, const GridBase& gridBase, const io::WriteOptions&) final
0 commit comments