Skip to content

Commit 17da0ce

Browse files
committed
Fix color loading from H5
1 parent 96cf4de commit 17da0ce

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rviz_mesh_tools_plugins/src/MapDisplay.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,18 @@ bool MapDisplay::loadData()
448448
const std::string mesh_part = "mesh";
449449

450450
hdf5_mesh_io->open(mapFile);
451+
hdf5_mesh_io->setMeshName(mesh_part);
451452
auto mesh_buffer = hdf5_mesh_io->MeshIO::load(mesh_part);
452453

454+
// MeshIO Loads colors as bool channel so we need to load it again.
455+
// This is because HDF5 stores bools and uchars as the same data type and
456+
// bool loading is tried before uchar
457+
auto color_opt = hdf5_mesh_io->loadChannel<unsigned char>(mesh_part + "/vertex_attributes", "vertex_colors");
458+
if (color_opt)
459+
{
460+
mesh_buffer->insert_or_assign("vertex_colors", color_opt.value());
461+
}
462+
453463
if (nullptr == mesh_buffer)
454464
{
455465
RCLCPP_ERROR(

0 commit comments

Comments
 (0)