knowing if a model is selected
Hi
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?
Thanks
Jamie
Asked by jdddog on 2014-11-28 04:17:20 UTC
Answers
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.
Asked by nkoenig on 2014-12-02 16:30:49 UTC
Comments
Ok thanks for the explanation, that makes sense now :)
Asked by jdddog on 2014-12-02 19:17:12 UTC
Comments
To get a model from a visual, you can use Visual::GetRootVisual
Asked by chapulina on 2014-12-01 10:59:45 UTC
Sweet thanks!
Asked by jdddog on 2014-12-02 19:18:44 UTC