Gazebo | Ignition | Community
Ask Your Question

knowing if a model is selected

asked 2014-11-28 03:17:20 -0500

jdddog gravatar image


How are you supposed to find out if a model is currently selected by the user from a model plugin? I've hunted around the Model and Entity classes and can't find any variables which store this information.

If there isn't currently a way, I could set a boolean in the model class when its selected / deselected in the method GLWidget::SetSelectedVisual. But how do you get a model from a visual?



edit retag flag offensive close merge delete



To get a model from a visual, you can use Visual::GetRootVisual

chapulina gravatar imagechapulina ( 2014-12-01 09:59:45 -0500 )edit

Sweet thanks!

jdddog gravatar imagejdddog ( 2014-12-02 18:18:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-02 15:30:49 -0500

nkoenig gravatar image

There is a pull request that will help resolve this issue. This functionality will make it into Gazebo 5.0, at which point you'll be able to subsribe to the ~/selection topic to get model selection information.

In the mean time you can write a GUI plugin that publishes the information to your model plugin. A key piece of information is that the GUI operates in a different process than the server. You model plugin runs on the server, and therefore does not have direct access to the GUI. The solution is to use a pub/sub mechanism.

edit flag offensive delete link more


Ok thanks for the explanation, that makes sense now :)

jdddog gravatar imagejdddog ( 2014-12-02 18:17:12 -0500 )edit

Question Tools


Asked: 2014-11-28 03:17:20 -0500

Seen: 228 times

Last updated: Dec 02 '14