Skip to content

Commit

Permalink
Showing 13 changed files with 99 additions and 37 deletions.
11 changes: 11 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
@@ -18,6 +18,17 @@ release will remove the deprecated code.
* `/<prefix>/<sensor_name>` -> `/<prefix>/<sensor_name>/image`
* `/<prefix>/camera_info` -> `/<prefix>/<sensor_name>/camera_info`

* Various `GuiEvent`s were deprecated in favor of their Ignition GUI
equivalents.
* **Deprecated** `ignition::gazebo::gui::SnapIntervals`
* **Replacement** `ignition::gui::SnapIntervals`
* **Deprecated** `ignition::gazebo::gui::Render`
* **Replacement** `ignition::gui::Render`
* **Deprecated** `ignition::gazebo::gui::SpawnPreviewModel`
* **Replacement** `ignition::gui::SpawnFromDescription`
* **Deprecated** `ignition::gazebo::gui::SnapPreviewPath`
* **Replacement** `ignition::gui::SnapFromPath`

## Ignition Gazebo 4.0.0 to 4.X.X

* Ignition Gazebo 4.0.0 enabled double sided material by default but this
10 changes: 5 additions & 5 deletions include/ignition/gazebo/gui/GuiEvents.hh
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
namespace events
{
/// \brief The class for sending and receiving custom snap value events.
class SnapIntervals : public QEvent
class IGN_DEPRECATED(5) SnapIntervals : public QEvent
{
/// \brief Constructor
/// \param[in] _xyz XYZ snapping values.
@@ -151,7 +151,7 @@ namespace events

/// \brief Event called in the render thread of a 3D scene.
/// It's safe to make rendering calls in this event's callback.
class Render : public QEvent
class IGN_DEPRECATED(5) Render : public QEvent
{
public: Render()
: QEvent(kType)
@@ -163,11 +163,11 @@ namespace events

/// \brief Event called to spawn a preview model.
/// Used by plugins that spawn models.
class SpawnPreviewModel : public QEvent
class IGN_DEPRECATED(5) SpawnPreviewModel : public QEvent
{
/// \brief Constructor
/// \param[in] _modelSdfString The model's SDF file as a string.
public: explicit SpawnPreviewModel(std::string &_modelSdfString)
public: explicit SpawnPreviewModel(const std::string &_modelSdfString)
: QEvent(kType), modelSdfString(_modelSdfString)
{
}
@@ -188,7 +188,7 @@ namespace events

/// \brief Event called to spawn a preview resource, which takes the path
/// to the SDF file. Used by plugins that spawn resources.
class SpawnPreviewPath : public QEvent
class IGN_DEPRECATED(5) SpawnPreviewPath : public QEvent
{
/// \brief Constructor
/// \param[in] _filePath The path to an SDF file.
6 changes: 4 additions & 2 deletions src/gui/plugins/align_tool/AlignTool.cc
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
#include <vector>

#include <ignition/gui/Application.hh>
#include <ignition/gui/GuiEvents.hh>
#include <ignition/gui/MainWindow.hh>
#include <ignition/common/Console.hh>
#include <ignition/plugin/Register.hh>
@@ -585,7 +586,7 @@ rendering::NodePtr AlignTool::TopLevelNode(rendering::ScenePtr &_scene,
/////////////////////////////////////////////////
bool AlignTool::eventFilter(QObject *_obj, QEvent *_event)
{
if (_event->type() == ignition::gazebo::gui::events::Render::kType)
if (_event->type() == ignition::gui::events::Render::kType)
{
// This event is called in Scene3d's RenderThread, so it's safe to make
// rendering calls here
@@ -603,7 +604,8 @@ bool AlignTool::eventFilter(QObject *_obj, QEvent *_event)
ignition::gazebo::gui::events::EntitiesSelected::kType)
{
auto selectedEvent =
reinterpret_cast<gui::events::EntitiesSelected *>(_event);
reinterpret_cast<ignition::gazebo::gui::events::EntitiesSelected *>(
_event);

// Only update if a valid cast, the data isn't empty, and
// the command is not from user (sent from backend)
4 changes: 2 additions & 2 deletions src/gui/plugins/grid_config/GridConfig.cc
Original file line number Diff line number Diff line change
@@ -17,13 +17,13 @@

#include <ignition/common/Console.hh>
#include <ignition/gui/Application.hh>
#include <ignition/gui/GuiEvents.hh>
#include <ignition/gui/MainWindow.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/math/Color.hh>
#include <ignition/math/Pose3.hh>
#include <ignition/rendering.hh>

#include "ignition/gazebo/gui/GuiEvents.hh"
#include "GridConfig.hh"

namespace ignition::gazebo
@@ -87,7 +87,7 @@ void GridConfig::LoadConfig(const tinyxml2::XMLElement *)
/////////////////////////////////////////////////
bool GridConfig::eventFilter(QObject *_obj, QEvent *_event)
{
if (_event->type() == ignition::gazebo::gui::events::Render::kType)
if (_event->type() == ignition::gui::events::Render::kType)
{
// This event is called in Scene3d's RenderThread, so it's safe to make
// rendering calls here
2 changes: 2 additions & 0 deletions src/gui/plugins/resource_spawner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
gz_add_gui_plugin(ResourceSpawner
SOURCES ResourceSpawner.cc
QT_HEADERS ResourceSpawner.hh
PRIVATE_LINK_LIBS
ignition-utils${IGN_UTILS_VER}::ignition-utils${IGN_UTILS_VER}
)
12 changes: 11 additions & 1 deletion src/gui/plugins/resource_spawner/ResourceSpawner.cc
Original file line number Diff line number Diff line change
@@ -31,10 +31,12 @@
#include <ignition/common/Profiler.hh>
#include <ignition/common/Filesystem.hh>
#include <ignition/gui/Application.hh>
#include <ignition/gui/GuiEvents.hh>
#include <ignition/gui/MainWindow.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>
#include <ignition/transport/Publisher.hh>
#include <ignition/utils/SuppressWarning.hh>
#include <ignition/fuel_tools/FuelClient.hh>
#include <ignition/fuel_tools/ClientConfig.hh>

@@ -626,10 +628,18 @@ void ResourceSpawner::OnSortChosen(const QString &_sortType)
/////////////////////////////////////////////////
void ResourceSpawner::OnResourceSpawn(const QString &_sdfPath)
{
gui::events::SpawnPreviewPath event(_sdfPath.toStdString());
ignition::gui::events::SpawnFromPath event(_sdfPath.toStdString());
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&event);

IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
ignition::gazebo::gui::events::SpawnPreviewPath oldEvent(
_sdfPath.toStdString());
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&oldEvent);
IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
}

// Register this plugin
4 changes: 3 additions & 1 deletion src/gui/plugins/scene3d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
gz_add_gui_plugin(GzScene3D
SOURCES Scene3D.cc
QT_HEADERS Scene3D.hh
PRIVATE_LINK_LIBS ${PROJECT_LIBRARY_TARGET_NAME}-rendering
PRIVATE_LINK_LIBS
${PROJECT_LIBRARY_TARGET_NAME}-rendering
ignition-utils${IGN_UTILS_VER}::ignition-utils${IGN_UTILS_VER}
)
43 changes: 27 additions & 16 deletions src/gui/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
@@ -56,6 +56,8 @@

#include <ignition/transport/Node.hh>

#include <ignition/utils/SuppressWarning.hh>

#include <ignition/gui/Conversions.hh>
#include <ignition/gui/GuiEvents.hh>
#include <ignition/gui/Application.hh>
@@ -805,10 +807,17 @@ void IgnRenderer::Render()

if (ignition::gui::App())
{
gui::events::Render event;
ignition::gui::events::Render event;
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&event);

IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
ignition::gazebo::gui::events::Render oldEvent;
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&oldEvent);
IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
}

// only has an effect in video recording lockstep mode
@@ -1220,7 +1229,7 @@ void IgnRenderer::DeselectAllEntities(bool _sendEvent)

if (_sendEvent)
{
gui::events::DeselectAllEntities deselectEvent;
ignition::gazebo::gui::events::DeselectAllEntities deselectEvent;
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&deselectEvent);
@@ -1817,7 +1826,7 @@ void IgnRenderer::UpdateSelectedEntity(const rendering::NodePtr &_node,
// Notify other widgets of the currently selected entities
if (_sendEvent || deselectedAll)
{
gui::events::EntitiesSelected selectEvent(
ignition::gazebo::gui::events::EntitiesSelected selectEvent(
this->dataPtr->renderUtil.SelectedEntities());
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
@@ -2896,7 +2905,8 @@ bool Scene3D::eventFilter(QObject *_obj, QEvent *_event)
ignition::gazebo::gui::events::EntitiesSelected::kType)
{
auto selectedEvent =
reinterpret_cast<gui::events::EntitiesSelected *>(_event);
reinterpret_cast<ignition::gazebo::gui::events::EntitiesSelected *>(
_event);
if (selectedEvent)
{
for (const auto &entity : selectedEvent->Data())
@@ -2929,7 +2939,8 @@ bool Scene3D::eventFilter(QObject *_obj, QEvent *_event)
ignition::gazebo::gui::events::DeselectAllEntities::kType)
{
auto deselectEvent =
reinterpret_cast<gui::events::DeselectAllEntities *>(_event);
reinterpret_cast<ignition::gazebo::gui::events::DeselectAllEntities *>(
_event);

// If the event is from the user, update render util state
if (deselectEvent && deselectEvent->FromUser())
@@ -2939,33 +2950,33 @@ bool Scene3D::eventFilter(QObject *_obj, QEvent *_event)
}
}
else if (_event->type() ==
ignition::gazebo::gui::events::SnapIntervals::kType)
ignition::gui::events::SnapIntervals::kType)
{
auto snapEvent = reinterpret_cast<gui::events::SnapIntervals *>(_event);
auto snapEvent = reinterpret_cast<ignition::gui::events::SnapIntervals *>(
_event);
if (snapEvent)
{
auto renderWindow = this->PluginItem()->findChild<RenderWindowItem *>();
renderWindow->SetXYZSnap(snapEvent->XYZ());
renderWindow->SetRPYSnap(snapEvent->RPY());
renderWindow->SetXYZSnap(snapEvent->Position());
renderWindow->SetRPYSnap(snapEvent->Rotation());
renderWindow->SetScaleSnap(snapEvent->Scale());
}
}
else if (_event->type() ==
ignition::gazebo::gui::events::SpawnPreviewModel::kType)
ignition::gui::events::SpawnFromDescription::kType)
{
auto spawnPreviewEvent =
reinterpret_cast<gui::events::SpawnPreviewModel *>(_event);
auto spawnPreviewEvent = reinterpret_cast<
ignition::gui::events::SpawnFromDescription *>(_event);
if (spawnPreviewEvent)
{
auto renderWindow = this->PluginItem()->findChild<RenderWindowItem *>();
renderWindow->SetModel(spawnPreviewEvent->ModelSdfString());
renderWindow->SetModel(spawnPreviewEvent->Description());
}
}
else if (_event->type() ==
ignition::gazebo::gui::events::SpawnPreviewPath::kType)
else if (_event->type() == ignition::gui::events::SpawnFromPath::kType)
{
auto spawnPreviewPathEvent =
reinterpret_cast<gui::events::SpawnPreviewPath *>(_event);
reinterpret_cast<ignition::gui::events::SpawnFromPath *>(_event);
if (spawnPreviewPathEvent)
{
auto renderWindow = this->PluginItem()->findChild<RenderWindowItem *>();
2 changes: 2 additions & 0 deletions src/gui/plugins/shapes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
gz_add_gui_plugin(Shapes
SOURCES Shapes.cc
QT_HEADERS Shapes.hh
PRIVATE_LINK_LIBS
ignition-utils${IGN_UTILS_VER}::ignition-utils${IGN_UTILS_VER}
)
11 changes: 10 additions & 1 deletion src/gui/plugins/shapes/Shapes.cc
Original file line number Diff line number Diff line change
@@ -26,10 +26,12 @@

#include <ignition/common/Console.hh>
#include <ignition/gui/Application.hh>
#include <ignition/gui/GuiEvents.hh>
#include <ignition/gui/MainWindow.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>
#include <ignition/transport/Publisher.hh>
#include <ignition/utils/SuppressWarning.hh>

#include "ignition/gazebo/EntityComponentManager.hh"
#include "ignition/gazebo/gui/GuiEvents.hh"
@@ -200,10 +202,17 @@ void Shapes::OnMode(const QString &_mode)
return;
}

gui::events::SpawnPreviewModel event(modelSdfString);
ignition::gui::events::SpawnFromDescription event(modelSdfString);
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&event);

IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
ignition::gazebo::gui::events::SpawnPreviewModel oldEvent(modelSdfString);
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&oldEvent);
IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
}

// Register this plugin
1 change: 1 addition & 0 deletions src/gui/plugins/transform_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ gz_add_gui_plugin(TransformControl
QT_HEADERS TransformControl.hh
PRIVATE_LINK_LIBS
${IGNITION-RENDERING_LIBRARIES}
ignition-utils${IGN_UTILS_VER}::ignition-utils${IGN_UTILS_VER}
)


24 changes: 18 additions & 6 deletions src/gui/plugins/transform_control/TransformControl.cc
Original file line number Diff line number Diff line change
@@ -25,17 +25,19 @@

#include <ignition/common/Console.hh>
#include <ignition/gui/Application.hh>
#include <ignition/gui/GuiEvents.hh>
#include <ignition/gui/MainWindow.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>
#include <ignition/transport/Publisher.hh>
#include <ignition/rendering/Visual.hh>
#include <ignition/rendering/Geometry.hh>
#include <ignition/rendering/Grid.hh>
#include <ignition/rendering/RenderEngine.hh>
#include <ignition/rendering/RenderTypes.hh>
#include <ignition/rendering/RenderingIface.hh>
#include <ignition/rendering/RenderEngine.hh>
#include <ignition/rendering/Scene.hh>
#include <ignition/rendering/Visual.hh>
#include <ignition/transport/Node.hh>
#include <ignition/transport/Publisher.hh>
#include <ignition/utils/SuppressWarning.hh>

#include "ignition/gazebo/components/Name.hh"
#include "ignition/gazebo/components/ParentEntity.hh"
@@ -110,13 +112,23 @@ void TransformControl::OnSnapUpdate(
this->dataPtr->rpySnapVals = math::Vector3d(_roll, _pitch, _yaw);
this->dataPtr->scaleSnapVals = math::Vector3d(_scaleX, _scaleY, _scaleZ);

gui::events::SnapIntervals event(
ignition::gui::events::SnapIntervals event(
this->dataPtr->xyzSnapVals,
this->dataPtr->rpySnapVals,
this->dataPtr->scaleSnapVals);
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(), &event);

IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
ignition::gui::events::SnapIntervals oldEvent(
this->dataPtr->xyzSnapVals,
this->dataPtr->rpySnapVals,
this->dataPtr->scaleSnapVals);
ignition::gui::App()->sendEvent(
ignition::gui::App()->findChild<ignition::gui::MainWindow *>(),
&oldEvent);
IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION

this->newSnapValues();
}

@@ -224,7 +236,7 @@ void TransformControl::LoadGrid()
/////////////////////////////////////////////////
bool TransformControl::eventFilter(QObject *_obj, QEvent *_event)
{
if (_event->type() == ignition::gazebo::gui::events::Render::kType)
if (_event->type() == ignition::gui::events::Render::kType)
{
// This event is called in Scene3d's RenderThread, so it's safe to make
// rendering calls here
Loading
Oops, something went wrong.

0 comments on commit 2bc062d

Please sign in to comment.