18 #ifndef GZ_SIM_GUI_COMPONENTINSPECTOREDITOR_HH_
19 #define GZ_SIM_GUI_COMPONENTINSPECTOREDITOR_HH_
25 #include <sdf/Material.hh>
26 #include <sdf/Physics.hh>
27 #include <sdf/Joint.hh>
29 #include <gz/math/SphericalCoordinates.hh>
30 #include <gz/math/Vector3.hh>
36 #include <gz/msgs/light.pb.h>
45 class ComponentInspectorEditorPrivate;
50 template <
class DataType>
51 void setData(QStandardItem *_item,
const DataType &_data)
59 setData(_item, ss.
str());
63 gzwarn <<
"Attempting to set unsupported data type to item ["
64 << _item->text().toStdString() <<
"]" <<
std::endl;
71 void setData(QStandardItem *_item,
const std::string &_data);
77 void setData(QStandardItem *_item,
const msgs::Light &_data);
89 void setData(QStandardItem *_item,
const sdf::Physics &_data);
101 void setData(QStandardItem *_item,
const bool &_data);
107 void setData(QStandardItem *_item,
const int &_data);
113 void setData(QStandardItem *_item,
const double &_data);
119 void setData(QStandardItem *_item,
const std::ostream &_data);
125 void setData(QStandardItem *_item,
const sdf::Material &_data);
131 void setUnit(QStandardItem *_item,
const std::string &_unit);
135 class ComponentsModel :
public QStandardItemModel
140 public:
explicit ComponentsModel();
143 public: ~ComponentsModel()
override =
default;
146 public: QHash<int, QByteArray> roleNames()
const override;
150 public:
static QHash<int, QByteArray> RoleNames();
155 public slots: QStandardItem *AddComponentType(
160 public slots:
void RemoveComponentType(
171 class ComponentInspectorEditor :
public sim::GuiSystem
193 QStringList modelParentLinks
194 READ ModelParentLinks
195 NOTIFY ModelLinksChanged
200 QStringList modelChildLinks
202 NOTIFY ModelLinksChanged
225 NOTIFY SimPausedChanged
232 NOTIFY NestedModelChanged
236 public: ComponentInspectorEditor();
239 public: ~ComponentInspectorEditor()
override;
242 public:
void LoadConfig(
const tinyxml2::XMLElement *_pluginElem)
override;
245 public:
void Update(
const UpdateInfo &, EntityComponentManager &)
override;
269 public: Q_INVOKABLE
void OnLight(
270 double _rSpecular,
double _gSpecular,
double _bSpecular,
271 double _aSpecular,
double _rDiffuse,
double _gDiffuse,
272 double _bDiffuse,
double _aDiffuse,
double _attRange,
273 double _attLinear,
double _attConstant,
double _attQuadratic,
274 bool _castShadows,
double _directionX,
double _directionY,
275 double _directionZ,
double _innerAngle,
double _outerAngle,
276 double _falloff,
double _intensity,
int _type);
281 public: Q_INVOKABLE
void OnPhysics(
double _stepSize,
282 double _realTimeFactor);
305 public: Q_INVOKABLE
void OnMaterialColor(
306 double _rAmbient,
double _gAmbient,
double _bAmbient,
307 double _aAmbient,
double _rDiffuse,
double _gDiffuse,
308 double _bDiffuse,
double _aDiffuse,
double _rSpecular,
309 double _gSpecular,
double _bSpecular,
double _aSpecular,
310 double _rEmissive,
double _gEmissive,
double _bEmissive,
311 double _aEmissive, QString _type, QColor _currColor);
319 public: Q_INVOKABLE
void OnSphericalCoordinates(QString _surface,
320 double _latitude,
double _longitude,
double _elevation,
325 public: Q_INVOKABLE
bool NestedModel()
const;
328 signals:
void NestedModelChanged();
331 protected:
bool eventFilter(QObject *_obj, QEvent *_event)
override;
335 public: Q_INVOKABLE
Entity GetEntity()
const;
339 public: Q_INVOKABLE
void SetEntity(
const sim::Entity &_entity);
342 signals:
void EntityChanged();
346 public: Q_INVOKABLE QString Type()
const;
350 public: Q_INVOKABLE
void SetType(
const QString &_entity);
353 signals:
void TypeChanged();
357 public: Q_INVOKABLE
bool Locked()
const;
361 public: Q_INVOKABLE
void SetLocked(
bool _locked);
364 signals:
void LockedChanged();
368 public: Q_INVOKABLE
bool SimPaused()
const;
371 signals:
void SimPausedChanged();
375 public:
void SetSimPaused(
bool _paused);
379 public: Q_INVOKABLE
bool Paused()
const;
383 public: Q_INVOKABLE
void SetPaused(
bool _paused);
386 signals:
void PausedChanged();
391 public: Q_INVOKABLE
void OnAddEntity(
const QString &_entity,
392 const QString &_type);
398 public: Q_INVOKABLE
void OnAddJoint(
const QString &_jointType,
399 const QString &_parentLink,
400 const QString &_childLink);
405 public: Q_INVOKABLE QStringList ModelParentLinks()
const;
410 public: Q_INVOKABLE QStringList ModelChildLinks()
const;
414 public: Q_INVOKABLE
void SetModelLinks(
const QStringList &_modelLinks);
417 signals:
void ModelLinksChanged();
423 public: Q_INVOKABLE
void OnLoadMesh(
const QString &_entity,
424 const QString &_type,
const QString &_mesh);