Skip to content

Commit fc4b166

Browse files
authored
PlantFlagTool::makeFlag(): reload mesh resource (#67)
A Reset also resets the ResourceManager, such that the mesh resource is not available anymore and createEntity() will fail. Fixes ros-visualization/rviz#1618
1 parent f417df4 commit fc4b166

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rviz_plugin_tutorials/src/plant_flag_tool.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ int PlantFlagTool::processMouseEvent( rviz::ViewportMouseEvent& event )
194194
// This is a helper function to create a new flag in the Ogre scene and save its scene node in a list.
195195
void PlantFlagTool::makeFlag( const Ogre::Vector3& position )
196196
{
197+
if( rviz::loadMeshFromResource( flag_resource_ ).isNull() )
198+
{
199+
ROS_ERROR( "PlantFlagTool: failed to load model resource '%s'.", flag_resource_.c_str() );
200+
return;
201+
}
202+
197203
Ogre::SceneNode* node = scene_manager_->getRootSceneNode()->createChildSceneNode();
198204
Ogre::Entity* entity = scene_manager_->createEntity( flag_resource_ );
199205
node->attachObject( entity );

0 commit comments

Comments
 (0)