diff --git a/src/gui/plugins/modules/EntityContextMenu.cc b/src/gui/plugins/modules/EntityContextMenu.cc index d43f6ba971..ef7637489b 100644 --- a/src/gui/plugins/modules/EntityContextMenu.cc +++ b/src/gui/plugins/modules/EntityContextMenu.cc @@ -20,8 +20,8 @@ #include #include -#include #include +#include #include #include @@ -257,37 +257,38 @@ void EntityContextMenu::OnRequest(const QString &_request, const QString &_data) else if (request == "follow") { msgs::CameraTrack followMsg; - followMsg.set_follow_target(_data.toStdString()); + followMsg.mutable_follow_target()->set_name(_data.toStdString()); followMsg.set_track_mode(msgs::CameraTrack::FOLLOW); - this->dataPtr->followTargetLookAt = followMsg.follow_target(); - gzmsg << "Follow target: " << followMsg.follow_target() << std::endl; + this->dataPtr->followTargetLookAt = followMsg.follow_target().name(); + gzmsg << "Follow target: " << followMsg.follow_target().name() << std::endl; this->dataPtr->trackPub.Publish(followMsg); } else if (request == "free_look") { msgs::CameraTrack followMsg; - followMsg.set_follow_target(_data.toStdString()); + followMsg.mutable_follow_target()->set_name(_data.toStdString()); followMsg.set_track_mode(msgs::CameraTrack::FOLLOW_FREE_LOOK); - this->dataPtr->followTargetLookAt = followMsg.follow_target(); - gzmsg << "Follow target: " << followMsg.follow_target() << std::endl; + this->dataPtr->followTargetLookAt = followMsg.follow_target().name(); + gzmsg << "Follow target: " << followMsg.follow_target().name() << std::endl; this->dataPtr->trackPub.Publish(followMsg); } else if (request == "look_at") { msgs::CameraTrack followMsg; - followMsg.set_track_target(_data.toStdString()); + followMsg.mutable_track_target()->set_name(_data.toStdString()); followMsg.set_track_mode(msgs::CameraTrack::FOLLOW_LOOK_AT); - followMsg.set_follow_target(this->dataPtr->followTargetLookAt); - gzmsg << "Follow target: " << followMsg.follow_target() << std::endl; - gzmsg << "Look at target: " << followMsg.track_target() << std::endl; + followMsg.mutable_follow_target()->set_name( + this->dataPtr->followTargetLookAt); + gzmsg << "Follow target: " << followMsg.follow_target().name() << std::endl; + gzmsg << "Look at target: " << followMsg.track_target().name() << std::endl; this->dataPtr->trackPub.Publish(followMsg); } else if (request == "track") { msgs::CameraTrack trackMsg; - trackMsg.set_track_target(_data.toStdString()); + trackMsg.mutable_track_target()->set_name(_data.toStdString()); trackMsg.set_track_mode(msgs::CameraTrack::TRACK); - gzmsg << "Track target: " << trackMsg.track_target() << std::endl; + gzmsg << "Track target: " << trackMsg.track_target().name() << std::endl; this->dataPtr->trackPub.Publish(trackMsg); } else if (request == "view_transparent") diff --git a/src/gui/plugins/modules/EntityContextMenu.hh b/src/gui/plugins/modules/EntityContextMenu.hh index a59c271d43..5f09419f32 100644 --- a/src/gui/plugins/modules/EntityContextMenu.hh +++ b/src/gui/plugins/modules/EntityContextMenu.hh @@ -67,7 +67,7 @@ namespace sim /// \brief Set whether followingTarget /// \param[in] _followingTarget True if followingTarget - public: Q_INVOKABLE void SetFollowingTarget(const bool &_followingTarget); + public: Q_INVOKABLE void SetFollowingTarget(bool &_followingTarget); /// \brief Notify that followingTarget has changed signals: void FollowingTargetChanged();