summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Render/StudioRenderer.cpp
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2018-06-07 14:08:40 +0300
committerAntti Määttä <antti.maatta@qt.io>2018-07-31 11:45:21 +0000
commit777046d35794802e5baf174b943926c7868d00e0 (patch)
treedd5c8e6f6ab3cf025cca129116770ed0adfff8ec /src/Authoring/Studio/Render/StudioRenderer.cpp
parent1e673c7386af26f3b906a9814785a084bd06a69c (diff)
Implement uip subpresentation preview in studio
Task-number: QT3DS-1849 Change-Id: I3ec3803ea1fbe0d59ba933d69ab0da92c42a9054 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Render/StudioRenderer.cpp')
-rw-r--r--src/Authoring/Studio/Render/StudioRenderer.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Authoring/Studio/Render/StudioRenderer.cpp b/src/Authoring/Studio/Render/StudioRenderer.cpp
index 79f159bf..6689f867 100644
--- a/src/Authoring/Studio/Render/StudioRenderer.cpp
+++ b/src/Authoring/Studio/Render/StudioRenderer.cpp
@@ -37,6 +37,7 @@
#include "Qt3DSOffscreenRenderManager.h"
#include "q3dsqmlrender.h"
#include "q3dsqmlstreamproxy.h"
+#include "StudioSubPresentationRenderer.h"
#include <QtCore/qdebug.h>
@@ -69,7 +70,7 @@ SEditCameraDefinition g_EditCameraDefinitions[] = {
};
QT3DSU32 g_NumEditCameras = sizeof(g_EditCameraDefinitions) / sizeof(*g_EditCameraDefinitions);
-struct StudioSubPresentationRenderer
+struct StudioSubPresentation
{
SubPresentationRecord subpresentation;
IOffscreenRenderer *renderer;
@@ -112,7 +113,7 @@ struct SRendererImpl : public IStudioRenderer,
bool m_GuidesEnabled;
qt3dsdm::TSignalConnectionPtr m_SelectionSignal;
float m_pixelRatio;
- QHash<QString, StudioSubPresentationRenderer> m_subpresentations;
+ QHash<QString, StudioSubPresentation> m_subpresentations;
QScopedPointer<Q3DSQmlStreamProxy> m_proxy;
SRendererImpl()
@@ -160,7 +161,9 @@ struct SRendererImpl : public IStudioRenderer,
if (m_proxy.isNull())
m_proxy.reset(new Q3DSQmlStreamProxy());
IOffscreenRenderManager &offscreenMgr(m_Context->GetOffscreenRenderManager());
- m_proxy->setPath(m_Doc.GetDocumentPath().GetAbsolutePath().toQString());
+ const QString projectPath = m_Doc.GetCore()->getProjectFile().getProjectPath().toQString();
+ // setPath expects full path, but strips the filename
+ m_proxy->setPath(projectPath + "/dummy.uip");
QVector<SubPresentationRecord> toUnregister;
QVector<SubPresentationRecord> toRegister;
const auto keys = m_subpresentations.keys();
@@ -199,7 +202,14 @@ struct SRendererImpl : public IStudioRenderer,
qt3ds::render::SOffscreenRendererKey(rid), *theOffscreenRenderer);
m_subpresentations[toRegister[i].m_id].renderer = theOffscreenRenderer;
} else {
-
+ qt3ds::render::IOffscreenRenderer *theOffscreenRenderer =
+ QT3DS_NEW(m_Context->GetAllocator(),
+ StudioSubpresentationRenderer)(*m_Context, toRegister[i].m_id,
+ toRegister[i].m_argsOrSrc,
+ projectPath);
+ offscreenMgr.RegisterOffscreenRenderer(
+ qt3ds::render::SOffscreenRendererKey(rid), *theOffscreenRenderer);
+ m_subpresentations[toRegister[i].m_id].renderer = theOffscreenRenderer;
}
m_subpresentations[toRegister[i].m_id].subpresentation = toRegister[i];
}
@@ -227,6 +237,7 @@ struct SRendererImpl : public IStudioRenderer,
}
}
+
ITextRenderer *GetTextRenderer() override
{
if (m_Context.mPtr)