@@ -153,6 +153,21 @@ void ignition::gazebo::setData(QStandardItem *_item, const msgs::Light &_data)
153
153
lightType = 2 ;
154
154
}
155
155
156
+ bool isLightOn = true ;
157
+ for (int i = 0 ; i < _data.header ().data_size (); ++i)
158
+ {
159
+ for (int j = 0 ;
160
+ j < _data.header ().data (i).value_size (); ++j)
161
+ {
162
+ if (_data.header ().data (i).key () ==
163
+ " isLightOn" )
164
+ {
165
+ isLightOn = ignition::math::parseInt (
166
+ _data.header ().data (i).value (0 ));
167
+ }
168
+ }
169
+ }
170
+
156
171
_item->setData (QString (" Light" ),
157
172
ComponentsModel::RoleNames ().key (" dataType" ));
158
173
_item->setData (QList ({
@@ -176,7 +191,8 @@ void ignition::gazebo::setData(QStandardItem *_item, const msgs::Light &_data)
176
191
QVariant (_data.spot_outer_angle ()),
177
192
QVariant (_data.spot_falloff ()),
178
193
QVariant (_data.intensity ()),
179
- QVariant (lightType)
194
+ QVariant (lightType),
195
+ QVariant (isLightOn)
180
196
}), ComponentsModel::RoleNames ().key (" data" ));
181
197
}
182
198
@@ -989,7 +1005,8 @@ void ComponentInspector::OnLight(
989
1005
double _attRange, double _attLinear, double _attConstant,
990
1006
double _attQuadratic, bool _castShadows, double _directionX,
991
1007
double _directionY, double _directionZ, double _innerAngle,
992
- double _outerAngle, double _falloff, double _intensity, int _type)
1008
+ double _outerAngle, double _falloff, double _intensity, int _type,
1009
+ bool _isLightOn)
993
1010
{
994
1011
std::function<void (const ignition::msgs::Boolean &, const bool )> cb =
995
1012
[](const ignition::msgs::Boolean &/* _rep*/ , const bool _result)
@@ -999,6 +1016,14 @@ void ComponentInspector::OnLight(
999
1016
};
1000
1017
1001
1018
ignition::msgs::Light req;
1019
+
1020
+ // todo(ahcorde) Use the field is_light_off in light.proto from
1021
+ // Garden on.
1022
+ auto header = req.mutable_header ()->add_data ();
1023
+ header->set_key (" isLightOn" );
1024
+ std::string *value = header->add_value ();
1025
+ *value = std::to_string (_isLightOn);
1026
+
1002
1027
req.set_name (this ->dataPtr ->entityName );
1003
1028
req.set_id (this ->dataPtr ->entity );
1004
1029
ignition::msgs::Set (req.mutable_diffuse (),
0 commit comments