Skip to content

Commit

Permalink
PlantFlagTool::makeFlag(): reload mesh resource
Browse files Browse the repository at this point in the history
A Reset also resets the ResourceManager, such that the mesh resource
is not available anymore and createEntity() will fail.

Fixes ros-visualization/rviz#1618
  • Loading branch information
rhaschke committed Apr 12, 2021
1 parent 65d8988 commit 740fd6d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rviz_plugin_tutorials/src/plant_flag_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ int PlantFlagTool::processMouseEvent( rviz::ViewportMouseEvent& event )
// This is a helper function to create a new flag in the Ogre scene and save its scene node in a list.
void PlantFlagTool::makeFlag( const Ogre::Vector3& position )
{
if( rviz::loadMeshFromResource( flag_resource_ ).isNull() )
{
ROS_ERROR( "PlantFlagTool: failed to load model resource '%s'.", flag_resource_.c_str() );
return;
}

Ogre::SceneNode* node = scene_manager_->getRootSceneNode()->createChildSceneNode();
Ogre::Entity* entity = scene_manager_->createEntity( flag_resource_ );
node->attachObject( entity );
Expand Down

0 comments on commit 740fd6d

Please sign in to comment.