diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-03-21 16:23:26 +0200 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-03-21 14:39:16 +0000 |
commit | 861aa586e361f6747adbd991d301aa778d3847a2 (patch) | |
tree | 1b24549f0317df1b79627a071607acb63d3e8194 | |
parent | 1a3e241ff5dbb6f843e8f5ff5774ac2056f4a00c (diff) |
Fix crash after changing the startup view
Task-number: QT3DS-3194
Change-Id: I6be9a6ca881b354ba3890effb78d42604ba2d94b
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Studio/Render/StudioRendererTranslation.cpp | 11 | ||||
-rw-r--r-- | src/Authoring/Studio/Render/StudioRendererTranslation.h | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp index 6d31ae44..752a84d7 100644 --- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp +++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp @@ -2641,6 +2641,17 @@ void STranslation::Render(int inWidgetId, bool inDrawGuides, bool scenePreviewPa } if (object.m_Type == GraphObjectTypes::Camera) { + if (m_InnerRect.isNull()) { + // this happens when the initial view is not the camera view + NVRenderRect thePresentationViewport = m_Context.GetPresentationViewport(); + m_InnerRect.m_Left = thePresentationViewport.m_X; + m_InnerRect.m_Right = thePresentationViewport.m_X + + thePresentationViewport.m_Width; + m_InnerRect.m_Bottom = thePresentationViewport.m_Y; + m_InnerRect.m_Top = thePresentationViewport.m_Y + + thePresentationViewport.m_Height; + } + QT3DSVec2 dim = QT3DSVec2(m_InnerRect.m_Right - m_InnerRect.m_Left, m_InnerRect.m_Top - m_InnerRect.m_Bottom); NVRenderRectF theViewport(0, 0, dim.x, dim.y); diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.h b/src/Authoring/Studio/Render/StudioRendererTranslation.h index 0a3c7a81..45e86871 100644 --- a/src/Authoring/Studio/Render/StudioRendererTranslation.h +++ b/src/Authoring/Studio/Render/StudioRendererTranslation.h @@ -290,10 +290,16 @@ namespace studio { , m_Bottom(b) { } + bool Contains(QT3DSI32 x, QT3DSI32 y) const { return x >= m_Left && x <= m_Right && y >= m_Bottom && y <= m_Top; } + + bool isNull() const + { + return m_Left == 0 && m_Top == 0 && m_Right == 0 && m_Bottom == 0; + } }; struct SDragPreparationResult |