From f9b357fdc0bfea5361e27b506059e62eab1f861b Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Tue, 16 Jul 2019 09:42:13 +0200 Subject: [PATCH] Fix opacity of Collada meshes (#1387) Fixes an issue introduced in #1294 (e906f82eb2ef04e63dea03f834ae722f144bc712): Materials of Collada mesh models need to be cloned for each instance of a robot link. --- src/rviz/robot/robot_link.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rviz/robot/robot_link.cpp b/src/rviz/robot/robot_link.cpp index 8246c53f91..077f77f62d 100644 --- a/src/rviz/robot/robot_link.cpp +++ b/src/rviz/robot/robot_link.cpp @@ -632,6 +632,13 @@ void RobotLink::createEntityForGeometryElement(const urdf::LinkConstSharedPtr& l { sub->setMaterial(default_material_); } + else + { + // create a new material copy for each instance of a RobotLink + Ogre::MaterialPtr mat = Ogre::MaterialPtr(new Ogre::Material(nullptr, material_name, 0, ROS_PACKAGE_NAME)); + *mat = *sub->getMaterial(); + sub->setMaterial(mat); + } materials_[sub] = sub->getMaterial(); } }