summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2018-12-03 15:09:10 +0200
committerKaj Grönholm <kaj.gronholm@qt.io>2018-12-04 08:29:57 +0000
commitac0d565d5bfcf5f237c27c5f9be480625b114e7e (patch)
treec7bcfc02b6f958ce2ed61e3b79a5b683128edba5
parentc3f56555c8b47ab0cc200fb37e182057a4045a19 (diff)
Don't start playback when interacting with scene
Task-number: QT3DS-2438 Change-Id: I0c6988ff5016dc0016a031d34a5758a624140458 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Studio/Application/StudioApp.cpp4
-rw-r--r--src/Authoring/Studio/Render/IStudioRenderer.h2
-rw-r--r--src/Authoring/Studio/Render/StudioRenderer.cpp8
3 files changed, 14 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Application/StudioApp.cpp b/src/Authoring/Studio/Application/StudioApp.cpp
index 20f0f7a5..23e3adb0 100644
--- a/src/Authoring/Studio/Application/StudioApp.cpp
+++ b/src/Authoring/Studio/Application/StudioApp.cpp
@@ -1200,6 +1200,10 @@ void CStudioApp::SetAutosetKeyframes(bool inFlag)
*/
void CStudioApp::PlaybackPlay()
{
+ // Do not start playback if user is currently interacting with scene
+ if (getRenderer().isMouseDown())
+ return;
+
CDoc *theDoc = m_core->GetDoc();
if (!theDoc->IsPlaying()) {
m_playbackTime = theDoc->GetCurrentViewTime();
diff --git a/src/Authoring/Studio/Render/IStudioRenderer.h b/src/Authoring/Studio/Render/IStudioRenderer.h
index 9953802b..3b3068c3 100644
--- a/src/Authoring/Studio/Render/IStudioRenderer.h
+++ b/src/Authoring/Studio/Render/IStudioRenderer.h
@@ -73,6 +73,8 @@ public:
virtual QT3DSI32 GetEditCamera() const = 0;
virtual void EditCameraZoomToFit() = 0;
+ virtual bool isMouseDown() const = 0;
+
// This must be safe to call from multiple places
virtual void Close() = 0;
diff --git a/src/Authoring/Studio/Render/StudioRenderer.cpp b/src/Authoring/Studio/Render/StudioRenderer.cpp
index c5e2c8e6..c8888c13 100644
--- a/src/Authoring/Studio/Render/StudioRenderer.cpp
+++ b/src/Authoring/Studio/Render/StudioRenderer.cpp
@@ -118,6 +118,7 @@ struct SRendererImpl : public IStudioRenderer,
QScopedPointer<Q3DSQmlStreamProxy> m_proxy;
QMap<QString, int> m_initialFrameMap;
bool m_fullSizePreview = false;
+ bool m_mouseDown = false;
SRendererImpl()
: m_Dispatch(*g_StudioApp.GetCore()->GetDispatch())
@@ -408,6 +409,11 @@ struct SRendererImpl : public IStudioRenderer,
}
}
+ bool isMouseDown() const override
+ {
+ return m_mouseDown;
+ }
+
void MakeContextCurrent() override
{
m_RenderContext->BeginRender();
@@ -770,6 +776,7 @@ struct SRendererImpl : public IStudioRenderer,
if (m_Translation == nullptr)
return;
+ m_mouseDown = true;
inPoint.setX(inPoint.x() * m_pixelRatio);
inPoint.setY(inPoint.y() * m_pixelRatio);
@@ -1033,6 +1040,7 @@ struct SRendererImpl : public IStudioRenderer,
void OnSceneMouseUp(SceneDragSenderType::Enum) override
{
m_MaybeDragStart = false;
+ m_mouseDown = false;
Qt3DSDMGuideHandle theSelectedGuide;
if (m_PickResult.getType() == StudioPickValueTypes::Guide) {
theSelectedGuide = m_PickResult.getData<Qt3DSDMGuideHandle>();