Skip to content

Commit 24573da

Browse files
author
John
authored
Add shapes plugin (#107)
Signed-off-by: John Shepherd <[email protected]>
1 parent 2392a30 commit 24573da

File tree

15 files changed

+694
-0
lines changed

15 files changed

+694
-0
lines changed

include/ignition/gazebo/gui/GuiEvents.hh

+22
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define IGNITION_GAZEBO_GUI_GUIEVENTS_HH_
1919

2020
#include <QEvent>
21+
#include <string>
2122
#include <utility>
2223
#include <vector>
2324
#include <ignition/math/Vector3.hh>
@@ -159,6 +160,27 @@ namespace events
159160
/// \brief Unique type for this event.
160161
static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
161162
};
163+
164+
/// \brief Event called to spawn a preview model. Used in shapes plugin.
165+
class SpawnPreviewModel : public QEvent
166+
{
167+
public: explicit SpawnPreviewModel(std::string &_modelSdfString)
168+
: QEvent(kType), modelSdfString(_modelSdfString)
169+
{
170+
}
171+
/// \brief Unique type for this event.
172+
static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
173+
174+
/// \brief Get the sdf string of the model.
175+
/// \return The model sdf string
176+
public: std::string ModelSdfString() const
177+
{
178+
return this->modelSdfString;
179+
}
180+
181+
/// \brief The sdf string of the model to be previewed.
182+
std::string modelSdfString;
183+
};
162184
} // namespace events
163185
}
164186
} // namespace gui

include/ignition/gazebo/rendering/SceneManager.hh

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
6464
/// \param[in] _id World ID.
6565
public: void SetWorldId(Entity _id);
6666

67+
/// \brief Get the world's ID.
68+
/// \return World ID
69+
public: Entity WorldId() const;
70+
6771
/// \brief Create a model
6872
/// \param[in] _id Unique model id
6973
/// \param[in] _model Model sdf dom

src/gui/plugins/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ add_subdirectory(component_inspector)
8585
add_subdirectory(entity_tree)
8686
add_subdirectory(grid_config)
8787
add_subdirectory(scene3d)
88+
add_subdirectory(shapes)
8889
add_subdirectory(transform_control)
8990
add_subdirectory(video_recorder)
9091
add_subdirectory(view_angle)

src/gui/plugins/scene3d/GzScene3D.qml

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Rectangle {
4040
onEntered: {
4141
GzScene3D.OnFocusWindow()
4242
}
43+
onPositionChanged: {
44+
GzScene3D.OnHovered(mouseArea.mouseX, mouseArea.mouseY);
45+
}
4346
}
4447

4548
RenderWindow {

0 commit comments

Comments
 (0)