ezEngine  Release 25.03
ezQtEngineViewWidget Class Reference

Base class for views that show engine output. More...

#include <EngineViewWidget.moc.h>

Inheritance diagram for ezQtEngineViewWidget:

Classes

struct  InteractionContext
 Holds information about the viewport that the user just now hovered over and what object was picked last. More...
 

Public Member Functions

 ezQtEngineViewWidget (QWidget *pParent, ezQtEngineDocumentWindow *pDocumentWindow, ezEngineViewConfig *pViewConfig)
 
ezUInt32 GetViewID () const
 Returns the ID of this view.
 
ezQtEngineDocumentWindowGetDocumentWindow () const
 
virtual void SyncToEngine ()
 Sends the redraw message to the engine.
 
void GetCameraMatrices (ezMat4 &out_mViewMatrix, ezMat4 &out_mProjectionMatrix) const
 
void UpdateCameraInterpolation ()
 Called every frame to move the camera to its current target (focus on selection, etc.) More...
 
void InterpolateCameraTo (const ezVec3 &vPosition, const ezVec3 &vDirection, float fFovOrDim, const ezVec3 *pNewUpDirection=nullptr, bool bImmediate=false)
 The view's camera will be interpolated to the given coordinates.
 
void SetEnablePicking (bool bEnable)
 If disabled, no picking takes place in this view. More...
 
void SetPickTransparent (bool bEnable)
 
virtual bool IsPickingAgainstSelectionAllowed () const
 Disabled during drag&drop operations, to prevent picking against the dragged object.
 
void OpenContextMenu (QPoint globalPos)
 Supposed to open a context menu at the given position. Derived classes must implement OnOpenContextMenu and do the actual work there.
 
const ezObjectPickingResultPickObject (ezUInt16 uiScreenPosX, ezUInt16 uiScreenPosY) const
 Starts a picking operation for the given pixel position in this view. Returns the most recent picking information in the meantime.
 
ezResult PickPlane (ezUInt16 uiScreenPosX, ezUInt16 uiScreenPosY, const ezPlane &plane, ezVec3 &out_vPosition) const
 Similar to PickObject, but computes the intersection with the given plane instead.
 
void HandleViewMessage (const ezEditorEngineViewMsg *pMsg)
 Processes incoming messages from the engine that are meant for this particular view. Mostly picking results.
 
virtual ezPlane GetFallbackPickingPlane (ezVec3 vPointOnPlane=ezVec3(0)) const
 Returns a plane that can be used for picking, when nothing else is available Orthographic views would typically return their projection planes, perspective views may return the ground plane.
 
void TakeScreenshot (const char *szOutputPath) const
 

Static Public Member Functions

static const InteractionContextGetInteractionContext ()
 Returns the latest information about what viewport the user interacted with.
 
static void SetInteractionContext (const InteractionContext &ctxt)
 Overrides the InteractionContext with custom values. Mostly useful for injecting procedural user interaction for unit tests.
 

Public Attributes

ezHybridArray< ezEditorInputContext *, 8 > m_InputContexts
 Add input contexts in the order in which they are supposed to be processed.
 
ezEngineViewConfigm_pViewConfig
 

Static Public Attributes

static ezSizeU32 s_FixedResolution
 

Protected Member Functions

virtual bool eventFilter (QObject *object, QEvent *event) override
 Used to deactivate shortcuts.
 
virtual void paintEvent (QPaintEvent *event) override
 
virtual QPaintEngine * paintEngine () const override
 
virtual void resizeEvent (QResizeEvent *event) override
 
virtual void keyPressEvent (QKeyEvent *e) override
 
virtual void keyReleaseEvent (QKeyEvent *e) override
 
virtual void mousePressEvent (QMouseEvent *e) override
 
virtual void mouseReleaseEvent (QMouseEvent *e) override
 
virtual void mouseMoveEvent (QMouseEvent *e) override
 
virtual void wheelEvent (QWheelEvent *e) override
 
virtual void focusOutEvent (QFocusEvent *e) override
 
virtual void dragEnterEvent (QDragEnterEvent *e) override
 
virtual void dragLeaveEvent (QDragLeaveEvent *e) override
 
virtual void dropEvent (QDropEvent *e) override
 
void EngineViewProcessEventHandler (const ezEditorEngineProcessConnection::Event &e)
 
void ShowRestartButton (bool bShow)
 
virtual void OnOpenContextMenu (QPoint globalPos)
 
virtual void HandleMarqueePickingResult (const ezViewMarqueePickingResultMsgToEditor *pMsg)
 

Protected Attributes

bool m_bUpdatePickingData
 
bool m_bPickTransparent = true
 
bool m_bInDragAndDropOperation
 
ezUInt32 m_uiViewID
 
ezQtEngineDocumentWindowm_pDocumentWindow
 
float m_fCameraLerp
 
float m_fCameraStartFovOrDim
 
float m_fCameraTargetFovOrDim
 
ezVec3 m_vCameraStartPosition
 
ezVec3 m_vCameraTargetPosition
 
ezVec3 m_vCameraStartDirection
 
ezVec3 m_vCameraTargetDirection
 
ezVec3 m_vCameraUp
 
ezTime m_LastCameraUpdate
 
QHBoxLayout * m_pRestartButtonLayout
 
QPushButton * m_pRestartButton
 
ezObjectPickingResult m_LastPickingResult
 

Static Protected Attributes

static ezUInt32 s_uiNextViewID = 0
 
static InteractionContext s_InteractionContext
 

Detailed Description

Base class for views that show engine output.

Member Function Documentation

◆ SetEnablePicking()

void ezQtEngineViewWidget::SetEnablePicking ( bool  bEnable)

If disabled, no picking takes place in this view.

Disabled in views that do not need picking (material asset, particle asset, etc.) and when the mouse is outside a view, to prevent useless picking.

◆ UpdateCameraInterpolation()

void ezQtEngineViewWidget::UpdateCameraInterpolation ( )

Called every frame to move the camera to its current target (focus on selection, etc.)

Todo:
Hard coded up vector

Member Data Documentation

◆ s_FixedResolution

ezSizeU32 ezQtEngineViewWidget::s_FixedResolution
static

If this is set to a non-zero value, all rendering will use a fixed resolution, instead of the actual window size. This is useful for unit tests, to guarantee a specific output size, to be able to do image comparisons.


The documentation for this class was generated from the following files: