A QQUickItem that manages the render window. More...
#include <Scene3D.hh>
Public Slots | |
| void | OnContextMenuRequested (QString _entity) |
| Qt callback when context menu request is received. More... | |
| void | Ready () |
| Slot called when thread is ready to be started. More... | |
| void | SetFollowTarget (const std::string &_target, bool _waitForTarget=false) |
| Move the user camera to follow the specified target. More... | |
Signals | |
| void | openContextMenu (QString _entity) |
| Signal fired to open context menu Note that the function name needs to start with lowercase in order for the connection to work on the QML side. More... | |
Public Member Functions | |
| RenderWindowItem (QQuickItem *_parent=nullptr) | |
| Constructor. More... | |
| ~RenderWindowItem () override | |
| Destructor. More... | |
| math::Pose3d | CameraPose () const |
| Get the user camera pose. More... | |
| void | DeselectAllEntities (bool _sendEvent) |
| Deselect all the currently selected entities within the RenderUtil class. More... | |
| void | HandleKeyPress (QKeyEvent *_e) |
| Handle key press event for snapping. More... | |
| void | HandleKeyRelease (QKeyEvent *_e) |
| Handle key release event for snapping. More... | |
| void | OnHovered (const gz::math::Vector2i &_hoverPos) |
| Called when the mouse hovers to a new position. More... | |
| bool | RendererInitialized () const |
| Get whether the renderer is initialized. The renderer is initialized when the context is created and the render thread is started. More... | |
| class RenderUtil * | RenderUtil () const |
| Set the renderer. More... | |
| math::Vector3d | ScreenToScene (const math::Vector2i &_screenPos) |
| Retrieve the first point on a surface in the 3D scene hit by a ray cast from the given 2D screen coordinates. More... | |
| void | SetCameraPose (const math::Pose3d &_pose) |
| Set the initial user camera pose. More... | |
| void | SetDropdownMenuEnabled (bool _enableDropdownMenu) |
| Set if the dropdown menu is enabled or disabled. More... | |
| void | SetErrorCb (std::function< void(const QString &)> _cb) |
| Set a callback to be called in case there are errors. More... | |
| void | SetFollowOffset (const math::Vector3d &_offset) |
| Set the camera follow offset position. More... | |
| void | SetFollowPGain (double _gain) |
| Set the p gain for the camera follow movement. More... | |
| void | SetFollowWorldFrame (bool _worldFrame) |
| True to set the camera to follow the target in world frame, false to follow in target's local frame. More... | |
| void | SetInitCameraPose (const math::Pose3d &_pose) |
| Set the initial user camera pose. More... | |
| void | SetModel (const std::string &_model) |
| Set the model to hover. More... | |
| void | SetModelPath (const std::string &_filePath) |
| Set the path of the model to hover. More... | |
| void | SetMoveTo (const std::string &_target) |
| Move the user camera to move to the specified target. More... | |
| void | SetMoveToPose (const math::Pose3d &_pose) |
| Set the pose of the camera. More... | |
| void | SetRecordVideo (bool _record, const std::string &_format, const std::string &_savePath) |
| Set whether to record video. More... | |
| void | SetRecordVideoBitrate (unsigned int _bitrate) |
| Set video recorder bitrate in bps. More... | |
| void | SetRecordVideoLockstep (bool _lockstep) |
| Set whether to record video in lockstep mode. More... | |
| void | SetRecordVideoUseSimTime (bool _useSimTime) |
| Set whether to record video using sim time as timestamp. More... | |
| void | SetRPYSnap (const math::Vector3d &_rpy) |
| Set the RPY snap values from the user input. More... | |
| void | SetScaleSnap (const math::Vector3d &_scale) |
| Set the scale snap values from the user input. More... | |
| void | SetTransformMode (const std::string &_mode) |
| Set the transform mode. More... | |
| void | SetViewAngle (const math::Vector3d &_direction) |
| Set the viewing angle of the camera. More... | |
| void | SetViewCollisionsTarget (const std::string &_target) |
| View collisions of the specified target. More... | |
| void | SetWorldName (const std::string &_name) |
| Set the world name. More... | |
| void | SetXYZSnap (const math::Vector3d &_xyz) |
| Set the XYZ snap values from the user input. More... | |
| void | UpdateSelectedEntity (Entity _entity, bool _sendEvent) |
| An update function to apply the rules of selection to the passed in node. The rules are as follows: More... | |
Protected Member Functions | |
| void | mouseMoveEvent (QMouseEvent *_e) override |
| void | mousePressEvent (QMouseEvent *_e) override |
| void | mouseReleaseEvent (QMouseEvent *_e) override |
| void | wheelEvent (QWheelEvent *_e) override |
Detailed Description
A QQUickItem that manages the render window.
Constructor & Destructor Documentation
◆ RenderWindowItem()
|
explicit |
Constructor.
- Parameters
-
[in] _parent Parent item
◆ ~RenderWindowItem()
|
override |
Destructor.
Member Function Documentation
◆ CameraPose()
| math::Pose3d CameraPose | ( | ) | const |
Get the user camera pose.
- Returns
- Pose of the user camera.
◆ DeselectAllEntities()
| void DeselectAllEntities | ( | bool | _sendEvent | ) |
Deselect all the currently selected entities within the RenderUtil class.
- Parameters
-
[in] _sendEvent True to notify other widgets. This should be true when the deselection is initiated from this plugin.
◆ HandleKeyPress()
| void HandleKeyPress | ( | QKeyEvent * | _e | ) |
Handle key press event for snapping.
- Parameters
-
[in] _e The key event to process.
◆ HandleKeyRelease()
| void HandleKeyRelease | ( | QKeyEvent * | _e | ) |
Handle key release event for snapping.
- Parameters
-
[in] _e The key event to process.
◆ mouseMoveEvent()
|
overrideprotected |
◆ mousePressEvent()
|
overrideprotected |
◆ mouseReleaseEvent()
|
overrideprotected |
◆ OnContextMenuRequested
|
slot |
Qt callback when context menu request is received.
- Parameters
-
[in] _entity Scoped name of entity.
◆ OnHovered()
| void OnHovered | ( | const gz::math::Vector2i & | _hoverPos | ) |
Called when the mouse hovers to a new position.
- Parameters
-
[in] _hoverPos 2D coordinates of the hovered mouse position on the render window.
◆ openContextMenu
|
signal |
Signal fired to open context menu Note that the function name needs to start with lowercase in order for the connection to work on the QML side.
- Parameters
-
[in] _entity Scoped name of entity.
◆ Ready
|
slot |
Slot called when thread is ready to be started.
◆ RendererInitialized()
| bool RendererInitialized | ( | ) | const |
Get whether the renderer is initialized. The renderer is initialized when the context is created and the render thread is started.
- Returns
- True if the renderer is initialized.
◆ RenderUtil()
| class RenderUtil* RenderUtil | ( | ) | const |
Set the renderer.
◆ ScreenToScene()
| math::Vector3d ScreenToScene | ( | const math::Vector2i & | _screenPos | ) |
Retrieve the first point on a surface in the 3D scene hit by a ray cast from the given 2D screen coordinates.
- Parameters
-
[in] _screenPos 2D coordinates on the screen, in pixels.
- Returns
- 3D coordinates of a point in the 3D scene.
◆ SetCameraPose()
| void SetCameraPose | ( | const math::Pose3d & | _pose | ) |
Set the initial user camera pose.
- Parameters
-
[in] _pose Pose to set the camera to
◆ SetDropdownMenuEnabled()
| void SetDropdownMenuEnabled | ( | bool | _enableDropdownMenu | ) |
Set if the dropdown menu is enabled or disabled.
- Parameters
-
[in] _enableDropdownMenu The boolean to enable or disable the menu
◆ SetErrorCb()
| void SetErrorCb | ( | std::function< void(const QString &)> | _cb | ) |
Set a callback to be called in case there are errors.
- Parameters
-
[in] _cb Error callback
◆ SetFollowOffset()
| void SetFollowOffset | ( | const math::Vector3d & | _offset | ) |
Set the camera follow offset position.
- Parameters
-
[in] _offset Camera follow offset position.
◆ SetFollowPGain()
| void SetFollowPGain | ( | double | _gain | ) |
Set the p gain for the camera follow movement.
- Parameters
-
[in] _gain Camera follow p gain.
◆ SetFollowTarget
|
slot |
Move the user camera to follow the specified target.
- Parameters
-
[in] _target Target to follow [in] _waitForTarget True to continuously look for the target to follow. A typical use case is follow a target that is not present on startup but spawned later into simulation
◆ SetFollowWorldFrame()
| void SetFollowWorldFrame | ( | bool | _worldFrame | ) |
True to set the camera to follow the target in world frame, false to follow in target's local frame.
- Parameters
-
[in] _worldFrame True to use the world frame.
◆ SetInitCameraPose()
| void SetInitCameraPose | ( | const math::Pose3d & | _pose | ) |
Set the initial user camera pose.
- Parameters
-
[in] _pose Pose to set the camera to
◆ SetModel()
| void SetModel | ( | const std::string & | _model | ) |
Set the model to hover.
- Parameters
-
[in] _model Sdf string of the model to load in for the user.
◆ SetModelPath()
| void SetModelPath | ( | const std::string & | _filePath | ) |
Set the path of the model to hover.
- Parameters
-
[in] _filePath File path of the model to load in for the user.
◆ SetMoveTo()
| void SetMoveTo | ( | const std::string & | _target | ) |
Move the user camera to move to the specified target.
- Parameters
-
[in] _target Target to move the camera to
◆ SetMoveToPose()
| void SetMoveToPose | ( | const math::Pose3d & | _pose | ) |
Set the pose of the camera.
- Parameters
-
[in] _pose The new camera pose in the world frame.
◆ SetRecordVideo()
| void SetRecordVideo | ( | bool | _record, |
| const std::string & | _format, | ||
| const std::string & | _savePath | ||
| ) |
Set whether to record video.
- Parameters
-
[in] _record True to start video recording, false to stop. [in] _format Video encoding format: "mp4", "ogv" [in] _savePath Path to save the recorded video.
◆ SetRecordVideoBitrate()
| void SetRecordVideoBitrate | ( | unsigned int | _bitrate | ) |
Set video recorder bitrate in bps.
- Parameters
-
[in] _bitrate Bit rate to set to
◆ SetRecordVideoLockstep()
| void SetRecordVideoLockstep | ( | bool | _lockstep | ) |
Set whether to record video in lockstep mode.
- Parameters
-
[in] _lockstep True to record video in lockstep mode
◆ SetRecordVideoUseSimTime()
| void SetRecordVideoUseSimTime | ( | bool | _useSimTime | ) |
Set whether to record video using sim time as timestamp.
- Parameters
-
[in] _useSimTime True record video using sim time
◆ SetRPYSnap()
| void SetRPYSnap | ( | const math::Vector3d & | _rpy | ) |
Set the RPY snap values from the user input.
- Parameters
-
[in] _rpy The RPY snap values
◆ SetScaleSnap()
| void SetScaleSnap | ( | const math::Vector3d & | _scale | ) |
Set the scale snap values from the user input.
- Parameters
-
[in] _scale The scale snap values
◆ SetTransformMode()
| void SetTransformMode | ( | const std::string & | _mode | ) |
Set the transform mode.
- Parameters
-
[in] _mode New transform mode to set to
◆ SetViewAngle()
| void SetViewAngle | ( | const math::Vector3d & | _direction | ) |
Set the viewing angle of the camera.
- Parameters
-
[in] _direction The pose to assume relative to the entit(y/ies). (0, 0, 0) indicates to return the camera back to the home pose originally loaded in from the sdf
◆ SetViewCollisionsTarget()
| void SetViewCollisionsTarget | ( | const std::string & | _target | ) |
View collisions of the specified target.
- Parameters
-
[in] _target Target to view collisions
◆ SetWorldName()
| void SetWorldName | ( | const std::string & | _name | ) |
Set the world name.
- Parameters
-
[in] _name Name of the world to set to.
◆ SetXYZSnap()
| void SetXYZSnap | ( | const math::Vector3d & | _xyz | ) |
Set the XYZ snap values from the user input.
- Parameters
-
[in] _xyz The XYZ snap values
◆ UpdateSelectedEntity()
| void UpdateSelectedEntity | ( | Entity | _entity, |
| bool | _sendEvent | ||
| ) |
An update function to apply the rules of selection to the passed in node. The rules are as follows:
- If control is held, append the node to the selected entity list.
- If control is not held, deselect all other entities.
- If the user is currently in a transform mode, attach the control to the latest selected node and deselect all others. Note that this function emits events to update other widgets.
- Parameters
-
[in] _entity The entity to select. [in] _sendEvent True to notify other widgets. This should be true when the selection is initiated from this plugin.
◆ wheelEvent()
|
overrideprotected |
The documentation for this class was generated from the following file: