-
-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix material handling #1294
fix material handling #1294
Conversation
} | ||
else | ||
{ | ||
// Need to clone here due to how selection works. Once selection id is done per object and not per material, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wjwwood I'm not sure whether this code is already obsolete, because selection handling was changed.
Anyway, removing this code, I didn't observed any issues in selecting links. However, probably you better know, what to test...
Ping - is this PR ready for merging or what is blocking it? We'd really love to see this fix make its way into rviz :) |
Hi @rhaschke,
Best, |
ed3b0b3
to
d0c7fc1
Compare
... and thus the need for boost::signals(1) which was removed from boost in version 1.69
- package.xml, format 2 - duplicate find_package - missing package dependencies, particularly rosunit + rostest
…on#1346), and remove-boost-signals1 (ros-visualization#1344)
This reverts commit 3f1b388.
As materials are not reused, there is no need (or use) to handle them with the MaterialManager. Using the MaterialManager actually causes a memory leak, as created materials will always be kept by the resource manager.
alternative implementation for ros-visualization#1079
In urdf::Link, only the first visual's material comprises actual color values, all others only have the name. Thus to correctly show the color of all visuals, we need to search for the first visual with given material name, much like ros-visualization#1079 has done. If the urdfdom fix (ros/urdfdom#114) is released, this work-around can be reverted.
d0c7fc1
to
83ac836
Compare
Fixes an issue introduced in ros-visualization#1294 (e906f82): Materials of Collada mesh models need to be cloned for each instance of a robot link.
This attempts to resolve #1222. As noted in #1222 (comment), I was able to track down the "memory leak" to material handling of robot links. Each time, a new
rviz::RobotLink
was created, the corresponding link material(s) were registered again with theOgre::MaterialManager
and never released until rviz finished.This PR addresses the issue by essentially rewriting material handling of robot links: Instead of registering materials with the
MaterialManager
, they are directly created usingnew Ogre::Material()
. This avoids both the unique naming problem, and the memory leak. However, the Ogre documentation explicitly suggests to useMaterialManager::create()
instead of using the Material constructor. You need to decide whether you accept this.If not, it is important to also remove the material(s) from MaterialManager in the RobotLink destructor, e.g. by calling
MaterialManager::remove(material->getHandle())
. However, I consider this overkill, because the material is explicitly not reused from the MaterialManager.I also reworked #1079: Instead of searching the corresponding material by the passed name, I directly pass the
urdf::MaterialSharedPtr
. This ensures that the correct material is used, even when two different materials are identically named.