Skip to content

View entity frames from the GUI #1105

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

Merged
merged 9 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/gui/plugins/modules/EntityContextMenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ namespace ignition::gazebo
/// \brief View collisions service name
public: std::string viewCollisionsService;

/// \brief View frames service name
public: std::string viewFramesService;

/// \brief Copy service name
public: std::string copyService;

Expand Down Expand Up @@ -118,6 +121,9 @@ EntityContextMenu::EntityContextMenu()
// For view collisions service requests
this->dataPtr->viewCollisionsService = "/gui/view/collisions";

// For view frames service requests
this->dataPtr->viewFramesService = "/gui/view/frames";

// For copy service requests
this->dataPtr->copyService = "/gui/copy";

Expand Down Expand Up @@ -230,6 +236,12 @@ void EntityContextMenu::OnRequest(const QString &_request, const QString &_data)
req.set_data(_data.toStdString());
this->dataPtr->node.Request(this->dataPtr->viewCollisionsService, req, cb);
}
else if (request == "view_frames")
{
ignition::msgs::StringMsg req;
req.set_data(_data.toStdString());
this->dataPtr->node.Request(this->dataPtr->viewFramesService, req, cb);
}
else if (request == "copy")
{
ignition::msgs::StringMsg req;
Expand Down
16 changes: 16 additions & 0 deletions src/gui/plugins/modules/EntityContextMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ Item {
context.OnRequest("view_joints", context.entity)
}
}
MenuItem {
id: viewFramesMenu
text: "Frames"
onTriggered: {
menu.close()
context.OnRequest("view_frames", context.entity)
}
}
MenuItem {
id: viewTransparentMenu
text: "Transparent"
Expand Down Expand Up @@ -139,6 +147,7 @@ Item {
viewJointsMenu.enabled = false;
viewWireframesMenu.enabled = false;
viewCollisionsMenu.enabled = false;
viewFramesMenu.enabled = false;

// enable / disable menu items
if (context.type == "model" || context.type == "link" ||
Expand Down Expand Up @@ -168,6 +177,13 @@ Item {
viewJointsMenu.enabled = true;
}

// TODO(chapulina) Support collision, sensor, etc.
if (context.type == "model" || context.type == "link" ||
context.type == "visual")
{
viewFramesMenu.enabled = true
}

menu.open()
}

Expand Down
Loading