Skip to content

Commit c235cf6

Browse files
ahcordeWilliamLewww
authored andcommitted
Non desired window opening alongside ignition GUI (gazebosim#1063)
Signed-off-by: ahcorde <[email protected]> Signed-off-by: William Lew <[email protected]>
1 parent 8694aab commit c235cf6

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

include/ignition/gazebo/rendering/RenderUtil.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
123123
/// \param[in] _enable True to use the current GL context
124124
public: void SetUseCurrentGLContext(bool _enable);
125125

126+
/// \brief Set the Window ID
127+
/// \param[in] _winID Window ID
128+
public: void SetWinID(const std::string &_winID);
129+
126130
/// \brief Set whether to create rendering sensors
127131
/// \param[in] _enable True to create rendering sensors
128132
/// \param[in] _createSensorCb Callback function for creating the sensors

src/gui/plugins/scene3d/Scene3D.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,9 @@ void IgnRenderer::Initialize()
18711871
if (this->initialized)
18721872
return;
18731873

1874+
this->dataPtr->renderUtil.SetWinID(std::to_string(
1875+
ignition::gui::App()->findChild<ignition::gui::MainWindow *>()->
1876+
QuickWindow()->winId()));
18741877
this->dataPtr->renderUtil.SetUseCurrentGLContext(true);
18751878
this->dataPtr->renderUtil.Init();
18761879

src/rendering/RenderUtil.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ class ignition::gazebo::RenderUtilPrivate
143143
/// \brief Flag to indicate if the current GL context should be used
144144
public: bool useCurrentGLContext = false;
145145

146+
/// \brief Window ID handle
147+
public: std::string winID = "";
148+
146149
/// \brief New scenes to be created
147150
public: std::vector<sdf::Scene> newScenes;
148151

@@ -1704,6 +1707,7 @@ void RenderUtil::Init()
17041707
params["useCurrentGLContext"] = "1";
17051708
if (this->dataPtr->isHeadlessRendering)
17061709
params["headless"] = "1";
1710+
params["winID"] = this->dataPtr->winID;
17071711
this->dataPtr->engine = rendering::engine(this->dataPtr->engineName, params);
17081712
if (!this->dataPtr->engine)
17091713
{
@@ -1823,6 +1827,12 @@ void RenderUtil::SetUseCurrentGLContext(bool _enable)
18231827
this->dataPtr->useCurrentGLContext = _enable;
18241828
}
18251829

1830+
/////////////////////////////////////////////////
1831+
void RenderUtil::SetWinID(const std::string &_winID)
1832+
{
1833+
this->dataPtr->winID = _winID;
1834+
}
1835+
18261836
/////////////////////////////////////////////////
18271837
void RenderUtil::SetEnableSensors(bool _enable,
18281838
std::function<std::string(const gazebo::Entity &, const sdf::Sensor &,

0 commit comments

Comments
 (0)