gz-sim
gz-sim copied to clipboard
Display more component types in the component inspector
The ComponentInspector GUI plugin displays all the components of an entity.
For all components, even custom ones, it will display the component name. But it will only display the values of the component if the component is listed in the plugin. We have several components which are not listed there yet though. On the example above, Physics Engine Plugin
is the component's name, and its value is not being displayed.
If the component's data type is already supported, like String it should just be a matter of adding an #include
and an if statement like the one below.
https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/src/gui/plugins/component_inspector/ComponentInspector.cc#L467-L475
That's the case of Physics Engine Plugin
above, which has std::string
data:
https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/include/ignition/gazebo/components/PhysicsEnginePlugin.hh#L34-L35
If the component's data type is not supported yet, the work should involve adding a new setData
function for that type and an accompanying qml
file, such as:
https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/src/gui/plugins/component_inspector/ComponentInspector.cc#L124-L132
That's the case of Scene
above, which has sdf::Scene
data:
https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/include/ignition/gazebo/components/Scene.hh#L44-L45
When implementing new component displays, let's use the pattern introduced in https://github.com/gazebosim/gz-sim/pull/1400, to make the code more manageable. (That is, look at Pose3d
as an example.)