summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-09-25 12:21:54 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-09-25 13:09:24 +0300
commit424bc31512b5ac6b2202ebb39c537bcd1118d9ab (patch)
tree4d2c9fc747340f7d8cd7f2051b5d870c185d98cc /src
parent1ee84df110d3cc6fc4509bc05a5699e199381a22 (diff)
parent0e7e7996a422b47bd371115e6aa4e2998bbda6fb (diff)
Merge branch '2.1' into master
Diffstat (limited to 'src')
-rw-r--r--src/Authoring/Client/Code/Core/Commands/CmdDataModel.cpp13
-rw-r--r--src/Authoring/Client/Code/Core/Commands/CmdDataModel.h6
-rw-r--r--src/Authoring/Client/Code/Core/Core/Core.cpp4
-rw-r--r--src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp34
-rw-r--r--src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h8
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.cpp10
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.h1
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp163
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h17
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp13
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h2
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.cpp4
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp30
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioPreferences.h5
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h3
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp15
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h27
-rw-r--r--src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.cpp17
-rw-r--r--src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.h3
-rw-r--r--src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp22
-rw-r--r--src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp4
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.cpp162
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.h9
-rw-r--r--src/Authoring/Studio/Application/StudioApp.cpp190
-rw-r--r--src/Authoring/Studio/Application/StudioApp.h7
-rw-r--r--src/Authoring/Studio/Application/StudioTutorialWidget.cpp230
-rw-r--r--src/Authoring/Studio/Application/StudioTutorialWidget.h33
-rw-r--r--src/Authoring/Studio/Application/StudioTutorialWidget.ui565
-rw-r--r--src/Authoring/Studio/DragAndDrop/BasicObjectDropSource.cpp3
-rw-r--r--src/Authoring/Studio/DragAndDrop/FileDropSource.cpp41
-rw-r--r--src/Authoring/Studio/MainFrm.cpp30
-rw-r--r--src/Authoring/Studio/MainFrm.qrc2
-rw-r--r--src/Authoring/Studio/MainFrm.ui20
-rw-r--r--src/Authoring/Studio/Palettes/Action/ActionView.cpp12
-rw-r--r--src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml29
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp16
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h3
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml504
-rw-r--r--src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.cpp9
-rw-r--r--src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.h2
-rw-r--r--src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.ui10
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp30
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectView.cpp10
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectView.qml3
-rw-r--r--src/Authoring/Studio/Palettes/Slide/SlideView.qml8
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp8
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h5
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp5
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h2
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp28
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h2
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp29
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp8
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp31
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp26
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h3
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp69
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h53
-rw-r--r--src/Authoring/Studio/Palettes/controls/FloatTextField.qml4
-rw-r--r--src/Authoring/Studio/Qt3DStudio.pro2
-rw-r--r--src/Authoring/Studio/Render/StudioRenderer.cpp22
-rw-r--r--src/Authoring/Studio/Render/StudioRendererTranslation.cpp57
-rw-r--r--src/Authoring/Studio/Render/StudioRotationWidget.cpp2
-rw-r--r--src/Authoring/Studio/UI/StudioAppPrefsPage.cpp9
-rw-r--r--src/Authoring/Studio/UI/StudioAppPrefsPage.ui31
-rw-r--r--src/Authoring/Studio/Utils/ImportUtils.cpp12
-rw-r--r--src/Authoring/Studio/Workspace/Dialogs.cpp4
-rw-r--r--src/Authoring/Studio/images.qrc41
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Active.png (renamed from src/Viewer/Qt3DViewer/resources/images/check.png)bin502 -> 610 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Active@2x.pngbin0 -> 817 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Disabled.pngbin642 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Disabled@2x.pngbin947 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Inactive.pngbin0 -> 626 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Inactive@2x.pngbin0 -> 796 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Normal.pngbin660 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-Normal@2x.pngbin901 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-White.pngbin363 -> 590 bytes
-rw-r--r--src/Authoring/Studio/images/Objects-DataInput-White@2x.pngbin601 -> 740 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/background.pngbin7419 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/background@2x.pngbin24837 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/button_back.pngbin807 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/button_back@2x.pngbin1510 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/button_next.pngbin782 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/button_next@2x.pngbin1499 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/dot_active.pngbin683 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/dot_active@2x.pngbin856 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/dot_inactive.pngbin1021 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/dot_inactive@2x.pngbin2386 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/1.pngbin226304 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/2.pngbin85453 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/3.pngbin104340 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/4.pngbin82564 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/5.pngbin92253 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/6.pngbin89810 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/7.pngbin93514 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/8.pngbin88906 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/1x/9.pngbin98073 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/1.pngbin348409 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/2.pngbin180698 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/3.pngbin205814 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/4.pngbin160298 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/5.pngbin178744 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/6.pngbin176670 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/7.pngbin183698 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/8.pngbin172953 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/Tutorial/screens/2x/9.pngbin190544 -> 0 bytes
-rw-r--r--src/Authoring/Studio/images/welcomedialog/laptop.pngbin0 -> 207370 bytes
-rw-r--r--src/Authoring/Studio/style.qss84
-rw-r--r--src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp1
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.cpp21
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.h4
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h1
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImpl.cpp3
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderData.cpp2
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderPreparationData.cpp3
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderBufferManager.cpp39
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderLoadedTexture.cpp22
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp23
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp1
-rw-r--r--src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h1
-rw-r--r--src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt1
-rw-r--r--src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp1
-rw-r--r--src/Runtime/Source/Runtime/Source/q3dsqmlscript.cpp10
m---------src/Runtime/qt3d-runtime0
-rw-r--r--src/Runtime/res.qrc1
-rw-r--r--src/Runtime/res/DataModelMetadata/en-us/MetaData.xml14
-rw-r--r--src/Runtime/res/effectlib/defaultMaterialBumpNoLod.glsllib (renamed from src/Viewer/qmlviewer/Qt3DSViewPlugin.h)40
-rw-r--r--src/Viewer/Qt3DViewer/Qt3DViewer.pro48
-rw-r--r--src/Viewer/Qt3DViewer/Viewer.qrc14
-rw-r--r--src/Viewer/Qt3DViewer/android/AndroidManifest.xml77
-rw-r--r--src/Viewer/Qt3DViewer/main.cpp367
-rw-r--r--src/Viewer/Qt3DViewer/qml/StyledButton.qml52
-rw-r--r--src/Viewer/Qt3DViewer/qml/StyledMenu.qml95
-rw-r--r--src/Viewer/Qt3DViewer/qml/StyledMenuButton.qml71
-rw-r--r--src/Viewer/Qt3DViewer/qml/StyledMenuItem.qml159
-rw-r--r--src/Viewer/Qt3DViewer/qml/StyledMenuSeparator.qml47
-rw-r--r--src/Viewer/Qt3DViewer/qml/main.qml594
-rw-r--r--src/Viewer/Qt3DViewer/remotedeploymentreceiver.cpp202
-rw-r--r--src/Viewer/Qt3DViewer/remotedeploymentreceiver.h79
-rw-r--r--src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.icobin112324 -> 0 bytes
-rw-r--r--src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.svg38
-rw-r--r--src/Viewer/Qt3DViewer/resources/images/arrow.pngbin523 -> 0 bytes
-rw-r--r--src/Viewer/Qt3DViewer/resources/images/arrow@2x.pngbin600 -> 0 bytes
-rw-r--r--src/Viewer/Qt3DViewer/resources/images/check@2x.pngbin638 -> 0 bytes
-rw-r--r--src/Viewer/Qt3DViewer/resources/images/viewer.icnsbin161003 -> 0 bytes
-rw-r--r--src/Viewer/Qt3DViewer/viewer.cpp401
-rw-r--r--src/Viewer/Qt3DViewer/viewer.h123
-rw-r--r--src/Viewer/Viewer.pro7
-rw-r--r--src/Viewer/qmlviewer/Qt3DSRenderer.cpp344
-rw-r--r--src/Viewer/qmlviewer/Qt3DSRenderer.h92
-rw-r--r--src/Viewer/qmlviewer/Qt3DSView.cpp307
-rw-r--r--src/Viewer/qmlviewer/Qt3DSView.h111
-rw-r--r--src/Viewer/qmlviewer/Qt3DSViewPlugin.cpp81
-rw-r--r--src/Viewer/qmlviewer/q3dspresentationitem.cpp102
-rw-r--r--src/Viewer/qmlviewer/q3dspresentationitem.h64
-rw-r--r--src/Viewer/qmlviewer/qmldir3
-rw-r--r--src/Viewer/qmlviewer/qmlviewer.pro34
-rw-r--r--src/Viewer/studio3d/q3dspresentation.cpp10
-rw-r--r--src/shared/dummyqml/qml/dummyqml.qml86
159 files changed, 1664 insertions, 4998 deletions
diff --git a/src/Authoring/Client/Code/Core/Commands/CmdDataModel.cpp b/src/Authoring/Client/Code/Core/Commands/CmdDataModel.cpp
index 9ae9277c..a2ee19d4 100644
--- a/src/Authoring/Client/Code/Core/Commands/CmdDataModel.cpp
+++ b/src/Authoring/Client/Code/Core/Commands/CmdDataModel.cpp
@@ -85,15 +85,15 @@ Q3DStudio::CString CmdDataModel::GetName() const
{
return m_Name;
}
-bool CmdDataModel::HasTransactions()
+bool CmdDataModel::HasTransactions() const
{
- return m_Consumer != NULL
+ return m_Consumer != nullptr
&& ((CTransactionConsumer *)m_Consumer.get())->m_TransactionList.size() > 0;
}
-bool CmdDataModel::ConsumerExists()
+bool CmdDataModel::ConsumerExists() const
{
- return m_Consumer != NULL;
+ return m_Consumer != nullptr;
}
void CmdDataModel::SetConsumer(ITransactionProducer *inProducer)
@@ -133,7 +133,7 @@ void CmdDataModel::ReleaseConsumer(bool inRunNotifications)
void CmdDataModel::DataModelUndo()
{
- if (ConsumerExists() && HasTransactions()) {
+ if (HasTransactions()) {
qCInfo(qt3ds::TRACE_INFO) << "Undoing " << m_Name.GetCharStar()
<< " generated from: " << m_File.GetCharStar() << "(" << m_Line << ")";
m_AfterDoAppState.Store(m_Doc);
@@ -154,7 +154,7 @@ void CmdDataModel::RunUndoNotifications()
void CmdDataModel::DataModelRedo()
{
- if (ConsumerExists() && HasTransactions()) {
+ if (HasTransactions()) {
qCInfo(qt3ds::TRACE_INFO) << "Redoing " << m_Name.GetCharStar()
<< " generated from: " << m_File.GetCharStar() << "(" << m_Line << ")";
m_BeforeDoAppState.Store(m_Doc);
@@ -182,4 +182,5 @@ void CmdDataModel::DataModelRollback()
m_Consumer->m_TransactionList.clear();
}
}
+
}
diff --git a/src/Authoring/Client/Code/Core/Commands/CmdDataModel.h b/src/Authoring/Client/Code/Core/Commands/CmdDataModel.h
index 7b1670ae..3758f7ed 100644
--- a/src/Authoring/Client/Code/Core/Commands/CmdDataModel.h
+++ b/src/Authoring/Client/Code/Core/Commands/CmdDataModel.h
@@ -67,8 +67,8 @@ public:
~CmdDataModel();
void SetName(const Q3DStudio::CString &inName);
Q3DStudio::CString GetName() const;
- bool HasTransactions();
- bool ConsumerExists();
+ bool HasTransactions() const;
+ bool ConsumerExists() const;
void SetConsumer();
void ReleaseConsumer(bool inRunNotifications = true);
void DataModelUndo();
@@ -114,4 +114,4 @@ struct SScopedDataModelConsumer
};
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/Authoring/Client/Code/Core/Core/Core.cpp b/src/Authoring/Client/Code/Core/Core/Core.cpp
index 6c82b9ce..818c891f 100644
--- a/src/Authoring/Client/Code/Core/Core/Core.cpp
+++ b/src/Authoring/Client/Code/Core/Core/Core.cpp
@@ -242,13 +242,11 @@ bool CCore::OnNewDocument(const Qt3DSFile &inDocument, bool isNewProject, bool s
CFilePath::CombineBaseAndRelative(theFinalDir, CFilePath(L"scripts")).CreateDir(true);
// create the project .uia file
- m_projectFile.create(theDocument.completeBaseName(), theFinalDir);
+ m_projectFile.create(theDocument.completeBaseName(), theFinalDir.toQString());
// set the default uip file path to the presentations folder
theDocument.setFile(QDir(theDocument.absolutePath() + QStringLiteral("/presentations")),
theDocument.GetFileName().toQString());
- } else {
- m_projectFile.ensureProjectFile(theDocument.toQString());
}
Qt3DSFile fileDocument(theDocument.toCString());
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp
index 46b7e578..29d64442 100644
--- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp
@@ -297,15 +297,20 @@ qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::GetIdProperty()
{
return GetObjectDefinitions().m_Guided.m_GuidProp;
}
-qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::GetTypeProperty()
+qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::GetTypeProperty() const
{
return GetObjectDefinitions().m_Typed.m_TypeProp;
}
-qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::GetSourcePathProperty()
+qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::GetSourcePathProperty() const
{
return m_SceneAsset.m_SourcePath;
}
+qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::getSubpresentationProperty() const
+{
+ return m_SceneImage.m_SubPresentation;
+}
+
bool CClientDataModelBridge::IsInternalProperty(const TCharStr &inPropertyName) const
{
return (inPropertyName == L"name" || inPropertyName == L"importid" || inPropertyName == L"type"
@@ -1082,6 +1087,28 @@ CClientDataModelBridge::GetSourcePath(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
return L"";
}
+/**
+ * Get the sub-presentation property value for this instance (only images have a sub-presentation
+ * property)
+ *
+ * @param inInstance instance to check its properties
+ *
+ * @return the sub-presentation property value
+ */
+Q3DStudio::CString
+CClientDataModelBridge::getSubpresentation(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const
+{
+ if (inInstance.Valid() && GetObjectType(inInstance) == OBJTYPE_IMAGE) {
+ qt3dsdm::SValue theValue;
+ IPropertySystem *thePropertySystem = m_Doc->GetStudioSystem()->GetPropertySystem();
+ thePropertySystem->GetInstancePropertyValue(inInstance, m_SceneImage.m_SubPresentation,
+ theValue);
+ return qt3dsdm::get<TDataStrPtr>(theValue)->GetData();
+ }
+
+ return L"";
+}
+
//=============================================================================
/**
* Get all instances that are derived from ItemBase Instance.
@@ -1535,7 +1562,8 @@ CClientDataModelBridge::GetParentInstance(qt3dsdm::Qt3DSDMInstanceHandle inInsta
}
}
-EStudioObjectType CClientDataModelBridge::GetObjectType(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
+EStudioObjectType
+CClientDataModelBridge::GetObjectType(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const
{
SValue theTypeValue;
IPropertySystem *thePropertySystem = m_Doc->GetStudioSystem()->GetPropertySystem();
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h
index 4b43ef3e..4d802494 100644
--- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h
+++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h
@@ -181,8 +181,9 @@ public:
virtual qt3dsdm::Qt3DSDMPropertyHandle GetSlideComponentIdProperty();
virtual qt3dsdm::Qt3DSDMPropertyHandle GetNameProperty();
virtual qt3dsdm::Qt3DSDMPropertyHandle GetIdProperty();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetTypeProperty();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetSourcePathProperty();
+ virtual qt3dsdm::Qt3DSDMPropertyHandle GetTypeProperty() const;
+ virtual qt3dsdm::Qt3DSDMPropertyHandle GetSourcePathProperty() const;
+ virtual qt3dsdm::Qt3DSDMPropertyHandle getSubpresentationProperty() const;
virtual qt3dsdm::Qt3DSDMInstanceHandle GetActionInstance();
virtual qt3dsdm::Qt3DSDMPropertyHandle GetActionEyeball();
virtual qt3dsdm::Qt3DSDMPropertyHandle GetImportId();
@@ -364,6 +365,7 @@ public:
qt3dsdm::Qt3DSDMInstanceHandle inInstance,
Q3DStudio::CString inDesiredName);
Q3DStudio::CString GetSourcePath(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
+ Q3DStudio::CString getSubpresentation(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
std::set<Q3DStudio::CString> GetSourcePathList() const;
std::set<Q3DStudio::CString> GetFontFileList() const;
std::set<Q3DStudio::CString> GetDynamicObjectTextureList() const;
@@ -395,7 +397,7 @@ public:
// TODO: EStudioObjectType and EASSETTYPE can't co-exist, one must go. Think EStudioObjectType
// should win since things are better classified
- EStudioObjectType GetObjectType(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
+ EStudioObjectType GetObjectType(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
bool IsBehaviorInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
bool IsCameraInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
bool IsGroupInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
index 127e306d..e78e4c81 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
@@ -814,7 +814,7 @@ void CDoc::DeselectAllItems(bool inSendEvent)
if (inSendEvent)
NotifySelectionChanged();
else
- SetSelection();
+ m_unnotifiedSelectionChange = SetSelection();
// Remove selection on keyframes.
DeselectAllKeyframes();
@@ -1103,9 +1103,11 @@ bool CDoc::SetSelection(Q3DStudio::SSelectedValue inNewSelection)
void CDoc::NotifySelectionChanged(Q3DStudio::SSelectedValue inNewSelection)
{
m_SelectedValue = inNewSelection;
- if (SetSelection(inNewSelection)) {
+ if (SetSelection(inNewSelection))
m_Core->GetDispatch()->FireSelectionChange(inNewSelection);
- }
+ else if (m_unnotifiedSelectionChange)
+ m_Core->GetDispatch()->FireSelectionChange(m_SelectedObject);
+ m_unnotifiedSelectionChange = false;
}
template <typename TDataType>
@@ -2883,6 +2885,8 @@ QString CDoc::GetDocumentUIAFile(bool master)
return file.isEmpty() ? masterFile : file;
}
+// TODO: use ProjectFile class framework to parse subpresentations and add datainput use
+// information from them to the map as well
void CDoc::UpdateDatainputMap(
const qt3dsdm::Qt3DSDMInstanceHandle inInstance,
QMultiMap<QString,
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.h b/src/Authoring/Client/Code/Core/Doc/Doc.h
index 7589096d..0a84c19d 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.h
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.h
@@ -509,6 +509,7 @@ protected:
std::shared_ptr<Q3DStudio::IDocSceneGraph> m_SceneGraph;
Q3DStudio::SSelectedValue m_SelectedValue;
bool m_nudging;
+ bool m_unnotifiedSelectionChange = false;
public:
void OnNewPresentation();
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index 32428bee..051475fd 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -966,12 +966,14 @@ public:
virtual Qt3DSDMInstanceHandle
CreateSceneGraphInstance(qt3dsdm::ComposerObjectTypes::Enum inType, TInstanceHandle inParent,
- TSlideHandle inSlide, TInstanceHandle inTargetId = TInstanceHandle()) override
+ TSlideHandle inSlide, TInstanceHandle inTargetId = TInstanceHandle(),
+ bool setTimeRange = true) override
{
Qt3DSDMInstanceHandle retval = IDocumentEditor::CreateSceneGraphInstance(
ComposerObjectTypes::Convert(inType), inParent, inSlide, m_DataCore, m_SlideSystem,
- m_Bridge.GetObjectDefinitions(), m_AssetGraph, m_MetaData, inTargetId);
- SetTimeRangeToParent(retval);
+ m_Bridge.GetObjectDefinitions(), m_AssetGraph, m_MetaData, inTargetId, setTimeRange);
+ if (setTimeRange)
+ SetTimeRangeToParent(retval);
return retval;
}
@@ -980,9 +982,11 @@ public:
DocumentEditorInsertType::Enum inInsertType,
const CPt &inPosition,
EPrimitiveType inPrimitiveType,
- long inStartTime) override
+ long inStartTime,
+ bool setTimeRange = true) override
{
- TInstanceHandle retval(CreateSceneGraphInstance(inType, inParent, inSlide));
+ TInstanceHandle retval(CreateSceneGraphInstance(inType, inParent, inSlide,
+ TInstanceHandle(), setTimeRange));
Q3DStudio::CString theName;
if (inType == ComposerObjectTypes::Model) {
@@ -998,9 +1002,14 @@ public:
theName = GetName(retval);
}
} else {
- theName = GetName(retval);
+ theName = ComposerObjectTypes::Convert(inType);
+ // TODO: This should work (QT3DS-2278). The line above is a quick fix in case
+ // the actual reason for this to have stopped working is not found in time for 2.1
+ // release.
+ //theName = GetName(retval);
}
- SetTimeRangeToParent(retval);
+ if (setTimeRange)
+ SetTimeRangeToParent(retval);
if (inType == ComposerObjectTypes::Layer) {
CreateSceneGraphInstance(ComposerObjectTypes::Camera, retval, inSlide);
@@ -1013,9 +1022,9 @@ public:
if (m_DataCore.IsInstanceOrDerivedFrom(
retval, m_Bridge.GetObjectDefinitions().m_SlideOwner.m_Instance))
m_Bridge.GetOrCreateGraphRoot(retval);
-
+ // if we did not set time range earlier, let's set it now to match parent
TInstanceHandle handle = FinalizeAddOrDrop(retval, inParent, inInsertType,
- inPosition, false, true, false);
+ inPosition, !setTimeRange, true, false);
SetName(retval, theName, true);
return handle;
}
@@ -1729,10 +1738,7 @@ public:
if (!img)
img = CreateImageInstanceForMaterialOrLayer(instance, prop);
- Qt3DSDMPropertyHandle propHandleSP = m_PropertySystem
- .GetAggregateInstancePropertyByName(img, L"subpresentation");
-
- SetInstancePropertyValueAsRenderable(img, propHandleSP, pId);
+ SetInstancePropertyValueAsRenderable(img, m_Bridge.getSubpresentationProperty(), pId);
}
/**
@@ -1766,7 +1772,7 @@ public:
}
void SetMaterialType(TInstanceHandle instance,
- const Q3DStudio::CString &inRelativePathToMaterialFile) override
+ const Q3DStudio::CString &inRelativePathToMaterialFile) override
{
const Q3DStudio::CString existing = m_Bridge.GetSourcePath(instance);
if (existing == inRelativePathToMaterialFile)
@@ -1820,10 +1826,8 @@ public:
DocumentEditorInsertType::LastChild, 0, instance);
}
- if (newMaterial.Valid()) {
- if (nextChild.Valid())
- m_AssetGraph.MoveBefore(newMaterial, nextChild);
- }
+ if (newMaterial.Valid() && nextChild.Valid())
+ m_AssetGraph.MoveBefore(newMaterial, nextChild);
// restore current lightmap settings for new material
if (theLightmapIndirectValue.hasValue())
@@ -2644,7 +2648,7 @@ public:
FinalizeAddOrDrop(qt3dsdm::Qt3DSDMInstanceHandle inInstance, qt3dsdm::Qt3DSDMInstanceHandle inParent,
DocumentEditorInsertType::Enum inInsertType, const CPt &inPosition,
bool inSetTimeRangeToParent, bool inSelectInstanceWhenFinished = true,
- bool checkUniqueName = true)
+ bool checkUniqueName = true, bool notifyRename = true)
{
if (inPosition.x != 0 && inPosition.y != 0) {
Q3DStudio::IDocSceneGraph *theGraph(m_Doc.GetSceneGraph());
@@ -2656,7 +2660,7 @@ public:
QT3DS_ASSERT(false);
}
}
- RearrangeObject(inInstance, inParent, inInsertType, checkUniqueName);
+ RearrangeObject(inInstance, inParent, inInsertType, checkUniqueName, notifyRename);
if (inSetTimeRangeToParent)
SetTimeRangeToParent(inInstance);
if (inSelectInstanceWhenFinished)
@@ -2712,7 +2716,8 @@ public:
TInstanceHandle inNewRoot,
bool inGenerateUniqueName,
DocumentEditorInsertType::Enum inInsertType,
- const CPt &inPosition)
+ const CPt &inPosition,
+ bool notifyRename = true)
{
std::shared_ptr<IComposerSerializer> theSerializer = m_Doc.CreateSerializer();
TInstanceHandleList retval = theSerializer->SerializeSceneGraphObject(
@@ -2722,7 +2727,8 @@ public:
if (inInsertType == DocumentEditorInsertType::NextSibling)
theInstance = retval[end - idx - 1];
- FinalizeAddOrDrop(theInstance, inNewRoot, inInsertType, inPosition, false);
+ FinalizeAddOrDrop(theInstance, inNewRoot, inInsertType, inPosition, false, true, true,
+ notifyRename);
SetName(theInstance, GetName(theInstance), inGenerateUniqueName);
}
@@ -2829,7 +2835,7 @@ public:
void RearrangeObjects(const qt3dsdm::TInstanceHandleList &inInstances,
TInstanceHandle inDest,
DocumentEditorInsertType::Enum inInsertType,
- bool checkUniqueName) override
+ bool checkUniqueName, bool notifyRename = true) override
{
qt3dsdm::TInstanceHandleList sortableList(ToGraphOrdering(inInstances));
QSet<TInstanceHandle> updateList;
@@ -2838,8 +2844,8 @@ public:
|| inInsertType == DocumentEditorInsertType::NextSibling)
theParent = GetParent(inDest);
- if (m_Bridge.IsComponentInstance(theParent)) {
- moveIntoComponent(inInstances, theParent);
+ if (m_Bridge.IsComponentInstance(theParent)
+ && moveIntoComponent(inInstances, theParent, checkUniqueName, notifyRename)) {
return;
}
@@ -2855,7 +2861,8 @@ public:
if (!m_Bridge.CheckNameUnique(theParent, theInstance, currName)) {
CString newName = m_Bridge.GetUniqueChildName(theParent, theInstance,
currName);
- m_Doc.getMoveRenameHandler()->displayMessageBox(currName, newName);
+ if (notifyRename)
+ m_Doc.getMoveRenameHandler()->displayMessageBox(currName, newName);
SetName(theInstance, newName);
}
}
@@ -2957,7 +2964,6 @@ public:
TInstanceHandle group = CreateSceneGraphInstance(ComposerObjectTypes::Group, sibling, slide,
DocumentEditorInsertType::PreviousSibling,
CPt(), PRIMITIVETYPE_UNKNOWN, -1);
-
// Move items into the group
RearrangeObjects(sortedList, group, DocumentEditorInsertType::LastChild, true);
}
@@ -2968,6 +2974,13 @@ public:
return Qt3DSDMInstanceHandle();
qt3dsdm::TInstanceHandleList theInstances = ToGraphOrdering(inInstances);
+
+ // Get the original start/end times
+ QList<std::pair<long, long>> theStartEndTimes;
+
+ for (auto instance : qAsConst(theInstances))
+ theStartEndTimes.append(GetTimeRange(instance));
+
// Do this in reverse order.
// first add new component.
Qt3DSDMSlideHandle theSlide = GetAssociatedSlide(theInstances[0]);
@@ -2979,8 +2992,6 @@ public:
// Update pivot and position
updatePivotAndPosition(component, inInstances);
- pair<long, long> theStartEndTimes = GetTimeRange(theInstances[0]);
-
CString theName = GetName(theInstances[0]);
// now cut the group
@@ -2991,27 +3002,48 @@ public:
Qt3DSDMSlideHandle theComponentSlide(m_Bridge.GetComponentActiveSlide(component));
// Paste into the master slide of the new component
- theSerializer->SerializeSceneGraphObject(*theReader, m_Doc.GetDocumentDirectory(),
- component,
- m_SlideSystem.GetMasterSlide(theComponentSlide));
+ TInstanceHandleList insertedHandles = theSerializer->SerializeSceneGraphObject(
+ *theReader,m_Doc.GetDocumentDirectory(), component,
+ m_SlideSystem.GetMasterSlide(theComponentSlide));
+
+ // Restore the original time range for all objects.
+ if (insertedHandles.size()) {
+ for (int i = 0; i < theStartEndTimes.size(); i++) {
+ if (theStartEndTimes.at(i) != std::make_pair(0L, 0L)) {
+ SetTimeRange(insertedHandles.at(i), theStartEndTimes.at(i).first,
+ theStartEndTimes.at(i).second);
+ }
+ }
+ }
- SetTimeRange(component, theStartEndTimes.first, theStartEndTimes.second);
SetName(component, theName);
m_Doc.SelectDataModelObject(component);
return component;
}
- void moveIntoComponent(const qt3dsdm::TInstanceHandleList &inInstances,
- const Qt3DSDMInstanceHandle targetComponent)
+ // Moves specified instances into target component by a simulated cut and paste.
+ // This is only necessary when moving objects from outside the component into the component.
+ // Returns true if move was done. Returns false if instances are already in target component,
+ // which means a regular rearrange can be done.
+ bool moveIntoComponent(const qt3dsdm::TInstanceHandleList &inInstances,
+ const Qt3DSDMInstanceHandle targetComponent, bool checkUniqueName,
+ bool notifyRename)
{
if (inInstances.empty())
- return;
+ return false;
- qt3dsdm::TInstanceHandleList theInstances = ToGraphOrdering(inInstances);
+ Qt3DSDMInstanceHandle rootInstance = GetParent(inInstances[0]);
+ while (rootInstance.Valid() && !m_Bridge.IsComponentInstance(rootInstance))
+ rootInstance = GetParent(rootInstance);
+
+ if (rootInstance == targetComponent)
+ return false;
+
+ const qt3dsdm::TInstanceHandleList theInstances = ToGraphOrdering(inInstances);
QList<std::pair<long, long>> theStartEndTimes;
- for (auto instance : qAsConst(theInstances))
+ for (auto instance : theInstances)
theStartEndTimes.append(GetTimeRange(instance));
// Now cut the group from the scene.
@@ -3029,8 +3061,8 @@ public:
targetComponent,
m_SlideSystem.GetMasterSlide(theComponentSlide));
- // Restore the original time range for all objects.
if (insertedHandles.size()) {
+ // Restore the original time range for all objects.
for (int i = 0; i < theStartEndTimes.size(); i++) {
if (theStartEndTimes.at(i) != std::make_pair(0L, 0L))
SetTimeRange(insertedHandles.at(i), theStartEndTimes.at(i).first,
@@ -3042,7 +3074,22 @@ public:
GetChildren(m_SlideSystem.GetMasterSlide(theComponentSlide), targetComponent,
childHandles);
updatePivotAndPosition(targetComponent, childHandles);
+
+ // Check for name uniqueness
+ if (checkUniqueName) {
+ for (auto instance : insertedHandles) {
+ CString currName = m_Bridge.GetName(instance);
+ if (!m_Bridge.CheckNameUnique(targetComponent, instance, currName)) {
+ CString newName = m_Bridge.GetUniqueChildName(
+ targetComponent, instance, currName);
+ if (notifyRename)
+ m_Doc.getMoveRenameHandler()->displayMessageBox(currName, newName);
+ SetName(instance, newName);
+ }
+ }
+ }
}
+ return true;
}
void DuplicateInstances(const qt3dsdm::TInstanceHandleList &inInstances) override
@@ -3061,7 +3108,7 @@ public:
{
qt3dsdm::TInstanceHandleList theInstances(ToGraphOrdering(inInstances));
std::shared_ptr<IDOMReader> theReader(CopySceneGraphObjectsToMemory(theInstances));
- return DoPasteSceneGraphObject(theReader, inDest, true, inInsertType, CPt());
+ return DoPasteSceneGraphObject(theReader, inDest, true, inInsertType, CPt(), false);
}
Qt3DSDMActionHandle AddAction(Qt3DSDMSlideHandle inSlide, Qt3DSDMInstanceHandle inOwner,
@@ -3926,9 +3973,9 @@ public:
};
TInstanceHandle CreateText(const Q3DStudio::CString &inFullPathToDocument,
- TInstanceHandle inParent, TSlideHandle inSlide,
- DocumentEditorInsertType::Enum inDropType,
- const CPt &inPosition = CPt(), long inStartTime = -1) override
+ TInstanceHandle inParent, TSlideHandle inSlide,
+ DocumentEditorInsertType::Enum inDropType,
+ const CPt &inPosition = CPt(), long inStartTime = -1) override
{
(void)inStartTime;
@@ -3965,7 +4012,10 @@ public:
// Set the name afterwards, do not do uniqueness check here
auto handle = FinalizeAddOrDrop(theTextInstance, inParent, inDropType, inPosition,
inStartTime == -1, true, false);
- SetName(handle, GetName(handle), true);
+ SetName(handle, ComposerObjectTypes::Convert(ComposerObjectTypes::Text), true);
+ // TODO: This should work (QT3DS-2278). The line above is a quick fix in case the actual
+ // reason for this to have stopped working is not found in time for 2.1 release.
+ //SetName(handle, GetName(handle), true);
return handle;
}
@@ -4697,6 +4747,29 @@ public:
}
}
+ void toggleBoolPropertyOnSelected(TPropertyHandle property) override
+ {
+ qt3dsdm::IPropertySystem *propertySystem = m_Doc.GetStudioSystem()->GetPropertySystem();
+ qt3dsdm::TInstanceHandleList selectedInstances
+ = m_Doc.GetSelectedValue().GetSelectedInstances();
+
+ if (selectedInstances.size() > 0) {
+ bool boolValue = false;
+ SValue value;
+ for (size_t idx = 0, end = selectedInstances.size(); idx < end; ++idx) {
+ qt3dsdm::Qt3DSDMInstanceHandle handle(selectedInstances[idx]);
+ if (handle.Valid()) {
+ if (value.empty()) {
+ // First valid handle selects if all are hidden/unhidden
+ propertySystem->GetInstancePropertyValue(handle, property, value);
+ boolValue = !qt3dsdm::get<bool>(value);
+ }
+ propertySystem->SetInstancePropertyValue(handle, property, boolValue);
+ }
+ }
+ }
+ }
+
void BuildDAEMap(const TFileModificationList &inList)
{
for (size_t fileIdx = 0, fileEnd = inList.size(); fileIdx < fileEnd; ++fileIdx) {
@@ -5005,7 +5078,7 @@ Qt3DSDMInstanceHandle IDocumentEditor::CreateSceneGraphInstance(
const wchar_t *inType, TInstanceHandle inParent, TSlideHandle inSlide,
qt3dsdm::IDataCore &inDataCore, qt3dsdm::ISlideSystem &inSlideSystem,
qt3dsdm::SComposerObjectDefinitions &inObjectDefs, Q3DStudio::CGraph &inAssetGraph,
- qt3dsdm::IMetaData &inMetaData, TInstanceHandle inTargetId)
+ qt3dsdm::IMetaData &inMetaData, TInstanceHandle inTargetId, bool setTimeRange)
{
return CreateSceneGraphInstance(inMetaData.GetCanonicalInstanceForType(inType), inParent,
inSlide, inDataCore, inSlideSystem, inObjectDefs, inAssetGraph,
diff --git a/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h b/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
index 51c99ef7..fca8d16f 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
@@ -126,7 +126,8 @@ public:
qt3dsdm::IDataCore &inDataCore, qt3dsdm::ISlideSystem &inSlideSystem,
qt3dsdm::SComposerObjectDefinitions &inObjectDefs,
Q3DStudio::CGraph &inAssetGraph, qt3dsdm::IMetaData &inMetaData,
- TInstanceHandle inTargetId = TInstanceHandle());
+ TInstanceHandle inTargetId = TInstanceHandle(),
+ bool setTimeRange = true);
static TInstanceHandle CreateSceneGraphInstance(
Qt3DSDMInstanceHandle inMaster, TInstanceHandle parent, TSlideHandle inSlide,
@@ -148,14 +149,16 @@ public:
virtual TInstanceHandle
CreateSceneGraphInstance(qt3dsdm::ComposerObjectTypes::Enum type, TInstanceHandle parent,
TSlideHandle inSlide,
- TInstanceHandle inTargetId = TInstanceHandle()) = 0;
+ TInstanceHandle inTargetId = TInstanceHandle(),
+ bool setTimeRange = true) = 0;
virtual TInstanceHandle CreateSceneGraphInstance(qt3dsdm::ComposerObjectTypes::Enum type,
TInstanceHandle parent, TSlideHandle inSlide,
DocumentEditorInsertType::Enum inInsertType,
const CPt &inPosition,
EPrimitiveType inPrimitiveType,
- long inStartTime) = 0;
+ long inStartTime,
+ bool setTimeRange = true) = 0;
virtual void setInstanceImagePropertyValueAsRenderable(TInstanceHandle instance,
TPropertyHandle prop,
const CString &pId) = 0;
@@ -320,15 +323,15 @@ public:
virtual void RearrangeObjects(const qt3dsdm::TInstanceHandleList &inInstances,
TInstanceHandle inDest,
DocumentEditorInsertType::Enum inInsertType,
- bool checkUniqueName = true) = 0;
+ bool checkUniqueName = true, bool notifyRename = true) = 0;
void RearrangeObject(TInstanceHandle inInstance, TInstanceHandle inDest,
DocumentEditorInsertType::Enum inInsertType,
- bool checkUniqueName = true)
+ bool checkUniqueName = true, bool notifyRename = true)
{
qt3dsdm::TInstanceHandleList theInstances;
theInstances.push_back(inInstance);
- RearrangeObjects(theInstances, inDest, inInsertType, checkUniqueName);
+ RearrangeObjects(theInstances, inDest, inInsertType, checkUniqueName, notifyRename);
}
virtual void ungroupObjects(const qt3dsdm::TInstanceHandleList &inInstances) = 0;
@@ -456,6 +459,8 @@ public:
virtual void ExternalizePath(TInstanceHandle path) = 0;
virtual void InternalizePath(TInstanceHandle path) = 0;
+ virtual void toggleBoolPropertyOnSelected(TPropertyHandle property) = 0;
+
static std::shared_ptr<IDOMReader>
ParseScriptFile(const Q3DStudio::CFilePath &inFullPathToDocument,
std::shared_ptr<qt3dsdm::IStringTable> inStringTable,
diff --git a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp
index b1f2a3ae..644675c4 100644
--- a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp
@@ -41,6 +41,10 @@
#include "Qt3DSDMXML.h"
#include "foundation/IOStreams.h"
#include "StudioUtils.h"
+#include "Core.h"
+#include "Dispatch.h"
+
+#include <QtCore/qtimer.h>
using namespace std;
@@ -184,6 +188,13 @@ void CStudioSystem::ResetDatabase()
m_StudioSystem = std::shared_ptr<CStudioFullSystem>(new CStudioFullSystem(
theCore, m_Bridge->GetSlideInstance(), m_Bridge->GetSlideComponentIdProperty(),
m_Bridge->GetActionInstance(), m_Bridge->GetActionEyeball()));
+
+ m_StudioSystem->GetAnimationSystem()->setRefreshCallback(
+ [this](Qt3DSDMInstanceHandle instance) {
+ QTimer::singleShot(0,[this, instance]() {
+ m_Doc->GetCore()->GetDispatch()->FireImmediateRefreshInstance(instance);
+ });
+ });
}
IMetaData *CStudioSystem::GetActionMetaData()
@@ -201,7 +212,7 @@ ISlideCore *CStudioSystem::GetSlideCore()
return m_StudioSystem->GetSlideCore().get();
}
-IPropertySystem *CStudioSystem::GetPropertySystem()
+IPropertySystem *CStudioSystem::GetPropertySystem() const
{
return m_StudioSystem->GetPropertySystem().get();
}
diff --git a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h
index f43056d9..b7cf5476 100644
--- a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h
+++ b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h
@@ -68,7 +68,7 @@ public:
CClientDataModelBridge *GetClientDataModelBridge() const { return m_Bridge.get(); }
ISlideSystem *GetSlideSystem();
ISlideCore *GetSlideCore();
- IPropertySystem *GetPropertySystem();
+ IPropertySystem *GetPropertySystem() const;
IStudioFullSystemSignalProvider *GetFullSystemSignalProvider();
IStudioFullSystemSignalSender *GetFullSystemSignalSender();
IAnimationCore *GetAnimationCore();
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.cpp b/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.cpp
index 94fc8edf..b61a74b8 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.cpp
+++ b/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.cpp
@@ -180,7 +180,7 @@ const QString &CStudioObjectTypes::GetNormalIconName(EStudioObjectType inType)
return theString;
}
case OBJTYPE_DATAINPUT: {
- static QString theString = QStringLiteral("Objects-DataInput-Normal.png");
+ static QString theString = QStringLiteral("Objects-DataInput-Active.png");
return theString;
}
case OBJTYPE_PRESENTATION: {
@@ -282,7 +282,7 @@ const QString &CStudioObjectTypes::GetDisabledIconName(EStudioObjectType inType)
return theString;
}
case OBJTYPE_DATAINPUT: {
- static QString theString = QStringLiteral("Objects-DataInput-Disabled.png");
+ static QString theString = QStringLiteral("Objects-DataInput-Inactive.png");
return theString;
}
case OBJTYPE_PRESENTATION: {
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp
index 742488fa..8a1f61ac 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp
+++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp
@@ -56,6 +56,7 @@ static QColor s_textColor;
static QColor s_masterColor;
static QColor s_disabledColor;
static QColor s_dataInputColor;
+static QLinearGradient s_welcomeBackgroundGradient;
static QColor s_timelineRowColorNormal;
static QColor s_timelineRowColorNormalProp;
@@ -136,6 +137,10 @@ void CStudioPreferences::LoadPreferences()
s_disabledColor = QColor("#727476");
s_dataInputColor = QColor("#ff5102");
+ s_welcomeBackgroundGradient = QLinearGradient(0.0, 0.0, 1.0, 0.0);
+ s_welcomeBackgroundGradient.setColorAt(0.0, QColor("#343E55"));
+ s_welcomeBackgroundGradient.setColorAt(1.0, QColor("#000727"));
+
s_timelineRowColorNormal = QColor("#404040");
s_timelineRowColorNormalProp = QColor("#373737");
s_timelineRowColorOver = QColor("#4d4d4d");
@@ -166,26 +171,6 @@ void CStudioPreferences::LoadPreferences()
//==============================================================================
/**
- * Returns the state of the legacy viewer
- * @return true if the legacy viewer is active
- */
-bool CStudioPreferences::IsLegacyViewerActive()
-{
- return CPreferences::GetUserPreferences().GetValue("LegacyViewerActive", false);
-}
-
-//==============================================================================
-/**
- * Sets the state of the legacy viewer
- * @param inActiveFlag true if the legacy viewer is active
- */
-void CStudioPreferences::SetLegacyViewerActive(bool inActive)
-{
- CPreferences::GetUserPreferences().SetValue("LegacyViewerActive", inActive);
-}
-
-//==============================================================================
-/**
* Returns the state of the timeline snapping grid
* @return true if the snapping grid is active
*/
@@ -869,6 +854,11 @@ QColor CStudioPreferences::dataInputColor()
return s_dataInputColor;
}
+QLinearGradient CStudioPreferences::welcomeBackgroundGradient()
+{
+ return s_welcomeBackgroundGradient;
+}
+
QColor CStudioPreferences::timelineRowColorNormal()
{
return s_timelineRowColorNormal;
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h
index 9365622a..bd586629 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h
+++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h
@@ -33,6 +33,7 @@
#pragma once
#include <qglobal.h>
+#include <QtGui/qbrush.h>
#include "CoreConst.h"
#include "Qt3DSFile.h"
@@ -52,9 +53,6 @@ public:
static bool IsTimelineSnappingGridActive();
static void SetTimelineSnappingGridActive(bool inActive);
- static bool IsLegacyViewerActive();
- static void SetLegacyViewerActive(bool inActive);
-
static ESnapGridResolution GetTimelineSnappingGridResolution();
static void SetTimelineSnappingGridResolution(ESnapGridResolution inResolution);
@@ -166,6 +164,7 @@ public:
static QColor masterColor();
static QColor disabledColor();
static QColor dataInputColor();
+ static QLinearGradient welcomeBackgroundGradient();
static QColor timelineRowColorNormal();
static QColor timelineRowColorNormalProp();
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h
index 588e06b3..c2a7c3b8 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h
@@ -403,6 +403,9 @@ public:
Qt3DSDMInstanceHandle inInstance,
Qt3DSDMPropertyHandle inProperty,
const SValue &inValue) = 0;
+
+ typedef std::function<void(Qt3DSDMInstanceHandle instance)> TRefreshCallbackFunc;
+ virtual void setRefreshCallback(TRefreshCallbackFunc func) = 0;
};
typedef std::shared_ptr<IStudioAnimationSystem> TStudioAnimationSystemPtr;
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp
index ca89031b..98712791 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp
@@ -208,6 +208,7 @@ struct DataConstructor<SObjectRefType>
#define QT3DS_WCHAR_T_shdwfilter L"shdwfilter"
#define QT3DS_WCHAR_T_orthographic L"orthographic"
#define QT3DS_WCHAR_T_fov L"fov"
+#define QT3DS_WCHAR_T_fovhorizontal L"fovhorizontal"
#define QT3DS_WCHAR_T_clipnear L"clipnear"
#define QT3DS_WCHAR_T_clipfar L"clipfar"
#define QT3DS_WCHAR_T_lookatlock L"lookatlock"
@@ -490,21 +491,21 @@ SComposerObjectDefinitions::SComposerObjectDefinitions(
, m_Asset(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Guided, m_Named)
, m_Scene(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset, m_SlideOwner)
, m_Image(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
- , m_Lightmaps(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
- , m_MaterialBase(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Lightmaps)
- , m_Material(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_MaterialBase)
- , m_CustomMaterial(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_MaterialBase)
- , m_ReferencedMaterial(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_MaterialBase)
+ , m_MaterialBase(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
+ , m_Lightmaps(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_MaterialBase)
+ , m_Material(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Lightmaps)
+ , m_CustomMaterial(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Lightmaps)
+ , m_ReferencedMaterial(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Lightmaps)
, m_Behavior(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
+ , m_Effect(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
, m_Node(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
, m_Layer(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
- , m_Model(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
, m_Group(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
+ , m_Model(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
, m_Light(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
, m_Camera(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
, m_Component(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node, m_SlideOwner)
, m_Text(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
- , m_Effect(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
, m_RenderPlugin(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Asset)
, m_Alias(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
, m_Path(inCore, inMetaData, inCore.CreateInstance(), m_Typed, m_Node)
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
index 3faba381..d72eea1e 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
@@ -56,8 +56,8 @@ class IPropertySystem;
HANDLE_COMPOSER_OBJECT_TYPE(Asset, ITERATE_COMPOSER_ASSET_PROPERTIES) \
HANDLE_COMPOSER_OBJECT_TYPE(Scene, ITERATE_COMPOSER_SCENE_PROPERTIES) \
HANDLE_COMPOSER_OBJECT_TYPE(Image, ITERATE_COMPOSER_IMAGE_PROPERTIES) \
- HANDLE_COMPOSER_OBJECT_TYPE(Lightmaps, ITERATE_COMPOSER_LIGHTMAP_PROPERTIES) \
HANDLE_COMPOSER_OBJECT_TYPE(MaterialBase, ITERATE_COMPOSER_MATERIAL_BASE_PROPERTIES) \
+ HANDLE_COMPOSER_OBJECT_TYPE(Lightmaps, ITERATE_COMPOSER_LIGHTMAP_PROPERTIES) \
HANDLE_COMPOSER_OBJECT_TYPE(Material, ITERATE_COMPOSER_MATERIAL_PROPERTIES) \
HANDLE_COMPOSER_OBJECT_TYPE(CustomMaterial, ITERATE_COMPOSER_NO_ADDITIONAL_PROPERTIES) \
HANDLE_COMPOSER_OBJECT_TYPE(ReferencedMaterial, \
@@ -255,6 +255,7 @@ class IPropertySystem;
#define ITERATE_COMPOSER_CAMERA_PROPERTIES \
HANDLE_COMPOSER_PROPERTY(orthographic, m_Orthographic, bool, false) \
HANDLE_COMPOSER_PROPERTY(fov, m_Fov, float, 60.f) \
+ HANDLE_COMPOSER_PROPERTY(fovhorizontal, m_FovHorizontal, bool, false) \
HANDLE_COMPOSER_PROPERTY(clipnear, m_ClipNear, float, 10.f) \
HANDLE_COMPOSER_PROPERTY(clipfar, m_ClipFar, float, 100000.f) \
HANDLE_COMPOSER_PROPERTY(scalemode, m_ScaleMode, TDataStrPtr, L"Fit") \
@@ -582,16 +583,16 @@ struct SComposerObjectDefinition<ComposerObjectTypes::Image>
};
template <>
-struct SComposerObjectDefinition<ComposerObjectTypes::Lightmaps>
- : public SComposerBaseObjectDefinition<ComposerObjectTypes::Lightmaps>
+struct SComposerObjectDefinition<ComposerObjectTypes::MaterialBase>
+ : public SComposerBaseObjectDefinition<ComposerObjectTypes::MaterialBase>
{
SComposerObjectDefinition(IDataCore &inCore, IMetaData &inMetaData,
Qt3DSDMInstanceHandle inInstance,
SComposerObjectDefinition<ComposerObjectTypes::Typed> &inTyped,
SComposerObjectDefinition<ComposerObjectTypes::Asset> &inAsset)
- : SComposerBaseObjectDefinition<ComposerObjectTypes::Lightmaps>(inCore, inMetaData,
- inInstance)
+ : SComposerBaseObjectDefinition<ComposerObjectTypes::MaterialBase>(inCore, inMetaData,
+ inInstance)
{
Derive(inCore, inAsset);
SetType(inCore, inTyped);
@@ -599,16 +600,16 @@ struct SComposerObjectDefinition<ComposerObjectTypes::Lightmaps>
};
template <>
-struct SComposerObjectDefinition<ComposerObjectTypes::MaterialBase>
- : public SComposerBaseObjectDefinition<ComposerObjectTypes::MaterialBase>
+struct SComposerObjectDefinition<ComposerObjectTypes::Lightmaps>
+ : public SComposerBaseObjectDefinition<ComposerObjectTypes::Lightmaps>
{
SComposerObjectDefinition(IDataCore &inCore, IMetaData &inMetaData,
Qt3DSDMInstanceHandle inInstance,
SComposerObjectDefinition<ComposerObjectTypes::Typed> &inTyped,
- SComposerObjectDefinition<ComposerObjectTypes::Lightmaps> &inBase)
- : SComposerBaseObjectDefinition<ComposerObjectTypes::MaterialBase>(inCore, inMetaData,
- inInstance)
+ SComposerObjectDefinition<ComposerObjectTypes::MaterialBase> &inBase)
+ : SComposerBaseObjectDefinition<ComposerObjectTypes::Lightmaps>(inCore, inMetaData,
+ inInstance)
{
Derive(inCore, inBase);
SetType(inCore, inTyped);
@@ -623,7 +624,7 @@ struct SComposerObjectDefinition<ComposerObjectTypes::Material>
SComposerObjectDefinition(IDataCore &inCore, IMetaData &inMetaData,
Qt3DSDMInstanceHandle inInstance,
SComposerObjectDefinition<ComposerObjectTypes::Typed> &inTyped,
- SComposerObjectDefinition<ComposerObjectTypes::MaterialBase> &inBase)
+ SComposerObjectDefinition<ComposerObjectTypes::Lightmaps> &inBase)
: SComposerBaseObjectDefinition<ComposerObjectTypes::Material>(inCore, inMetaData,
inInstance)
{
@@ -640,7 +641,7 @@ struct SComposerObjectDefinition<ComposerObjectTypes::CustomMaterial>
SComposerObjectDefinition(IDataCore &inCore, IMetaData &inMetaData,
Qt3DSDMInstanceHandle inInstance,
SComposerObjectDefinition<ComposerObjectTypes::Typed> &inTyped,
- SComposerObjectDefinition<ComposerObjectTypes::MaterialBase> &inBase)
+ SComposerObjectDefinition<ComposerObjectTypes::Lightmaps> &inBase)
: SComposerBaseObjectDefinition<ComposerObjectTypes::CustomMaterial>(inCore, inMetaData,
inInstance)
{
@@ -657,7 +658,7 @@ struct SComposerObjectDefinition<ComposerObjectTypes::ReferencedMaterial>
SComposerObjectDefinition(IDataCore &inCore, IMetaData &inMetaData,
Qt3DSDMInstanceHandle inInstance,
SComposerObjectDefinition<ComposerObjectTypes::Typed> &inTyped,
- SComposerObjectDefinition<ComposerObjectTypes::MaterialBase> &inBase)
+ SComposerObjectDefinition<ComposerObjectTypes::Lightmaps> &inBase)
: SComposerBaseObjectDefinition<ComposerObjectTypes::ReferencedMaterial>(inCore, inMetaData,
inInstance)
{
diff --git a/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.cpp b/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.cpp
index ba7eff54..2b788880 100644
--- a/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.cpp
+++ b/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.cpp
@@ -368,6 +368,18 @@ bool CStudioAnimationSystem::SetAnimatedInstancePropertyValue(Qt3DSDMSlideHandle
do_all(thePresentAnimations, std::bind(InsertUniqueAnimationFloatPair, std::placeholders::_1,
std::ref(m_AnimationFloatPairs),
std::cref(inValue), m_AnimationCore));
+
+
+ if (m_Consumer && m_refreshCallback) {
+ // Only create a single refresh per transaction stack
+ if (((CTransactionConsumer *)m_Consumer.get())->m_TransactionList.size() == 0) {
+ CreateGenericTransactionWithConsumer(
+ __FILE__, __LINE__, m_Consumer,
+ std::bind(m_refreshCallback, inInstance),
+ std::bind(m_refreshCallback, inInstance));
+ }
+ }
+
CreateGenericTransactionWithConsumer(
__FILE__, __LINE__, m_Consumer,
std::bind(assign_to<TAnimationFloatPairList>, m_AnimationFloatPairs,
@@ -590,4 +602,9 @@ void CStudioAnimationSystem::SetConsumer(TTransactionConsumerPtr inConsumer)
{
m_Consumer = inConsumer;
}
+
+void CStudioAnimationSystem::setRefreshCallback(TRefreshCallbackFunc func)
+{
+ m_refreshCallback = func;
+}
}
diff --git a/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.h b/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.h
index df28590b..e6fdf755 100644
--- a/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.h
+++ b/src/Authoring/QT3DSDM/Systems/StudioAnimationSystem.h
@@ -53,6 +53,7 @@ class CStudioAnimationSystem : public IStudioAnimationSystem,
TSlideCorePtr m_SlideCore;
TSlideGraphCorePtr m_SlideGraphCore;
TAnimationCorePtr m_AnimationCore;
+ TRefreshCallbackFunc m_refreshCallback = nullptr;
bool m_AutoKeyframe;
// When a property has an animation associated with it, then writes
@@ -115,6 +116,8 @@ public:
void SetConsumer(TTransactionConsumerPtr inConsumer) override;
+ void setRefreshCallback(TRefreshCallbackFunc func) override;
+
private:
void OnAnimationDeleted(Qt3DSDMAnimationHandle inAnimation);
diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp
index 208b555e..dc57da8a 100644
--- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp
+++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp
@@ -1859,12 +1859,26 @@ void FbxDomWalker::ProcessTextureParameter(FbxTexture *inTexture,
{
if (inTexture) {
outTextureParameters.m_Flag = true;
- outTextureParameters.m_offsetU.m_Value = (float)inTexture->GetTranslationU();
- outTextureParameters.m_offsetV.m_Value = (float)inTexture->GetTranslationV();
- if (inTexture->GetWrapModeU() == FbxTexture::eRepeat)
+ outTextureParameters.m_offsetU.SetValue(inTexture->GetTranslationU());
+ outTextureParameters.m_offsetV.SetValue(inTexture->GetTranslationV());
+ outTextureParameters.m_repeatU.SetValue(inTexture->GetScaleU());
+ outTextureParameters.m_repeatV.SetValue(inTexture->GetScaleV());
+#if 0
+ // TODO: These parameters do not work correctly with current math in SetTexture, so they are
+ // ignored for now. Created a task (QT3DS-2255) to implement support later, if deemed
+ // necessary.
+ outTextureParameters.m_rotateUV.SetValue(inTexture->GetRotationW());
+ outTextureParameters.m_mirrorU.SetValue(inTexture->GetSwapUV());
+ outTextureParameters.m_mirrorV.SetValue(inTexture->GetSwapUV());
+#endif
+ if (inTexture->GetWrapModeU() == FbxTexture::eRepeat) {
outTextureParameters.m_wrapU.m_Value = 1;
- if (inTexture->GetWrapModeV() == FbxTexture::eRepeat)
+ outTextureParameters.m_wrapU.m_Flag = true;
+ }
+ if (inTexture->GetWrapModeV() == FbxTexture::eRepeat) {
outTextureParameters.m_wrapV.m_Value = 1;
+ outTextureParameters.m_wrapV.m_Flag = true;
+ }
}
}
diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp
index 25225ff2..dc8e1a80 100644
--- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp
+++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp
@@ -818,7 +818,7 @@ public:
if (inTextureParameters.m_offsetU.m_Flag) {
SetInstancePropertyValue(
theImageInstance, m_Image.m_PositionU,
- (theDefaultPivot - 1 + inTextureParameters.m_offsetU.m_Value * theCoverageU)
+ ((theDefaultPivot - 1 + inTextureParameters.m_offsetU.m_Value) * theCoverageU)
/ theScaleU);
}
// From AMXMayaExporter: do offset with pivotV and scaleV...
@@ -826,7 +826,7 @@ public:
if (inTextureParameters.m_offsetV.m_Flag) {
SetInstancePropertyValue(
theImageInstance, m_Image.m_PositionV,
- (theDefaultPivot - 1 + inTextureParameters.m_offsetV.m_Value * theCoverageV)
+ ((theDefaultPivot - 1 + inTextureParameters.m_offsetV.m_Value) * theCoverageV)
/ theScaleV);
}
diff --git a/src/Authoring/Studio/Application/ProjectFile.cpp b/src/Authoring/Studio/Application/ProjectFile.cpp
index 6dfeb5b8..051971f9 100644
--- a/src/Authoring/Studio/Application/ProjectFile.cpp
+++ b/src/Authoring/Studio/Application/ProjectFile.cpp
@@ -31,6 +31,8 @@
#include "Exceptions.h"
#include "DataInputDlg.h"
#include "StudioApp.h"
+#include "Qt3DSDMStudioSystem.h"
+#include "ClientDataModelBridge.h"
#include "Core.h"
#include "Doc.h"
#include "PresentationFile.h"
@@ -45,14 +47,37 @@ ProjectFile::ProjectFile()
// find the 1st .uia file in the current or parent directories and assume this is the project file,
// as a project should have only 1 .uia file
-void ProjectFile::ensureProjectFile(const QString &uipPath)
+void ProjectFile::ensureProjectFile()
{
- QString uiaPath = PresentationFile::findProjectFile(uipPath);
+ if (!m_fileInfo.exists()) {
+ QFileInfo uipFile(g_StudioApp.GetCore()->GetDoc()
+ ->GetDocumentPath().GetAbsolutePath().toQString());
+ QString uiaPath(PresentationFile::findProjectFile(uipFile.absoluteFilePath()));
+
+ if (uiaPath.isEmpty()) {
+ // .uia not found, create new project .uia file. Creation sets info.
+ create(uipFile.completeBaseName(), uipFile.absolutePath());
+ addPresentationNode(uipFile.absoluteFilePath());
+ updateDocPresentationId();
+ } else {
+ // .uia found, set project file info
+ m_fileInfo.setFile(uiaPath);
+ }
+ }
+}
+
+void ProjectFile::initProjectFile(const QString &presPath)
+{
+ QFileInfo uipFile(presPath);
+ QString uiaPath(PresentationFile::findProjectFile(uipFile.absoluteFilePath()));
- if (!uiaPath.isEmpty()) // uia found
+ if (uiaPath.isEmpty()) {
+ // .uia not found, clear project file info
+ m_fileInfo = QFileInfo();
+ } else {
+ // .uia found, set project file info
m_fileInfo.setFile(uiaPath);
- else
- throw ProjectFileNotFoundException();
+ }
}
/**
@@ -63,6 +88,8 @@ void ProjectFile::ensureProjectFile(const QString &uipPath)
*/
void ProjectFile::addPresentationNode(const QString &pPath, const QString &pId)
{
+ ensureProjectFile();
+
// open the uia file
QFile file(getProjectFilePath());
file.open(QIODevice::ReadWrite);
@@ -126,7 +153,7 @@ void ProjectFile::addPresentationNode(const QString &pPath, const QString &pId)
}
// get the src attribute (relative path) to the first presentation in a uia file, if no initial
-// presentation exists, the first one is returned
+// presentation exists, the first one is returned.
QString ProjectFile::getInitialPresentationSrc(const QString &uiaPath)
{
QFile file(uiaPath);
@@ -166,6 +193,8 @@ QString ProjectFile::getInitialPresentationSrc(const QString &uiaPath)
*/
void ProjectFile::writePresentationId(const QString &id, const QString &src)
{
+ ensureProjectFile();
+
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
QString theSrc = src.isEmpty() ? doc->getRelativePath() : src;
QString theId = id.isEmpty() ? doc->getPresentationId() : id;
@@ -199,22 +228,48 @@ void ProjectFile::writePresentationId(const QString &id, const QString &src)
}
}
- // overwrite the uia file
- file.resize(0);
- file.write(domDoc.toByteArray(4));
- file.close();
+ if (!oldId.isEmpty()) { // a presentation id changed
+ // overwrite the uia file
+ file.resize(0);
+ file.write(domDoc.toByteArray(4));
- // update in-memory values
- auto *sp = std::find_if(g_StudioApp.m_subpresentations.begin(),
- g_StudioApp.m_subpresentations.end(),
- [&theSrc](const SubPresentationRecord &spr) -> bool {
- return spr.m_argsOrSrc == theSrc;
- });
- if (sp != g_StudioApp.m_subpresentations.end())
- sp->m_id = theId;
+ // update m_subpresentations
+ auto *sp = std::find_if(g_StudioApp.m_subpresentations.begin(),
+ g_StudioApp.m_subpresentations.end(),
+ [&theSrc](const SubPresentationRecord &spr) -> bool {
+ return spr.m_argsOrSrc == theSrc;
+ });
+ if (sp != g_StudioApp.m_subpresentations.end())
+ sp->m_id = theId;
+
+ // update current doc instances (layers and images) that are using this presentation Id
+ auto *bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
+ qt3dsdm::IPropertySystem *propSystem = doc->GetStudioSystem()->GetPropertySystem();
+ std::function<void(qt3dsdm::Qt3DSDMInstanceHandle)>
+ parseChildren = [&](qt3dsdm::Qt3DSDMInstanceHandle instance) {
+ Q3DStudio::CGraphIterator iter;
+ GetAssetChildren(doc, instance, iter);
+
+ while (!iter.IsDone()) {
+ qt3dsdm::Qt3DSDMInstanceHandle child = iter.GetCurrent();
+ if (bridge->GetObjectType(child) & (OBJTYPE_LAYER | OBJTYPE_IMAGE)) {
+ if (bridge->GetSourcePath(child).toQString() == oldId) {
+ propSystem->SetInstancePropertyValue(child, bridge->GetSourcePathProperty(),
+ qt3dsdm::SValue(QVariant(theId)));
+ }
+ if (bridge->getSubpresentation(child).toQString() == oldId) {
+ propSystem->SetInstancePropertyValue(child,
+ bridge->getSubpresentationProperty(),
+ qt3dsdm::SValue(QVariant(theId)));
+ }
+ }
+ parseChildren(child);
+ ++iter;
+ }
+ };
+ parseChildren(doc->GetSceneInstance());
- // update changed presentation Id in all .uip files if in-use
- if (!oldId.isEmpty()) {
+ // update changed presentation Id in all .uip files if in-use
QDomNodeList pNodes = assetsElem.elementsByTagName(QStringLiteral("presentation"));
for (int i = 0; i < pNodes.count(); ++i) {
QDomElement pElem = pNodes.at(i).toElement();
@@ -225,9 +280,13 @@ void ProjectFile::writePresentationId(const QString &id, const QString &src)
}
}
-// set the doc PresentationId from the project file, this is called after a document is loaded
+// Set the doc PresentationId from the project file, this is called after a document is loaded.
+// If there is no project file, does nothing.
void ProjectFile::updateDocPresentationId()
{
+ if (!m_fileInfo.exists())
+ return;
+
QFile file(getProjectFilePath());
file.open(QFile::Text | QFile::ReadOnly);
if (!file.isOpen()) {
@@ -254,6 +313,9 @@ void ProjectFile::updateDocPresentationId()
// get a presentationId that match a given src attribute
QString ProjectFile::getPresentationId(const QString &src) const
{
+ if (!m_fileInfo.exists())
+ return {};
+
if (src == g_StudioApp.GetCore()->GetDoc()->getRelativePath()) {
return g_StudioApp.GetCore()->GetDoc()->getPresentationId();
} else {
@@ -270,8 +332,7 @@ QString ProjectFile::getPresentationId(const QString &src) const
}
// create the project .uia file
-void ProjectFile::create(const QString &projectName,
- const Q3DStudio::CFilePath &projectPath)
+void ProjectFile::create(const QString &projectName, const QString &projectPath)
{
QDomDocument doc;
doc.setContent(QStringLiteral("<?xml version=\"1.0\" encoding=\"utf-8\"?>"
@@ -287,8 +348,7 @@ void ProjectFile::create(const QString &projectName,
"</statemachine>"
"</application>"));
- QString uiaPath = projectPath.toQString() + QStringLiteral("/") + projectName
- + QStringLiteral(".uia");
+ QString uiaPath = projectPath + QStringLiteral("/") + projectName + QStringLiteral(".uia");
QFile file(uiaPath);
file.open(QIODevice::WriteOnly);
@@ -303,11 +363,22 @@ void ProjectFile::create(const QString &projectName,
* Clone the project file with a preview suffix and set the initial attribute to the currently
* open document
*
- * @return path to the preview project file
+ * @return path to the preview project file. Return path to .uip or preview .uip file if there
+ * is no project file.
*/
QString ProjectFile::createPreview()
{
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
+ QString uipPrvPath = doc->GetDocumentPath().GetAbsolutePath().toQString();
+ // create a preview uip if doc modified
+ if (doc->IsModified()) {
+ uipPrvPath.replace(QLatin1String(".uip"), QLatin1String("_@preview@.uip"));
+ g_StudioApp.GetCore()->OnSaveDocument(uipPrvPath, true);
+ }
+
+ if (!m_fileInfo.exists())
+ return uipPrvPath;
+
QString prvPath = getProjectFilePath();
prvPath.replace(QLatin1String(".uia"), QLatin1String("_@preview@.uia"));
@@ -325,12 +396,8 @@ QString ProjectFile::createPreview()
assetsElem.setAttribute(QStringLiteral("initial"),
doc->getPresentationId());
- // create a preview uip if doc modified
if (doc->IsModified()) {
- QString uipPrvPath = doc->GetDocumentPath().GetAbsolutePath().toQString();
- uipPrvPath.replace(QLatin1String(".uip"), QLatin1String("_@preview@.uip"));
- g_StudioApp.GetCore()->OnSaveDocument(uipPrvPath, true);
-
+ // Set the preview uip path in the uia file
QDomNodeList pNodes = assetsElem.elementsByTagName(QStringLiteral("presentation"));
for (int i = 0; i < pNodes.count(); ++i) {
QDomElement pElem = pNodes.at(i).toElement();
@@ -357,6 +424,9 @@ void ProjectFile::loadSubpresentationsAndDatainputs(
QVector<SubPresentationRecord> &subpresentations,
QMap<QString, CDataInputDialogItem *> &datainputs)
{
+ if (!m_fileInfo.exists())
+ return;
+
subpresentations.clear();
datainputs.clear();
@@ -421,6 +491,9 @@ void ProjectFile::loadSubpresentationsAndDatainputs(
*/
bool ProjectFile::isUniquePresentationId(const QString &id, const QString &src) const
{
+ if (!m_fileInfo.exists())
+ return true;
+
QString theSrc = src.isEmpty() ? g_StudioApp.GetCore()->GetDoc()->getRelativePath() : src;
bool isCurrDoc = theSrc == g_StudioApp.GetCore()->GetDoc()->getRelativePath();
@@ -437,7 +510,10 @@ bool ProjectFile::isUniquePresentationId(const QString &id, const QString &src)
QString ProjectFile::ensureUniquePresentationId(const QString &id) const
{
- QFile file(getProjectFilePath());
+ if (!m_fileInfo.exists())
+ return id;
+
+ QFile file(m_fileInfo.filePath());
file.open(QIODevice::ReadOnly);
QDomDocument doc;
doc.setContent(&file);
@@ -465,21 +541,33 @@ QString ProjectFile::ensureUniquePresentationId(const QString &id) const
return newId;
}
-// Get the path to the project root
+// Get the path to the project root. If .uia doesn't exist, return path to current presentation.
QString ProjectFile::getProjectPath() const
{
- return m_fileInfo.path();
+ if (m_fileInfo.exists()) {
+ return m_fileInfo.path();
+ } else {
+ return QFileInfo(g_StudioApp.GetCore()->GetDoc()
+ ->GetDocumentPath().GetAbsolutePath().toQString()).absolutePath();
+ }
}
-// Get the path to the project's .uia file
+// Get the path to the project's .uia file. If .uia doesn't exist, return empty string.
QString ProjectFile::getProjectFilePath() const
{
- return m_fileInfo.filePath();
+ if (m_fileInfo.exists())
+ return m_fileInfo.filePath();
+ else
+ return {};
}
+// Returns current project name or empty string if there is no .uia file
QString ProjectFile::getProjectName() const
{
- return m_fileInfo.completeBaseName();
+ if (m_fileInfo.exists())
+ return m_fileInfo.completeBaseName();
+ else
+ return {};
}
/**
diff --git a/src/Authoring/Studio/Application/ProjectFile.h b/src/Authoring/Studio/Application/ProjectFile.h
index 2cf01572..effc0c98 100644
--- a/src/Authoring/Studio/Application/ProjectFile.h
+++ b/src/Authoring/Studio/Application/ProjectFile.h
@@ -43,17 +43,16 @@ class ProjectFile
public:
ProjectFile();
- void create(const QString &projectName,
- const Q3DStudio::CFilePath &projectPath);
- void ensureProjectFile(const QString &uipPath);
+ void create(const QString &projectName, const QString &projectPath);
+ void ensureProjectFile();
+ void initProjectFile(const QString &presPath);
void loadSubpresentationsAndDatainputs(
QVector<SubPresentationRecord> &subpresentations,
QMap<QString, CDataInputDialogItem *> &datainputs);
void writePresentationId(const QString &id, const QString &src = {});
void updateDocPresentationId();
void addPresentationNode(const QString &uip, const QString &pId = {});
- bool isUniquePresentationId(const QString &id,
- const QString &src = {}) const;
+ bool isUniquePresentationId(const QString &id, const QString &src = {}) const;
QString getProjectPath() const;
QString getProjectFilePath() const;
QString getProjectName() const;
diff --git a/src/Authoring/Studio/Application/StudioApp.cpp b/src/Authoring/Studio/Application/StudioApp.cpp
index eb071391..3e26e85d 100644
--- a/src/Authoring/Studio/Application/StudioApp.cpp
+++ b/src/Authoring/Studio/Application/StudioApp.cpp
@@ -315,9 +315,11 @@ bool CStudioApp::initInstance(const QCommandLineParser &parser)
thePreferencesPath, CFilePath(L"Qt3DSComposer\\Preferences.setting"));
CPreferences::SetPreferencesFile(thePreferencesPath);
- // Initialize help file path
- m_pszHelpFilePath = Qt3DSFile::GetApplicationDirectory().GetPath() +
- Q3DStudio::CString("/../doc/qt3dstudio/qt3dstudio-index.html");
+ // Initialize help file paths
+ m_helpFilePath = Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
+ QStringLiteral("/../doc/qt3dstudio/qt3dstudio-index.html");
+ m_gettingStartedFilePath = Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
+ QStringLiteral("/../doc/qt3dstudio/getting-started.html");
CStudioPreferences::LoadPreferences();
@@ -398,83 +400,88 @@ bool CStudioApp::run(const QCommandLineParser &parser)
bool CStudioApp::handleWelcomeRes(int res, bool recursive)
{
bool theReturn = true;
+ bool canceled = false;
switch (res) {
case StudioTutorialWidget::createNewResult: {
- Qt3DSFile theFile(m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir()));
- if (theFile.GetPath() != "") {
- if (!m_core->OnNewDocument(theFile, true)) {
- // Invalid filename, show a message box and the startup dialog
- showInvalidFilenameWarning();
- theReturn = showStartupDialog();
+ if (PerformSavePrompt()) {
+ Qt3DSFile theFile(m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir()));
+ if (theFile.GetPath() != "") {
+ if (!m_core->OnNewDocument(theFile, true)) {
+ // Invalid filename, show a message box and the startup dialog
+ showInvalidFilenameWarning();
+ theReturn = showStartupDialog();
+ } else {
+ theReturn = true;
+ m_welcomeShownThisSession = true;
+ }
} else {
- theReturn = true;
- m_welcomeShownThisSession = true;
+ canceled = true;
}
} else {
- // User Cancels the dialog. Show the welcome screen.
- if (recursive) {
- m_welcomeShownThisSession = false;
- m_goStraightToWelcomeFileDialog = true;
- theReturn = showStartupDialog();
- } else {
- theReturn = false;
- }
+ canceled = true;
}
} break;
case StudioTutorialWidget::openSampleResult: {
- // Try three options:
- // - open a specific example .uip
- // - failing that, show the main example root dir
- // - failing all previous, show default Documents dir
- QFileInfo filePath;
- QString theFile(QStringLiteral("."));
+ if (PerformSavePrompt()) {
+ // Try three options:
+ // - open a specific example .uip
+ // - failing that, show the main example root dir
+ // - failing all previous, show default Documents dir
+ QFileInfo filePath;
+ QString theFile(QStringLiteral("."));
#ifndef Q_OS_MACOS
- filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../examples/studio3d/SampleProject"));
-
- if (!filePath.exists()) {
filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../examples/studio3d"));
-#else
- filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../../../../examples/studio3d/SampleProject"));
+ QStringLiteral("/../examples/studio3d/SampleProject"));
- if (!filePath.exists()) {
+ if (!filePath.exists()) {
+ filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
+ QStringLiteral("/../examples/studio3d"));
+#else
filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../../../../examples/studio3d"));
-#endif
+ QStringLiteral("/../../../../examples/studio3d/SampleProject"));
+
if (!filePath.exists()) {
- filePath.setFile(QStandardPaths::writableLocation(
- QStandardPaths::DocumentsLocation));
+ filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
+ QStringLiteral("/../../../../examples/studio3d"));
+#endif
+ if (!filePath.exists()) {
+ filePath.setFile(QStandardPaths::writableLocation(
+ QStandardPaths::DocumentsLocation));
+ }
+ theFile = m_dialogs->GetFileOpenChoice(filePath.absoluteFilePath());
+ } else {
+ theFile = filePath.absoluteFilePath() + QStringLiteral("/SampleProject.uip");
}
- theFile = m_dialogs->GetFileOpenChoice(filePath.absoluteFilePath());
- } else {
- theFile = filePath.absoluteFilePath() + QStringLiteral("/SampleProject.uip");
- }
- if (!theFile.isEmpty()) {
- OnLoadDocument(theFile);
- theReturn = true;
- m_welcomeShownThisSession = true;
- } else {
- // User Cancels the dialog. Show the welcome screen.
- if (recursive) {
- m_welcomeShownThisSession = false;
- m_goStraightToWelcomeFileDialog = true;
- theReturn = showStartupDialog();
+ if (!theFile.isEmpty()) {
+ OnLoadDocument(theFile);
+ theReturn = true;
+ m_welcomeShownThisSession = true;
} else {
- theReturn = false;
+ canceled = true;
}
+ } else {
+ canceled = true;
}
} break;
-
default:
- ASSERT(false); // Should not reach this block.
+ // Welcome screen was simply closed
theReturn = false;
break;
}
+
+ if (canceled) {
+ // User Cancels the dialog. Show the welcome screen.
+ if (recursive) {
+ m_welcomeShownThisSession = false;
+ m_goStraightToWelcomeFileDialog = true;
+ theReturn = showStartupDialog();
+ } else {
+ theReturn = false;
+ }
+ }
return theReturn;
}
@@ -532,7 +539,7 @@ bool CStudioApp::showStartupDialog()
}
if (show) {
- StudioTutorialWidget tutorial(m_pMainWnd, m_goStraightToWelcomeFileDialog, true);
+ StudioTutorialWidget tutorial(m_pMainWnd);
welcomeRes = tutorial.exec();
}
}
@@ -1627,9 +1634,7 @@ bool CStudioApp::OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupD
m_views->getMainFrame()->showScene();
try {
- Q3DStudio::CFilePath docFilePath(inDocument.GetAbsolutePath());
- // make sure a project (a .uia file) exists
- m_core->getProjectFile().ensureProjectFile(docFilePath.toQString());
+ m_core->getProjectFile().initProjectFile(loadDocument.GetAbsolutePath().toQString());
OnLoadDocumentCatcher(loadDocument);
m_core->GetDispatch()->FireOnOpenDocument(loadDocument, true);
// Loading was successful
@@ -1709,6 +1714,7 @@ bool CStudioApp::OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupD
void CStudioApp::saveDataInputsToProjectFile()
{
// open the uia file
+ m_core->getProjectFile().ensureProjectFile();
QFile file(m_core->getProjectFile().getProjectFilePath());
file.open(QIODevice::ReadWrite);
QDomDocument doc;
@@ -2035,9 +2041,11 @@ QSize CStudioApp::getRenderableSize(const QString &renderableId)
r.m_size = PresentationFile::readSize(path);
} else { // QML stream
QQmlApplicationEngine qmlEngine(path);
- QQuickItem *item = qobject_cast<QQuickItem *>(qmlEngine.rootObjects().at(0));
- if (item)
- r.m_size = QSize(qRound(item->width()), qRound(item->height()));
+ if (qmlEngine.rootObjects().size() > 0) {
+ QQuickItem *item = qobject_cast<QQuickItem *>(qmlEngine.rootObjects().at(0));
+ if (item)
+ r.m_size = QSize(qRound(item->width()), qRound(item->height()));
+ }
}
}
return r.m_size;
@@ -2063,32 +2071,38 @@ void CStudioApp::OnUndefinedDatainputsFail(
void CStudioApp::toggleEyeball()
{
- CDoc *theDoc = m_core->GetDoc();
- qt3dsdm::IPropertySystem *propertySystem = theDoc->GetStudioSystem()->GetPropertySystem();
- qt3dsdm::TInstanceHandleList selectedInstances
- = theDoc->GetSelectedValue().GetSelectedInstances();
-
- if (selectedInstances.size() > 0) {
- Q3DStudio::ScopedDocumentEditor editor(*theDoc,
- L"Visibility Toggle",
- __FILE__, __LINE__);
- bool boolValue = false;
- SValue value;
- for (size_t idx = 0, end = selectedInstances.size(); idx < end; ++idx) {
- qt3dsdm::Qt3DSDMInstanceHandle handle(selectedInstances[idx]);
-
- if (handle.Valid()) {
- qt3dsdm::Qt3DSDMPropertyHandle property
- = theDoc->GetStudioSystem()->GetClientDataModelBridge()
- ->GetSceneAsset().m_Eyeball;
- if (value.empty()) {
- // First valid handle selects if all are hidden/unhidden
- propertySystem->GetInstancePropertyValue(handle, property, value);
- boolValue = !qt3dsdm::get<bool>(value);
- }
- editor->SetInstancePropertyValue(handle, property, boolValue);
- }
- }
+ CDoc *doc = m_core->GetDoc();
+ if (doc->getSelectedInstancesCount() > 0) {
+ qt3dsdm::Qt3DSDMPropertyHandle property
+ = doc->GetStudioSystem()->GetClientDataModelBridge()->GetSceneAsset().m_Eyeball;
+ SCOPED_DOCUMENT_EDITOR(*doc, tr("Visibility Toggle"))
+ ->toggleBoolPropertyOnSelected(property);
+ }
+}
+
+void CStudioApp::toggleShy()
+{
+ CDoc *doc = m_core->GetDoc();
+ if (doc->getSelectedInstancesCount() > 0) {
+ qt3dsdm::Qt3DSDMPropertyHandle property
+ = doc->GetStudioSystem()->GetClientDataModelBridge()->GetSceneAsset().m_Shy;
+ SCOPED_DOCUMENT_EDITOR(*doc, tr("Shy Toggle"))
+ ->toggleBoolPropertyOnSelected(property);
+ }
+}
+
+void CStudioApp::toggleLocked()
+{
+ CDoc *doc = m_core->GetDoc();
+ if (doc->getSelectedInstancesCount() > 0) {
+ qt3dsdm::Qt3DSDMPropertyHandle property
+ = doc->GetStudioSystem()->GetClientDataModelBridge()->GetSceneAsset().m_Locked;
+ SCOPED_DOCUMENT_EDITOR(*doc, tr("Locked Toggle"))
+ ->toggleBoolPropertyOnSelected(property);
+
+ // Since you are not supposed to be able to select locked objects,
+ // we just assume anything toggled was actually locked and deselect everything
+ doc->DeselectAllItems();
}
}
diff --git a/src/Authoring/Studio/Application/StudioApp.h b/src/Authoring/Studio/Application/StudioApp.h
index 958daa9e..131b90bc 100644
--- a/src/Authoring/Studio/Application/StudioApp.h
+++ b/src/Authoring/Studio/Application/StudioApp.h
@@ -97,6 +97,7 @@ public:
#if (defined Q_OS_MACOS)
void openApplication(const QString &inFilename);
#endif
+ bool handleWelcomeRes(int res, bool recursive);
public Q_SLOTS:
void handleMessageReceived(const QString &message, QObject *socket);
@@ -110,7 +111,6 @@ protected:
bool isNewProject = true);
void initCore();
bool showStartupDialog();
- bool handleWelcomeRes(int res, bool recursive);
QString resolvePresentationFile(const QString &inFile);
CCore *m_core;
@@ -217,6 +217,8 @@ public:
void SetAutosaveEnabled(bool enabled);
void SetAutosaveInterval(int interval);
void toggleEyeball();
+ void toggleShy();
+ void toggleLocked();
void showPresentationIdUniqueWarning();
void showInvalidFilenameWarning();
void checkDeletedDatainputs();
@@ -250,7 +252,8 @@ public:
void OnNewPresentation() override;
void OnPresentationModifiedExternally() override;
- Q3DStudio::CString m_pszHelpFilePath;
+ QString m_helpFilePath;
+ QString m_gettingStartedFilePath;
QVector<SubPresentationRecord> m_subpresentations;
QMap<QString, CDataInputDialogItem *> m_dataInputDialogItems;
diff --git a/src/Authoring/Studio/Application/StudioTutorialWidget.cpp b/src/Authoring/Studio/Application/StudioTutorialWidget.cpp
index c6240531..bb80e7bf 100644
--- a/src/Authoring/Studio/Application/StudioTutorialWidget.cpp
+++ b/src/Authoring/Studio/Application/StudioTutorialWidget.cpp
@@ -28,165 +28,69 @@
#include "StudioTutorialWidget.h"
#include "ui_StudioTutorialWidget.h"
#include "StudioUtils.h"
+#include "StudioApp.h"
+#include "StudioPreferences.h"
#include <QtWidgets/qdesktopwidget.h>
#include <QtGui/qpainter.h>
+#include <QtGui/qbrush.h>
+#include <QtCore/qtimer.h>
+#include <QtGui/qdesktopservices.h>
+#include <QtCore/qurl.h>
-StudioTutorialWidget::StudioTutorialWidget(QWidget *parent, bool goToFileDialog,
- bool showProjectButtons) :
+StudioTutorialWidget::StudioTutorialWidget(QWidget *parent) :
QDialog(parent, Qt::MSWindowsFixedSizeDialogHint),
- m_ui(new Ui::StudioTutorialWidget),
- m_welcomeImages(0),
- m_imgIter(0),
- m_palette(0),
- m_displayScale(1.0),
- m_showProjectButtons(showProjectButtons)
+ m_ui(new Ui::StudioTutorialWidget)
{
m_ui->setupUi(this);
- connect(m_ui->studioTutorialBack, &QPushButton::clicked, this,
- &StudioTutorialWidget::handleBack);
- connect(m_ui->studioTutorialForward, &QPushButton::clicked, this,
- &StudioTutorialWidget::handleFwd);
- connect(m_ui->pageIndicator, &StudioTutorialPageIndicator::indexChanged, this,
- &StudioTutorialWidget::handleIndexChange);
connect(m_ui->studioTutorialShowAgain, &QCheckBox::stateChanged, this,
&StudioTutorialWidget::handleDoNotShowAgainChange);
connect(m_ui->studioTutorialNew, &QPushButton::clicked, this,
&StudioTutorialWidget::handleCreateNew);
connect(m_ui->studioTutorialOpen, &QPushButton::clicked, this,
&StudioTutorialWidget::handleOpenSample);
+ connect(m_ui->studioTutorialQuickStart, &QPushButton::clicked, this,
+ &StudioTutorialWidget::handleQuickStartGuide);
- OnInitDialog(goToFileDialog);
+ QTimer::singleShot(0, this, &StudioTutorialWidget::OnInitDialog);
- if (m_showProjectButtons)
- m_ui->studioTutorialNew->setText(tr("Create New"));
- else
- m_ui->studioTutorialNew->setText(tr("OK"));
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
StudioTutorialWidget::~StudioTutorialWidget()
{
delete m_ui;
- delete m_welcomeImages;
- delete m_palette;
+ delete m_backgroundPalette;
}
-void StudioTutorialWidget::OnInitDialog(bool goToFileDialog)
+void StudioTutorialWidget::OnInitDialog()
{
- m_welcomeImages = new QList<QString>();
-
- // populate welcome screen images
- getImageList();
- m_imgIter = m_welcomeImages->begin();
- m_imgIterPrev = m_imgIter;
- m_pageOutPixmap = getScaledPic(m_imgIterPrev);
- m_pageInPixmap = getScaledPic(m_imgIter);
- m_backgroundPixmap = QPixmap(":/images/Tutorial/background.png");
-
- // based on background PNG, get the scale that we need to fit welcome
- // screen and buttons comfortably on display
- m_displayScale = getDisplayScalingForImage(m_backgroundPixmap);
- QSize backgroundSize = m_backgroundPixmap.size();
+ QSize backgroundSize = size();
QRect screenRect = QApplication::desktop()->availableGeometry(
QApplication::desktop()->screenNumber(this));
QSize windowSize = screenRect.size();
- m_ui->verticalWidget->setFixedSize(backgroundSize);
-
move(screenRect.x() + (windowSize.width() - backgroundSize.width()) / 2,
screenRect.y() + (windowSize.height() - backgroundSize.height()) / 2);
- // do we go straight to last page with file dialog buttons?
- int initPage = goToFileDialog ? m_welcomeImages->size() - 1 : 0;
- m_imgIter = m_welcomeImages->begin() + initPage;
- updateButtons();
+ setFixedSize(backgroundSize);
QSettings settings;
m_ui->studioTutorialShowAgain->setChecked(!settings.value("showWelcomeScreen").toBool());
-
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-}
-
-void StudioTutorialWidget::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event)
-
- QPainter painter(this);
-
- if (!m_palette) {
- m_palette = new QPalette;
- m_palette->setBrush(QPalette::Window, m_backgroundPixmap);
- setPalette(*m_palette);
- resize(m_backgroundPixmap.size());
- setFixedSize(size());
- }
-
- // Make tutorial images to scale to full background width, vertically centered,
- // while keeping correct aspect ratio
- qreal aspectRatio = (qreal) m_pageInPixmap.height() / m_pageInPixmap.width();
- int rectHeight = size().width() * aspectRatio;
- QRect rect(0, (size().height() / 2) - (rectHeight / 2),
- size().width(), rectHeight);
-
- qreal pageOutOpacity = 1.0 - m_pageInOpacity;
-
- if (pageOutOpacity > 0.0) {
- painter.setOpacity(pageOutOpacity);
- painter.drawPixmap(rect, m_pageOutPixmap);
- }
- if (m_pageInOpacity > 0.0) {
- painter.setOpacity(m_pageInOpacity);
- painter.drawPixmap(rect, m_pageInPixmap);
- }
-
- if (m_pageInOpacity < 1.0) {
- // Page switching animation still going on
- qreal opacityAnimationStep = qreal(m_opacityTime.restart()) / 300.0;
- m_pageInOpacity += opacityAnimationStep;
- m_pageInOpacity = qMin(m_pageInOpacity, 1.0);
- update();
- }
-}
-
-void StudioTutorialWidget::animateInOut()
-{
- m_pageOutPixmap = getScaledPic(m_imgIterPrev);
- m_pageInPixmap = getScaledPic(m_imgIter);
- m_pageInOpacity = 0.0;
- m_opacityTime.start();
- update();
-}
-
-void StudioTutorialWidget::handleFwd()
-{
- if (*m_imgIter != m_welcomeImages->last()) {
- m_imgIterPrev = m_imgIter;
- m_imgIter++;
- updateButtons();
- animateInOut();
- }
-}
-
-void StudioTutorialWidget::handleBack()
-{
- if (*m_imgIter != m_welcomeImages->first()) {
- m_imgIterPrev = m_imgIter;
- m_imgIter--;
- updateButtons();
- animateInOut();
- }
+ m_backgroundPalette = new QPalette(palette());
+ QPixmap background(size());
+ QPainter backgroundPainter(&background);
+ QLinearGradient gradient = CStudioPreferences::welcomeBackgroundGradient();
+ gradient.setFinalStop(background.width(), 0.0);
+ backgroundPainter.fillRect(background.rect(), gradient);
+ QPixmap laptop(":/images/welcomedialog/laptop.png");
+ backgroundPainter.drawPixmap(0, 100, laptop.width(), laptop.height(), laptop);
+ backgroundPainter.end();
+ m_backgroundPalette->setBrush(backgroundRole(), QBrush(background));
+ setAutoFillBackground(true);
+ setPalette(*m_backgroundPalette);
}
-void StudioTutorialWidget::handleIndexChange(int index)
-{
- index = qBound(0, index, m_welcomeImages->size() - 1);
- if (index != page()) {
- m_imgIterPrev = m_imgIter;
- m_imgIter = m_welcomeImages->begin() + index;
- updateButtons();
- animateInOut();
- }
-}
void StudioTutorialWidget::handleDoNotShowAgainChange(int state)
{
@@ -205,79 +109,9 @@ void StudioTutorialWidget::handleCreateNew()
this->done(StudioTutorialWidget::createNewResult);
}
-void StudioTutorialWidget::getImageList()
-{
- QString imagePath = QStringLiteral(":/images/Tutorial/screens/1x");
-
- // Use @2x images for hiDPI displays
- if (devicePixelRatio() > 1.0)
- imagePath = QStringLiteral(":/images/Tutorial/screens/2x");
-
- QDirIterator *it = new QDirIterator(imagePath, QDirIterator::NoIteratorFlags);
-
- while (it->hasNext())
- m_welcomeImages->append(it->next());
-
- m_ui->pageIndicator->setCount(m_welcomeImages->size());
-}
-
-int StudioTutorialWidget::page() const
+void StudioTutorialWidget::handleQuickStartGuide()
{
- int i = 0;
- QList<QString>::iterator iter = m_welcomeImages->begin();
- while (iter != m_imgIter) { ++i; iter++; }
- return i;
-}
-
-QPixmap StudioTutorialWidget::getScaledPic(const QList<QString>::iterator &iter)
-{
- QPixmap picOrig = QPixmap(*iter);
- QPixmap pic = picOrig;
- if (m_displayScale < 1.0) {
- // Limit to the maximum size of @2x images
- pic = picOrig.scaledToHeight(qMin(1200.0, m_displayScale * picOrig.height()),
- Qt::SmoothTransformation);
- }
-
- pic.setDevicePixelRatio(devicePixelRatio());
- return pic;
-}
-
-qreal StudioTutorialWidget::getDisplayScalingForImage(const QPixmap &picOrig)
-{
- // Note that high DPI scaling has an effect on the display
- // resolution returned by QApplication::desktop()->availableGeometry().
- // DPI scaling factor is integer and taken from the primary screen.
- // When running studio on secondary monitor with different DPI,
- // or running it on primary with non-integer scaling, we might
- // get different dialog size than intended.
- QSize displaySize = QApplication::desktop()->availableGeometry(
- QApplication::desktop()->screenNumber(this)).size();
-
- // Scale down if images do not fit on screen, otherwise use
- // 1:1 PNGs to avoid scaling artifacts. Scale to 90% of the display size if scaling is needed.
- if (picOrig.height() > displaySize.height() || picOrig.width() > displaySize.width()) {
- QSize picScaledSize = picOrig.size();
- picScaledSize.scale(displaySize * 0.9, Qt::KeepAspectRatio);
- m_displayScale = qMin((qreal)picScaledSize.height() / (qreal)picOrig.height(),
- (qreal)picScaledSize.width() / (qreal)picOrig.width());
- return m_displayScale;
- } else {
- return 1.0;
- }
-}
-
-void StudioTutorialWidget::updateButtons()
-{
- bool isFirst = (*m_imgIter == m_welcomeImages->first());
- bool isLast = (*m_imgIter == m_welcomeImages->last());
-
- m_ui->studioTutorialBack->setVisible(!isFirst);
- m_ui->studioTutorialForward->setVisible(!isLast);
- m_ui->studioTutorialOpen->setVisible(isLast && m_showProjectButtons);
- m_ui->studioTutorialNew->setVisible(isLast);
- m_ui->studioTutorialShowAgain->setVisible(isFirst);
- m_ui->checkBoxLabel->setVisible(isFirst);
-
- m_ui->pageIndicator->setCurrentIndex(page());
+ QFile theFile(g_StudioApp.m_gettingStartedFilePath);
+ if (theFile.exists())
+ QDesktopServices::openUrl(QUrl::fromLocalFile(theFile.fileName()));
}
diff --git a/src/Authoring/Studio/Application/StudioTutorialWidget.h b/src/Authoring/Studio/Application/StudioTutorialWidget.h
index e55f5efb..8cd8ca0f 100644
--- a/src/Authoring/Studio/Application/StudioTutorialWidget.h
+++ b/src/Authoring/Studio/Application/StudioTutorialWidget.h
@@ -51,7 +51,7 @@ class StudioTutorialWidget : public QDialog
{
Q_OBJECT
public:
- explicit StudioTutorialWidget(QWidget *parent, bool goToFileDialog, bool showProjectButtons);
+ explicit StudioTutorialWidget(QWidget *parent);
~StudioTutorialWidget();
@@ -63,42 +63,17 @@ public:
};
protected:
- void paintEvent(QPaintEvent *event) override;
- void OnInitDialog(bool goToFileDialog);
+ void OnInitDialog();
public:
- void handleFwd();
- void handleBack();
- void handleIndexChange(int index);
void handleDoNotShowAgainChange(int state);
void handleOpenSample();
void handleCreateNew();
- int page() const;
+ void handleQuickStartGuide();
private:
Ui::StudioTutorialWidget *m_ui;
-
- QList<QString> *m_welcomeImages;
- QList<QString>::iterator m_imgIter;
- QList<QString>::iterator m_imgIterPrev;
-
- QPalette *m_palette;
- QPixmap m_pageInPixmap;
- QPixmap m_pageOutPixmap;
- QPixmap m_backgroundPixmap;
-
- qreal m_displayScale;
- qreal m_pageInOpacity = 0.0;
- QTime m_opacityTime;
-
- bool m_showProjectButtons;
-
- void getImageList();
- void updateButtons();
- void animateInOut();
-
- QPixmap getScaledPic(const QList<QString>::iterator &iter);
- qreal getDisplayScalingForImage(const QPixmap &picOrig);
+ QPalette *m_backgroundPalette = nullptr;
};
#endif // STUDIOTUTORIALWIDGET_H
diff --git a/src/Authoring/Studio/Application/StudioTutorialWidget.ui b/src/Authoring/Studio/Application/StudioTutorialWidget.ui
index f7e9dd64..2bef1ed8 100644
--- a/src/Authoring/Studio/Application/StudioTutorialWidget.ui
+++ b/src/Authoring/Studio/Application/StudioTutorialWidget.ui
@@ -9,12 +9,12 @@
<rect>
<x>0</x>
<y>0</y>
- <width>1440</width>
- <height>900</height>
+ <width>1200</width>
+ <height>700</height>
</rect>
</property>
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -25,7 +25,10 @@
<property name="accessibleName">
<string>StudioTutorialWidget</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
<property name="leftMargin">
<number>0</number>
</property>
@@ -38,186 +41,58 @@
<property name="bottomMargin">
<number>0</number>
</property>
- <item row="0" column="0">
- <widget class="QWidget" name="verticalWidget" native="true">
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="checkboxLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetNoConstraint</enum>
+ <item>
+ <widget class="QWidget" name="studioTutorialBackground" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QWidget" name="CheckboxLayout" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <item>
- <widget class="QCheckBox" name="studioTutorialShowAgain">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="accessibleName">
- <string>studioTutorialShowAgain</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="checkBoxLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Do Not Show This Again</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QWidget" name="topBar" native="true">
- <layout class="QHBoxLayout" name="topBarLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="sizeConstraint">
- <enum>QLayout::SetMaximumSize</enum>
- </property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QPushButton" name="studioTutorialBack">
- <property name="maximumSize">
- <size>
- <width>39</width>
- <height>39</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
+ <widget class="QCheckBox" name="studioTutorialShowAgain">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
<property name="accessibleName">
- <string>studioTutorialBack</string>
+ <string>studioTutorialShowAgain</string>
</property>
<property name="text">
<string/>
</property>
- <property name="icon">
- <iconset resource="../images.qrc">
- <normaloff>:/images/Tutorial/button_back.png</normaloff>:/images/Tutorial/button_back.png</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>39</width>
- <height>39</height>
- </size>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>323</width>
- <height>46</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="studioTutorialForward">
+ <widget class="QLabel" name="checkBoxLabel">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="maximumSize">
- <size>
- <width>39</width>
- <height>39</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="accessibleName">
- <string>StudioTutorialWidget</string>
- </property>
<property name="text">
- <string/>
+ <string>Do Not Show This Again</string>
</property>
- <property name="icon">
- <iconset resource="../images.qrc">
- <normaloff>:/images/Tutorial/button_next.png</normaloff>:/images/Tutorial/button_next.png</iconset>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
- <property name="iconSize">
- <size>
- <width>39</width>
- <height>39</height>
- </size>
- </property>
- <property name="flat">
+ <property name="wordWrap">
<bool>true</bool>
</property>
</widget>
@@ -225,11 +100,14 @@
</layout>
</widget>
</item>
- <item>
- <spacer name="verticalSpacer">
+ <item row="0" column="1">
+ <spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
@@ -238,102 +116,275 @@
</property>
</spacer>
</item>
- <item>
- <widget class="QWidget" name="bottomBar" native="true">
- <layout class="QHBoxLayout" name="bottomBarLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetMaximumSize</enum>
- </property>
- <item>
- <widget class="QWidget" name="leftSpacer">
- <property name="minimumSize">
- <size>
- <width>160</width>
- <height>80</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="StudioTutorialPageIndicator" name="pageIndicator" native="true">
- <property name="minimumSize">
- <size>
- <width>200</width>
- <height>40</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QWidget" name="buttonsArea" native="true">
- <property name="minimumSize">
- <size>
- <width>160</width>
- <height>80</height>
- </size>
- </property>
- <layout class="QVBoxLayout" name="buttons">
- <item>
- <widget class="QPushButton" name="studioTutorialOpen">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="accessibleName">
- <string>studioTutorialOpen</string>
- </property>
- <property name="text">
- <string>Open Sample Project</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="studioTutorialNew">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="accessibleName">
- <string>studioTutorialNew</string>
- </property>
- <property name="text">
- <string>Create New</string>
+ <item row="1" column="1">
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>150</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>685</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QWidget" name="studioLabel" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="studioTutorialWelcome">
+ <property name="font">
+ <font>
+ <family>Titillium Web</family>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Welcome to</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="studioTutorialName">
+ <property name="font">
+ <font>
+ <family>Titillium Web</family>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Qt 3D Studio</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QWidget" name="buttonsContainer" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QWidget" name="buttonsArea" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>160</width>
+ <height>80</height>
+ </size>
+ </property>
+ <layout class="QVBoxLayout" name="buttons">
+ <property name="spacing">
+ <number>18</number>
</property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
+ <item>
+ <widget class="QPushButton" name="studioTutorialQuickStart">
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="accessibleName">
+ <string>studioTutorialNew</string>
+ </property>
+ <property name="text">
+ <string>Quick Start Guide</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="studioTutorialOpen">
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="accessibleName">
+ <string>studioTutorialOpen</string>
+ </property>
+ <property name="text">
+ <string>Open Example Project</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="studioTutorialNew">
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="accessibleName">
+ <string>studioTutorialNew</string>
+ </property>
+ <property name="text">
+ <string>Create New Project</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="2">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>200</height>
+ </size>
+ </property>
+ </spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>StudioTutorialPageIndicator</class>
- <extends>QWidget</extends>
- <header>StudioTutorialPageIndicator.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources>
- <include location="../images.qrc"/>
- </resources>
+ <resources/>
<connections/>
</ui>
diff --git a/src/Authoring/Studio/DragAndDrop/BasicObjectDropSource.cpp b/src/Authoring/Studio/DragAndDrop/BasicObjectDropSource.cpp
index b0ffd273..6def1156 100644
--- a/src/Authoring/Studio/DragAndDrop/BasicObjectDropSource.cpp
+++ b/src/Authoring/Studio/DragAndDrop/BasicObjectDropSource.cpp
@@ -253,7 +253,8 @@ CCmd *CBasicObjectDropSource::GenerateAssetCommand(qt3dsdm::Qt3DSDMInstanceHandl
} else {
SCOPED_DOCUMENT_EDITOR(*theDoc, QObject::tr("Add Instance"))
->CreateSceneGraphInstance(theComposerType, inTarget, inSlide, theInsertType,
- thePoint, (EPrimitiveType)m_PrimitiveType, theStartTime);
+ thePoint, (EPrimitiveType)m_PrimitiveType, theStartTime,
+ false);
}
}
return nullptr;
diff --git a/src/Authoring/Studio/DragAndDrop/FileDropSource.cpp b/src/Authoring/Studio/DragAndDrop/FileDropSource.cpp
index ff6c58ab..6c6339c7 100644
--- a/src/Authoring/Studio/DragAndDrop/FileDropSource.cpp
+++ b/src/Authoring/Studio/DragAndDrop/FileDropSource.cpp
@@ -52,7 +52,8 @@ bool CFileDropSource::ValidateTarget(CDropTarget *inTarget)
EStudioObjectType targetType = (EStudioObjectType)inTarget->GetObjectType();
if (m_ObjectType & (OBJTYPE_PRESENTATION | OBJTYPE_QML_STREAM)) {
- SetHasValidTarget(targetType & (OBJTYPE_LAYER | OBJTYPE_MATERIAL | OBJTYPE_IMAGE));
+ SetHasValidTarget(targetType & (OBJTYPE_LAYER | OBJTYPE_MATERIAL | OBJTYPE_CUSTOMMATERIAL
+ | OBJTYPE_REFERENCEDMATERIAL | OBJTYPE_IMAGE));
return m_HasValidTarget;
}
@@ -190,21 +191,45 @@ CCmd *CFileDropSource::GenerateAssetCommand(qt3dsdm::Qt3DSDMInstanceHandle inTar
.relativeFilePath(theFilePath.toQString());
Q3DStudio::CString presentationId = Q3DStudio::CString::fromQString(theDoc.GetCore()
->getProjectFile().getPresentationId(pathFromRoot));
- EStudioObjectType rowType = theDoc.GetStudioSystem()->GetClientDataModelBridge()
- ->GetObjectType(inTarget);
+ auto &bridge(*theDoc.GetStudioSystem()->GetClientDataModelBridge());
+ EStudioObjectType rowType = bridge.GetObjectType(inTarget);
if (rowType == OBJTYPE_LAYER) {
qt3dsdm::Qt3DSDMPropertyHandle propHandle = theDoc.GetPropertySystem()
->GetAggregateInstancePropertyByName(inTarget, L"sourcepath");
Q3DStudio::SCOPED_DOCUMENT_EDITOR(theDoc, theCommandName)
->SetInstancePropertyValueAsRenderable(inTarget, propHandle, presentationId);
- } else if (rowType == OBJTYPE_MATERIAL) {
- ChooseImagePropertyDlg dlg(inTarget);
+ } else if (rowType & (OBJTYPE_MATERIAL | OBJTYPE_CUSTOMMATERIAL
+ | OBJTYPE_REFERENCEDMATERIAL)) {
+ // if this is a ref material, update the material it references
+ qt3dsdm::Qt3DSDMInstanceHandle refInstance = 0;
+ if (rowType == OBJTYPE_REFERENCEDMATERIAL) {
+ auto optValue = theDoc.getSceneEditor()->GetInstancePropertyValue(inTarget,
+ bridge.GetObjectDefinitions().m_ReferencedMaterial
+ .m_ReferencedMaterial.m_Property);
+ if (optValue.hasValue()) {
+ refInstance = bridge.GetInstance(theDoc.GetSceneInstance(),
+ optValue.getValue());
+ }
+ }
+ ChooseImagePropertyDlg dlg(refInstance ? refInstance : inTarget, refInstance != 0);
if (dlg.exec() == QDialog::Accepted) {
qt3dsdm::Qt3DSDMPropertyHandle propHandle = dlg.getSelectedPropertyHandle();
- Q3DStudio::SCOPED_DOCUMENT_EDITOR(theDoc, theCommandName)
- ->setInstanceImagePropertyValueAsRenderable(inTarget, propHandle,
- presentationId);
+ if (dlg.detachMaterial()) {
+ Q3DStudio::ScopedDocumentEditor editor(
+ Q3DStudio::SCOPED_DOCUMENT_EDITOR(theDoc,
+ tr("Set material sub-presentation")));
+ editor->BeginAggregateOperation();
+ editor->SetMaterialType(inTarget, "Standard Material");
+ editor->setInstanceImagePropertyValueAsRenderable(inTarget, propHandle,
+ presentationId);
+ editor->EndAggregateOperation();
+ } else {
+ Q3DStudio::SCOPED_DOCUMENT_EDITOR(theDoc, theCommandName)
+ ->setInstanceImagePropertyValueAsRenderable(refInstance ? refInstance
+ : inTarget,
+ propHandle, presentationId);
+ }
}
} else if (rowType == OBJTYPE_IMAGE) {
qt3dsdm::Qt3DSDMPropertyHandle propHandle = theDoc.GetPropertySystem()
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp
index 7966d81f..91e2186f 100644
--- a/src/Authoring/Studio/MainFrm.cpp
+++ b/src/Authoring/Studio/MainFrm.cpp
@@ -69,6 +69,7 @@
#include <QtCore/qurl.h>
#include <QtCore/qdir.h>
#include <QtCore/qprocess.h>
+#include <QtGui/qfontdatabase.h>
// Constants
const long PLAYBACK_TIMER_TIMEOUT = 10; // 10 milliseconds
@@ -89,6 +90,10 @@ CMainFrame::CMainFrame()
{
m_ui->setupUi(this);
+ // Register TitilliumWeb as application font in case user doesn't have it already installed
+ QFontDatabase::addApplicationFont(QStringLiteral(":/TitilliumWeb-Light.ttf"));
+ QFontDatabase::addApplicationFont(QStringLiteral(":/TitilliumWeb-Regular.ttf"));
+
OnCreate();
g_StudioApp.GetCore()->GetDispatch()->AddPresentationChangeListener(this);
@@ -213,15 +218,6 @@ CMainFrame::CMainFrame()
connect(m_ui->actionRemote_Preview, &QAction::triggered,
this, &CMainFrame::OnPlaybackPreviewRemote);
- // Only show runtime1 preview if we have appropriate viewer and it's enabled
- if (CStudioPreferences::IsLegacyViewerActive()
- && CPreviewHelper::viewerExists(QStringLiteral("Qt3DViewer"))) {
- connect(m_ui->actionPreviewRuntime1, &QAction::triggered,
- this, &CMainFrame::OnPlaybackPreviewRuntime1);
- } else {
- m_ui->actionPreviewRuntime1->setVisible(false);
- }
-
// Tool mode toolbar
connect(m_ui->actionPosition_Tool, &QAction::triggered, this, &CMainFrame::OnToolMove);
connect(m_ui->actionRotation_Tool, &QAction::triggered, this, &CMainFrame::OnToolRotate);
@@ -388,6 +384,8 @@ void CMainFrame::OnCreate()
m_ui->action_Revert->setEnabled(false);
m_ui->actionImportAssets->setEnabled(false);
m_ui->actionRemote_Preview->setEnabled(false);
+ m_ui->action_New_Presentation->setEnabled(false);
+ m_ui->actionData_Inputs->setEnabled(false);
#if 1 // TODO: Hidden until UX decision is made if these buttons are needed at all or not
m_ui->actionPan_Tool->setVisible(false);
@@ -426,6 +424,8 @@ void CMainFrame::OnNewPresentation()
m_ui->action_Connect_to_Device->setEnabled(true);
m_ui->action_Revert->setEnabled(true);
m_ui->actionImportAssets->setEnabled(true);
+ m_ui->action_New_Presentation->setEnabled(true);
+ m_ui->actionData_Inputs->setEnabled(true);
// Clear data input list and sub-presentation list
g_StudioApp.m_subpresentations.clear();
@@ -906,9 +906,6 @@ void CMainFrame::EditPreferences(short inPageIndex)
CStudioPreferences::SetBigTimeAdvanceAmount(CStudioPreferences::DEFAULT_BIG_TIME_ADVANCE);
CStudioPreferences::SetTimelineSnappingGridActive(true);
CStudioPreferences::SetTimelineSnappingGridResolution(SNAPGRID_SECONDS);
- CStudioPreferences::SetLegacyViewerActive(false);
- // Hide legacy viewer preview button
- m_ui->actionPreviewRuntime1->setVisible(false);
CStudioPreferences::SetEditViewFillMode(true);
CStudioPreferences::SetPreferredStartupView(
CStudioPreferences::PREFERREDSTARTUP_DEFAULTINDEX);
@@ -1725,7 +1722,7 @@ void CMainFrame::OnViewTooltips()
*/
void CMainFrame::OnUpdateHelpIndex()
{
- QFile theFile(g_StudioApp.m_pszHelpFilePath.toQString());
+ QFile theFile(g_StudioApp.m_helpFilePath);
m_ui->action_Reference_Manual->setEnabled(theFile.exists());
}
@@ -1735,7 +1732,7 @@ void CMainFrame::OnUpdateHelpIndex()
*/
void CMainFrame::OnHelpIndex()
{
- QFile theFile(g_StudioApp.m_pszHelpFilePath.toQString());
+ QFile theFile(g_StudioApp.m_helpFilePath);
if (theFile.exists())
QDesktopServices::openUrl(QUrl::fromLocalFile(theFile.fileName()));
}
@@ -1755,8 +1752,9 @@ void CMainFrame::OnHelpVisitQt()
*/
void CMainFrame::OnHelpOpenTutorial()
{
- StudioTutorialWidget tutorial(this, false, false);
- tutorial.exec();
+ StudioTutorialWidget tutorial(this);
+ int welcomeRes = tutorial.exec();
+ g_StudioApp.handleWelcomeRes(welcomeRes, false);
}
//==============================================================================
diff --git a/src/Authoring/Studio/MainFrm.qrc b/src/Authoring/Studio/MainFrm.qrc
index 4951b792..9ee43b21 100644
--- a/src/Authoring/Studio/MainFrm.qrc
+++ b/src/Authoring/Studio/MainFrm.qrc
@@ -2,5 +2,7 @@
<qresource prefix="/">
<file>style.qss</file>
<file>Palettes/Inspector/DataInputChooser.qml</file>
+ <file alias="TitilliumWeb-Light.ttf">../../../Studio/Content/Font Library/titilliumweb/TitilliumWeb-Light.ttf</file>
+ <file alias="TitilliumWeb-Regular.ttf">../../../Studio/Content/Font Library/titilliumweb/TitilliumWeb-Regular.ttf</file>
</qresource>
</RCC>
diff --git a/src/Authoring/Studio/MainFrm.ui b/src/Authoring/Studio/MainFrm.ui
index 425df183..6e4ca810 100644
--- a/src/Authoring/Studio/MainFrm.ui
+++ b/src/Authoring/Studio/MainFrm.ui
@@ -201,8 +201,8 @@ Project palette using Import functionality.</string>
<addaction name="actionItem_Select_Tool"/>
<addaction name="separator"/>
<addaction name="actionPosition_Tool"/>
- <addaction name="actionScale_Tool"/>
<addaction name="actionRotation_Tool"/>
+ <addaction name="actionScale_Tool"/>
<addaction name="actionLocal_Global_Manipulators"/>
<addaction name="separator"/>
<addaction name="actionAutoset_Keyframes"/>
@@ -250,7 +250,6 @@ Project palette using Import functionality.</string>
</attribute>
<addaction name="actionPreview"/>
<addaction name="actionRemote_Preview"/>
- <addaction name="actionPreviewRuntime1"/>
</widget>
<action name="action_Reference_Manual">
<property name="text">
@@ -275,7 +274,7 @@ Project palette using Import functionality.</string>
</action>
<action name="action_Open_Tutorial">
<property name="text">
- <string>&amp;Open Tutorial...</string>
+ <string>&amp;Show Welcome Screen...</string>
</property>
</action>
<action name="actionSet_Changed_Keyframes">
@@ -818,21 +817,6 @@ Project palette using Import functionality.</string>
<bool>false</bool>
</property>
</action>
- <action name="actionPreviewRuntime1">
- <property name="icon">
- <iconset resource="images.qrc">
- <normaloff>:/images/playback_tools_low-02.png</normaloff>:/images/playback_tools_low-02.png</iconset>
- </property>
- <property name="text">
- <string>Preview with Legacy Qt 3D Viewer 1.1</string>
- </property>
- <property name="iconText">
- <string>Preview with Legacy Qt 3D Viewer 1.1</string>
- </property>
- <property name="toolTip">
- <string>Preview with Legacy Qt 3D Viewer 1.1</string>
- </property>
- </action>
<action name="actionImportAssets">
<property name="text">
<string>Import Assets...</string>
diff --git a/src/Authoring/Studio/Palettes/Action/ActionView.cpp b/src/Authoring/Studio/Palettes/Action/ActionView.cpp
index dc3e6ff1..58cb7b75 100644
--- a/src/Authoring/Studio/Palettes/Action/ActionView.cpp
+++ b/src/Authoring/Studio/Palettes/Action/ActionView.cpp
@@ -422,9 +422,8 @@ QObject *ActionView::showTriggerObjectBrowser(const QPoint &point)
const auto actionInfo = m_actionsModel->actionInfoAt(m_currentActionIndex);
const auto instanceHandle = GetBridge()->GetInstance(actionInfo.m_Owner,
actionInfo.m_TriggerObject);
- m_triggerObjectBrowser->selectAndExpand(instanceHandle, actionInfo.m_Owner);
-
m_triggerObjectBrowser->disconnect();
+ m_triggerObjectBrowser->selectAndExpand(instanceHandle, actionInfo.m_Owner);
CDialogs::showWidgetBrowser(this, m_triggerObjectBrowser, point);
connect(m_triggerObjectBrowser, &ObjectBrowserView::selectionChanged,
@@ -454,9 +453,8 @@ QObject *ActionView::showTargetObjectBrowser(const QPoint &point)
const auto actionInfo = m_actionsModel->actionInfoAt(m_currentActionIndex);
const auto instanceHandle = GetBridge()->GetInstance(actionInfo.m_Owner,
actionInfo.m_TargetObject);
- m_targetObjectBrowser->selectAndExpand(instanceHandle, actionInfo.m_Owner);
-
m_targetObjectBrowser->disconnect();
+ m_targetObjectBrowser->selectAndExpand(instanceHandle, actionInfo.m_Owner);
CDialogs::showWidgetBrowser(this, m_targetObjectBrowser, point);
connect(m_targetObjectBrowser, &ObjectBrowserView::selectionChanged,
@@ -517,8 +515,8 @@ QObject *ActionView::showEventBrowser(const QPoint &point)
m_eventsBrowser->setModel(m_eventsModel);
- m_eventsBrowser->selectAndExpand(QString::fromStdWString(actionInfo.m_Event));
m_eventsBrowser->disconnect();
+ m_eventsBrowser->selectAndExpand(QString::fromStdWString(actionInfo.m_Event));
CDialogs::showWidgetBrowser(this, m_eventsBrowser, point);
connect(m_eventsBrowser, &EventsBrowserView::selectionChanged,
@@ -553,8 +551,8 @@ QObject *ActionView::showHandlerBrowser(const QPoint &point)
m_handlerBrowser->setModel(m_handlersModel);
- m_handlerBrowser->selectAndExpand(QString::fromStdWString(actionInfo.m_Handler));
m_handlerBrowser->disconnect();
+ m_handlerBrowser->selectAndExpand(QString::fromStdWString(actionInfo.m_Handler));
CDialogs::showWidgetBrowser(this, m_handlerBrowser, point);
connect(m_handlerBrowser, &EventsBrowserView::selectionChanged,
@@ -601,8 +599,8 @@ QObject *ActionView::showEventBrowserForArgument(int handle, const QPoint &point
eventName = QString::fromWCharArray(eventInfo.m_Name.wide_str());
}
}
- m_fireEventsBrowser->selectAndExpand(eventName);
m_fireEventsBrowser->disconnect();
+ m_fireEventsBrowser->selectAndExpand(eventName);
CDialogs::showWidgetBrowser(this, m_fireEventsBrowser, point);
connect(m_fireEventsBrowser, &EventsBrowserView::selectionChanged,
diff --git a/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml b/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml
index 5693ee7b..d025a889 100644
--- a/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml
+++ b/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml
@@ -54,6 +54,7 @@ Row {
width: _valueWidth
function doCommitValue() {
+ wheelCommitTimer.stop();
if (rateLimiter.running)
rateLimiter.stop();
textField.setTextFieldValue();
@@ -82,9 +83,10 @@ Row {
delta = -delta;
slider.value = Number(slider.value + delta).toFixed(doubleValidator.decimals);
}
+ wheelCommitTimer.stop();
if (!rateLimiter.running)
rateLimiter.start();
- textField.setTextFieldValue()
+ textField.setTextFieldValue();
}
}
@@ -121,10 +123,10 @@ Row {
}
onMoved: {
- if (!rateLimiter.running) {
+ wheelCommitTimer.stop();
+ if (!rateLimiter.running)
rateLimiter.start();
- }
- textField.setTextFieldValue()
+ textField.setTextFieldValue();
}
// onPressedChanged is triggered both mouse clicks and arrow keys, so adjusting with arrow
@@ -142,15 +144,24 @@ Row {
var delta = (wheel.angleDelta.x != 0) ? wheel.angleDelta.x
: wheel.angleDelta.y;
- if (delta > 0) {
+ if (delta > 0)
slider.increase();
- } else {
+ else
slider.decrease();
- }
- if (!rateLimiter.running) {
+ if (!rateLimiter.running)
rateLimiter.start();
+ textField.setTextFieldValue();
+
+ // Leaving a transaction open can interfere with other editor functionality,
+ // so commit the wheel transaction after a brief delay
+ wheelCommitTimer.restart();
+ }
+ Timer {
+ id: wheelCommitTimer
+ interval: 1000
+ onTriggered: {
+ root.doCommitValue();
}
- textField.setTextFieldValue()
}
}
}
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 1c3b2368..ea2750ee 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -116,6 +116,12 @@ InspectorControlModel::InspectorControlModel(QObject *parent)
void InspectorControlModel::setInspectable(CInspectableBase *inInspectable)
{
+ // Commit any pending transactions on selection change
+ m_UpdatableEditor.CommitEditor();
+ m_modifiedProperty.first = 0;
+ m_modifiedProperty.second = 0;
+ m_previouslyCommittedValue = {};
+
const auto signalProvider
= g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetFullSystemSignalProvider();
@@ -646,6 +652,11 @@ InspectorControlBase* InspectorControlModel::createItem(Qt3DSDMInspectable *insp
item->m_controllable = metaProperty.m_Controllable;
+ // disable IBL Override for reference materials
+ if (item->m_title == QLatin1String("IBL Override") && studio->GetClientDataModelBridge()
+ ->GetObjectType(item->m_instance) == OBJTYPE_REFERENCEDMATERIAL) {
+ item->m_enabled = false;
+ }
auto signalProvider = studio->GetFullSystemSignalProvider();
if (item->m_animatable) {
item->m_animated = studio->GetAnimationSystem()->IsPropertyAnimated(item->m_instance,
@@ -738,8 +749,6 @@ void InspectorControlModel::updateControlledToggleState(InspectorControlBase* in
// Restore original tool tip from metadata when turning control off
if (!currPropValStr.size()) {
inItem->m_controlled = false;
- inItem->m_tooltip = Q3DStudio::CString(
- inItem->m_metaProperty.m_Description.c_str()).toQString();
inItem->m_controller = "";
} else {
Q3DStudio::CString propName
@@ -751,8 +760,6 @@ void InspectorControlModel::updateControlledToggleState(InspectorControlBase* in
if ((propNamePos == currPropValStr.ENDOFSTRING)
&& (propNamePos != 0)) {
inItem->m_controlled = false;
- inItem->m_tooltip = Q3DStudio::CString(
- inItem->m_metaProperty.m_Description.c_str()).toQString();
inItem->m_controller = "";
} else {
inItem->m_controlled = true;
@@ -769,7 +776,6 @@ void InspectorControlModel::updateControlledToggleState(InspectorControlBase* in
const QString ctrlName = currPropValStr.substr(
posCtrlr, propNamePos - posCtrlr).toQString();
- inItem->m_tooltip = tr("Controlling Data Input:\n%1").arg(ctrlName);
inItem->m_controller = ctrlName;
}
}
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
index 56558d10..41e567b4 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
@@ -65,6 +65,7 @@ class InspectorControlBase : public QObject
Q_PROPERTY(int instance MEMBER m_instance CONSTANT)
Q_PROPERTY(int handle MEMBER m_property CONSTANT)
+ Q_PROPERTY(bool enabled MEMBER m_enabled CONSTANT)
Q_PROPERTY(bool animatable MEMBER m_animatable CONSTANT)
Q_PROPERTY(bool animated MEMBER m_animated NOTIFY animatedChanged)
Q_PROPERTY(bool controlled MEMBER m_controlled NOTIFY controlledChanged)
@@ -93,6 +94,7 @@ public:
qt3dsdm::Qt3DSDMInstanceHandle m_instance;
qt3dsdm::Qt3DSDMPropertyHandle m_property;
+ bool m_enabled = true;
bool m_animatable = false;
bool m_animated = false;
bool m_controlled = false;
@@ -226,7 +228,6 @@ private:
int theIndex, bool disableAnimation = false,
bool isReference = false);
bool isGroupRebuildRequired(CInspectableBase *inspectable, int theIndex) const;
-
};
#endif // INSPECTORCONTROLMODEL_H
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
index 88a94ef7..4f799edb 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
@@ -166,280 +166,258 @@ Rectangle {
modelData.instance, modelData.handle);
}
- Item {
+ ColumnLayout { // Property row and datainput control
Layout.alignment: Qt.AlignTop
- width: 16
- height: _controlBaseHeight
- visible: model.modelData.animatable
-
- Image {
- id: animatedPropertyButton
-
- property bool animated: model.modelData.animated
+ spacing: 0
+ RowLayout { // Property row
+ Layout.alignment: Qt.AlignLeft
+ Rectangle { // Property animation control button
+ width: 16
+ height: 16
+ color: animateButtonMouseArea.containsMouse
+ ? _studioColor1 : _backgroundColor
+
+ Image {
+ id: animatedPropertyButton
+ visible: model.modelData.animatable
+
+ property bool animated: model.modelData.animated
+
+ anchors.fill: parent
+ fillMode: Image.Pad
+
+ source: {
+ _resDir + (animated
+ ? "Inspector-AnimateToggle-Active.png"
+ : "Inspector-AnimateToggle-Normal.png")
+ }
- anchors.fill: parent
- fillMode: Image.Pad
+ MouseArea {
+ id: animateButtonMouseArea
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton | Qt.LeftButton
+ hoverEnabled: true
+ onClicked: {
+ if (mouse.button === Qt.LeftButton) {
+ _inspectorModel.setPropertyAnimated(
+ model.modelData.instance,
+ model.modelData.handle,
+ !model.modelData.animated)
+ } else {
+ const coords = mapToItem(root,
+ mouse.x,
+ mouse.y);
+ groupDelegateItem.showContextMenu(coords);
+ }
+ }
+ }
+ StyledTooltip {
+ text: qsTr("Enable animation")
+ enabled: animateButtonMouseArea.containsMouse
+ }
- source: {
- _resDir + (animated
- ? "Inspector-AnimateToggle-Active.png"
- : "Inspector-AnimateToggle-Normal.png")
+ }
}
-
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.RightButton | Qt.LeftButton
- onClicked: {
- if (mouse.button === Qt.LeftButton) {
- _inspectorModel.setPropertyAnimated(
- model.modelData.instance,
- model.modelData.handle,
- !model.modelData.animated)
- } else {
+ StyledLabel { // Property label
+ id: propertyRow
+
+ readonly property var modelData: model.modelData
+ text: model.modelData.title
+ // Color picked from DataInput icon
+ color: model.modelData.controlled?
+ _dataInputColor
+ : _parentView.titleColor(modelData.instance,
+ modelData.handle)
+
+ Layout.alignment: Qt.AlignTop
+
+ MouseArea {
+ id: propertyLabelMouseArea
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ hoverEnabled: true
+ onClicked: {
const coords = mapToItem(root, mouse.x, mouse.y);
groupDelegateItem.showContextMenu(coords);
- }
+ }
+ }
+ StyledTooltip {
+ id: valueToolTip
+ text: modelData.toolTip
+ enabled: propertyLabelMouseArea.containsMouse
}
}
}
- }
-
- Item {
- width: (animatedPropertyButton.visible
- ? 4 : animatedPropertyButton.width + 4)
- height: loadedItem.height + 4 // Add little space between items
- }
-
- StyledLabel {
- id: propertyRow
- readonly property var modelData: model.modelData
- text: model.modelData.title
- // Color picked from DataInput icon
- color: model.modelData.controlled?
- _dataInputColor
- : _parentView.titleColor(modelData.instance,
- modelData.handle)
+ RowLayout { // Datainput button & label
+ Layout.alignment: Qt.AlignLeft
+ Rectangle { // Datainput control button
+ width: 16
+ height: 16
+ visible: model.modelData.controllable
+ color: dataInputButtonMouseArea.containsMouse
+ ? _studioColor1 : _backgroundColor
+
+ MouseArea {
+ id: dataInputButtonMouseArea
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton | Qt.LeftButton
+ hoverEnabled: true
+ onClicked: {
+ if (mouse.button === Qt.LeftButton) {
+ _parentView.showDataInputChooser(
+ model.modelData.handle,
+ model.modelData.instance,
+ mapToGlobal(
+ ctrldPropButton.x
+ + ctrldPropButton.width,
+ ctrldPropButton.y
+ + ctrldPropButton.height));
+ }
+ }
+ }
+ Image {
+ id: ctrldPropButton
- Layout.alignment: Qt.AlignTop
+ property bool controlled: model.modelData.controlled
- MouseArea {
- id: mouse
- anchors.fill: parent
- acceptedButtons: Qt.RightButton
- hoverEnabled: true
- onClicked: {
- const coords = mapToItem(root, mouse.x, mouse.y);
- groupDelegateItem.showContextMenu(coords);
- }
- }
+ anchors.fill: parent
+ fillMode: Image.Pad
- StyledTooltip {
- id: valueToolTip
- text: modelData.toolTip
- enabled: mouse.containsMouse
- }
- }
- Item {
- Layout.alignment: Qt.AlignTop
- width: 16
- height: _controlBaseHeight
- visible: model.modelData.controllable
-
- MouseArea {
- id: mousearea
- anchors.fill: parent
- acceptedButtons: Qt.RightButton | Qt.LeftButton
- hoverEnabled: true
- onClicked: {
- if (mouse.button === Qt.LeftButton) {
- _parentView.showDataInputChooser(
- model.modelData.handle,
- model.modelData.instance,
- mapToGlobal(
- ctrldPropButton.x
- + ctrldPropButton.width,
- ctrldPropButton.y
- + ctrldPropButton.height));
- } else {
- groupDelegateItem.showContextMenu(
- mapToItem(root, mouse.x, mouse.y));
+ source: {
+ _resDir + (controlled
+ ? "Objects-DataInput-Active.png"
+ : "Objects-DataInput-Inactive.png")
+ }
+ }
+ StyledTooltip {
+ text: qsTr("Select Data Input control")
+ enabled: dataInputButtonMouseArea.containsMouse
}
}
- }
- StyledTooltip {
- id: ctrlToolTip
- text: modelData.toolTip
- enabled: mousearea.containsMouse
- }
-
- Image {
- id: ctrldPropButton
-
- property bool controlled: model.modelData.controlled
-
- anchors.fill: parent
- fillMode: Image.Pad
-
- source: {
- _resDir + (controlled
- ? "Objects-DataInput-Normal.png"
- : "Objects-DataInput-Disabled.png")
+ StyledLabel {
+ id: dataInputName
+ // use visible: modelData.controlled instead
+ // if label needs to be shown
+ // only when item is actually controlled
+ // (causes re-layouting of inspector panel)
+ visible: modelData.controllable
+ text: modelData.controlled ?
+ modelData.controller : "[No datainput control]";
+ color: modelData.controlled ?
+ _dataInputColor : _disabledColor;
}
-
-
}
}
- Item {
- width: (ctrldPropButton.visible
- ? 4 : ctrldPropButton.width + 4)
- height: loadedItem.height + 4 // Add little space between items
- }
-
- ColumnLayout {
- StyledLabel {
- id: dataInputName
- Layout.preferredWidth: _valueWidth
- // use visible: modelData.controlled instead
- // if label needs to be shown
- // only when item is actually controlled
- // (causes re-layouting of inspector panel)
- visible: modelData.controllable
- text: modelData.controlled ?
- modelData.controller : "[No datainput control]";
- color: modelData.controlled ?
- _dataInputColor : _disabledColor;
-
- StyledTooltip {
- id: dILabelToolTip
- text: modelData.toolTip
- enabled: mouseareaDILabel.containsMouse
- }
-
- MouseArea {
- id: mouseareaDILabel
- anchors.fill: parent
- acceptedButtons: Qt.RightButton | Qt.LeftButton
- hoverEnabled: true
- onClicked: {
- if (mouse.button === Qt.RightButton) {
- groupDelegateItem.showContextMenu(
- mapToItem(root, mouse.x, mouse.y));
- }
+ Loader {
+ id: loader
+ readonly property var modelData: propertyRow.modelData
+ enabled: modelData.enabled
+ opacity: enabled ? 1 : .5
+ Layout.alignment: Qt.AlignTop
+ sourceComponent: {
+ const dataType = modelData.dataType;
+ switch (dataType) {
+ case DataModelDataType.Long:
+ if (modelData.propertyType ===
+ AdditionalMetaDataType.ShadowMapResolution) {
+ return shadowResolutionComponent;
}
- }
- }
-
- Loader {
- id: loader
- readonly property var modelData: propertyRow.modelData
- sourceComponent: {
- const dataType = modelData.dataType;
- switch (dataType) {
- case DataModelDataType.Long:
- if (modelData.propertyType ===
- AdditionalMetaDataType.ShadowMapResolution) {
- return shadowResolutionComponent;
- }
- if (modelData.propertyType === AdditionalMetaDataType.Range) {
- return intSliderComponent;
- }
- console.warn("KDAB_TODO: implement handler for type \"Long\", property:",
- modelData.propertyType);
- return null;
- case DataModelDataType.Long4:
- if (modelData.propertyType === AdditionalMetaDataType.Image) {
- return imageChooser;
- }
- console.warn("KDAB_TODO: implement handler for type \"long4\" property:",
- modelData.propertyType);
- return null;
- case DataModelDataType.ObjectRef:
- if (modelData.propertyType === AdditionalMetaDataType.ObjectRef)
- return objectReference;
- console.warn("KDAB_TODO: implement handler for type: \"objectref\" property:",
- modelData.propertyType);
- return null;
- case DataModelDataType.StringOrInt:
- //TODO: Maybe do some further check if the right combo is used
- if (modelData.propertyType === AdditionalMetaDataType.StringList)
- return slideSelectionDropDown;
- console.warn("KDAB_TODO: (String) implement handler for type \"stringOrInt\" property:",
- modelData.propertyType);
- return null;
- case DataModelDataType.String:
- if (modelData.propertyType === AdditionalMetaDataType.Import)
- return fileChooser;
- if (modelData.propertyType === AdditionalMetaDataType.StringList)
- return comboDropDown;
- if (modelData.propertyType === AdditionalMetaDataType.Renderable)
- return renderableDropDown;
- if (modelData.propertyType === AdditionalMetaDataType.Mesh)
- return meshChooser;
- if (modelData.propertyType === AdditionalMetaDataType.MultiLine)
- return multiLine;
- if (modelData.propertyType === AdditionalMetaDataType.Font)
- return fontDropDown;
- if (modelData.propertyType === AdditionalMetaDataType.Texture)
- return textureChooser;
- if (modelData.propertyType === AdditionalMetaDataType.String)
- return editLine;
- if (modelData.propertyType === AdditionalMetaDataType.None)
- return null;
- console.warn("KDAB_TODO: (String) implement handler for type \"string\" property:",
- modelData.propertyType);
- return null;
- case DataModelDataType.Bool:
- return checkBox;
- case DataModelDataType.Float:
- if (modelData.propertyType === AdditionalMetaDataType.None)
- return valueComponent;
- if (modelData.propertyType === AdditionalMetaDataType.Range)
- return sliderComponent;
- if (modelData.propertyType === AdditionalMetaDataType.FontSize)
- return fontSizeComponent;
- console.warn("KDAB_TODO: implement handler for type\"float\" property:",
- modelData.propertyType);
- return null;
- case DataModelDataType.Float2:
- if (modelData.propertyType === AdditionalMetaDataType.None)
- return xyPropertyComponent;
- console.warn("TODO: implement handler for type:\"float2\" property:",
- modelData.propertyType, "text ",
- model.modelData.title);
- return null;
- case DataModelDataType.Float3:
- if (modelData.propertyType === AdditionalMetaDataType.Color)
- return colorBox;
- if (modelData.propertyType === AdditionalMetaDataType.Rotation)
- return xyzPropertyComponent;
- if (modelData.propertyType === AdditionalMetaDataType.None)
- return xyzPropertyComponent;
- console.warn("KDAB_TODO: implement handler for type:\"float3\" property:",
- modelData.propertyType, "text ",
- model.modelData.title);
- return null;
- case DataModelDataType.StringRef:
- if (modelData.propertyType === AdditionalMetaDataType.None)
- return materialTypeDropDown;
- if (modelData.propertyType === AdditionalMetaDataType.Renderable)
- return shaderDropDown;
- if (modelData.propertyType === AdditionalMetaDataType.ObjectRef)
- return matDataDropDown;
- console.warn("KDAB_TODO: implement handler for type:\"StringRef\" text ",
- model.modelData.title);
+ if (modelData.propertyType === AdditionalMetaDataType.Range)
+ return intSliderComponent;
+ console.warn("KDAB_TODO: implement handler for type \"Long\", property:",
+ modelData.propertyType);
+ return null;
+ case DataModelDataType.Long4:
+ if (modelData.propertyType === AdditionalMetaDataType.Image)
+ return imageChooser;
+ console.warn("KDAB_TODO: implement handler for type \"long4\" property:",
+ modelData.propertyType);
+ return null;
+ case DataModelDataType.ObjectRef:
+ if (modelData.propertyType === AdditionalMetaDataType.ObjectRef)
+ return objectReference;
+ console.warn("KDAB_TODO: implement handler for type: \"objectref\" property:",
+ modelData.propertyType);
+ return null;
+ case DataModelDataType.StringOrInt:
+ //TODO: Maybe do some further check if the right combo is used
+ if (modelData.propertyType === AdditionalMetaDataType.StringList)
+ return slideSelectionDropDown;
+ console.warn("KDAB_TODO: (String) implement handler for type \"stringOrInt\" property:",
+ modelData.propertyType);
+ return null;
+ case DataModelDataType.String:
+ if (modelData.propertyType === AdditionalMetaDataType.Import)
+ return fileChooser;
+ if (modelData.propertyType === AdditionalMetaDataType.StringList)
+ return comboDropDown;
+ if (modelData.propertyType === AdditionalMetaDataType.Renderable)
+ return renderableDropDown;
+ if (modelData.propertyType === AdditionalMetaDataType.Mesh)
+ return meshChooser;
+ if (modelData.propertyType === AdditionalMetaDataType.MultiLine)
+ return multiLine;
+ if (modelData.propertyType === AdditionalMetaDataType.Font)
+ return fontDropDown;
+ if (modelData.propertyType === AdditionalMetaDataType.Texture)
+ return textureChooser;
+ if (modelData.propertyType === AdditionalMetaDataType.String)
+ return editLine;
+ if (modelData.propertyType === AdditionalMetaDataType.None)
return null;
- default:
- console.warn("KDAB_TODO: implement handler for type",
- dataType, "property",
- modelData.propertyType, "text ",
- model.modelData.title);
- }
+ console.warn("KDAB_TODO: (String) implement handler for type \"string\" property:",
+ modelData.propertyType);
+ return null;
+ case DataModelDataType.Bool:
+ return checkBox;
+ case DataModelDataType.Float:
+ if (modelData.propertyType === AdditionalMetaDataType.None)
+ return valueComponent;
+ if (modelData.propertyType === AdditionalMetaDataType.Range)
+ return sliderComponent;
+ if (modelData.propertyType === AdditionalMetaDataType.FontSize)
+ return fontSizeComponent;
+ console.warn("KDAB_TODO: implement handler for type\"float\" property:",
+ modelData.propertyType);
+ return null;
+ case DataModelDataType.Float2:
+ if (modelData.propertyType === AdditionalMetaDataType.None)
+ return xyPropertyComponent;
+ console.warn("TODO: implement handler for type:\"float2\" property:",
+ modelData.propertyType, "text ",
+ model.modelData.title);
+ return null;
+ case DataModelDataType.Float3:
+ if (modelData.propertyType === AdditionalMetaDataType.Color)
+ return colorBox;
+ if (modelData.propertyType === AdditionalMetaDataType.Rotation)
+ return xyzPropertyComponent;
+ if (modelData.propertyType === AdditionalMetaDataType.None)
+ return xyzPropertyComponent;
+ console.warn("KDAB_TODO: implement handler for type:\"float3\" property:",
+ modelData.propertyType, "text ",
+ model.modelData.title);
return null;
+ case DataModelDataType.StringRef:
+ if (modelData.propertyType === AdditionalMetaDataType.None)
+ return materialTypeDropDown;
+ if (modelData.propertyType === AdditionalMetaDataType.Renderable)
+ return shaderDropDown;
+ if (modelData.propertyType === AdditionalMetaDataType.ObjectRef)
+ return matDataDropDown;
+ console.warn("KDAB_TODO: implement handler for type:\"StringRef\" text ",
+ model.modelData.title);
+ return null;
+ default:
+ console.warn("KDAB_TODO: implement handler for type",
+ dataType, "property",
+ modelData.propertyType, "text ",
+ model.modelData.title);
}
+ return null;
}
-
}
}
}
@@ -475,7 +453,6 @@ Rectangle {
}
MouseArea {
- id: mouseAreaX
anchors.fill: parent
property int clickedPos
preventStealing: true
@@ -853,15 +830,15 @@ Rectangle {
property var value: parent.modelData.value
model: values
- // Disable for non-layer
- enabled: _inspectorModel.isLayer(instance)
showArrow: enabled
implicitWidth: _valueWidth
implicitHeight: _controlBaseHeight
Component.onCompleted: {
- currentIndex = find(value)
+ // Disable for non-layer
+ enabled = _inspectorModel.isLayer(instance);
+ currentIndex = find(value);
}
onCurrentIndexChanged: {
@@ -878,16 +855,25 @@ Rectangle {
Component {
id: checkBox
- Image {
+ Item {
+ id: checkboxItem
property int instance: parent.modelData.instance
property int handle: parent.modelData.handle
property bool checked: parent.modelData.value
- source: (_resDir + (checked ? "checkbox-checked.png" : "checkbox-unchecked.png"))
-
- MouseArea {
+ width: 16
+ height: _controlBaseHeight
+ Image {
anchors.fill: parent
- onClicked: _inspectorModel.setPropertyValue(instance, handle, !checked)
+ fillMode: Image.Pad
+ source: (_resDir + (checked ? "checkbox-checked.png" : "checkbox-unchecked.png"))
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: _inspectorModel.setPropertyValue(checkboxItem.instance,
+ checkboxItem.handle,
+ !checkboxItem.checked)
+ }
}
}
}
diff --git a/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.cpp b/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.cpp
index f81357a8..77dbd4b9 100644
--- a/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.cpp
+++ b/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.cpp
@@ -34,6 +34,7 @@
// This dialog displays all texture properties of an object and allows the user to choose one
ChooseImagePropertyDlg::ChooseImagePropertyDlg(qt3dsdm::Qt3DSDMInstanceHandle inTarget,
+ bool isRefMaterial,
QWidget *parent)
: QDialog(parent)
, m_instance(inTarget)
@@ -50,6 +51,9 @@ ChooseImagePropertyDlg::ChooseImagePropertyDlg(qt3dsdm::Qt3DSDMInstanceHandle in
QDialog::accept();
});
+ if (!isRefMaterial)
+ m_ui->cbDetach->setVisible(false);
+
fillList();
}
@@ -58,6 +62,11 @@ ChooseImagePropertyDlg::~ChooseImagePropertyDlg()
delete m_ui;
}
+bool ChooseImagePropertyDlg::detachMaterial() const
+{
+ return m_ui->cbDetach->checkState() == Qt::Checked;
+}
+
// fill the list with all material properties of type image
void ChooseImagePropertyDlg::fillList()
{
diff --git a/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.h b/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.h
index 5d723348..e644643c 100644
--- a/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.h
+++ b/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.h
@@ -48,10 +48,12 @@ class ChooseImagePropertyDlg : public QDialog
public:
explicit ChooseImagePropertyDlg(qt3dsdm::Qt3DSDMInstanceHandle instance,
+ bool isRefMaterial = false,
QWidget *parent = 0);
~ChooseImagePropertyDlg();
int getSelectedPropertyHandle() const;
+ bool detachMaterial() const;
private:
Ui::ChooseImagePropertyDlg *m_ui;
diff --git a/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.ui b/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.ui
index f3084163..a6780539 100644
--- a/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.ui
+++ b/src/Authoring/Studio/Palettes/Project/ChooseImagePropertyDlg.ui
@@ -43,6 +43,16 @@
<widget class="QListWidget" name="listProps"/>
</item>
<item>
+ <widget class="QCheckBox" name="cbDetach">
+ <property name="toolTip">
+ <string>Detach from referenced material</string>
+ </property>
+ <property name="text">
+ <string>Detach Material</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp b/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
index 9ccb0f87..2e67ea3d 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
+++ b/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
@@ -174,6 +174,7 @@ void ProjectFileSystemModel::updateReferences()
std::for_each(sourcePathList.begin(), sourcePathList.end(), addReferencesPresentation);
std::for_each(fontFileList.begin(), fontFileList.end(), addReferencesPresentation);
std::for_each(effectTextureList.begin(), effectTextureList.end(), addReferencesProject);
+ std::for_each(effectTextureList.begin(), effectTextureList.end(), addReferencesPresentation);
std::for_each(renderableList.begin(), renderableList.end(), addReferencesRenderable);
m_references.insert(projectPath);
@@ -486,19 +487,24 @@ void ProjectFileSystemModel::importUrl(QDir &targetDir, const QUrl &url)
QObject *qmlRoot = nullptr;
if (extension == QLatin1String("qml")) {
qmlEngine.load(sourceFile);
- const char *rootClassName = qmlEngine.rootObjects().at(0)
- ->metaObject()->superClass()->className();
-
- // the assumption here is that any qml that is not a behavior is a qml stream
- if (strcmp(rootClassName, "Q3DStudio::Q3DSQmlBehavior") != 0) { // not a behavior
- qmlRoot = qmlEngine.rootObjects().at(0);
-
- // put the qml in the correct folder
- if (targetDir.path().endsWith(QLatin1String("/scripts"))) {
- const QString path(QStringLiteral("../qml streams"));
- targetDir.mkpath(path); // create the folder if doesn't exist (i.e. old project)
- targetDir.cd(path);
+ if (qmlEngine.rootObjects().size() > 0) {
+ const char *rootClassName = qmlEngine.rootObjects().at(0)
+ ->metaObject()->superClass()->className();
+ // the assumption here is that any qml that is not a behavior is a qml stream
+ if (strcmp(rootClassName, "Q3DStudio::Q3DSQmlBehavior") != 0) { // not a behavior
+ qmlRoot = qmlEngine.rootObjects().at(0);
+ // put the qml in the correct folder
+ if (targetDir.path().endsWith(QLatin1String("/scripts"))) {
+ const QString path(QStringLiteral("../qml streams"));
+ targetDir.mkpath(path); // create the folder if doesn't exist
+ targetDir.cd(path);
+ }
}
+ } else {
+ // Invalid qml file, block import
+ g_StudioApp.GetDialogs()->DisplayKnownErrorDialog(
+ tr("Failed to parse '%1'\nAborting import.").arg(sourceFile));
+ return;
}
}
// Copy the file to target directory
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectView.cpp b/src/Authoring/Studio/Palettes/Project/ProjectView.cpp
index 8bcf93f4..eff2334a 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectView.cpp
+++ b/src/Authoring/Studio/Palettes/Project/ProjectView.cpp
@@ -372,9 +372,13 @@ bool ProjectView::isQmlStream(int row) const
return false;
QQmlApplicationEngine qmlEngine(filePath);
- const char *rootClassName = qmlEngine.rootObjects().at(0)
- ->metaObject()->superClass()->className();
- return strcmp(rootClassName, "Q3DStudio::Q3DSQmlBehavior") != 0;
+ if (qmlEngine.rootObjects().size() > 0) {
+ const char *rootClassName = qmlEngine.rootObjects().at(0)
+ ->metaObject()->superClass()->className();
+ return strcmp(rootClassName, "Q3DStudio::Q3DSQmlBehavior") != 0;
+ } else {
+ return false;
+ }
}
bool ProjectView::isMaterialFolder(int row) const
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectView.qml b/src/Authoring/Studio/Palettes/Project/ProjectView.qml
index 4e946fda..f7d9c56f 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectView.qml
+++ b/src/Authoring/Studio/Palettes/Project/ProjectView.qml
@@ -39,7 +39,6 @@ Rectangle {
ColumnLayout {
anchors.fill: parent
spacing: 4
- width: parent.width
Item {
Layout.fillWidth: true
@@ -240,7 +239,7 @@ Rectangle {
}
RowLayout {
- width: parent.width
+ Layout.fillWidth: true
Layout.margins: 4
Layout.rightMargin: 12
Layout.leftMargin: 12
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.qml b/src/Authoring/Studio/Palettes/Slide/SlideView.qml
index 3e60b76b..0cb96919 100644
--- a/src/Authoring/Studio/Palettes/Slide/SlideView.qml
+++ b/src/Authoring/Studio/Palettes/Slide/SlideView.qml
@@ -154,6 +154,7 @@ Rectangle {
Row {
rotation: 90
anchors.centerIn: parent
+ spacing: 5
Image {
id: dataInputImage2
fillMode: Image.Pad
@@ -346,7 +347,7 @@ Rectangle {
property string currentController: _parentView.currController
property string toolTip: _parentView.toolTip
background: Rectangle {
- color: "transparent"
+ color: controlButtonArea.containsMouse ? _studioColor1 : _backgroundColor
}
MouseArea {
id: controlButtonArea
@@ -364,8 +365,8 @@ Rectangle {
property bool controlled: parent.controlled
source: {
_resDir + (controlled
- ? "Objects-DataInput-Normal.png"
- : "Objects-DataInput-Disabled.png")
+ ? "Objects-DataInput-Active.png"
+ : "Objects-DataInput-Inactive.png")
}
}
StyledTooltip {
@@ -377,7 +378,6 @@ Rectangle {
StyledLabel {
id: dataInputName
text: _parentView.currController
- leftPadding: 10
color: _parentView.controlled ? _dataInputColor : "transparent"
}
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
index 73a23354..3908c255 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
@@ -74,7 +74,7 @@ void RowMover::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
RowTree *RowMover::insertionTarget() const
{
- return m_insertionTarget;
+ return m_insertionTarget.data();
}
RowTree *RowMover::insertionParent() const
@@ -112,7 +112,7 @@ void RowMover::resetInsertionParent(RowTree *newParent)
}
}
-bool RowMover::isActive()
+bool RowMover::isActive() const
{
return m_active;
}
@@ -153,7 +153,7 @@ void RowMover::end(bool force)
m_sourceRows.clear();
- if (m_insertionTarget)
+ if (!m_insertionTarget.isNull())
m_insertionTarget->setDnDState(RowTree::DnDState::None);
setVisible(false);
@@ -207,7 +207,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
{
// DnD a presentation / Qml stream from the project panel (to set it as a subpresentation)
if (rowType == OBJTYPE_PRESENTATION || rowType == OBJTYPE_QML_STREAM) {
- if (m_insertionTarget)
+ if (!m_insertionTarget.isNull())
m_insertionTarget->setDnDState(RowTree::DnDState::None, RowTree::DnDState::SP_TARGET);
RowTree *rowAtMouse = m_scene->rowManager()->getRowAtPos(scenePos);
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h
index b9fe59d9..da268968 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h
@@ -34,6 +34,7 @@
#include "DocumentEditorEnumerations.h"
#include "StudioObjectTypes.h"
#include <QtCore/qtimer.h>
+#include <QtCore/qpointer.h>
class RowTree;
class TimelineGraphicsScene;
@@ -48,7 +49,7 @@ public:
void start(const QVector<RowTree *> &rows);
void end(bool force = false);
void updateTargetRow(const QPointF &scenePos, EStudioObjectType rowType = OBJTYPE_UNKNOWN);
- bool isActive();
+ bool isActive() const;
RowTree *insertionTarget() const;
RowTree *insertionParent() const;
QVector<RowTree *> sourceRows() const;
@@ -65,7 +66,7 @@ private:
bool isNextSiblingRow(RowTree *r1, RowTree *r2) const;
TimelineGraphicsScene *m_scene = nullptr;
- RowTree *m_insertionTarget = nullptr; // insertion target
+ QPointer<RowTree> m_insertionTarget; // insertion target
RowTree *m_insertionParent = nullptr; // insertion parent
RowTree *m_rowAutoExpand = nullptr;
QVector<RowTree *> m_sourceRows; // dragged rows
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp
index f04165e8..429b0170 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp
@@ -51,7 +51,8 @@ void SelectionRect::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
void SelectionRect::start(const QPointF &origin)
{
m_rect.setTopLeft(origin);
-
+ m_rect.setWidth(0);
+ m_rect.setHeight(0);
m_active = true;
}
@@ -77,7 +78,7 @@ void SelectionRect::end()
m_active = false;
}
-bool SelectionRect::isActive()
+bool SelectionRect::isActive() const
{
return m_active;
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h
index cad62662..224284c0 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h
@@ -39,7 +39,7 @@ public:
void start(const QPointF &origin);
void updateSize(const QPointF &pos, const QRectF &visibleScene);
void end();
- bool isActive();
+ bool isActive() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget = nullptr) override;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
index 80db4a44..f5d9c6ce 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -322,13 +322,13 @@ TimelineGraphicsScene::TimelineGraphicsScene(TimelineWidget *timelineWidget)
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::ShiftModifier | Qt::Key_H));
action->setShortcutContext(Qt::ApplicationShortcut);
- connect(action, &QAction::triggered, this, &TimelineGraphicsScene::handleShySelected);
+ connect(action, &QAction::triggered, &g_StudioApp, &CStudioApp::toggleShy);
timelineWidget->addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::ControlModifier | Qt::Key_H));
action->setShortcutContext(Qt::ApplicationShortcut);
- connect(action, &QAction::triggered, this, &TimelineGraphicsScene::handleLockSelected);
+ connect(action, &QAction::triggered, &g_StudioApp, &CStudioApp::toggleLocked);
timelineWidget->addAction(action);
}
@@ -519,6 +519,8 @@ void TimelineGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
m_rowManager->selectRow(rowTree, ctrlKeyDown);
if (rowTree->draggable())
m_startRowMoverOnNextDrag = true;
+ } else if (m_clickedTreeControlType == TreeControlType::Arrow) {
+ updateSnapSteps();
}
} else if (item->type() == TimelineItem::TypeRowTimeline) {
m_editedTimelineRow = static_cast<RowTimeline *>(item);
@@ -817,6 +819,9 @@ void TimelineGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
+ if (m_timelineZooming)
+ updateSnapSteps();
+
resetMousePressParams();
QGraphicsScene::mouseReleaseEvent(event);
@@ -847,8 +852,9 @@ void TimelineGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even
RowTreeLabelItem *treeLabelItem = static_cast<RowTreeLabelItem *>(item);
if (treeLabelItem->parentRow()->isProperty()) {
treeLabelItem->parentRow()->togglePropertyExpanded();
- } else if (!treeLabelItem->isLocked()) {
- // Tree labels text can be edited with double-click
+ } else if (!treeLabelItem->isLocked()
+ && treeLabelItem->parentRow()->rowType() != OBJTYPE_SCENE) {
+ // Tree labels text can be edited with double-click, except for Scene label
treeLabelItem->setEnabled(true);
treeLabelItem->setFocus();
}
@@ -1041,20 +1047,6 @@ void TimelineGraphicsScene::handleEditComponent()
}
}
-void TimelineGraphicsScene::handleShySelected()
-{
- RowTree *selectedRow = m_rowManager->selectedRow();
- if (selectedRow)
- selectedRow->toggleShy();
-}
-
-void TimelineGraphicsScene::handleLockSelected()
-{
- RowTree *selectedRow = m_rowManager->selectedRow();
- if (selectedRow)
- selectedRow->toggleLocked();
-}
-
void TimelineGraphicsScene::handleApplicationFocusLoss()
{
// Hide the timebar tooltip if application loses focus
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
index b1814cd7..621693b3 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
@@ -117,8 +117,6 @@ private:
void handleMakeComponent();
void handleCopyObjectPath();
void handleEditComponent();
- void handleShySelected();
- void handleLockSelected();
void handleApplicationFocusLoss();
QGraphicsLinearLayout *m_layoutRoot;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
index 12535ab7..3040dd05 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
@@ -529,15 +529,26 @@ void TimelineWidget::onAssetCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
Qt3DSDMTimelineItemBinding *binding = getBindingForHandle(inInstance, m_binding);
- bool rowExists = binding && binding->getRowTree();
- if (binding && !rowExists) {
- auto parentInstance = m_bridge->GetParentInstance(inInstance);
- Qt3DSDMTimelineItemBinding *bindingParent = getBindingForHandle(parentInstance,
- m_binding);
- RowTree *row = m_graphicsScene->rowManager()
- ->createRowFromBinding(binding, bindingParent->getRowTree());
- row->updateSubpresentations();
- insertToHandlesMap(binding);
+ if (!binding) {
+ // if binding is not found, refresh it (so far the only known case where this is needed
+ // is when setting a subpresentation on a ref mat row and checking 'Detach material')
+ m_fullReconstruct = true;
+ if (!m_asyncUpdateTimer.isActive())
+ m_asyncUpdateTimer.start();
+ } else {
+ if (!binding->getRowTree()) { // row doesn't exist
+ auto parentInstance = m_bridge->GetParentInstance(inInstance);
+ Qt3DSDMTimelineItemBinding *bindingParent = getBindingForHandle(parentInstance,
+ m_binding);
+ if (bindingParent) {
+ RowTree *row = m_graphicsScene->rowManager()
+ ->createRowFromBinding(binding, bindingParent->getRowTree());
+ row->updateSubpresentations();
+ insertToHandlesMap(binding);
+ } else {
+ qWarning() << "Binding parent was not found.";
+ }
+ }
}
}
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
index 34e3b9ce..0865757f 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
@@ -135,17 +135,17 @@ void RowTimeline::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
if (m_controllerDataInput.size()) {
static const QPixmap pixDataInput
= QPixmap(":/images/Objects-DataInput-White.png");
- static const QFont normalFont = CAppFonts::GetInstance()->GetNormalFont();
- static const QFontMetrics fm(normalFont);
+ static const QFontMetrics fm(painter->font());
// need clip region to limit datainput icon visibility to the same rect as we use
// for text
painter->setClipRect(x, 0, w, currentHeight);
painter->setClipping(true);
painter->setPen(QPen(CStudioPreferences::textColor(), 2));
- painter->drawText(QRect(x + pixDataInput.width(), 0, w, currentHeight),
+ // +5 added to text location to make margin comparable to other datainput controls
+ painter->drawText(QRect(x + pixDataInput.width() + 5, 0, w, currentHeight),
m_controllerDataInput, QTextOption(Qt::AlignCenter));
- // place the icon marginY amount away from the datainput name
+ // place the icon in front of the text
int textwidth = fm.width(m_controllerDataInput);
int iconx = x + (w - textwidth) / 2;
if (iconx < x)
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
index bd3f8f24..473cfad9 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
@@ -35,6 +35,8 @@
#include "Bindings/ITimelineItemBinding.h"
#include "Bindings/Qt3DSDMTimelineItemBinding.h"
#include "ChooseImagePropertyDlg.h"
+#include "Qt3DSDMStudioSystem.h"
+#include "ClientDataModelBridge.h"
RowTreeContextMenu::RowTreeContextMenu(RowTree *inRowTree, QWidget *parent)
: QMenu(parent)
@@ -189,11 +191,34 @@ void RowTreeContextMenu::addSubPresentation(QAction *action)
Q3DStudio::SCOPED_DOCUMENT_EDITOR(doc, tr("Set layer sub-presentation"))
->SetInstancePropertyValueAsRenderable(instance, propHandle, presentationId);
} else if (m_RowTree->rowType() == OBJTYPE_MATERIAL) {
- ChooseImagePropertyDlg dlg(instance);
+ auto &bridge(*doc.GetStudioSystem()->GetClientDataModelBridge());
+ // if this is a ref material, update the material it references
+
+ qt3dsdm::Qt3DSDMInstanceHandle refInstance = 0;
+ if (bridge.GetObjectType(instance) == OBJTYPE_REFERENCEDMATERIAL) {
+ auto optValue = doc.getSceneEditor()->GetInstancePropertyValue(instance,
+ bridge.GetObjectDefinitions().m_ReferencedMaterial
+ .m_ReferencedMaterial.m_Property);
+ if (optValue.hasValue())
+ refInstance = bridge.GetInstance(doc.GetSceneInstance(), optValue.getValue());
+ }
+
+ ChooseImagePropertyDlg dlg(refInstance ? refInstance : instance, refInstance != 0);
if (dlg.exec() == QDialog::Accepted) {
qt3dsdm::Qt3DSDMPropertyHandle propHandle = dlg.getSelectedPropertyHandle();
- Q3DStudio::SCOPED_DOCUMENT_EDITOR(doc, tr("Set material sub-presentation"))
- ->setInstanceImagePropertyValueAsRenderable(instance, propHandle, presentationId);
+ if (dlg.detachMaterial()) {
+ Q3DStudio::ScopedDocumentEditor editor(Q3DStudio::SCOPED_DOCUMENT_EDITOR(doc,
+ tr("Set material sub-presentation")));
+ editor->BeginAggregateOperation();
+ editor->SetMaterialType(instance, "Standard Material");
+ editor->setInstanceImagePropertyValueAsRenderable(instance, propHandle,
+ presentationId);
+ editor->EndAggregateOperation();
+ } else {
+ Q3DStudio::SCOPED_DOCUMENT_EDITOR(doc, tr("Set material sub-presentation"))
+ ->setInstanceImagePropertyValueAsRenderable(refInstance ? refInstance : instance,
+ propHandle, presentationId);
+ }
}
} else if (m_RowTree->rowType() == OBJTYPE_IMAGE) {
qt3dsdm::Qt3DSDMPropertyHandle propHandle = doc.GetPropertySystem()
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp
index 2bdeb2c5..0fa1e28b 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp
@@ -43,6 +43,8 @@
#include <QtWidgets/qslider.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qtimer.h>
+#include <QtWidgets/qpushbutton.h>
+#include <QtWidgets/qshortcut.h>
TimelineToolbar::TimelineToolbar() : QToolBar()
{
@@ -56,8 +58,8 @@ TimelineToolbar::TimelineToolbar() : QToolBar()
static const QIcon iconLast = QIcon(":/images/playback_tools_low-04.png");
static const QIcon iconZoomIn = QIcon(":/images/zoom_in.png");
static const QIcon iconZoomOut = QIcon(":/images/zoom_out.png");
- m_iconDiActive = QIcon(":/images/Objects-DataInput-Normal.png");
- m_iconDiInactive = QIcon(":/images/Objects-DataInput-Disabled.png");
+ m_iconDiActive = QIcon(":/images/Objects-DataInput-Active.png");
+ m_iconDiInactive = QIcon(":/images/Objects-DataInput-Inactive.png");
m_iconStop = QIcon(":/images/playback_tools_low-01.png");
m_iconPlay = QIcon(":/images/playback_tools_low-02.png");
@@ -75,11 +77,10 @@ TimelineToolbar::TimelineToolbar() : QToolBar()
m_actionDataInput = new QAction(m_iconDiInactive, tr("No Controller"), this);
m_actionDeleteRow = new QAction(iconDelete, tr("Delete Selected Object (Del)"), this);
m_actionPlayStop = new QAction(this);
- m_timeLabel = new TimelineToolbarLabel(this);
+ m_timeLabel = new QPushButton({}, this);
m_diLabel = new QLabel();
m_actionZoomIn = new QAction(iconZoomIn, tr("Zoom In"), this);
m_actionZoomOut = new QAction(iconZoomOut, tr("Zoom Out"), this);
- QAction *actionGoToTime = new QAction(this);
m_scaleSlider = new QSlider();
m_scaleSlider->setOrientation(Qt::Horizontal);
@@ -88,7 +89,8 @@ TimelineToolbar::TimelineToolbar() : QToolBar()
m_scaleSlider->setMaximum(22);
m_scaleSlider->setValue(2);
- m_timeLabel->setText(tr("0:00.000"));
+ m_timeLabel->setObjectName(QLatin1String("timelineButton"));
+ m_timeLabel->setFlat(true);
m_timeLabel->setMinimumWidth(80);
m_timeLabel->setToolTip(tr("Go To Time (%1%2T)").arg(ctrlKey).arg(altKey));
@@ -104,7 +106,7 @@ TimelineToolbar::TimelineToolbar() : QToolBar()
// connections
connect(m_actionNewLayer, &QAction::triggered, this, &TimelineToolbar::newLayerTriggered);
connect(m_actionDeleteRow, &QAction::triggered, this, &TimelineToolbar::deleteLayerTriggered);
- connect(m_timeLabel, &TimelineToolbarLabel::clicked, this, &TimelineToolbar::gotoTimeTriggered);
+ connect(m_timeLabel, &QPushButton::clicked, this, &TimelineToolbar::gotoTimeTriggered);
connect(actionFirst, &QAction::triggered, this, &TimelineToolbar::firstFrameTriggered);
connect(m_actionPlayStop, &QAction::triggered, this, &TimelineToolbar::onPlayButtonClicked);
connect(actionLast, &QAction::triggered, this, &TimelineToolbar::lastFrameTriggered);
@@ -112,12 +114,12 @@ TimelineToolbar::TimelineToolbar() : QToolBar()
connect(m_actionZoomIn, &QAction::triggered, this, &TimelineToolbar::onZoomInButtonClicked);
connect(m_actionZoomOut, &QAction::triggered, this, &TimelineToolbar::onZoomOutButtonClicked);
connect(m_actionDataInput, &QAction::triggered, this, &TimelineToolbar::onDiButtonClicked);
- connect(actionGoToTime, &QAction::triggered, this, &TimelineToolbar::gotoTimeTriggered);
// add actions
addAction(m_actionNewLayer);
addAction(m_actionDeleteRow);
addAction(m_actionDataInput);
+ addSpacing(2);
addWidget(m_diLabel);
addSpacing(20);
addWidget(m_timeLabel);
@@ -130,19 +132,19 @@ TimelineToolbar::TimelineToolbar() : QToolBar()
addWidget(m_scaleSlider);
addAction(m_actionZoomIn);
- // child-action, not visible in UI
- m_timeLabel->addAction(actionGoToTime);
-
// add keyboard shortcuts
m_actionZoomOut->setShortcut(Qt::Key_Minus);
m_actionZoomOut->setShortcutContext(Qt::ApplicationShortcut);
m_actionZoomIn->setShortcut(Qt::Key_Plus);
m_actionZoomIn->setShortcutContext(Qt::ApplicationShortcut);
- actionGoToTime->setShortcut(QKeySequence(Qt::ControlModifier | Qt::AltModifier | Qt::Key_T));
- actionGoToTime->setShortcutContext(Qt::ApplicationShortcut);
m_actionNewLayer->setShortcut(QKeySequence(Qt::ControlModifier | Qt::Key_L));
m_actionNewLayer->setShortcutContext(Qt::ApplicationShortcut);
+ QShortcut *gotoTimeShortcut = new QShortcut(this);
+ gotoTimeShortcut->setKey(QKeySequence(Qt::ControlModifier | Qt::AltModifier | Qt::Key_T));
+ gotoTimeShortcut->setContext(Qt::ApplicationShortcut);
+ connect(gotoTimeShortcut, &QShortcut::activated, this, &TimelineToolbar::gotoTimeTriggered);
+
m_connectSelectionChange = g_StudioApp.GetCore()->GetDispatch()->ConnectSelectionChange(
std::bind(&TimelineToolbar::onSelectionChange, this, std::placeholders::_1));
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h
index 3e65e45d..9921c495 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h
@@ -30,7 +30,6 @@
#define TIMELINETOOLBAR_H
#include "SelectedValueImpl.h"
-#include "TimelineToolbarLabel.h"
#include "Qt3DSDMSignals.h"
#include "DispatchListeners.h"
#include "Dispatch.h"
@@ -90,7 +89,7 @@ private:
void updateDataInputStatus();
void updateTimelineTitleColor(bool controlled);
- TimelineToolbarLabel *m_timeLabel;
+ QPushButton *m_timeLabel;
QLabel *m_diLabel;
QAction *m_actionDeleteRow;
QAction *m_actionPlayStop;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp
deleted file mode 100644
index 69c8843d..00000000
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "TimelineToolbarLabel.h"
-#include "StudioPreferences.h"
-#include "StudioApp.h"
-
-TimelineToolbarLabel::TimelineToolbarLabel(QWidget *parent)
- : QLabel(parent)
-{
- setHighlight(false);
- setAlignment(Qt::AlignCenter);
-}
-
-void TimelineToolbarLabel::enterEvent(QEvent *event)
-{
- Q_UNUSED(event);
- if (isEnabled())
- setHighlight(true);
-}
-
-void TimelineToolbarLabel::leaveEvent(QEvent *event)
-{
- Q_UNUSED(event);
- if (isEnabled())
- setHighlight(false);
-}
-
-void TimelineToolbarLabel::mousePressEvent(QMouseEvent *event)
-{
- g_StudioApp.setLastActiveView(parentWidget()->parentWidget());
- emit clicked(event);
-}
-
-void TimelineToolbarLabel::setHighlight(bool highlight)
-{
- if (highlight) {
- QColor bgColor = CStudioPreferences::GetMouseOverHighlightColor();
- QString bgColorStyle = QStringLiteral("background-color: ") + bgColor.name();
- setStyleSheet(bgColorStyle);
- } else {
- setStyleSheet("background-color: transparent;");
- }
-}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h
deleted file mode 100644
index 412797e7..00000000
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TIMELINETOOLBARLABEL_H
-#define TIMELINETOOLBARLABEL_H
-
-#include <QtWidgets/qlabel.h>
-#include <QtGui/qevent.h>
-
-class TimelineToolbarLabel : public QLabel
-{
- Q_OBJECT
-public:
- explicit TimelineToolbarLabel(QWidget *parent = nullptr);
-
-protected:
- void enterEvent(QEvent *event) override;
- void leaveEvent(QEvent *event) override;
- void mousePressEvent(QMouseEvent *event) override;
-
-signals:
- void clicked(QMouseEvent *event);
-
-private:
- void setHighlight(bool highlight);
-};
-
-#endif // TIMELINETOOLBARLABEL_H
diff --git a/src/Authoring/Studio/Palettes/controls/FloatTextField.qml b/src/Authoring/Studio/Palettes/controls/FloatTextField.qml
index 03e0cf48..9d65f68e 100644
--- a/src/Authoring/Studio/Palettes/controls/FloatTextField.qml
+++ b/src/Authoring/Studio/Palettes/controls/FloatTextField.qml
@@ -179,9 +179,9 @@ TextField {
if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
event.accepted = true
var delta = 1.0;
- if (event.modifiers === Qt.ControlModifier)
+ if (event.modifiers & Qt.ControlModifier)
delta = 0.1;
- else if (event.modifiers === Qt.ShiftModifier)
+ else if (event.modifiers & Qt.ShiftModifier)
delta = 10.0;
if (event.key === Qt.Key_Down)
delta = -delta;
diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro
index e04d05b1..2a1cd865 100644
--- a/src/Authoring/Studio/Qt3DStudio.pro
+++ b/src/Authoring/Studio/Qt3DStudio.pro
@@ -191,7 +191,6 @@ HEADERS += \
Palettes/TimelineGraphicsView/ui/Ruler.h \
Palettes/TimelineGraphicsView/ui/TimelineItem.h \
Palettes/TimelineGraphicsView/ui/TimelineToolbar.h \
- Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h \
Palettes/TimelineGraphicsView/ui/TreeHeader.h \
Palettes/TimelineGraphicsView/ui/TreeHeaderView.h \
PreviewHelper.h \
@@ -348,7 +347,6 @@ SOURCES += \
Palettes/TimelineGraphicsView/ui/Ruler.cpp \
Palettes/TimelineGraphicsView/ui/TimelineItem.cpp \
Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp \
- Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp \
Palettes/TimelineGraphicsView/ui/TreeHeader.cpp \
Palettes/TimelineGraphicsView/ui/TreeHeaderView.cpp \
PreviewHelper.cpp \
diff --git a/src/Authoring/Studio/Render/StudioRenderer.cpp b/src/Authoring/Studio/Render/StudioRenderer.cpp
index 9bc45340..1f78f2bc 100644
--- a/src/Authoring/Studio/Render/StudioRenderer.cpp
+++ b/src/Authoring/Studio/Render/StudioRenderer.cpp
@@ -496,15 +496,17 @@ struct SRendererImpl : public IStudioRenderer,
|| m_Translation->GetOrCreateTranslator(theInstance) == nullptr
|| GraphObjectTypes::IsNodeType(
m_Translation->GetOrCreateTranslator(theInstance)->GetGraphObject().m_Type)
- == false)
+ == false) {
theInstance = m_Doc.GetActiveLayer();
+ }
// If we *still* aren't pointed at a node then bail.
if (m_Translation->GetOrCreateTranslator(theInstance) == nullptr
|| GraphObjectTypes::IsNodeType(
m_Translation->GetOrCreateTranslator(theInstance)->GetGraphObject().m_Type)
- == false)
+ == false) {
return;
+ }
SNode &theNode = static_cast<SNode &>(
m_Translation->GetOrCreateTranslator(theInstance)->GetGraphObject());
@@ -523,10 +525,24 @@ struct SRendererImpl : public IStudioRenderer,
}
}
}
- } else
+ } else {
theBounds =
theNode.GetBounds(m_Context->GetBufferManager(), m_Context->GetPathManager());
+ }
+
+ // Fake bounds for non-physical objects
+ if (theBounds.isEmpty()) {
+ const int dim = 50.0f; // Dimensions of a default sized cube
+ theBounds = qt3ds::NVBounds3(QT3DSVec3(-dim, -dim, -dim), QT3DSVec3(dim, dim, dim));
+ }
+
+ // Empty groups don't have proper global transform, so we need to recalculate it.
+ // For simplicity's sake, we recalculate for all groups, not just empty ones.
+ if (theNode.m_Type == GraphObjectTypes::Node)
+ theNode.CalculateGlobalVariables();
+
QT3DSVec3 theCenter = theNode.m_GlobalTransform.transform(theBounds.getCenter());
+
// Center the edit camera so that it points directly at the bounds center point
m_Translation->m_EditCameraInfo.m_Position = theCenter;
// Now we need to adjust the camera's zoom such that the view frustum contains the bounding
diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
index cfedfbf9..c214dfea 100644
--- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
+++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
@@ -382,6 +382,7 @@ struct STranslatorDataModelParser
#define Camera_ClipNear m_Camera.m_ClipNear
#define Camera_ClipFar m_Camera.m_ClipFar
#define Camera_FOV m_Camera.m_Fov
+#define Camera_FOVHorizontal m_Camera.m_FovHorizontal
#define Camera_Orthographic m_Camera.m_Orthographic
#define Camera_ScaleMode m_Camera.m_ScaleMode
#define Camera_ScaleAnchor m_Camera.m_ScaleAnchor
@@ -2497,11 +2498,21 @@ void STranslation::Render(int inWidgetId, bool inDrawGuides, bool scenePreviewPa
&& theTranslator->GetGraphObject().m_Type != GraphObjectTypes::Layer) {
qt3ds::render::SNode &theNode(
- static_cast<qt3ds::render::SNode &>(theTranslator->GetGraphObject()));
+ static_cast<qt3ds::render::SNode &>(theTranslator->GetGraphObject()));
+ const GraphObjectTypes::Enum type = theTranslator->GetGraphObject().m_Type;
+
+ // Don't draw widgets for non-visible nodes
+ bool isActive = theNode.m_Flags.IsActive();
+ // Light and camera nodes are never active, so check from doc
+ if (type == GraphObjectTypes::Camera || type == GraphObjectTypes::Light)
+ isActive = m_Reader.IsCurrentlyActive(theHandles[0]);
+ shouldDisplayWidget = shouldDisplayWidget && isActive;
+
SCamera *theRenderCamera = m_Context.GetRenderer().GetCameraForNode(theNode);
bool isActiveCamera = theRenderCamera == (static_cast<SCamera *>(&theNode));
- if (shouldDisplayWidget && isActiveCamera == false
- && theTranslator->GetGraphObject().m_Type != GraphObjectTypes::Camera) {
+ if (shouldDisplayWidget && !isActiveCamera
+ && ((type == GraphObjectTypes::Camera && m_EditCameraEnabled)
+ || type != GraphObjectTypes::Camera)) {
switch (theToolMode) {
default:
QT3DS_ASSERT(false);
@@ -2511,14 +2522,14 @@ void STranslation::Render(int inWidgetId, bool inDrawGuides, bool scenePreviewPa
if (!m_TranslationWidget) {
m_TranslationWidget
= qt3ds::widgets::IStudioWidget::CreateTranslationWidget(
- m_Context.GetAllocator());
+ m_Context.GetAllocator());
}
theNextWidget = m_TranslationWidget.mPtr;
break;
case STUDIO_TOOLMODE_ROTATE:
if (!m_RotationWidget) {
m_RotationWidget = qt3ds::widgets::IStudioWidget::CreateRotationWidget(
- m_Context.GetAllocator());
+ m_Context.GetAllocator());
}
theNextWidget = m_RotationWidget.mPtr;
break;
@@ -2526,7 +2537,7 @@ void STranslation::Render(int inWidgetId, bool inDrawGuides, bool scenePreviewPa
case STUDIO_TOOLMODE_SCALE:
if (!m_ScaleWidget) {
m_ScaleWidget = qt3ds::widgets::IStudioWidget::CreateScaleWidget(
- m_Context.GetAllocator());
+ m_Context.GetAllocator());
}
theNextWidget = m_ScaleWidget.mPtr;
break;
@@ -3010,8 +3021,11 @@ SStudioPickValue STranslation::Pick(CPt inMouseCoords, TranslationSelectMode::En
const SGraphObject &theObject = *thePickResult.m_HitObject;
// check hit distance to cameras and lights
- if (lastIndex != -1 && thePickResult.m_CameraDistanceSq > lastDist * lastDist)
+ if (lastIndex != -1 && thePickResult.m_CameraDistanceSq > lastDist * lastDist) {
+ DoPrepareForDrag(static_cast<SNode *>(
+ &(m_editModeCamerasAndLights[lastIndex]->GetGraphObject())));
return m_editModeCamerasAndLights[lastIndex]->GetInstanceHandle();
+ }
if (theObject.m_Type == GraphObjectTypes::Model
|| theObject.m_Type == GraphObjectTypes::Text
@@ -3084,8 +3098,11 @@ SStudioPickValue STranslation::Pick(CPt inMouseCoords, TranslationSelectMode::En
RequestRender();
}
- if (lastIndex != -1)
+ if (lastIndex != -1) {
+ DoPrepareForDrag(static_cast<SNode *>(
+ &(m_editModeCamerasAndLights[lastIndex]->GetGraphObject())));
return m_editModeCamerasAndLights[lastIndex]->GetInstanceHandle();
+ }
return SStudioPickValue();
}
@@ -3684,20 +3701,25 @@ void STranslation::PerformWidgetDrag(int inWidgetSubComponent, CPt inOriginalCoo
QT3DSF32 theIntersectionCosine = theOriginalRay.m_Direction.dot(thePlaneNormal);
QT3DSVec3 objToPrevious;
QT3DSVec3 objToCurrent;
- /*
- long theModifiers = CHotKeys::GetCurrentKeyModifiers();
- if ( theModifiers & CHotKeys::MODIFIER_SHIFT )
- {
- DebugBreak();
- }
- */
- if (!theOriginalPlaneCoords.hasValue() || !theCurrentPlaneCoords.hasValue())
- return;
if (fabs(theIntersectionCosine) > .08f) {
+ if (!theOriginalPlaneCoords.hasValue() || !theCurrentPlaneCoords.hasValue())
+ return;
objToPrevious = globalPos - *theOriginalPlaneCoords;
objToCurrent = globalPos - *theCurrentPlaneCoords;
objToPrevious.normalize();
QT3DSF32 lineLen = objToCurrent.normalize();
+
+ if (!thePrepResult->m_Camera->m_Flags.IsOrthographic()) {
+ // Flip object vector if coords are behind camera to get the correct angle
+ QT3DSVec3 camToCurrent = camGlobalPos - *theCurrentPlaneCoords;
+ if (camToCurrent.dot(theCamDirection) >= 0.0f) {
+ objToCurrent = -objToCurrent;
+ // Negative line length seems counterintuitive, but since the end point is
+ // behind the camera, it results in correct line when rendered
+ lineLen = -lineLen;
+ }
+ }
+
QT3DSF32 cosAngle = objToPrevious.dot(objToCurrent);
QT3DSVec3 theCrossProd = objToPrevious.cross(objToCurrent);
QT3DSF32 theCrossPlaneDot = theCrossProd.dot(thePlaneNormal);
@@ -3705,6 +3727,7 @@ void STranslation::PerformWidgetDrag(int inWidgetSubComponent, CPt inOriginalCoo
QT3DSF32 angleRad = acos(cosAngle) * angleSign;
angleRad = MakeNiceRotation(angleRad);
QT3DSQuat theRotation(angleRad, thePlaneNormal);
+
m_CumulativeRotation = ShortestAngleDifference(m_CumulativeRotation, angleRad);
m_LastRenderedWidget->SetRotationEdges(-1.0f * objToPrevious, thePlaneNormal,
m_CumulativeRotation, lineLen);
diff --git a/src/Authoring/Studio/Render/StudioRotationWidget.cpp b/src/Authoring/Studio/Render/StudioRotationWidget.cpp
index 8578595c..547039a0 100644
--- a/src/Authoring/Studio/Render/StudioRotationWidget.cpp
+++ b/src/Authoring/Studio/Render/StudioRotationWidget.cpp
@@ -375,7 +375,7 @@ struct SRotationWidget : public SStudioWidgetImpl<StudioWidgetTypes::Rotation>
char textBuffer[25] = { 0 };
QT3DSF32 angleDeg(m_RotationWedge->m_Angle);
TODEG(angleDeg);
- sprintf(textBuffer, " %.1f ", angleDeg); // spaces added for margin
+ sprintf(textBuffer, " %.1f ", -angleDeg); // spaces added for margin
STextRenderInfo theInfo;
theInfo.m_Text = inRenderContext.GetStringTable().RegisterStr(textBuffer);
theInfo.m_HorizontalAlignment = TextHorizontalAlignment::Center;
diff --git a/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp b/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
index 00c1349c..bfea1bac 100644
--- a/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
+++ b/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
@@ -90,7 +90,6 @@ void CStudioAppPrefsPage::onInitDialog()
// Add tool tips for controls
m_ui->m_DefaultInterpolation->setToolTip(tr("Set default keyframe interpolation type"));
m_ui->m_checkTimelineAbsoluteSnapping->setToolTip(tr("Enable timeline snapping grid"));
- m_ui->m_checkLegacyViewer->setToolTip(tr("Enable preview with legacy Qt 3D Viewer 1.1"));
m_ui->m_SnapRangeCombo->setToolTip(tr("Set resolution of timeline snapping grid"));
m_ui->m_buttonRestoreDefaults->setToolTip(tr("Click to restore default Studio settings"));
@@ -119,8 +118,6 @@ void CStudioAppPrefsPage::onInitDialog()
connect(m_ui->m_SnapRangeCombo, activated, this, [=](){ setModified(true); });
connect(m_ui->m_checkTimelineAbsoluteSnapping, &QCheckBox::clicked,
this, [=](){ setModified(true); enableOptions(); });
- connect(m_ui->m_checkLegacyViewer, &QCheckBox::clicked,
- this, [=](){ setModified(true); m_restartNeeded = true; });
connect(m_ui->m_EditViewStartupView, activated, this, [=](){ setModified(true); });
connect(m_ui->selectorWidth,
static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
@@ -164,9 +161,6 @@ void CStudioAppPrefsPage::loadSettings()
m_ui->m_checkTimelineAbsoluteSnapping->setChecked(
CStudioPreferences::IsTimelineSnappingGridActive());
- // Legacy viewer
- m_ui->m_checkLegacyViewer->setChecked(CStudioPreferences::IsLegacyViewerActive());
-
// Tool handles
m_ui->selectorWidth->setValue(CStudioPreferences::getSelectorLineWidth());
m_ui->selectorLength->setValue(CStudioPreferences::getSelectorLineLength());
@@ -209,9 +203,6 @@ void CStudioAppPrefsPage::saveSettings()
long theCurrentSelection = m_ui->m_SnapRangeCombo->currentIndex();
CStudioPreferences::SetTimelineSnappingGridResolution((ESnapGridResolution)theCurrentSelection);
- // Legacy viewer
- CStudioPreferences::SetLegacyViewerActive(m_ui->m_checkLegacyViewer->isChecked());
-
// Preferred Startup View
long theSel = m_ui->m_EditViewStartupView->currentIndex();
long theNumItems = m_ui->m_EditViewStartupView->count();
diff --git a/src/Authoring/Studio/UI/StudioAppPrefsPage.ui b/src/Authoring/Studio/UI/StudioAppPrefsPage.ui
index 1af60cd3..9d724e63 100644
--- a/src/Authoring/Studio/UI/StudioAppPrefsPage.ui
+++ b/src/Authoring/Studio/UI/StudioAppPrefsPage.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>347</width>
- <height>511</height>
+ <width>418</width>
+ <height>543</height>
</rect>
</property>
<property name="windowTitle">
@@ -20,6 +20,16 @@
<string>General</string>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="m_checkTimelineAbsoluteSnapping">
+ <property name="text">
+ <string>Timeline Snapping Grid</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="m_DefaultInterpolation"/>
+ </item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@@ -30,26 +40,9 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QComboBox" name="m_DefaultInterpolation"/>
- </item>
<item row="1" column="1">
<widget class="QComboBox" name="m_SnapRangeCombo"/>
</item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="m_checkTimelineAbsoluteSnapping">
- <property name="text">
- <string>Timeline Snapping Grid</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="m_checkLegacyViewer">
- <property name="text">
- <string>Legacy Viewer</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
diff --git a/src/Authoring/Studio/Utils/ImportUtils.cpp b/src/Authoring/Studio/Utils/ImportUtils.cpp
index 875eef79..b850404f 100644
--- a/src/Authoring/Studio/Utils/ImportUtils.cpp
+++ b/src/Authoring/Studio/Utils/ImportUtils.cpp
@@ -57,11 +57,13 @@ SObjectFileType ImportUtils::GetObjectFileTypeForFile(const CFilePath &inFile,
} else if (theExtension.Compare(CDialogs::GetQmlFileExtension(),
Q3DStudio::CString::ENDOFSTRING, false)) {
QQmlApplicationEngine qmlEngine(inFile.absoluteFilePath());
- const char *rootClassName = qmlEngine.rootObjects().at(0)
- ->metaObject()->superClass()->className();
- bool isQmlStream = strcmp(rootClassName, "Q3DStudio::Q3DSQmlBehavior") != 0;
- return isQmlStream ? SObjectFileType(OBJTYPE_QML_STREAM, DocumentEditorFileType::QmlStream)
- : SObjectFileType(OBJTYPE_BEHAVIOR, DocumentEditorFileType::Behavior);
+ if (qmlEngine.rootObjects().size() > 0) {
+ const char *rootClassName = qmlEngine.rootObjects().at(0)
+ ->metaObject()->superClass()->className();
+ bool isQmlStream = strcmp(rootClassName, "Q3DStudio::Q3DSQmlBehavior") != 0;
+ return isQmlStream ? SObjectFileType(OBJTYPE_QML_STREAM, DocumentEditorFileType::QmlStream)
+ : SObjectFileType(OBJTYPE_BEHAVIOR, DocumentEditorFileType::Behavior);
+ } // If qml file is invalid, it will be of unknown type
} else if (theExtension.Compare(CDialogs::GetMaterialDataFileExtension(),
Q3DStudio::CString::ENDOFSTRING, false)) {
return SObjectFileType(OBJTYPE_MATERIALDATA, DocumentEditorFileType::MaterialData);
diff --git a/src/Authoring/Studio/Workspace/Dialogs.cpp b/src/Authoring/Studio/Workspace/Dialogs.cpp
index 05e31f32..d45b27d5 100644
--- a/src/Authoring/Studio/Workspace/Dialogs.cpp
+++ b/src/Authoring/Studio/Workspace/Dialogs.cpp
@@ -87,11 +87,11 @@ struct SAllowedTypesEntry
};
const char *imgExts[] = {
- "png", "jpg", "jpeg", "dds", "bmp", "gif", "hdr", nullptr,
+ "png", "jpg", "jpeg", "dds", "bmp", "gif", "hdr", "ktx", nullptr,
};
const wchar_t *wideImgExts[] = {
- L"png", L"jpg", L"jpeg", L"dds", L"bmp", L"gif", L"hdr", nullptr,
+ L"png", L"jpg", L"jpeg", L"dds", L"bmp", L"gif", L"hdr", L"ktx", nullptr,
};
const char *modelExts[] = {
diff --git a/src/Authoring/Studio/images.qrc b/src/Authoring/Studio/images.qrc
index ef0fc1bd..7e0367fb 100644
--- a/src/Authoring/Studio/images.qrc
+++ b/src/Authoring/Studio/images.qrc
@@ -230,18 +230,16 @@
<file>images/client_tools_hi_color-06@2x.png</file>
<file>images/prefstab-00@2x.png</file>
<file>images/playback_tools_low-03@2x.png</file>
- <file>images/Tutorial/button_back.png</file>
- <file>images/Tutorial/button_next.png</file>
- <file>images/Tutorial/button_back@2x.png</file>
- <file>images/Tutorial/button_next@2x.png</file>
<file>images/Objects-edit-disabled.png</file>
<file>images/Objects-edit-disabled@2x.png</file>
<file>images/Objects-edit-normal.png</file>
<file>images/Objects-edit-normal@2x.png</file>
- <file>images/Objects-DataInput-Normal.png</file>
- <file>images/Objects-DataInput-Normal@2x.png</file>
- <file>images/Objects-DataInput-Disabled.png</file>
- <file>images/Objects-DataInput-Disabled@2x.png</file>
+ <file>images/Objects-DataInput-Active.png</file>
+ <file>images/Objects-DataInput-Active@2x.png</file>
+ <file>images/Objects-DataInput-Inactive.png</file>
+ <file>images/Objects-DataInput-Inactive@2x.png</file>
+ <file>images/Objects-DataInput-White.png</file>
+ <file>images/Objects-DataInput-White@2x.png</file>
<file>images/Asset-import-Normal.png</file>
<file>images/Asset-import-Normal@2x.png</file>
<file>images/arrow_up.png</file>
@@ -255,38 +253,12 @@
<file>images/zoom_out@2x.png</file>
<file>images/zoom_in.png</file>
<file>images/zoom_in@2x.png</file>
- <file>images/Tutorial/background.png</file>
- <file>images/Tutorial/background@2x.png</file>
- <file>images/Tutorial/dot_active.png</file>
- <file>images/Tutorial/dot_active@2x.png</file>
- <file>images/Tutorial/dot_inactive.png</file>
- <file>images/Tutorial/dot_inactive@2x.png</file>
- <file>images/Tutorial/screens/1x/1.png</file>
- <file>images/Tutorial/screens/1x/2.png</file>
- <file>images/Tutorial/screens/1x/3.png</file>
- <file>images/Tutorial/screens/1x/4.png</file>
- <file>images/Tutorial/screens/1x/5.png</file>
- <file>images/Tutorial/screens/1x/6.png</file>
- <file>images/Tutorial/screens/1x/7.png</file>
- <file>images/Tutorial/screens/1x/8.png</file>
- <file>images/Tutorial/screens/1x/9.png</file>
- <file>images/Tutorial/screens/2x/1.png</file>
- <file>images/Tutorial/screens/2x/2.png</file>
- <file>images/Tutorial/screens/2x/3.png</file>
- <file>images/Tutorial/screens/2x/4.png</file>
- <file>images/Tutorial/screens/2x/5.png</file>
- <file>images/Tutorial/screens/2x/6.png</file>
- <file>images/Tutorial/screens/2x/7.png</file>
- <file>images/Tutorial/screens/2x/8.png</file>
- <file>images/Tutorial/screens/2x/9.png</file>
<file>images/remote.png</file>
<file>images/remote@2x.png</file>
<file>images/remote-disabled.png</file>
<file>images/remote-disabled@2x.png</file>
<file>images/Assets-Model.png</file>
<file>images/Assets-Model@2x.png</file>
- <file>images/Objects-DataInput-White.png</file>
- <file>images/Objects-DataInput-White@2x.png</file>
<file>images/presentation_edit.png</file>
<file>images/presentation_edit@2x.png</file>
<file>images/presentation_notUsed.png</file>
@@ -299,6 +271,7 @@
<file>images/qml_used@2x.png</file>
<file>images/Toggle-HideShowControlled.png</file>
<file>images/Toggle-HideShowControlled@2x.png</file>
+ <file>images/welcomedialog/laptop.png</file>
</qresource>
<qresource prefix="/startup">
<file alias="open_dialog.png">images/open_dialog.png</file>
diff --git a/src/Viewer/Qt3DViewer/resources/images/check.png b/src/Authoring/Studio/images/Objects-DataInput-Active.png
index 5c1ef70a..cef46028 100644
--- a/src/Viewer/Qt3DViewer/resources/images/check.png
+++ b/src/Authoring/Studio/images/Objects-DataInput-Active.png
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Active@2x.png b/src/Authoring/Studio/images/Objects-DataInput-Active@2x.png
new file mode 100644
index 00000000..94330a8e
--- /dev/null
+++ b/src/Authoring/Studio/images/Objects-DataInput-Active@2x.png
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Disabled.png b/src/Authoring/Studio/images/Objects-DataInput-Disabled.png
deleted file mode 100644
index f1c3533b..00000000
--- a/src/Authoring/Studio/images/Objects-DataInput-Disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Disabled@2x.png b/src/Authoring/Studio/images/Objects-DataInput-Disabled@2x.png
deleted file mode 100644
index 18e6b0fb..00000000
--- a/src/Authoring/Studio/images/Objects-DataInput-Disabled@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Inactive.png b/src/Authoring/Studio/images/Objects-DataInput-Inactive.png
new file mode 100644
index 00000000..6bed14ee
--- /dev/null
+++ b/src/Authoring/Studio/images/Objects-DataInput-Inactive.png
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Inactive@2x.png b/src/Authoring/Studio/images/Objects-DataInput-Inactive@2x.png
new file mode 100644
index 00000000..b04b43b1
--- /dev/null
+++ b/src/Authoring/Studio/images/Objects-DataInput-Inactive@2x.png
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Normal.png b/src/Authoring/Studio/images/Objects-DataInput-Normal.png
deleted file mode 100644
index 60a0c23e..00000000
--- a/src/Authoring/Studio/images/Objects-DataInput-Normal.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-Normal@2x.png b/src/Authoring/Studio/images/Objects-DataInput-Normal@2x.png
deleted file mode 100644
index d9f39837..00000000
--- a/src/Authoring/Studio/images/Objects-DataInput-Normal@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-White.png b/src/Authoring/Studio/images/Objects-DataInput-White.png
index 346f1c86..f97b5a80 100644
--- a/src/Authoring/Studio/images/Objects-DataInput-White.png
+++ b/src/Authoring/Studio/images/Objects-DataInput-White.png
Binary files differ
diff --git a/src/Authoring/Studio/images/Objects-DataInput-White@2x.png b/src/Authoring/Studio/images/Objects-DataInput-White@2x.png
index a5e1a406..21905429 100644
--- a/src/Authoring/Studio/images/Objects-DataInput-White@2x.png
+++ b/src/Authoring/Studio/images/Objects-DataInput-White@2x.png
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/background.png b/src/Authoring/Studio/images/Tutorial/background.png
deleted file mode 100644
index 374eb982..00000000
--- a/src/Authoring/Studio/images/Tutorial/background.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/background@2x.png b/src/Authoring/Studio/images/Tutorial/background@2x.png
deleted file mode 100644
index d6235212..00000000
--- a/src/Authoring/Studio/images/Tutorial/background@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/button_back.png b/src/Authoring/Studio/images/Tutorial/button_back.png
deleted file mode 100644
index 8113df5b..00000000
--- a/src/Authoring/Studio/images/Tutorial/button_back.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/button_back@2x.png b/src/Authoring/Studio/images/Tutorial/button_back@2x.png
deleted file mode 100644
index ec6a2f13..00000000
--- a/src/Authoring/Studio/images/Tutorial/button_back@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/button_next.png b/src/Authoring/Studio/images/Tutorial/button_next.png
deleted file mode 100644
index 857dcada..00000000
--- a/src/Authoring/Studio/images/Tutorial/button_next.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/button_next@2x.png b/src/Authoring/Studio/images/Tutorial/button_next@2x.png
deleted file mode 100644
index f32c4f26..00000000
--- a/src/Authoring/Studio/images/Tutorial/button_next@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/dot_active.png b/src/Authoring/Studio/images/Tutorial/dot_active.png
deleted file mode 100644
index 009e5f85..00000000
--- a/src/Authoring/Studio/images/Tutorial/dot_active.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/dot_active@2x.png b/src/Authoring/Studio/images/Tutorial/dot_active@2x.png
deleted file mode 100644
index 59ab92bb..00000000
--- a/src/Authoring/Studio/images/Tutorial/dot_active@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/dot_inactive.png b/src/Authoring/Studio/images/Tutorial/dot_inactive.png
deleted file mode 100644
index 0550db1e..00000000
--- a/src/Authoring/Studio/images/Tutorial/dot_inactive.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png b/src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png
deleted file mode 100644
index 697d1db0..00000000
--- a/src/Authoring/Studio/images/Tutorial/dot_inactive@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/1.png b/src/Authoring/Studio/images/Tutorial/screens/1x/1.png
deleted file mode 100644
index b20c2154..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/1.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/2.png b/src/Authoring/Studio/images/Tutorial/screens/1x/2.png
deleted file mode 100644
index d890a8f8..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/2.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/3.png b/src/Authoring/Studio/images/Tutorial/screens/1x/3.png
deleted file mode 100644
index 41a9ea8a..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/3.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/4.png b/src/Authoring/Studio/images/Tutorial/screens/1x/4.png
deleted file mode 100644
index fd43b00c..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/4.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/5.png b/src/Authoring/Studio/images/Tutorial/screens/1x/5.png
deleted file mode 100644
index 8204a1bb..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/5.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/6.png b/src/Authoring/Studio/images/Tutorial/screens/1x/6.png
deleted file mode 100644
index 8f878f7b..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/6.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/7.png b/src/Authoring/Studio/images/Tutorial/screens/1x/7.png
deleted file mode 100644
index 39aaf6dc..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/7.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/8.png b/src/Authoring/Studio/images/Tutorial/screens/1x/8.png
deleted file mode 100644
index adfbb798..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/8.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/1x/9.png b/src/Authoring/Studio/images/Tutorial/screens/1x/9.png
deleted file mode 100644
index 5a3401f0..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/1x/9.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/1.png b/src/Authoring/Studio/images/Tutorial/screens/2x/1.png
deleted file mode 100644
index 1cea5bfa..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/1.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/2.png b/src/Authoring/Studio/images/Tutorial/screens/2x/2.png
deleted file mode 100644
index a95f4cfd..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/2.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/3.png b/src/Authoring/Studio/images/Tutorial/screens/2x/3.png
deleted file mode 100644
index d8d3cf42..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/3.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/4.png b/src/Authoring/Studio/images/Tutorial/screens/2x/4.png
deleted file mode 100644
index a27debc9..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/4.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/5.png b/src/Authoring/Studio/images/Tutorial/screens/2x/5.png
deleted file mode 100644
index 1723dad6..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/5.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/6.png b/src/Authoring/Studio/images/Tutorial/screens/2x/6.png
deleted file mode 100644
index 4a552b84..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/6.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/7.png b/src/Authoring/Studio/images/Tutorial/screens/2x/7.png
deleted file mode 100644
index 0efe714d..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/7.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/8.png b/src/Authoring/Studio/images/Tutorial/screens/2x/8.png
deleted file mode 100644
index 2b97b613..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/8.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/Tutorial/screens/2x/9.png b/src/Authoring/Studio/images/Tutorial/screens/2x/9.png
deleted file mode 100644
index a9b2317f..00000000
--- a/src/Authoring/Studio/images/Tutorial/screens/2x/9.png
+++ /dev/null
Binary files differ
diff --git a/src/Authoring/Studio/images/welcomedialog/laptop.png b/src/Authoring/Studio/images/welcomedialog/laptop.png
new file mode 100644
index 00000000..0bdeef44
--- /dev/null
+++ b/src/Authoring/Studio/images/welcomedialog/laptop.png
Binary files differ
diff --git a/src/Authoring/Studio/style.qss b/src/Authoring/Studio/style.qss
index a5b4bab9..37458cd2 100644
--- a/src/Authoring/Studio/style.qss
+++ b/src/Authoring/Studio/style.qss
@@ -267,21 +267,48 @@ QHeaderView::section:hover {
/* Tutorial Dialog */
QDialog#StudioTutorialWidget,
QDialog#StudioTutorialWidget QWidget {
- color: #ffffff;
background-color: transparent;
border: 0px;
}
+QLabel#studioTutorialName {
+ font-size: 42px;
+ font-family: "Titillium Web";
+ font-weight: 300;
+ color: "#00cd45";
+}
+
+QLabel#studioTutorialWelcome {
+ font-size: 42px;
+ font-family: "Titillium Web";
+ font-weight: 300;
+ color: #ffffff;
+}
+
+QPushButton#studioTutorialOpen,
+QPushButton#studioTutorialNew,
+QPushButton#studioTutorialQuickStart {
+ font-size: 28px;
+ font-family: "Titillium Web";
+ font-weight: 300;
+ color: #ffffff;
+ padding: 0px 60px 0px 60px;
+}
+
QPushButton:!pressed#studioTutorialOpen,
-QPushButton:!pressed#studioTutorialNew {
- background: transparent;
- border: 1px solid #41cd52;
+QPushButton:!pressed#studioTutorialNew,
+QPushButton:!pressed#studioTutorialQuickStart {
+ background: "#00cd45";
+ border: 3px solid "#00cd45";
+ border-radius: 10px;
}
QPushButton:pressed#studioTutorialOpen,
-QPushButton:pressed#studioTutorialNew {
- background: #41cd52;
- border: 1px solid #41cd52;
+QPushButton:pressed#studioTutorialNew,
+QPushButton:pressed#studioTutorialQuickStart {
+ background: transparent;
+ border: 3px solid "#00cd45";
+ border-radius: 10px;
}
/* Startup Dialog */
@@ -310,27 +337,17 @@ QDialog#AboutDlg QPushButton:pressed {
border: 1px solid #41cd52;
}
-/* TimeLineToolbar */
-QWidget#TimeLineParent,
-TimeLineToolbar QWidget#layoutWidget {
- background: #404244;
-}
-
-TimeLineToolbar QPushButton#timeButton {
+/* TimelineToolbar */
+QPushButton#timelineButton {
border: 0px;
}
-TimeLineToolbar QLabel#dataInputName {
- background: transparent;
- color: #ff5102;
+QPushButton:pressed#timelineButton {
+ background: #46a2da;
}
-QLabel#timebarToolTip {
- background: #404244;
- color: #ffffff;
- font-size: 12px;
- border: 1px solid #727476;
- border-radius: 2;
+QPushButton:hover:!pressed#timelineButton {
+ background: #262829;
}
/* Loading progress dialog */
@@ -346,15 +363,12 @@ QDialog#ProgressDlg QWidget#progressActionText {
font-size: 16px;
}
-/* Sub-presentation Dialogs and Data Input Dialogs */
-QDialog#SubPresentationListDlg QTableView QTableCornerButton::section,
-QDialog#SubPresentationListDlg QHeaderView::section,
+/* Data Input Dialogs */
QDialog#DataInputListDlg QTableView QTableCornerButton::section,
QDialog#DataInputListDlg QHeaderView::section {
font-weight: bold;
}
-QDialog#SubPresentationListDlg QTableView,
QDialog#DataInputListDlg QTableView {
selection-background-color: #46a2da;
gridline-color: #2e2f30;
@@ -370,7 +384,6 @@ QDialog#DataInputListDlg QComboBox QAbstractItemView::item
margin-top: 5px;
}
-QDialog#SubPresentationListDlg QPushButton#SubPresentationListButton,
QDialog#DataInputListDlg QPushButton#DataInputListButton {
background-color: transparent;
border: 0px;
@@ -381,31 +394,16 @@ QDialog#DataInputListDlg QPushButton#DataInputListButton {
padding: 0px;
}
-QDialog#SubPresentationListDlg QPushButton#SubPresentationListButton:pressed,
QDialog#DataInputListDlg QPushButton#DataInputListButton:pressed {
background-color: #262829;
}
-QDialog#SubPresentationDlg QPushButton:!enabled,
QDialog#DataInputDlg QPushButton:!enabled,
QDialog#DataInputDlg QComboBox QAbstractItemView::item:disabled {
background: transparent;
color: #727476;
}
-/* Data input chooser */
-DataInputSelectDlg {
- border: 1px solid #404244;
-}
-
-DataInputSelectDlg::item:selected {
- background: #46a2da;
-}
-
-DataInputSelectDlg::item:hover {
- background: #23516d;
-}
-
/* QSlider horizontal */
QSlider {
background: transparent;
diff --git a/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp b/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp
index 8b3f90a8..1eb7fa48 100644
--- a/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp
+++ b/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp
@@ -522,6 +522,7 @@ struct SRuntimePropertyParser
#define Camera_ClipNear ATTRIBUTE_CLIPNEAR
#define Camera_ClipFar ATTRIBUTE_CLIPFAR
#define Camera_FOV ATTRIBUTE_FOV
+#define Camera_FOVHorizontal ATTRIBUTE_FOVHORIZONTAL
#define Camera_Orthographic ATTRIBUTE_ORTHOGRAPHIC
#define Camera_ScaleMode ATTRIBUTE_SCALEMODE
#define Camera_ScaleAnchor ATTRIBUTE_SCALEANCHOR
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.cpp
index 218dfd16..062a36c5 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.cpp
@@ -33,9 +33,8 @@
#include "render/Qt3DSRenderTexture2D.h"
#include "render/Qt3DSRenderContext.h"
#include "Qt3DSTextRenderer.h"
-/*
-#include <Windows.h>
-*/
+
+#include <qmath.h>
using namespace qt3ds::render;
@@ -159,6 +158,7 @@ SCamera::SCamera()
, m_ClipNear(10)
, m_ClipFar(10000)
, m_FOV(60)
+ , m_FOVHorizontal(false)
, m_ScaleMode(CameraScaleModes::Fit)
, m_ScaleAnchor(CameraScaleAnchors::Center)
{
@@ -201,7 +201,7 @@ bool SCamera::ComputeFrustumPerspective(const NVRenderRectF &inViewport,
const QT3DSVec2 &inDesignDimensions)
{
m_Projection = QT3DSMat44::createIdentity();
- QT3DSF32 theAngleInRadians = m_FOV / 2.0f;
+ QT3DSF32 theAngleInRadians = verticalFov(inViewport) / 2.0f;
QT3DSF32 theDeltaZ = m_ClipFar - m_ClipNear;
QT3DSF32 theSine = sinf(theAngleInRadians);
QT3DSF32 designAspect = GetAspectRatio(inDesignDimensions);
@@ -471,3 +471,16 @@ QT3DSVec3 SCamera::UnprojectToPosition(const QT3DSVec3 &inGlobalPos, const SRay
NVPlane theCameraPlane(theCameraDir, theDistance);
return inRay.Intersect(theCameraPlane);
}
+
+QT3DSF32 SCamera::verticalFov(QT3DSF32 aspectRatio) const
+{
+ if (m_FOVHorizontal)
+ return 2.0f * qAtan(qTan(qreal(m_FOV) / 2.0) / qreal(aspectRatio));
+ else
+ return m_FOV;
+}
+
+QT3DSF32 SCamera::verticalFov(const NVRenderRectF &inViewport) const
+{
+ return verticalFov(GetAspectRatio(inViewport));
+}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.h b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.h
index 3939276e..d6d8ce82 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.h
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderCamera.h
@@ -102,6 +102,7 @@ namespace render {
QT3DSF32 m_ClipFar;
QT3DSF32 m_FOV; // Radians
+ bool m_FOVHorizontal;
QT3DSMat44 m_Projection;
CameraScaleModes::Enum m_ScaleMode;
@@ -166,6 +167,9 @@ namespace render {
// plane as inGlobalPos.
// Expects CalculateGlobalVariables has been called or doesn't need to be.
QT3DSVec3 UnprojectToPosition(const QT3DSVec3 &inGlobalPos, const SRay &inRay) const;
+
+ QT3DSF32 verticalFov(QT3DSF32 aspectRatio) const;
+ QT3DSF32 verticalFov(const NVRenderRectF &inViewport) const;
};
}
}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h
index 00727d53..eb19f51f 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h
@@ -339,6 +339,7 @@ namespace render {
HANDLE_QT3DS_RENDER_PROPERTY(Camera, ClipNear, Dirty) \
HANDLE_QT3DS_RENDER_PROPERTY(Camera, ClipFar, Dirty) \
HANDLE_QT3DS_RENDER_RADIAN_PROPERTY(Camera, FOV, Dirty) \
+ HANDLE_QT3DS_RENDER_PROPERTY(Camera, FOVHorizontal, Dirty) \
HANDLE_QT3DS_NODE_FLAGS_PROPERTY(Camera, Orthographic, Dirty) \
HANDLE_QT3DS_RENDER_ENUM_PROPERTY(Camera, ScaleMode, Dirty) \
HANDLE_QT3DS_RENDER_ENUM_PROPERTY(Camera, ScaleAnchor, Dirty)
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImpl.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImpl.cpp
index 94fe815d..d6fb3b1b 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImpl.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImpl.cpp
@@ -1649,11 +1649,12 @@ namespace render {
QT3DSF32 R2 = pLayer->m_AoDistance * pLayer->m_AoDistance * 0.16f;
QT3DSF32 rw = 100, rh = 100;
- QT3DSF32 fov = (pCamera) ? pCamera->m_FOV : 1.0f;
+
if (inDepthTexture && inDepthTexture.GetTexture()) {
rw = (QT3DSF32)inDepthTexture.GetTexture()->GetTextureDetails().m_Width;
rh = (QT3DSF32)inDepthTexture.GetTexture()->GetTextureDetails().m_Height;
}
+ QT3DSF32 fov = (pCamera) ? pCamera->verticalFov(rw / rh) : 1.0f;
QT3DSF32 tanHalfFovY = tanf(0.5f * fov * (rh / rw));
QT3DSF32 invFocalLenX = tanHalfFovY * (rw / rh);
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderData.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderData.cpp
index 51bff7f4..15070b64 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderData.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderData.cpp
@@ -316,7 +316,7 @@ namespace render {
QT3DSVec3 camY(dataPtr[4], dataPtr[5], dataPtr[6]);
QT3DSVec3 camZ(dataPtr[8], dataPtr[9], dataPtr[10]);
- float tanFOV = tanf(inCamera.m_FOV * 0.5f);
+ float tanFOV = tanf(inCamera.verticalFov(inViewPort) * 0.5f);
float asTanFOV = tanFOV * inViewPort.m_Width / inViewPort.m_Height;
camEdges[0] = -asTanFOV * camX + tanFOV * camY + camZ;
camEdges[1] = asTanFOV * camX + tanFOV * camY + camZ;
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderPreparationData.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderPreparationData.cpp
index 4491ff09..bd824cb4 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderPreparationData.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/RendererImpl/Qt3DSRendererImplLayerRenderPreparationData.cpp
@@ -307,6 +307,9 @@ namespace render {
if (!m_Layer.m_Flags.IsActive())
return;
+ // Ensure we clear the widget layer always
+ m_Renderer.LayerNeedsFrameClear(*static_cast<SLayerRenderData *>(this));
+
if (m_IRenderWidgets.size() < MAX_LAYER_WIDGETS)
m_IRenderWidgets.push_back(&inWidget);
}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderBufferManager.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderBufferManager.cpp
index 2e25ff0d..fe49a91f 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderBufferManager.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderBufferManager.cpp
@@ -49,6 +49,7 @@
#include "foundation/Qt3DSPerfTimer.h"
#include "foundation/Qt3DSMutex.h"
#include "Qt3DSRenderPrefilterTexture.h"
+#include <QtCore/qdir.h>
using namespace qt3ds::render;
@@ -344,14 +345,36 @@ struct SBufferManager : public IBufferManager
// in sub-presentations. Note: Runtime 1 is going to be removed in Qt 3D Studio 2.x,
// so this should be ok.
if (!theLoadedImage) {
- QString searchPath = QStringLiteral(".");
- searchPath.append(inImagePath.c_str());
- int loops = 0;
- while (!theLoadedImage && ++loops <= 3) {
- theLoadedImage = SLoadedTexture::Load(
- searchPath.toUtf8(), m_Context->GetFoundation(),
- *m_InputStreamFactory, true, m_Context->GetRenderContextType());
- searchPath.prepend(QStringLiteral("../"));
+ if (QDir(inImagePath.c_str()).isRelative()) {
+ QString searchPath = QLatin1String(".");
+ searchPath.append(inImagePath.c_str());
+ int loops = 0;
+ while (!theLoadedImage && ++loops <= 3) {
+ theLoadedImage = SLoadedTexture::Load(
+ searchPath.toUtf8(), m_Context->GetFoundation(),
+ *m_InputStreamFactory, true,
+ m_Context->GetRenderContextType());
+ searchPath.prepend(QLatin1String("../"));
+ }
+ } else {
+ // Some textures, for example environment maps for custom materials,
+ // have absolute path at this point. It point to the wrong place with
+ // the new project structure, so we need to split it up and construct
+ // the new absolute path here.
+ QString wholePath = inImagePath.c_str();
+ QStringList splitPath = wholePath.split(QLatin1String("../"));
+ QString searchPath = splitPath.at(0) + splitPath.at(1);
+ int loops = 0;
+ while (!theLoadedImage && ++loops <= 3) {
+ theLoadedImage = SLoadedTexture::Load(
+ searchPath.toUtf8(), m_Context->GetFoundation(),
+ *m_InputStreamFactory, true,
+ m_Context->GetRenderContextType());
+ searchPath = splitPath.at(0);
+ for (int i = 0; i < loops; i++)
+ searchPath.append(QLatin1String("../"));
+ searchPath.append(splitPath.at(1));
+ }
}
}
}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderLoadedTexture.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderLoadedTexture.cpp
index ce9ed6fc..0b47a7e6 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderLoadedTexture.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/ResourceManager/Qt3DSRenderLoadedTexture.cpp
@@ -655,27 +655,27 @@ SLoadedTexture *SLoadedTexture::Load(const QString &inPath, NVFoundationBase &in
NVRenderContextType renderContextType)
{
if (inPath.isEmpty())
- return NULL;
+ return nullptr;
- SLoadedTexture *theLoadedImage = NULL;
+ SLoadedTexture *theLoadedImage = nullptr;
NVScopedRefCounted<IRefCountedInputStream> theStream(inFactory.GetStreamForFile(inPath));
QString fileName;
inFactory.GetPathForFile(inPath, fileName);
if (theStream.mPtr && inPath.size() > 3) {
- if (inPath.endsWith("png", Qt::CaseInsensitive))
+ if (inPath.endsWith("png", Qt::CaseInsensitive)
+ || inPath.endsWith("jpg", Qt::CaseInsensitive)
+ || inPath.endsWith("peg", Qt::CaseInsensitive)
+ || inPath.endsWith("ktx", Qt::CaseInsensitive)) {
theLoadedImage = LoadQImage(fileName, inFlipY, inFoundation, renderContextType);
- else if (inPath.endsWith("jpg", Qt::CaseInsensitive)
- || inPath.endsWith("peg", Qt::CaseInsensitive))
- theLoadedImage = LoadQImage(fileName, inFlipY, inFoundation, renderContextType);
- else if (inPath.endsWith("dds", Qt::CaseInsensitive))
+ } else if (inPath.endsWith("dds", Qt::CaseInsensitive)) {
theLoadedImage = LoadDDS(*theStream, inFlipY, inFoundation, renderContextType);
- else if (inPath.endsWith("gif", Qt::CaseInsensitive))
+ } else if (inPath.endsWith("gif", Qt::CaseInsensitive)) {
theLoadedImage = LoadGIF(*theStream, !inFlipY, inFoundation, renderContextType);
- else if (inPath.endsWith("bmp", Qt::CaseInsensitive))
+ } else if (inPath.endsWith("bmp", Qt::CaseInsensitive)) {
theLoadedImage = LoadBMP(*theStream, !inFlipY, inFoundation, renderContextType);
- else if (inPath.endsWith("hdr", Qt::CaseInsensitive))
+ } else if (inPath.endsWith("hdr", Qt::CaseInsensitive)) {
theLoadedImage = LoadHDR(*theStream, inFoundation, renderContextType);
- else {
+ } else {
qCCritical(INTERNAL_ERROR, "Unrecognized image extension: %s", qPrintable(inPath));
}
}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp
index 718bc21b..2e9300d9 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp
@@ -1058,23 +1058,12 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator
GenerateImageUVCoordinates(bumpImageIdx, *bumpImage);
fragmentShader.AddUniform("bumpAmount", "float");
- if (m_RenderContext.GetRenderContext().GetRenderContextType()
- == NVRenderContextValues::GLES2) {
- fragmentShader.AddUniform(m_ImageSamplerSize, "vec2");
- fragmentShader.AddInclude("defaultMaterialBumpNoLod.glsllib");
- fragmentShader << "\tworld_normal = defaultMaterialBumpNoLod( " << m_ImageSampler
- << ", bumpAmount, " << m_ImageFragCoords
- << ", tangent, binormal, world_normal, "
- << m_ImageSamplerSize << ");" << Endl;
- } else {
- fragmentShader.AddInclude("defaultMaterialFileBumpTexture.glsllib");
- // vec3 simplerFileBumpTexture( in sampler2D sampler, in float factor, vec2
- // texCoord, vec3 tangent, vec3 binormal, vec3 normal )
-
- fragmentShader << "\tworld_normal = simplerFileBumpTexture( " << m_ImageSampler
- << ", bumpAmount, " << m_ImageFragCoords
- << ", tangent, binormal, world_normal );" << Endl;
- }
+ fragmentShader.AddUniform(m_ImageSamplerSize, "vec2");
+ fragmentShader.AddInclude("defaultMaterialBumpNoLod.glsllib");
+ fragmentShader << "\tworld_normal = defaultMaterialBumpNoLod( " << m_ImageSampler
+ << ", bumpAmount, " << m_ImageFragCoords
+ << ", tangent, binormal, world_normal, "
+ << m_ImageSamplerSize << ");" << Endl;
// Do gram schmidt
fragmentShader << "\tbinormal = normalize(cross(world_normal, tangent) );\n";
fragmentShader << "\ttangent = normalize(cross(binormal, world_normal) );\n";
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp
index 8167e577..70280b0e 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp
@@ -713,6 +713,7 @@ struct SRenderUIPLoader : public IDOMReferenceResolver
#define Camera_ClipNear "clipnear"
#define Camera_ClipFar "clipfar"
#define Camera_FOV "fov"
+#define Camera_FOVHorizontal "fovhorizontal"
#define Camera_Orthographic "orthographic"
#define Camera_ScaleMode "scalemode"
#define Camera_ScaleAnchor "scaleanchor"
diff --git a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h
index 51a6163f..2a497bf4 100644
--- a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h
+++ b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h
@@ -74,6 +74,7 @@ enum EAttribute {
ATTRIBUTE_CLIPNEAR = 0x0068FF28, // clipnear
ATTRIBUTE_CLIPFAR = 0x037EF699, // clipfar
ATTRIBUTE_FOV = 0x00D60213, // fov
+ ATTRIBUTE_FOVHORIZONTAL = 0x01BDB34F, // fovhorizontal
ATTRIBUTE_SCALEMODE = 0x01FD2FD3, // scalemode
ATTRIBUTE_SCALEANCHOR = 0x02CFCF41, // scaleanchor
ATTRIBUTE_BRIGHTNESS = 0x0230D3AF, // brightness
diff --git a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt
index 7e0a3f0d..90948c07 100644
--- a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt
+++ b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt
@@ -34,6 +34,7 @@ orthographic
clipnear
clipfar
fov
+fovhorizontal
scalemode
scaleanchor
diff --git a/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp b/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp
index 60d748cb..4d201d72 100644
--- a/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp
+++ b/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp
@@ -83,6 +83,7 @@ const char *GetAttributeString(const EAttribute inAttribute)
case ATTRIBUTE_CLIPNEAR: return "clipnear";
case ATTRIBUTE_CLIPFAR: return "clipfar";
case ATTRIBUTE_FOV: return "fov";
+ case ATTRIBUTE_FOVHORIZONTAL: return "fovhorizontal";
case ATTRIBUTE_SCALEMODE: return "scalemode";
case ATTRIBUTE_SCALEANCHOR: return "scaleanchor";
case ATTRIBUTE_BRIGHTNESS: return "brightness";
diff --git a/src/Runtime/Source/Runtime/Source/q3dsqmlscript.cpp b/src/Runtime/Source/Runtime/Source/q3dsqmlscript.cpp
index 7b1ceb3d..09f18148 100644
--- a/src/Runtime/Source/Runtime/Source/q3dsqmlscript.cpp
+++ b/src/Runtime/Source/Runtime/Source/q3dsqmlscript.cpp
@@ -212,15 +212,15 @@ void Q3DSQmlScript::setAttribute(const QString &handle, const QString &attribute
float valueFloat;
const char *valuePtr = nullptr;
- switch (value.type()) {
- case QVariant::Bool:
- case QVariant::Int:
- case QVariant::Double:
+ switch (static_cast<QMetaType::Type>(value.type())) {
+ case QMetaType::Bool:
+ case QMetaType::Int:
+ case QMetaType::Double:
case QMetaType::Float:
valueFloat = value.toFloat();
valuePtr = (const char *)&valueFloat;
break;
- case QVariant::String:
+ case QMetaType::QString:
default:
valueStr = value.toString().toUtf8();
valuePtr = valueStr.constData();
diff --git a/src/Runtime/qt3d-runtime b/src/Runtime/qt3d-runtime
-Subproject 19927763930bca5f5aac6d77107d93e5518b5f6
+Subproject 9091098014c4cdfbc122bbc015b7641b07f2820
diff --git a/src/Runtime/res.qrc b/src/Runtime/res.qrc
index 6472c2d5..ee705bc2 100644
--- a/src/Runtime/res.qrc
+++ b/src/Runtime/res.qrc
@@ -82,6 +82,7 @@
<file>res/effectlib/textureCoordinateInfo.glsllib</file>
<file>res/effectlib/transformCoordinate.glsllib</file>
<file>res/effectlib/defaultMaterialFileBumpTexture.glsllib</file>
+ <file>res/effectlib/defaultMaterialBumpNoLod.glsllib</file>
<file>res/effectlib/defaultMaterialFileDisplacementTexture.glsllib</file>
<file>res/effectlib/defaultMaterialFileNormalTexture.glsllib</file>
<file>res/effectlib/vertexFragmentBase.glsllib</file>
diff --git a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
index 3af22bef..cdfb282c 100644
--- a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
+++ b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
@@ -46,6 +46,9 @@
<Property name="fov" formalName="Field of View" description="Viewing angle of the camera\n(how much it can see)" min="1" max="180" default="60">
<ShowIfEqual property="orthographic" value="False"/>
</Property>
+ <Property name="fovhorizontal" formalName="FOV Horizontal" description="Field of view angle orientation" type="Boolean" default="False">
+ <ShowIfEqual property="orthographic" value="False"/>
+ </Property>
<Property name="clipnear" formalName="Clipping Start" description="Near distance at which objects disappear" min="1" max="1000" default="10" />
<Property name="clipfar" formalName="Clipping End" description="Far distance at which objects disappear" default="5000" />
<Property name="scalemode" formalName="Scale Mode" description="Render more content as the layer expands\n(same size) or scale up the content (fit)" list="Same Size:Fit:Fit Horizontal:Fit Vertical" default="Fit" />
@@ -227,18 +230,16 @@
<Property name="shdwmapfar" formalName="Shadow Far Clip" description="Affects the maximum distance for the shadow\ndepth map" default="5000" />
<Property name="shdwmapfov" formalName="Shadow Field of View" description="Affects the field of view of the shadow\ncamera" default="90" min="1" max="179" hidden="True" />
</Light>
+ <MaterialBase>
+ <Property name="name" formalName="Name" description="Object name" type="String" default="Material" hidden="False" category="Basic Properties" />
+ <Property name="iblprobe" formalName="IBL Override" description="IBL probe to use in place of the\nlayer probe for this material" type="Image" category="Basic Properties" />
+ </MaterialBase>
<Lightmaps>
- <Property name="name" formalName="Name" description="Object name" type="String" default="Lightmaps" hidden="False" category="Lighting" />
<Property name="lightmapindirect" formalName="Indirect Lightmap" description="Image providing indirect light values\nfor GI" type="Image" category="Lighting" />
<Property name="lightmapradiosity" formalName="Radiosity Lightmap" description="Image providing directional light values" type="Image" category="Lighting" />
<Property name="lightmapshadow" formalName="Shadow Lightmap" description="Baked Shadow map" type="Image" category="Lighting" />
</Lightmaps>
- <MaterialBase>
- <Property name="name" formalName="Name" description="Object name" type="String" default="MaterialBase" hidden="False" category="Material" />
- <Property name="iblprobe" formalName="IBL Override" description="IBL probe to use in place of the\nlayer probe for this material" type="Image" category="Material" />
- </MaterialBase>
<Material>
- <Property name="name" formalName="Name" description="Object name" type="String" default="Material" hidden="False" category="Material" />
<Property name="shaderlighting" formalName="Lighting" description="Light model" list="Pixel:None" default="Pixel" category="Material" />
<Property name="blendmode" formalName="Blending Mode" description="How this material blends with content\nbehind it. Modes marked with * are\navailable only with HW supporting\nadvanced blending modes." list="Normal:Screen:Multiply:*Overlay:*ColorBurn:*ColorDodge" default="Normal" category="Material" />
<Property name="vertexcolors" formalName="Enable Vertex Colors" description="Use vertex colors from the mesh" type="Boolean" default="False" animatable="False" category="Material" />
@@ -271,7 +272,6 @@
<Property name="diffuselightwrap" formalName="Diffuse Light Wrap" description="Diffuse Light Wrap" type="float" min='0.0' max='1.0' category="Material" />
</Material>
<ReferencedMaterial>
- <Property name="name" formalName="Name" description="Object name" type="String" default="Material" hidden="True" category="Material" />
<Property name="referencedmaterial" formalName="Referenced Material" description="Material to use all settings from" type="ObjectRef" category="Material" />
</ReferencedMaterial>
<Model>
diff --git a/src/Viewer/qmlviewer/Qt3DSViewPlugin.h b/src/Runtime/res/effectlib/defaultMaterialBumpNoLod.glsllib
index 1d1a6fff..4144ae2f 100644
--- a/src/Viewer/qmlviewer/Qt3DSViewPlugin.h
+++ b/src/Runtime/res/effectlib/defaultMaterialBumpNoLod.glsllib
@@ -1,6 +1,5 @@
/****************************************************************************
**
-** Copyright (c) 2016 NVIDIA CORPORATION.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
@@ -28,33 +27,26 @@
**
****************************************************************************/
-#ifndef Q3DSVIEW_PLUGIN_H
-#define Q3DSVIEW_PLUGIN_H
-
-#include <QtQml/qqmlextensionplugin.h>
-
-static void initResources()
+float calcRGBAvg(in vec4 rgba)
{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtStudio3D);
-#endif
+ return (rgba.r + rgba.g + rgba.b) / 3.0;
}
-QT_BEGIN_NAMESPACE
-
-class Q3DSViewPlugin : public QQmlExtensionPlugin
+vec3 defaultMaterialBumpNoLod(in sampler2D sampler, in float factor,
+ in vec2 texCoord, in vec3 tangent, in vec3 binormal,
+ in vec3 normal, in vec2 bumpSize)
{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+ // invert factor
+ float invFactor = -factor;
-public:
- Q3DSViewPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent)
- {
- initResources();
- }
- void registerTypes(const char *uri) override;
-};
+ vec2 unitStep = 1.0 / bumpSize;
-QT_END_NAMESPACE
+ float du = calcRGBAvg(texture2D(sampler, vec2(texCoord.x + unitStep.x, texCoord.y)))
+ - calcRGBAvg(texture2D(sampler, vec2(texCoord.x, texCoord.y)));
+ float dv = calcRGBAvg(texture2D(sampler, vec2(texCoord.x, texCoord.y + unitStep.y)))
+ - calcRGBAvg(texture2D(sampler, vec2(texCoord.x, texCoord.y)));
-#endif // Q3DSVIEW_PLUGIN_H
+ vec3 n = normalize(vec3(invFactor * du, invFactor * dv, 1.0));
+ n = n.x * normalize(tangent) + n.y * normalize(binormal) + n.z * normal;
+ return normalize(normal + n);
+}
diff --git a/src/Viewer/Qt3DViewer/Qt3DViewer.pro b/src/Viewer/Qt3DViewer/Qt3DViewer.pro
deleted file mode 100644
index d8046f46..00000000
--- a/src/Viewer/Qt3DViewer/Qt3DViewer.pro
+++ /dev/null
@@ -1,48 +0,0 @@
-include($$PWD/../../Runtime/commoninclude.pri)
-
-TEMPLATE = app
-TARGET = Qt3DViewer
-QT += qml quickcontrols2 studio3d-private
-
-INCLUDEPATH += $$PWD/../qmlviewer
-
-RESOURCES += Viewer.qrc
-RC_ICONS = resources/images/3D-studio-viewer.ico
-
-ICON = resources/images/viewer.icns
-
-SOURCES += \
- $$PWD/../qmlviewer/Qt3DSView.cpp \
- $$PWD/../qmlviewer/Qt3DSRenderer.cpp \
- $$PWD/../qmlviewer/q3dspresentationitem.cpp \
- main.cpp \
- viewer.cpp \
- remotedeploymentreceiver.cpp
-
-HEADERS += \
- $$PWD/../qmlviewer/Qt3DSView.h \
- $$PWD/../qmlviewer/Qt3DSRenderer.h \
- $$PWD/../qmlviewer/q3dspresentationitem.h \
- viewer.h \
- remotedeploymentreceiver.h
-
-android: {
-SOURCES += \
- $$PWD/../studio3d/q3dsviewersettings.cpp \
- $$PWD/../studio3d/q3dspresentation.cpp \
- $$PWD/../studio3d/q3dsdatainput.cpp
-
-HEADERS += \
- $$PWD/../studio3d/q3dsviewersettings.h \
- $$PWD/../studio3d/q3dspresentation.h \
- $$PWD/../studio3d/q3dsdatainput.h
-}
-
-LIBS += \
- -lqt3dsruntime$$qtPlatformTargetSuffix() \
- -lqt3dsqmlstreamer$$qtPlatformTargetSuffix()
-
-macos:QMAKE_RPATHDIR += @executable_path/../../../../lib
-
-target.path = $$[QT_INSTALL_BINS]
-INSTALLS += target
diff --git a/src/Viewer/Qt3DViewer/Viewer.qrc b/src/Viewer/Qt3DViewer/Viewer.qrc
deleted file mode 100644
index c808dca5..00000000
--- a/src/Viewer/Qt3DViewer/Viewer.qrc
+++ /dev/null
@@ -1,14 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file alias="images/arrow.png">resources/images/arrow.png</file>
- <file alias="images/arrow@2x.png">resources/images/arrow@2x.png</file>
- <file alias="images/check.png">resources/images/check.png</file>
- <file alias="images/check@2x.png">resources/images/check@2x.png</file>
- <file>qml/main.qml</file>
- <file>qml/StyledMenu.qml</file>
- <file>qml/StyledMenuButton.qml</file>
- <file>qml/StyledMenuItem.qml</file>
- <file>qml/StyledMenuSeparator.qml</file>
- <file>qml/StyledButton.qml</file>
- </qresource>
-</RCC>
diff --git a/src/Viewer/Qt3DViewer/android/AndroidManifest.xml b/src/Viewer/Qt3DViewer/android/AndroidManifest.xml
deleted file mode 100644
index 3697a9a7..00000000
--- a/src/Viewer/Qt3DViewer/android/AndroidManifest.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<manifest package="org.qtproject.qt3dviewer" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.1" android:versionCode="1" android:installLocation="auto">
- <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
- <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
-
- <!-- Application arguments -->
- <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
- <!-- Application arguments -->
-
- <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
- <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
- <meta-data android:name="android.app.repository" android:value="default"/>
- <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
- <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
- <!-- Deploy Qt libs as part of package -->
- <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
- <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
- <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
- <!-- Run with local libs -->
- <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
- <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
- <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
- <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
- <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
- <!-- Messages maps -->
- <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
- <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
- <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
- <!-- Messages maps -->
-
- <!-- Splash screen -->
- <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
- <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
- <!-- Splash screen -->
-
- <!-- Background running -->
- <!-- Warning: changing this value to true may cause unexpected crashes if the
- application still try to draw after
- "applicationStateChanged(Qt::ApplicationSuspended)"
- signal is sent! -->
- <meta-data android:name="android.app.background_running" android:value="false"/>
- <!-- Background running -->
-
- <!-- auto screen scale factor -->
- <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
- <!-- auto screen scale factor -->
-
- <!-- extract android style -->
- <!-- available android:values :
- * full - useful QWidget & Quick Controls 1 apps
- * minimal - useful for Quick Controls 2 apps, it is much faster than "full"
- * none - useful for apps that don't use any of the above Qt modules
- -->
- <meta-data android:name="android.app.extract_android_style" android:value="full"/>
- <!-- extract android style -->
- </activity>
-
- <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
-
- </application>
-
- <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
- <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
-
- <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
- Remove the comment if you do not require these default permissions. -->
- <!-- %%INSERT_PERMISSIONS -->
-
- <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
- Remove the comment if you do not require these default features. -->
- <!-- %%INSERT_FEATURES -->
-
-</manifest>
diff --git a/src/Viewer/Qt3DViewer/main.cpp b/src/Viewer/Qt3DViewer/main.cpp
deleted file mode 100644
index 6b020a4f..00000000
--- a/src/Viewer/Qt3DViewer/main.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 - 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "viewer.h"
-
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qtouchdevice.h>
-#include <QtGui/qscreen.h>
-#include <QtCore/qcommandlineparser.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qtimer.h>
-#include <QtGui/qopenglcontext.h>
-#include <QtStudio3D/q3dssurfaceviewer.h>
-#include <QtStudio3D/private/q3dsimagesequencegenerator_p.h>
-#include <QtQml/qqmlapplicationengine.h>
-#include <QtQml/qqmlengine.h>
-#include <QtQml/qqmlcontext.h>
-
-static QSurfaceFormat findIdealGLVersion()
-{
- QSurfaceFormat fmt;
- fmt.setProfile(QSurfaceFormat::CoreProfile);
-
- // Advanced: Try 4.3 core (so we get compute shaders for instance)
- fmt.setVersion(4, 3);
- QOpenGLContext ctx;
- ctx.setFormat(fmt);
- if (ctx.create() && ctx.format().version() >= qMakePair(4, 3))
- return fmt;
-
- // Basic: Stick with 3.3 for now to keep less fortunate,
- // Mesa-based systems happy
- fmt.setVersion(3, 3);
- ctx.setFormat(fmt);
- if (ctx.create())
- return fmt;
-
- // We tried...
- return QSurfaceFormat::defaultFormat();
-}
-
-static QSurfaceFormat findIdealGLESVersion()
-{
- QSurfaceFormat fmt;
-
- // Advanced: Try 3.1 (so we get compute shaders for instance)
- fmt.setVersion(3, 1);
- QOpenGLContext ctx;
- ctx.setFormat(fmt);
- if (ctx.create())
- return fmt;
-
- // Basic: OpenGL ES 3.0 is a hard requirement at the moment since we can
- // only generate 300 es shaders, uniform buffers are mandatory.
- fmt.setVersion(3, 0);
- ctx.setFormat(fmt);
- if (ctx.create())
- return fmt;
-
- // We tried...
- return QSurfaceFormat::defaultFormat();
-}
-
-int main(int argc, char *argv[])
-{
-#if defined(Q_OS_MACOS)
- QSurfaceFormat openGLFormat;
- openGLFormat.setRenderableType(QSurfaceFormat::OpenGL);
- openGLFormat.setProfile(QSurfaceFormat::CoreProfile);
- openGLFormat.setMajorVersion(4);
- openGLFormat.setMinorVersion(1);
- openGLFormat.setStencilBufferSize(8);
- QSurfaceFormat::setDefaultFormat(openGLFormat);
-#endif
-
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setOrganizationName("The Qt Company");
- QCoreApplication::setOrganizationDomain("qt.io");
- QCoreApplication::setApplicationName("Qt 3D Viewer");
-
- QGuiApplication a(argc, argv);
-
-#if !defined(Q_OS_MACOS)
- QSurfaceFormat fmt;
- if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL)
- fmt = findIdealGLVersion();
- else
- fmt = findIdealGLESVersion();
- fmt.setDepthBufferSize(24);
- fmt.setStencilBufferSize(8);
- QSurfaceFormat::setDefaultFormat(fmt);
-#endif
-
- QCommandLineParser parser;
- parser.addHelpOption();
- parser.addPositionalArgument(
- "file",
- QCoreApplication::translate("main", "The presentation file to open."),
- QCoreApplication::translate("main", "[file]"));
-
- parser.addOption({"sequence",
- QCoreApplication::translate("main",
- "Generates an image sequence.\n"
- "The file argument must be specified.\n"""
- "Specifying any of the seq-* arguments\n"
- "implies setting this option.")});
- parser.addOption({"seq-start",
- QCoreApplication::translate("main",
- "Start time of the sequence in\n"
- "milliseconds.\n"
- "The default value is 0."),
- QCoreApplication::translate("main", "ms"), QString::number(0)});
- parser.addOption({"seq-end",
- QCoreApplication::translate("main",
- "End time of the sequence in\n"
- "milliseconds.\n"
- "The default value is 1000."),
- QCoreApplication::translate("main", "ms"), QString::number(1000)});
- parser.addOption({"seq-fps",
- QCoreApplication::translate("main",
- "Frames per second for the sequence.\n"
- "The default value is 60."),
- QCoreApplication::translate("main", "fps"), QString::number(60)});
- parser.addOption({"seq-interval",
- QCoreApplication::translate("main",
- "Time interval between frames in\n"
- "the sequence in milliseconds. The seq-fps argument is ignored"
- "if this argument is used."),
- QCoreApplication::translate("main", "ms"), QString::number(0)});
- parser.addOption({"seq-width",
- QCoreApplication::translate("main",
- "Width of the image sequence.\n"
- "The default value is 1920."),
- QCoreApplication::translate("main", "pixels"), QString::number(1920)});
- parser.addOption({"seq-height",
- QCoreApplication::translate("main",
- "Height of the image sequence.\n"
- "The default value is 1080."),
- QCoreApplication::translate("main", "pixels"), QString::number(1080)});
- parser.addOption({"seq-outpath",
- QCoreApplication::translate("main",
- "Output path of the image sequence.\n"
- "The default value is the current directory."),
- QCoreApplication::translate("main", "path"), QStringLiteral(".")});
- parser.addOption({"seq-outfile",
- QCoreApplication::translate("main",
- "Output filename base for the image\n"
- "sequence.\n"
- "The default value is derived from the presentation filename."),
- QCoreApplication::translate("main", "file"), QStringLiteral("")});
- parser.addOption({"connect",
- QCoreApplication::translate("main",
- "If this parameter is specified, the viewer\n"
- "is started in connection mode.\n"
- "The default value is 36000."),
- QCoreApplication::translate("main", "port"), QString::number(36000)});
- parser.addOption({"fullscreen",
- QCoreApplication::translate("main",
- "Starts the viewer in fullscreen mode.\n")});
- parser.addOption({"maximized",
- QCoreApplication::translate("main",
- "Starts the viewer in maximized mode.")});
- parser.addOption({"windowgeometry",
- QCoreApplication::translate("main",
- "Specifies the initial\n"
- "window geometry using the X11-syntax.\n"
- "For example: 1000x800+50+50"),
- QCoreApplication::translate("main", "geometry"), QStringLiteral("")});
- parser.addOption({"mattecolor",
- QCoreApplication::translate("main",
- "Specifies custom matte color\n"
- "using #000000 syntax.\n"
- "For example, white matte: #ffffff"),
- QCoreApplication::translate("main", "color"), QStringLiteral("#333333")});
- parser.addOption({"showstats",
- QCoreApplication::translate("main",
- "Show render statistics on screen.")});
- parser.addOption({"scalemode",
- QCoreApplication::translate("main",
- "Specifies scaling mode.\n"
- "The default value is 'center'."),
- QCoreApplication::translate("main", "center|fit|fill"),
- QStringLiteral("center")});
- parser.process(a);
-
- const QStringList files = parser.positionalArguments();
- if (files.count() > 1) {
- qWarning() << "Only one presentation file can be given.";
- parser.showHelp(-1);
- }
-
- bool generateSequence = parser.isSet("sequence") || parser.isSet("seq-start")
- || parser.isSet("seq-end") || parser.isSet("seq-fps")
- || parser.isSet("seq-interval") || parser.isSet("seq-width")
- || parser.isSet("seq-height") || parser.isSet("seq-outpath")
- || parser.isSet("seq-outfile");
-
-#ifndef Q_OS_ANDROID
- Q3DSImageSequenceGenerator *generator = nullptr;
-#endif
- Viewer viewer(generateSequence);
-
- // Figure out control size multiplier for devices using touch screens to ensure all controls
- // have minimum usable size.
- qreal sizeMultiplier = 1.0;
- const auto touchDevices = QTouchDevice::devices();
- if (touchDevices.size() > 0) {
- // Find out the actual screen logical pixel size. Typically touch devices we care about
- // only have a single screen, so we just check primary screen.
- const auto screens = QGuiApplication::screens();
- if (screens.size() > 0) {
- QScreen *screen = screens.at(0);
- qreal dpi = screen->physicalDotsPerInch() / screen->devicePixelRatio();
- sizeMultiplier = dpi / 40.0; // divider chosen empirically
- }
- }
-
- QQmlApplicationEngine engine;
- // Set import paths so that standalone installation works
- QString extraImportPath1(QStringLiteral("%1/qml"));
- engine.addImportPath(extraImportPath1.arg(QGuiApplication::applicationDirPath()));
-#ifdef Q_OS_MACOS
- QString extraImportPath2(QStringLiteral("%1/../../../../qml"));
- engine.addImportPath(extraImportPath2.arg(QGuiApplication::applicationDirPath()));
-#endif
-
- QQmlContext *ctx = engine.rootContext();
- ctx->setContextProperty(QStringLiteral("_menuBackgroundColor"), QColor("#404244"));
- ctx->setContextProperty(QStringLiteral("_menuSelectionColor"), QColor("#46a2da"));
- ctx->setContextProperty(QStringLiteral("_menuBorderColor"), QColor("#727476"));
- ctx->setContextProperty(QStringLiteral("_dialogBorderColor"), QColor("#404244"));
- ctx->setContextProperty(QStringLiteral("_dialogBackgroundColor"), QColor("#2e2f30"));
- ctx->setContextProperty(QStringLiteral("_dialogFieldColor"), QColor("#404244"));
- ctx->setContextProperty(QStringLiteral("_dialogFieldBorderColor"), QColor("#262829"));
- ctx->setContextProperty(QStringLiteral("_textColor"), QColor("#ffffff"));
- ctx->setContextProperty(QStringLiteral("_disabledColor"), QColor("#727476"));
- ctx->setContextProperty(QStringLiteral("_fontSize"), int(12 * sizeMultiplier));
- ctx->setContextProperty(QStringLiteral("_controlBaseHeight"), int(24 * sizeMultiplier));
- ctx->setContextProperty(QStringLiteral("_controlBaseWidth"), int(80 * sizeMultiplier));
- ctx->setContextProperty(QStringLiteral("_controlPadding"), int(12 * sizeMultiplier));
- ctx->setContextProperty(QStringLiteral("_viewerHelper"), &viewer);
- qmlRegisterUncreatableType<Viewer>(
- "Qt3DStudioViewer", 1, 0, "ViewerHelper",
- QCoreApplication::translate("main",
- "Creation of ViewerHelper not allowed from QML"));
- engine.load(QUrl(QLatin1String("qrc:/qml/main.qml")));
- Q_ASSERT(engine.rootObjects().size() > 0);
- QWindow *appWindow = qobject_cast<QWindow *>(engine.rootObjects().at(0));
- Q_ASSERT(appWindow);
- viewer.setQmlRootObject(appWindow);
-
- if (parser.isSet(QStringLiteral("windowgeometry"))) {
- int width = 1280;
- int height = 768;
- int x = 50;
- int y = 50;
- QString geometryStr = parser.value(QStringLiteral("windowgeometry"));
- const QStringList splitPlus = geometryStr.split(QLatin1Char('+'));
- if (splitPlus.size() > 0) {
- const QStringList splitX = splitPlus[0].split(QLatin1Char('x'));
- if (splitX.size() >= 2) {
- width = splitX[0].toInt();
- height = splitX[1].toInt();
- }
- if (splitPlus.size() >= 3) {
- x = splitPlus[1].toInt();
- y = splitPlus[2].toInt();
- }
- }
- appWindow->setGeometry(x, y, width, height);
- }
- if (parser.isSet(QStringLiteral("fullscreen")))
- appWindow->setVisibility(QWindow::FullScreen);
- else if (parser.isSet(QStringLiteral("maximized")))
- appWindow->setVisibility(QWindow::Maximized);
-
- if (parser.isSet(QStringLiteral("mattecolor"))) {
- QColor matteColor(parser.value("mattecolor"));
- if (matteColor != Qt::black) {
- appWindow->setProperty("showMatteColor", QVariant::fromValue<QColor>(matteColor));
- appWindow->setProperty("matteColor", QVariant::fromValue<QColor>(matteColor));
- }
- }
- if (parser.isSet(QStringLiteral("showstats")))
- appWindow->setProperty("showRenderStats", true);
- if (parser.isSet(QStringLiteral("scalemode"))) {
- QString scaleStr(parser.value("scalemode"));
- if (scaleStr == QStringLiteral("fit"))
- appWindow->setProperty("scaleMode", Q3DSViewerSettings::ScaleModeFit);
- else if (scaleStr == QStringLiteral("fill"))
- appWindow->setProperty("scaleMode", Q3DSViewerSettings::ScaleModeFill);
- else
- appWindow->setProperty("scaleMode", Q3DSViewerSettings::ScaleModeCenter);
- }
-
-#ifndef Q_OS_ANDROID
- if (generateSequence) {
- if (files.count() != 1) {
- qWarning() << "Presentation file is required for generating an image sequence.";
- parser.showHelp(-1);
- }
- generator = new Q3DSImageSequenceGenerator;
- QObject::connect(generator, &Q3DSImageSequenceGenerator::progress,
- &viewer, &Viewer::generatorProgress);
- QObject::connect(generator, &Q3DSImageSequenceGenerator::finished,
- &viewer, &Viewer::generatorFinished);
- viewer.setGeneratorDetails(files.first());
- generator->generateImageSequence(
- files.first(),
- parser.value("seq-start").toDouble(),
- parser.value("seq-end").toDouble(),
- parser.value("seq-fps").toDouble(),
- parser.value("seq-interval").toDouble(),
- parser.value("seq-width").toInt(),
- parser.value("seq-height").toInt(),
- parser.value("seq-outpath"),
- parser.value("seq-outfile"));
- } else
-#endif
- if (!files.isEmpty()) {
- // Load the presentation after window has been exposed to give QtQuick time to construct
- // the application window properly
- QTimer *exposeTimer = new QTimer(appWindow);
- QObject::connect(exposeTimer, &QTimer::timeout, [&](){
- if (appWindow->isExposed()) {
- exposeTimer->stop();
- exposeTimer->deleteLater();
- viewer.loadFile(files.first());
- }
- });
- exposeTimer->start(0);
- } else {
- viewer.setContentView(Viewer::ConnectView);
- if (parser.isSet(QStringLiteral("connect")))
- viewer.setConnectPort(parser.value(QStringLiteral("connect")).toInt());
- viewer.connectRemote();
- }
-
- return a.exec();
-}
diff --git a/src/Viewer/Qt3DViewer/qml/StyledButton.qml b/src/Viewer/Qt3DViewer/qml/StyledButton.qml
deleted file mode 100644
index 400179de..00000000
--- a/src/Viewer/Qt3DViewer/qml/StyledButton.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.Controls 2.2
-
-Button {
- id: control
- implicitWidth: _controlBaseWidth
- implicitHeight: _controlBaseHeight
-
- contentItem: Text {
- width: _controlBaseWidth
- text: control.text
- height: _controlBaseHeight
- font.pixelSize: _fontSize
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- background: Rectangle {
- color: control.down ? _menuSelectionColor : _dialogFieldColor
- border.color: _dialogFieldBorderColor
- radius: 2
- }
-}
diff --git a/src/Viewer/Qt3DViewer/qml/StyledMenu.qml b/src/Viewer/Qt3DViewer/qml/StyledMenu.qml
deleted file mode 100644
index 6275dbc6..00000000
--- a/src/Viewer/Qt3DViewer/qml/StyledMenu.qml
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.Controls 2.2
-
-Menu {
- id: control
-
- property alias hovered: menuArea.containsMouse
-
- width: contentItem.width + leftPadding + rightPadding
- height: contentItem.height + topPadding + bottomPadding
- padding: 1 // For background border
- x: 0
- y: parent.height
- closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnEscape
-
- contentItem: MouseArea {
- id: menuArea
- hoverEnabled: true
- height: list.height
- width: list.width
- ListView {
- id: list
- boundsBehavior: Flickable.StopAtBounds
- clip: true
- model: control.contentModel
- currentIndex: control.currentIndex
- highlightRangeMode: ListView.ApplyRange
- highlightMoveDuration: 0
- Component.onCompleted: {
- var maxItemWidth = 0;
- var maxShortcutWidth = 0;
- var totalHeight = 0
- var extraWidth = 0
- var i;
- for (i = control.contentData.length - 1; i >= 0; --i) {
- if (control.contentData[i].itemWidth !== undefined) {
- maxItemWidth = Math.max(maxItemWidth, control.contentData[i].itemWidth);
- maxShortcutWidth = Math.max(maxShortcutWidth,
- control.contentData[i].shortcutWidth);
- }
- totalHeight += control.contentData[i].height
- }
- maxItemWidth += _controlPadding // minimum item spacer
- for (i = control.contentData.length - 1; i >= 0; --i) {
- if (control.contentData[i].itemSpacerWidth !== undefined) {
- control.contentData[i].itemSpacerWidth
- = maxItemWidth - control.contentData[i].itemWidth;
- control.contentData[i].shortcutSpacerWidth
- = maxShortcutWidth - control.contentData[i].shortcutWidth;
- }
- }
- width = maxItemWidth + maxShortcutWidth + extraWidth
- + control.contentData[0].leftPadding + control.contentData[0].rightPadding
- + control.contentData[0].arrowWidth + control.contentData[0].checkMarkWidth;
- height = totalHeight
- }
- }
- }
-
- background: Rectangle {
- width: control.width
- height: control.height
- color: _menuBackgroundColor
- border.color: _menuBorderColor
- }
-}
diff --git a/src/Viewer/Qt3DViewer/qml/StyledMenuButton.qml b/src/Viewer/Qt3DViewer/qml/StyledMenuButton.qml
deleted file mode 100644
index b5290c3d..00000000
--- a/src/Viewer/Qt3DViewer/qml/StyledMenuButton.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.Controls 2.2
-
-Button {
- id: control
-
- property Menu menu: null
- property ApplicationWindow window: null
-
- onPressed: {
- if (menu.visible)
- menu.close();
- else
- menu.open();
- }
-
- onHoveredChanged: {
- if (hovered && window.menuOpen) {
- window.closeMenus();
- menu.open();
- }
- }
-
- hoverEnabled: true
- width: contentItem.contentWidth + leftPadding + rightPadding
- leftPadding: _controlPadding
- rightPadding: _controlPadding
- height: _controlBaseHeight
- contentItem: Text {
- text: control.text
- font.pixelSize: _fontSize
- opacity: enabled ? 1.0 : 0.3
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- background: Rectangle {
- opacity: enabled ? 1 : 0.3
- color: control.down || control.hovered
- ? _menuSelectionColor : _menuBackgroundColor
- }
-}
diff --git a/src/Viewer/Qt3DViewer/qml/StyledMenuItem.qml b/src/Viewer/Qt3DViewer/qml/StyledMenuItem.qml
deleted file mode 100644
index 79049a90..00000000
--- a/src/Viewer/Qt3DViewer/qml/StyledMenuItem.qml
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.Controls 2.2
-
-MenuItem {
- id: control
-
- property alias shortcut: shortcut.sequence
- property string shortcutText
- property alias itemSpacerWidth: itemSpacer.width
- property alias shortcutSpacerWidth: shortcutSpacer.width
- property alias itemWidth: itemLabel.width
- property alias shortcutWidth: shortcutLabel.width
- property bool showArrow: false
- property int arrowWidth: arrow.width
- property int checkMarkWidth: checkMark.width
- property bool showCheckMark: false
- property Menu arrowMenu: null
-
- hoverEnabled: true
- width: contentItem.width + leftPadding + rightPadding
- height: contentItem.height + topPadding + bottomPadding
- padding: 0
- leftPadding: 0
- rightPadding: 0
-
- MouseArea {
- anchors.fill: parent
- onPressed: {
- if (showArrow) {
- if (!arrowMenu.visible) {
- arrowMenuDelay.stop();
- arrowMenu.open();
- }
- } else {
- mouse.accepted = false;
- }
- }
- }
-
- onHoveredChanged: {
- if (showArrow)
- arrowMenuDelay.start();
- }
-
- Timer {
- id: arrowMenuDelay
- interval: 500
- repeat: false
- onTriggered: {
- if (arrowMenu.visible) {
- if (!control.hovered && !arrowMenu.hovered)
- arrowMenu.close();
- } else {
- if (control.hovered)
- arrowMenu.open();
- }
- }
- }
-
- Shortcut {
- id: shortcut
- context: Qt.ApplicationShortcut
- onActivated: control.triggered()
- }
-
- contentItem: Row {
- width: checkMark.width + itemLabel.width + itemSpacer.width
- + shortcutLabel.width + shortcutSpacer.width + arrow.width
- height: _controlBaseHeight
- Item {
- id: checkMark
- width: 16
- height: _controlBaseHeight
- Image {
- anchors.fill: parent
- visible: control.showCheckMark
- fillMode: Image.Pad
- source: "qrc:/images/check.png"
- }
- }
- Label {
- id: itemLabel
- text: control.text
- font.pixelSize: _fontSize
- horizontalAlignment: Text.AlignLeft
- color: control.enabled ? _textColor : _disabledColor
- verticalAlignment: Text.AlignVCenter
- clip: true
- width: contentWidth
- height: _controlBaseHeight
- }
- Item {
- id: itemSpacer
- width: _controlPadding
- height: _controlBaseHeight
- }
- Label {
- id: shortcutLabel
- text: shortcut.nativeText === "" ? control.shortcutText : shortcut.nativeText
- font.pixelSize: _fontSize
- horizontalAlignment: Text.AlignLeft
- color: control.enabled ? _textColor : _disabledColor
- verticalAlignment: Text.AlignVCenter
- clip: true
- width: contentWidth
- height: _controlBaseHeight
- }
- Item {
- id: shortcutSpacer
- width: 0
- height: _controlBaseHeight
- }
- Item {
- id: arrow
- width: 16
- height: _controlBaseHeight
- Image {
- anchors.fill: parent
- visible: control.showArrow
- fillMode: Image.Pad
- source: "qrc:/images/arrow.png"
- }
- }
- }
- background: Rectangle {
- width: control.width
- height: control.height
- color: control.hovered ? _menuSelectionColor : _menuBackgroundColor
- }
-}
diff --git a/src/Viewer/Qt3DViewer/qml/StyledMenuSeparator.qml b/src/Viewer/Qt3DViewer/qml/StyledMenuSeparator.qml
deleted file mode 100644
index 344d6678..00000000
--- a/src/Viewer/Qt3DViewer/qml/StyledMenuSeparator.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.Controls 2.2
-
-MenuSeparator {
- id: control
- padding: 0
- topPadding: 0
- bottomPadding: 0
- leftPadding: 0
- rightPadding: 0
- width: parent.width
- height: 1
- contentItem: Rectangle {
- width: control.width - control.leftPadding - control.rightPadding
- height: 1
- color: _menuBorderColor
- }
-}
diff --git a/src/Viewer/Qt3DViewer/qml/main.qml b/src/Viewer/Qt3DViewer/qml/main.qml
deleted file mode 100644
index 8d9a2015..00000000
--- a/src/Viewer/Qt3DViewer/qml/main.qml
+++ /dev/null
@@ -1,594 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.Controls 2.2
-import QtQuick.Dialogs 1.2
-import Qt3DStudioViewer 1.0
-import QtStudio3D 1.0
-import QtQuick.Window 2.2
-
-ApplicationWindow {
- id: window
- width: 1280
- height: 768
- visible: true
- title: qsTr("Qt 3D Studio Viewer")
-
- property bool menuOpen: fileMenu.visible || viewMenu.visible
- property Item loadedContent: contentLoader ? contentLoader.item : null
- property string error
- property int previousVisibility
-
- property color showMatteColor: Qt.rgba(0.2, 0.2, 0.2, 1)
- property color hideMatteColor: Qt.rgba(0, 0, 0, 1)
- property color matteColor: hideMatteColor
- property bool showRenderStats: false
- property int scaleMode: ViewerSettings.ScaleModeCenter
-
- function closeMenus() {
- fileMenu.close();
- scaleMenu.close();
- viewMenu.close();
- }
-
- Component.onCompleted: {
- _viewerHelper.restoreWindowState(window);
- previousVisibility = visibility;
- }
-
- onClosing: {
- _viewerHelper.storeWindowState(window);
- }
-
- Timer {
- id: infoTimer
- repeat: false
- interval: 5000
-
- onTriggered: {
- infoOverlay.visible = false;
- }
- }
-
- Rectangle {
- id: infoOverlay
- visible: false
- color: "black"
- border.color: _dialogBorderColor
- x: parent.width * 0.2
- y: parent.height * 0.4
- width: parent.width * 0.6
- height: parent.height * 0.2
- z: 20
- Label {
- id: infoLabel
- anchors.fill: parent
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: window.width / 40
- }
- }
-
- Connections {
- target: _viewerHelper
- onShowInfoOverlay: {
- // Show a brief info overlay
- infoLabel.text = infoStr;
- infoOverlay.visible = true;
- infoTimer.restart();
- }
- }
-
- MouseArea {
- property int swipeStart: 0
-
- anchors.fill: parent
- z: 10
- enabled: !ipEntry.visible
-
- onPressed: {
- if (window.visibility === Window.FullScreen)
- swipeStart = mouse.y;
- _viewerHelper.handleMousePress(mouse.x, mouse.y, mouse.button, mouse.buttons,
- mouse.modifiers);
- mouse.accepted = true;
- }
- onReleased: {
- _viewerHelper.handleMouseRelease(mouse.x, mouse.y, mouse.button, mouse.buttons,
- mouse.modifiers);
- mouse.accepted = true;
- }
- onPositionChanged: {
- // Swipe down to exit fullscreen mode
- if (window.visibility === Window.FullScreen && mouse.y > swipeStart + (height / 8)) {
- window.visibility = window.previousVisibility;
- } else {
- _viewerHelper.handleMouseMove(mouse.x, mouse.y, mouse.button, mouse.buttons,
- mouse.modifiers);
- }
- }
- }
-
- DropArea {
- anchors.fill: parent
- onEntered: {
- if (drag.hasUrls) {
- var filename = _viewerHelper.convertUrlListToFilename(drag.urls);
- if (filename === "")
- drag.accepted = false;
- }
- }
- onDropped: {
- if (drop.hasUrls) {
- var filename = _viewerHelper.convertUrlListToFilename(drop.urls);
- if (filename === "")
- drag.accepted = false;
- else
- _viewerHelper.loadFile(filename);
- }
- }
- }
-
- Loader {
- id: contentLoader
- anchors.fill: parent
- sourceComponent: {
- switch (_viewerHelper.contentView) {
- case ViewerHelper.StudioView:
- return studioContent;
- case ViewerHelper.ConnectView:
- return connectContent;
- case ViewerHelper.SequenceView:
- return sequenceContent;
- default:
- return emptyContent;
- }
- }
- Timer {
- id: asyncContentChanger
- repeat: false
- interval: 0
- property int view: ViewerHelper.DefaultView
- function changeView(newView) {
- view = newView;
- start();
- }
-
- onTriggered: {
- _viewerHelper.contentView = view;
- }
- }
- }
-
- Component {
- id: emptyContent
- Rectangle {
- color: "black"
- Label {
- anchors.fill: parent
- text: window.error
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: width / 80
- }
- }
- }
-
- Component {
- id: studioContent
- Studio3D {
- id: studio3D
-
- property alias hiderVisible: hider.visible
-
- focus: true
- ViewerSettings {
- matteColor: window.matteColor
- showRenderStats: window.showRenderStats
- scaleMode: window.scaleMode
- }
-
- // Hider item keeps the Studio3D hidden until it starts running and we reset the
- // animation time to the start
- Rectangle {
- id: hider
- color: "black"
- anchors.fill: parent
- }
-
- Timer {
- id: revealTimer
- repeat: false
- interval: 0
- onTriggered: {
- hider.visible = false;
- }
- }
-
- onRunningChanged: {
- if (running) {
- // Successfully opened a presentation, update the open folder
- _viewerHelper.openFolder = presentation.source.toString();
- // Force the animation to start from the beginning, as the first frame render
- // can take some time as shaders are compiled on-demand
- // Localization note: "Scene" needs to be the same as the default "Scene"
- // element name generated in the Studio application.
- presentation.goToTime(qsTr("Scene"), 0);
- revealTimer.start();
- }
- }
- onErrorChanged: {
- if (error.length > 0) {
- window.error = error;
- asyncContentChanger.changeView(ViewerHelper.DefaultView);
- }
- }
- }
- }
-
- Component {
- id: connectContent
- Rectangle {
- color: "black"
- Label {
- anchors.fill: parent
- text: _viewerHelper.connectText
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: width / 40
- }
- }
- }
-
- Component {
- id: sequenceContent
- Rectangle {
- property alias mainText: mainLabel.text
- property alias detailsText: detailsLabel.text
- color: "black"
- Item {
- anchors.fill: parent
- Label {
- id: mainLabel
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignBottom
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottomMargin: _controlPadding
- height: parent.height / 2
- font.pixelSize: width / 40
- text: qsTr("Image sequence generation initializing...")
- }
- Label {
- id: detailsLabel
- color: _textColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignTop
- anchors.top: mainLabel.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.topMargin: _controlPadding
- height: parent.height / 2
- font.pixelSize: width / 50
- }
- }
- }
- }
-
- Rectangle {
- id: ipEntry
- visible: false
- color: _dialogBackgroundColor
- border.color: _dialogBorderColor
- y: (parent.height - height) / 2
- x: (parent.width - width) / 2
- z: 100
- width: connectionEntry.width + (2 * _controlPadding)
- height: connectionEntry.height + (2 * _controlPadding)
-
- onVisibleChanged: {
- if (visible) {
- connectText.forceActiveFocus();
- connectText.selectAll();
- }
- }
-
- Grid {
- id: connectionEntry
- spacing: _controlPadding
- columns: 2
- y: _controlPadding
- x: _controlPadding
- Label {
- id: ipEntryLabel
- width: _controlBaseWidth
- height: _controlBaseHeight
- text: qsTr("Enter IP port:")
- color: _textColor
- font.pixelSize: _fontSize
- verticalAlignment: Text.AlignVCenter
- padding: _controlPadding / 2
- }
- TextField {
- id: connectText
- width: _controlBaseWidth
- height: _controlBaseHeight
- font.pixelSize: _fontSize
- color: _textColor
- selectByMouse: true
- padding: _controlPadding / 6
- enabled: ipEntry.visible
- text: _viewerHelper.connectPort
- validator: IntValidator {
- bottom: 1
- top: 65535
- }
-
- onAccepted: {
- if (ipEntry.visible) {
- _viewerHelper.contentView = ViewerHelper.ConnectView;
- _viewerHelper.connectPort = Number(text);
- _viewerHelper.connectRemote();
- ipEntry.visible = false;
- infoOverlay.visible = false;
- }
- }
-
- background: Rectangle {
- id: textBackground
- color: _dialogFieldColor
- border.width: 1
- border.color: _dialogFieldBorderColor
- radius: 2
- }
- }
- StyledButton {
- id: connectButton
- width: _controlBaseWidth
- text: qsTr("Connect")
- onClicked: {
- _viewerHelper.contentView = ViewerHelper.ConnectView;
- _viewerHelper.connectPort = Number(connectText.text);
- _viewerHelper.connectRemote();
- ipEntry.visible = false;
- infoOverlay.visible = false;
- }
- }
- StyledButton {
- id: cancelButton
- width: _controlBaseWidth
- text: qsTr("Cancel")
- onClicked: {
- ipEntry.visible = false;
- }
- }
- }
- }
-
- Component {
- id: fileDialogComponent
- FileDialog {
- id: fileDialog
- title: qsTr("Choose Presentation or Project")
- folder: _viewerHelper.openFolder
- nameFilters: [qsTr("All supported formats (*.uip *.uia)"),
- qsTr("Studio UI Presentation (*.uip)"),
- qsTr("Application file (*.uia)")]
- onAccepted: {
- _viewerHelper.contentView = ViewerHelper.StudioView;
- contentLoader.item.presentation.setSource(fileUrls[0]);
- }
- }
- }
-
- header: Rectangle {
- height: _controlBaseHeight
- color: _menuBackgroundColor
- visible: window.visibility !== Window.FullScreen
-
- Row {
- anchors.fill: parent
- StyledMenuButton {
- id: fileButton
- text: qsTr("File")
- menu: fileMenu
- window: window
-
- StyledMenu {
- id: fileMenu
- StyledMenuItem {
- text: qsTr("Open...")
- shortcut: StandardKey.Open
- enabled: _viewerHelper.contentView !== ViewerHelper.SequenceView
- onTriggered: {
- if (enabled) {
- fileDialogLoader.sourceComponent = fileDialogComponent;
- fileDialogLoader.item.open();
- }
- }
- Loader {
- id: fileDialogLoader
- sourceComponent: Item {}
- }
- }
- StyledMenuItem {
- text: _viewerHelper.connected ? qsTr("Disconnect") : qsTr("Connect...")
- shortcut: "F9"
- enabled: _viewerHelper.contentView !== ViewerHelper.SequenceView
- onTriggered: {
- if (enabled) {
- if (_viewerHelper.connected)
- _viewerHelper.disconnectRemote();
- else
- ipEntry.visible = !ipEntry.visible;
- }
- }
- }
- StyledMenuItem {
- text: qsTr("Reload")
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- shortcut: "F5"
- onTriggered: {
- if (enabled) {
- contentLoader.item.hiderVisible = true;
- contentLoader.item.reset();
- }
- }
- }
- StyledMenuSeparator {}
- StyledMenuItem {
- text: qsTr("Quit")
- shortcut: "Ctrl+Q"
- onTriggered: {
- window.close();
- }
- }
- }
- }
- StyledMenuButton {
- id: viewButton
- text: qsTr("View")
- menu: viewMenu
- window: window
-
- StyledMenu {
- id: viewMenu
- StyledMenuItem {
- text: qsTr("Show Matte")
- shortcut: "Ctrl+D"
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- showCheckMark: window.matteColor !== window.hideMatteColor
- onTriggered: {
- if (enabled) {
- if (window.matteColor === window.hideMatteColor)
- window.matteColor = window.showMatteColor;
- else
- window.matteColor = window.hideMatteColor;
- }
- }
- }
- StyledMenuItem {
- id: scaleMenuItem
- text: qsTr("Scale Mode")
- showArrow: true
- arrowMenu: scaleMenu
- shortcut: "Ctrl+Shift+S"
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- onTriggered: {
- if (enabled) {
- scaleMenu.close();
- if (window.scaleMode === ViewerSettings.ScaleModeCenter)
- window.scaleMode = ViewerSettings.ScaleModeFit;
- else if (window.scaleMode === ViewerSettings.ScaleModeFit)
- window.scaleMode = ViewerSettings.ScaleModeFill;
- else if (window.scaleMode === ViewerSettings.ScaleModeFill)
- window.scaleMode = ViewerSettings.ScaleModeCenter;
- }
- }
-
- StyledMenu {
- id: scaleMenu
- x: parent.width
- y: 0
-
- StyledMenuItem {
- id: scaleCenter
- text: qsTr("Center")
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- showCheckMark: window.scaleMode === ViewerSettings.ScaleModeCenter
- onTriggered: {
- if (enabled)
- window.scaleMode = ViewerSettings.ScaleModeCenter;
- }
- }
- StyledMenuItem {
- id: scaleFit
- text: qsTr("Scale to Fit")
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- showCheckMark: window.scaleMode === ViewerSettings.ScaleModeFit
- onTriggered: {
- if (enabled)
- window.scaleMode = ViewerSettings.ScaleModeFit;
- }
- }
- StyledMenuItem {
- id: scaleFill
- text: qsTr("Scale to Fill")
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- showCheckMark: window.scaleMode === ViewerSettings.ScaleModeFill
- onTriggered: {
- if (enabled)
- window.scaleMode = ViewerSettings.ScaleModeFill;
- }
- }
- }
- }
- StyledMenuItem {
- text: qsTr("Show Render Statistics")
- shortcut: "F7"
- enabled: _viewerHelper.contentView === ViewerHelper.StudioView
- showCheckMark: window.showRenderStats
- onTriggered: {
- if (enabled)
- window.showRenderStats = !window.showRenderStats;
- }
- }
- StyledMenuSeparator {}
- StyledMenuItem {
- text: qsTr("Full Screen")
- shortcut: "F11"
- Shortcut {
- sequence: "ESC"
- context: Qt.ApplicationShortcut
- enabled: window.visibility === Window.FullScreen
- onActivated: {
- window.visibility = window.previousVisibility;
- }
- }
-
- onTriggered: {
- if (window.visibility !== Window.FullScreen) {
- window.previousVisibility = window.visibility
- window.visibility = Window.FullScreen;
- } else {
- window.visibility = window.previousVisibility;
- }
- }
- }
- }
- }
- }
- }
-}
diff --git a/src/Viewer/Qt3DViewer/remotedeploymentreceiver.cpp b/src/Viewer/Qt3DViewer/remotedeploymentreceiver.cpp
deleted file mode 100644
index cdfa5b05..00000000
--- a/src/Viewer/Qt3DViewer/remotedeploymentreceiver.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "remotedeploymentreceiver.h"
-#include "viewer.h"
-
-#include <QtNetwork>
-
-RemoteDeploymentReceiver::RemoteDeploymentReceiver(int serverPort, QObject *parent)
- : QObject(parent)
- , m_tcpServer(0)
- , m_connection(0)
- , m_temporaryDir(0)
- , m_serverPort(serverPort)
- , m_projectDeployed(false)
-{
- m_incoming.setVersion(QDataStream::Qt_5_8);
-}
-
-RemoteDeploymentReceiver::~RemoteDeploymentReceiver()
-{
- delete m_temporaryDir;
- m_temporaryDir = 0;
-}
-
-void RemoteDeploymentReceiver::setPort(int value)
-{
- m_serverPort = value;
-}
-
-QString RemoteDeploymentReceiver::startServer()
-{
- if (m_tcpServer)
- return QString();
-
- m_tcpServer = new QTcpServer(this);
- if (!m_tcpServer->listen(QHostAddress::Any, m_serverPort)) {
- QString error = tr("Can't start the remote connection: '%1'")
- .arg(m_tcpServer->errorString());
- delete m_tcpServer;
- m_tcpServer = 0;
- return error;
- }
-
- QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
- // use the first non-localhost IPv4 address
- for (int i = 0; i < ipAddressesList.size(); ++i) {
- if (ipAddressesList.at(i) != QHostAddress::LocalHost
- && ipAddressesList.at(i).toIPv4Address()) {
- m_hostAddress = ipAddressesList.at(i);
- break;
- }
- }
-
- // if we did not find one, use IPv4 localhost
- if (m_hostAddress.isNull())
- m_hostAddress = QHostAddress(QHostAddress::LocalHost);
-
- m_serverPort = m_tcpServer->serverPort();
- connect(m_tcpServer, SIGNAL(newConnection()),
- this, SLOT(acceptRemoteConnection()));
- return QString();
-}
-
-void RemoteDeploymentReceiver::disconnectRemote()
-{
- if (m_connection)
- m_connection->disconnectFromHost();
-}
-
-void RemoteDeploymentReceiver::acceptRemoteConnection()
-{
- Q_ASSERT(m_tcpServer);
- Q_ASSERT(!m_connection);
- m_connection = m_tcpServer->nextPendingConnection();
- Q_ASSERT(m_connection);
-
- m_incoming.setDevice(m_connection);
-
- connect(m_connection, &QTcpSocket::disconnected,
- this, &RemoteDeploymentReceiver::acceptRemoteDisconnection);
-
- connect(m_connection, &QTcpSocket::readyRead,
- this, &RemoteDeploymentReceiver::readProject);
-
- Q_EMIT(remoteConnected());
-}
-
-void RemoteDeploymentReceiver::acceptRemoteDisconnection()
-{
- Q_ASSERT(m_tcpServer);
- Q_ASSERT(m_connection);
- m_connection->deleteLater();
- m_connection = 0;
-
- m_incoming.setDevice(0);
-
- Q_EMIT(remoteDisconnected());
-}
-
-void RemoteDeploymentReceiver::readProject()
-{
- m_projectDeployed = false;
- Q_EMIT(projectChanging());
-
- m_incoming.startTransaction();
-
- int totalBytes = 0;
- m_incoming >> totalBytes;
-
- Viewer *viewer = qobject_cast<Viewer *>(parent());
- if (viewer && totalBytes != 0) {
- viewer->updateProgress(
- 100 * ((double)m_connection->bytesAvailable() / (double)totalBytes));
- }
-
- if (m_connection->bytesAvailable() < totalBytes) {
- m_incoming.rollbackTransaction();
- return;
- }
-
- int numberOfFiles = 0;
- QString projectFile;
- m_incoming >> numberOfFiles;
- m_incoming >> projectFile;
-
- QVector<QPair<QString, QByteArray> > files;
- for (int i = 0; i < numberOfFiles; ++i) {
- QString fileName;
- QByteArray fileContents;
- m_incoming >> fileName;
- m_incoming >> fileContents;
- files.append(qMakePair(fileName, fileContents));
- }
-
- if (!m_incoming.commitTransaction()) {
- m_incoming.abortTransaction();
- qWarning() << "Error transferring remote project in one payload";
- return;
- }
-
- QFileInfo currentProject(m_projectFile);
- if (projectFile != currentProject.fileName()) {
- delete m_temporaryDir;
- m_temporaryDir = 0;
- }
-
- if (!m_temporaryDir)
- m_temporaryDir = new QTemporaryDir;
-
- Q_ASSERT(m_temporaryDir->isValid());
-
- for (const auto &file : qAsConst(files)) {
- QString filePath = m_temporaryDir->path() + QDir::separator() + file.first;
- QFile tmpFile(filePath);
- QDir tmpFileDir = QFileInfo(tmpFile).absoluteDir();
- if (!tmpFileDir.exists())
- tmpFileDir.mkpath(".");
- if (!tmpFile.open(QIODevice::WriteOnly)) {
- delete m_temporaryDir;
- m_temporaryDir = 0;
- qWarning() << "Error opening temporary file for remote project:"
- << filePath;
- return;
- }
-
- if (file.first == projectFile)
- m_projectFile = filePath;
-
- tmpFile.write(file.second);
- tmpFile.close();
- }
-
- m_projectDeployed = true;
- Q_EMIT(projectChanged());
-}
diff --git a/src/Viewer/Qt3DViewer/remotedeploymentreceiver.h b/src/Viewer/Qt3DViewer/remotedeploymentreceiver.h
deleted file mode 100644
index 49f7de3f..00000000
--- a/src/Viewer/Qt3DViewer/remotedeploymentreceiver.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef REMOTEDEPLOYMENTRECEIVER_H
-#define REMOTEDEPLOYMENTRECEIVER_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qtemporarydir.h>
-#include <QtNetwork/qtcpserver.h>
-
-class RemoteDeploymentReceiver : public QObject
-{
- Q_OBJECT
-public:
- explicit RemoteDeploymentReceiver(int serverPort, QObject *parent);
- ~RemoteDeploymentReceiver();
-
- QString startServer();
- void disconnectRemote();
-
- QHostAddress hostAddress() const { return m_hostAddress; }
- int serverPort() const { return m_serverPort; }
- void setServerPort(int port) { m_serverPort = port; }
- bool isConnected() const { return m_connection; }
- bool isProjectDeployed() const { return m_connection && m_projectDeployed; }
- QString fileName() const { return m_projectFile; }
-
-Q_SIGNALS:
- void projectChanged();
- void projectChanging();
- void remoteConnected();
- void remoteDisconnected();
-
-private Q_SLOTS:
- void acceptRemoteConnection();
- void acceptRemoteDisconnection();
- void readProject();
- void setPort(int value);
-
-private:
- QTcpServer *m_tcpServer = nullptr;
- QTcpSocket *m_connection = nullptr;
- QHostAddress m_hostAddress;
- QDataStream m_incoming;
- QTemporaryDir *m_temporaryDir = nullptr;
- QString m_projectFile;
- bool m_projectDeployed;
- int m_serverPort;
-};
-
-#endif // REMOTEDEPLOYMENTRECEIVER_H
diff --git a/src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.ico b/src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.ico
deleted file mode 100644
index c15cd68a..00000000
--- a/src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.ico
+++ /dev/null
Binary files differ
diff --git a/src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.svg b/src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.svg
deleted file mode 100644
index 69a14f48..00000000
--- a/src/Viewer/Qt3DViewer/resources/images/3D-studio-viewer.svg
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg width="512px" height="512px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
- <title>icon_512x512</title>
- <desc>Created with Sketch.</desc>
- <defs>
- <polygon id="path-1" points="64 0 0 48 0 112 64 160 128 112 128 48"></polygon>
- <path d="M45.6534039,84.7089559 L45.6534039,97.4054197 L15.0588235,128 L0,112.941176 L30.1176471,82.8235294 L43.7426612,82.8235294 C35.3039365,74.0299707 30.1176471,62.091235 30.1176471,48.9411765 C30.1176471,21.9117111 52.0293581,0 79.0588235,0 C106.088289,0 128,21.9117111 128,48.9411765 C128,75.9706419 106.088289,97.8823529 79.0588235,97.8823529 C66.1449913,97.8823529 54.3993526,92.8807218 45.6534039,84.7089559 Z M79.0588235,82.8235294 C97.7715303,82.8235294 112.941176,67.6538833 112.941176,48.9411765 C112.941176,30.2284697 97.7715303,15.0588235 79.0588235,15.0588235 C60.3461167,15.0588235 45.1764706,30.2284697 45.1764706,48.9411765 C45.1764706,67.6538833 60.3461167,82.8235294 79.0588235,82.8235294 Z" id="path-2"></path>
- </defs>
- <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
- <g id="icon_512x512">
- <g id="Group-3" transform="translate(56.000000, 88.000000)">
- <g id="Page-1-Copy">
- <polygon id="Fill-1" fill="#41CD52" points="0 288.0032 328 288.0032 384 232.0032 384 0.0032 56 0.0032 0 56.0032"></polygon>
- <g id="Group-6" transform="translate(72.000000, 48.000000)" fill="#FFFFFF">
- <path d="M39.3792,138.3936 C44.8752,147.8176 55.4752,152.6656 71.0512,152.6656 C86.6272,152.6656 97.0992,147.9536 102.5952,138.6496 C107.9552,129.3456 110.7072,113.5216 110.7072,91.4016 C110.7072,69.1536 107.9632,53.0576 102.3312,42.9776 C96.7072,32.9056 86.3632,27.9216 71.0512,27.9216 C55.8752,27.9216 45.3952,32.8896 39.6432,42.9776 C34.0112,53.0656 31.1312,69.0256 31.1312,91.1456 C31.1312,113.1296 33.8832,128.9616 39.3792,138.3936 L39.3792,138.3936 Z M70.9232,176.2256 C45.6592,176.2256 27.9952,169.4096 18.0432,155.8016 C8.0992,142.2016 3.1232,120.5936 3.1232,91.2736 C3.1232,61.8336 8.2272,39.9696 18.3072,25.7056 C28.3872,11.4416 46.0512,4.2416 70.9232,4.2416 C95.9152,4.2416 113.4592,11.3056 123.4032,25.5696 C133.4832,39.7056 138.4512,61.5616 138.4512,91.1536 C138.4512,110.6496 136.3632,126.3536 132.3072,138.2656 C128.1152,150.2976 121.4432,159.4656 112.0192,165.7536 L132.4352,198.6016 L107.4352,210.2336 L85.8432,174.7776 C82.6992,175.8016 77.7232,176.1376 70.9232,176.1376 L70.9232,176.2256 Z" id="Fill-2"></path>
- <path d="M198.66,71.5184 L198.66,125.0464 C198.66,134.9984 199.444,141.5344 200.884,144.8064 C202.316,148.0784 206.116,149.6544 212.004,149.6544 L231.9,148.7984 L233.076,170.0064 C222.212,172.1024 213.972,173.1424 208.212,173.1424 C194.468,173.1424 185.044,170.0064 179.94,163.7184 C174.836,157.4384 172.22,145.5344 172.22,127.9984 L172.22,71.5824 L153.764,71.5824 L153.764,48.9424 L172.348,48.9424 L172.348,13.7344 L198.66,13.7344 L198.66,48.9424 L232.164,48.9424 L232.164,71.4544 L198.66,71.5184 Z" id="Fill-4"></path>
- </g>
- </g>
- <g id="Group" transform="translate(280.000000, 176.000000)">
- <g id="Path-29">
- <use fill="#D8D8D8" fill-rule="evenodd" xlink:href="#path-1"></use>
- <path stroke="#FFFFFF" stroke-width="7" d="M64,-4.375 L131.5,46.25 L131.5,113.75 L64,164.375 L-3.5,113.75 L-3.5,46.25 L64,-4.375 Z"></path>
- </g>
- <polygon id="Path-27" fill="#81CFFF" points="0 48 64 96 128 48 64 0"></polygon>
- <polygon id="Path-28-Copy" fill="#1F83C1" transform="translate(96.000000, 104.000000) scale(-1, 1) translate(-96.000000, -104.000000) " points="64 48 64 112 128 160 128 96"></polygon>
- <polygon id="Path-28" fill="#2696DA" points="0 48 0 112 64 160 64 96"></polygon>
- </g>
- <g id="Group-2" transform="translate(200.000000, 208.000000)">
- <g id="Combined-Shape">
- <use fill="#707070" fill-rule="evenodd" xlink:href="#path-2"></use>
- <path stroke="#FFFFFF" stroke-width="7" d="M49.1534039,92.0264501 L49.1534039,98.8551671 L15.0588235,132.949747 L-4.94974747,112.941176 L28.6678996,79.3235294 L36.3089911,79.3235294 C30.0728186,70.5670745 26.6176471,60.0229376 26.6176471,48.9411765 C26.6176471,19.9787144 50.0963615,-3.5 79.0588235,-3.5 C108.021286,-3.5 131.5,19.9787144 131.5,48.9411765 C131.5,77.9036385 108.021286,101.382353 79.0588235,101.382353 C68.1809425,101.382353 57.8185023,98.0537262 49.1534039,92.0264501 Z M79.0588235,79.3235294 C95.8385337,79.3235294 109.441176,65.7208867 109.441176,48.9411765 C109.441176,32.1614663 95.8385337,18.5588235 79.0588235,18.5588235 C62.2791133,18.5588235 48.6764706,32.1614663 48.6764706,48.9411765 C48.6764706,65.7208867 62.2791133,79.3235294 79.0588235,79.3235294 Z"></path>
- </g>
- </g>
- </g>
- </g>
- </g>
-</svg> \ No newline at end of file
diff --git a/src/Viewer/Qt3DViewer/resources/images/arrow.png b/src/Viewer/Qt3DViewer/resources/images/arrow.png
deleted file mode 100644
index 40ebda88..00000000
--- a/src/Viewer/Qt3DViewer/resources/images/arrow.png
+++ /dev/null
Binary files differ
diff --git a/src/Viewer/Qt3DViewer/resources/images/arrow@2x.png b/src/Viewer/Qt3DViewer/resources/images/arrow@2x.png
deleted file mode 100644
index 1a21ee06..00000000
--- a/src/Viewer/Qt3DViewer/resources/images/arrow@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Viewer/Qt3DViewer/resources/images/check@2x.png b/src/Viewer/Qt3DViewer/resources/images/check@2x.png
deleted file mode 100644
index ed730bfe..00000000
--- a/src/Viewer/Qt3DViewer/resources/images/check@2x.png
+++ /dev/null
Binary files differ
diff --git a/src/Viewer/Qt3DViewer/resources/images/viewer.icns b/src/Viewer/Qt3DViewer/resources/images/viewer.icns
deleted file mode 100644
index b718d75c..00000000
--- a/src/Viewer/Qt3DViewer/resources/images/viewer.icns
+++ /dev/null
Binary files differ
diff --git a/src/Viewer/Qt3DViewer/viewer.cpp b/src/Viewer/Qt3DViewer/viewer.cpp
deleted file mode 100644
index 4d6bcea3..00000000
--- a/src/Viewer/Qt3DViewer/viewer.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qsettings.h>
-#include <QtCore/qfileinfo.h>
-#include <QtStudio3D/private/q3dsviewersettings_p.h>
-#include <QtStudio3D/private/q3dspresentation_p.h>
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qscreen.h>
-#include <QtQuick/qquickwindow.h>
-
-#include "viewer.h"
-#include "q3dspresentationitem.h"
-
-Viewer::Viewer(bool generatorMode, QObject *parent)
- : QObject(parent)
- , m_generatorMode(generatorMode)
-{
- if (m_generatorMode)
- setContentView(SequenceView);
-
- m_connectTextResetTimer.setInterval(5000);
- m_connectTextResetTimer.setSingleShot(true);
- connect(&m_connectTextResetTimer, &QTimer::timeout, this, &Viewer::resetConnectionInfoText);
-}
-
-Viewer::~Viewer()
-{
-}
-
-void Viewer::connectRemote()
-{
- if (m_remoteDeploymentReceiver) {
- delete m_remoteDeploymentReceiver;
- m_remoteDeploymentReceiver = 0;
- Q_EMIT connectedChanged();
- }
-
- m_remoteDeploymentReceiver = new RemoteDeploymentReceiver(m_connectPort, this);
- QString error = m_remoteDeploymentReceiver->startServer();
- if (!error.isEmpty()) {
- delete m_remoteDeploymentReceiver;
- m_remoteDeploymentReceiver = nullptr;
- setContentView(DefaultView);
- m_qmlRootObject->setProperty("error", QVariant(error));
- return;
- }
-
- resetConnectionInfoText();
-
- connect(m_remoteDeploymentReceiver, &RemoteDeploymentReceiver::remoteConnected,
- this, &Viewer::remoteConnected);
-
- connect(m_remoteDeploymentReceiver, &RemoteDeploymentReceiver::remoteDisconnected,
- this, &Viewer::remoteDisconnected);
-
- connect(m_remoteDeploymentReceiver, &RemoteDeploymentReceiver::projectChanging,
- this, &Viewer::remoteProjectChanging);
-
- connect(m_remoteDeploymentReceiver, &RemoteDeploymentReceiver::projectChanged,
- this, &Viewer::loadRemoteDeploymentReceiver);
-
- Q_EMIT connectedChanged();
-}
-
-void Viewer::disconnectRemote()
-{
- m_remoteDeploymentReceiver->disconnectRemote();
-}
-
-// Used to load files via command line and when using remote deployment
-void Viewer::loadFile(const QString &filename)
-{
- QString targetFilename = filename;
- // Try to find the application (*.uia) file for loading instead of the presentation (*.uip)
- // in case we are connected to remote sender.
- if (isConnected() && targetFilename.endsWith(QStringLiteral(".uip"))) {
- targetFilename.chop(4);
- targetFilename.append(QStringLiteral(".uia"));
- QFileInfo targetfileInfo(targetFilename);
- // uia not found, revert to given uip
- if (!targetfileInfo.exists())
- targetFilename = filename;
- }
-
- QFileInfo fileInfo(targetFilename);
- if (!fileInfo.exists()) {
- setContentView(DefaultView);
- m_qmlRootObject->setProperty(
- "error", QVariant(tr("Tried to load nonexistent file %1").arg(targetFilename)));
- return;
- }
-
- QUrl sourceUrl = QUrl::fromLocalFile(fileInfo.absoluteFilePath());
-
- setContentView(StudioView);
-
- if (qmlStudio())
- qmlStudio()->presentation()->setSource(sourceUrl);
-}
-
-QString Viewer::convertUrlListToFilename(const QList<QUrl> &list)
-{
- for (const QUrl &url : list) {
- QString str = url.toLocalFile();
- if (!str.isEmpty()) {
- if (QFileInfo(str).suffix() == QStringLiteral("uip")
- || QFileInfo(str).suffix() == QStringLiteral("uia")) {
- return str;
- }
- }
- }
- return QString();
-}
-
-void Viewer::restoreWindowState(QWindow *window)
-{
- QSettings settings;
- QRect geo = settings.value(QStringLiteral("WindowGeometry"), QRect()).toRect();
- int visibility = settings.value(QStringLiteral("WindowVisibility"),
- QWindow::Windowed).toInt();
-
- // Do not restore geometry if resulting geometry means the center of the window
- // would be offscreen on the virtual desktop
- QRect vgeo = window->screen()->availableVirtualGeometry();
- QPoint center(geo.x() + geo.width() / 2, geo.y() + geo.height() / 2);
- bool offscreen = center.x() > vgeo.width() || center.x() < 0
- || center.y() > vgeo.height() || center.y() < 0;
-
- if (!offscreen && !geo.isNull()) {
- // The first geometry set at startup may adjust the geometry according to pixel
- // ratio if mouse cursor is on different screen than where window goes and the
- // two screens have different pixel ratios. Setting geometry twice seems to
- // work around this.
- geo.adjust(0, 0, -1, 0);
- window->setGeometry(geo);
- geo.adjust(0, 0, 1, 0);
- window->setGeometry(geo);
- }
-
- window->setVisibility(QWindow::Visibility(visibility));
-}
-
-void Viewer::storeWindowState(QWindow *window)
-{
- QSettings settings;
- settings.setValue(QStringLiteral("WindowGeometry"), window->geometry());
- settings.setValue(QStringLiteral("WindowState"), window->visibility());
-}
-
-// Since we need mouse events for handling the swipe gesture in viewer, we need to generate
-// a fake event for the presentation.
-void Viewer::handleMousePress(int x, int y, int button, int buttons, int modifiers)
-{
- if (qmlStudio()) {
- QMouseEvent fakeEvent(QEvent::MouseButtonPress,
- QPointF(x, y) * qmlStudio()->window()->devicePixelRatio(),
- Qt::MouseButton(button),
- Qt::MouseButtons(buttons),
- Qt::KeyboardModifiers(modifiers));
- qmlStudio()->presentation()->mousePressEvent(&fakeEvent);
- }
-}
-
-void Viewer::handleMouseRelease(int x, int y, int button, int buttons, int modifiers)
-{
- if (qmlStudio()) {
- QMouseEvent fakeEvent(QEvent::MouseButtonRelease,
- QPointF(x, y) * qmlStudio()->window()->devicePixelRatio(),
- Qt::MouseButton(button),
- Qt::MouseButtons(buttons),
- Qt::KeyboardModifiers(modifiers));
- qmlStudio()->presentation()->mouseReleaseEvent(&fakeEvent);
- }
-}
-
-void Viewer::handleMouseMove(int x, int y, int button, int buttons, int modifiers)
-{
- if (qmlStudio()) {
- QMouseEvent fakeEvent(QEvent::MouseMove,
- QPointF(x, y) * qmlStudio()->window()->devicePixelRatio(),
- Qt::MouseButton(button),
- Qt::MouseButtons(buttons),
- Qt::KeyboardModifiers(modifiers));
- qmlStudio()->presentation()->mouseMoveEvent(&fakeEvent);
- }
-}
-
-void Viewer::setContentView(Viewer::ContentView view)
-{
- if (view != m_contentView) {
- m_qmlStudio = nullptr;
- m_contentView = view;
- Q_EMIT contentViewChanged();
- }
-}
-
-Viewer::ContentView Viewer::contentView() const
-{
- return m_contentView;
-}
-
-void Viewer::setOpenFolder(const QUrl &folder)
-{
- QString localFolder = folder.toLocalFile();
- QFileInfo fi(localFolder);
- QString newDir;
- if (fi.isDir())
- newDir = fi.absoluteFilePath();
- else
- newDir = fi.absolutePath();
- if (newDir != m_openFileDir) {
- m_openFileDir = newDir;
- QSettings settings;
- settings.setValue(QStringLiteral("DirectoryOfLastOpen"), m_openFileDir);
- Q_EMIT openFolderChanged();
- }
-}
-
-QUrl Viewer::openFolder()
-{
- if (m_openFileDir.size() == 0) {
- QSettings settings;
- m_openFileDir = settings.value(QStringLiteral("DirectoryOfLastOpen"),
- QString("")).toString();
-#ifdef Q_OS_ANDROID
- if (m_openFileDir.isEmpty())
- m_openFileDir = QStringLiteral("/sdcard/qt3dviewer"); // Add default folder for Android
-#endif
- }
- return QUrl::fromLocalFile(m_openFileDir);
-}
-
-void Viewer::setConnectPort(int port)
-{
- if (m_connectPort != port) {
- QSettings settings;
- m_connectPort = port;
- settings.setValue(QStringLiteral("ConnectPort"), m_connectPort);
- Q_EMIT connectPortChanged();
- }
-}
-
-int Viewer::connectPort()
-{
- if (m_connectPort < 0) {
- QSettings settings;
- m_connectPort = settings.value(QStringLiteral("ConnectPort"), 36000).toInt();
- }
- return m_connectPort;
-}
-
-QString Viewer::connectText() const
-{
- return m_connectText;
-}
-
-bool Viewer::isConnected() const
-{
- return m_remoteDeploymentReceiver ? m_remoteDeploymentReceiver->isConnected() : false;
-}
-
-void Viewer::setQmlRootObject(QObject *obj)
-{
- m_qmlRootObject = obj;
-}
-
-void Viewer::loadRemoteDeploymentReceiver()
-{
- Q_ASSERT(m_remoteDeploymentReceiver);
- const QString remote = m_remoteDeploymentReceiver->fileName();
- QMetaObject::invokeMethod(this, "loadFile", Qt::QueuedConnection, Q_ARG(QString, remote));
-}
-
-void Viewer::remoteProjectChanging()
-{
- if (m_contentView != ConnectView)
- setContentView(ConnectView);
- m_connectText = tr("Loading remote project...");
- Q_EMIT connectTextChanged();
-}
-
-void Viewer::remoteConnected()
-{
- m_connectText = tr("Remote Connected");
- Q_EMIT connectTextChanged();
- Q_EMIT connectedChanged();
- if (m_contentView != ConnectView)
- Q_EMIT showInfoOverlay(m_connectText);
-}
-
-void Viewer::remoteDisconnected()
-{
- m_connectText = tr("Remote Disconnected");
- Q_EMIT connectTextChanged();
- Q_EMIT connectedChanged();
- if (m_contentView != ConnectView) {
- Q_EMIT showInfoOverlay(m_connectText);
- } else {
- // Start timer to reset connection info text
- m_connectTextResetTimer.start();
- }
-}
-
-void Viewer::resetConnectionInfoText()
-{
- m_connectText.clear();
- QTextStream stream(&m_connectText);
- stream << tr("Use IP: %1 and Port: %2\n"
- "in Qt 3D Studio Editor to connect to this viewer.\n\n"
- "Use File/Open... to open a local presentation.")
- .arg(m_remoteDeploymentReceiver->hostAddress().toString())
- .arg(QString::number(m_connectPort));
- Q_EMIT connectTextChanged();
-}
-
-Q3DSView *Viewer::qmlStudio()
-{
- if (m_contentView == StudioView) {
- if (!m_qmlStudio) {
- QObject *loadedContent = m_qmlRootObject->property("loadedContent").value<QObject *>();
- m_qmlStudio = static_cast<Q3DSView *>(loadedContent);
- }
- } else {
- m_qmlStudio = nullptr;
- }
- return m_qmlStudio;
-}
-
-void Viewer::generatorProgress(int totalFrames, int frameCount)
-{
- QString progressString;
- if (frameCount >= totalFrames) {
- progressString =
- QCoreApplication::translate(
- "main", "Image sequence generation done! (%2 frames generated)")
- .arg(totalFrames);
- } else {
- progressString =
- QCoreApplication::translate("main", "Image sequence generation progress: %1 / %2")
- .arg(frameCount).arg(totalFrames);
- }
- QObject *loadedContent = m_qmlRootObject->property("loadedContent").value<QObject *>();
- loadedContent->setProperty("mainText", progressString);
-}
-
-void Viewer::generatorFinished(bool success, const QString &details)
-{
- QObject *loadedContent = m_qmlRootObject->property("loadedContent").value<QObject *>();
- if (success) {
- loadedContent->setProperty("detailsText", details);
- } else {
- QString mainString =
- QCoreApplication::translate("main", "Image sequence generation failed:");
- loadedContent->setProperty("mainText", mainString);
- loadedContent->setProperty("detailsText", details);
- }
-}
-
-void Viewer::updateProgress(int percent)
-{
- // Don't wait for 100%, as it'll already start loading and text isn't updated anymore
- if (percent >= 99)
- m_connectText = tr("Loading remote project...");
- else
- m_connectText = QStringLiteral("Receiving (%1%)").arg(percent);
- Q_EMIT connectTextChanged();
-}
-
-void Viewer::setGeneratorDetails(const QString &filename)
-{
- QObject *loadedContent = m_qmlRootObject->property("loadedContent").value<QObject *>();
- loadedContent->setProperty("detailsText", filename);
-}
diff --git a/src/Viewer/Qt3DViewer/viewer.h b/src/Viewer/Qt3DViewer/viewer.h
deleted file mode 100644
index 9931483e..00000000
--- a/src/Viewer/Qt3DViewer/viewer.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIEWER_H
-#define VIEWER_H
-
-#include "remotedeploymentreceiver.h"
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qtimer.h>
-#include <QtGui/qwindow.h>
-#include "Qt3DSView.h"
-
-class Viewer : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(ContentView contentView READ contentView WRITE setContentView NOTIFY contentViewChanged)
- Q_PROPERTY(QUrl openFolder READ openFolder WRITE setOpenFolder NOTIFY openFolderChanged)
- Q_PROPERTY(int connectPort READ connectPort WRITE setConnectPort NOTIFY connectPortChanged)
- Q_PROPERTY(QString connectText READ connectText NOTIFY connectTextChanged)
- Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
-
-public:
- enum ContentView {
- DefaultView,
- StudioView,
- ConnectView,
- SequenceView
- };
-
- Q_ENUM(ContentView)
-
- explicit Viewer(bool generatorMode, QObject *parent = nullptr);
- ~Viewer();
-
- Q_INVOKABLE void connectRemote();
- Q_INVOKABLE void disconnectRemote();
- Q_INVOKABLE void loadFile(const QString &filename);
- Q_INVOKABLE QString convertUrlListToFilename(const QList<QUrl> &list);
- Q_INVOKABLE void restoreWindowState(QWindow *window);
- Q_INVOKABLE void storeWindowState(QWindow *window);
-
- Q_INVOKABLE void handleMousePress(int x, int y, int button, int buttons, int modifiers);
- Q_INVOKABLE void handleMouseRelease(int x, int y, int button, int buttons, int modifiers);
- Q_INVOKABLE void handleMouseMove(int x, int y, int button, int buttons, int modifiers);
-
- void setContentView(ContentView view);
- ContentView contentView() const;
- void setOpenFolder(const QUrl &folder);
- QUrl openFolder(); // not const since it potentially updates from settings
- void setConnectPort(int port);
- int connectPort(); // not const since it potentially updates from settings
- QString connectText() const;
- bool isConnected() const;
-
- void setQmlRootObject(QObject *obj);
-
- void loadProject(const QByteArray &data);
- void updateProgress(int percent);
- void setGeneratorDetails(const QString &filename);
-
-public Q_SLOTS:
- void generatorProgress(int totalFrames, int frameCount);
- void generatorFinished(bool success, const QString &details);
-
-private Q_SLOTS:
- void loadRemoteDeploymentReceiver();
- void remoteProjectChanging();
- void remoteConnected();
- void remoteDisconnected();
- void resetConnectionInfoText();
-
-Q_SIGNALS:
- void contentViewChanged();
- void openFolderChanged();
- void connectPortChanged();
- void connectTextChanged();
- void connectedChanged();
- void showInfoOverlay(const QString &infoStr);
-
-private:
- Q3DSView *qmlStudio();
-
- QString m_openFileDir;
- RemoteDeploymentReceiver *m_remoteDeploymentReceiver = nullptr;
- bool m_generatorMode = false;
- ContentView m_contentView = DefaultView;
- QObject *m_qmlRootObject = nullptr;
- int m_connectPort = -1;
- QString m_connectText;
- Q3DSView *m_qmlStudio = nullptr;
- QTimer m_connectTextResetTimer;
-};
-
-#endif // VIEWER_H
diff --git a/src/Viewer/Viewer.pro b/src/Viewer/Viewer.pro
index 07bdb7ad..62df68ee 100644
--- a/src/Viewer/Viewer.pro
+++ b/src/Viewer/Viewer.pro
@@ -1,9 +1,4 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
- studio3d \
- qmlviewer
-
-!boot2qt:!integrity:!qnx {
- SUBDIRS += Qt3DViewer
-}
+ studio3d
diff --git a/src/Viewer/qmlviewer/Qt3DSRenderer.cpp b/src/Viewer/qmlviewer/Qt3DSRenderer.cpp
deleted file mode 100644
index 39d0c9d6..00000000
--- a/src/Viewer/qmlviewer/Qt3DSRenderer.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2016 NVIDIA CORPORATION.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "Qt3DSRenderer.h"
-#include "Qt3DSViewerApp.h"
-#include "Qt3DSAudioPlayerImpl.h"
-
-#include <QtStudio3D/private/q3dscommandqueue_p.h>
-#include <QtStudio3D/private/q3dsviewersettings_p.h>
-#include <QtStudio3D/private/q3dspresentation_p.h>
-#include <QtStudio3D/private/studioutils_p.h>
-
-#include <QtCore/qdebug.h>
-#include <QtGui/qwindow.h>
-#include <QtGui/qopenglcontext.h>
-#include <QtQuick/qquickwindow.h>
-
-using namespace Q3DSViewer;
-
-QT_BEGIN_NAMESPACE
-
-Q3DSRenderer::Q3DSRenderer(bool visibleFlag, qt3ds::Qt3DSAssetVisitor *assetVisitor)
- : m_visibleFlag(visibleFlag)
- , m_initElements(false)
- , m_runtime(0)
- , m_window(nullptr)
- , m_initialized(false)
- , m_initializationFailure(false)
- , m_visitor(assetVisitor)
- , m_settings(new Q3DSViewerSettings(this))
- , m_presentation(new Q3DSPresentation(this))
-{
-}
-
-Q3DSRenderer::~Q3DSRenderer()
-{
- releaseRuntime();
-}
-
-QOpenGLFramebufferObject *Q3DSRenderer::createFramebufferObject(const QSize &size)
-{
- QOpenGLFramebufferObjectFormat theFormat;
- theFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- QOpenGLFramebufferObject *frameBuffer =
- new QOpenGLFramebufferObject(size, theFormat);
- if (m_runtime && m_runtime->IsInitialised())
- m_runtime->setOffscreenId(frameBuffer->handle());
- return frameBuffer;
-}
-
-/** Pull pending commands from the plugin.
- * Invoked automatically by the QML scene graph.
- *
- * This is the only place where it is valid for the Q3DSView plugin and render to communicate.
- */
-void Q3DSRenderer::synchronize(QQuickFramebufferObject *inView)
-{
- // Passing m_InitElements here is a bit of a hack to easily set the flag on the plugin.
- static_cast<Q3DSView *>(inView)->getCommands(m_initElements, m_commands);
-
- if (m_initializationFailure)
- static_cast<Q3DSView *>(inView)->setError(m_error);
-
- if (m_commands.m_sourceChanged) {
- releaseRuntime();
- // Need to update source here rather than processCommands, as source is needed for init
- m_presentation->setSource(m_commands.m_source);
- m_initialized = false;
- m_initializationFailure = false;
- m_error.clear();
- static_cast<Q3DSView *>(inView)->setError(QString());
- }
-
- m_initElements = false;
-
- // We need a handle to the window to be able to reset the GL state inside of Draw().
- // See https://bugreports.qt.io/browse/QTBUG-47213
- if (!m_window)
- m_window = inView->window();
-}
-
-void Q3DSRenderer::releaseRuntime()
-{
- m_settings->d_ptr->setViewerApp(nullptr);
- m_presentation->d_ptr->setViewerApp(nullptr);
-
- if (m_runtime) {
- m_runtime->Release();
- m_runtime = nullptr;
- }
-}
-
-/** Invoked by the QML scene graph indicating that it's time to render.
- * Calls `draw()` if the plugin is visible, or `processCommands()` otherwise.
- *
- * Note that this will still render if the plugin is opacity:0. To avoid this,
- * add a line to your QML to hide the object when opacity is zero, like:
- *
- * visible: opacity != 0
- */
-void Q3DSRenderer::render()
-{
- // We may start in a non visible state but we still need
- // to init the runtime otherwise the commands are never processed
- if (!m_initialized && !m_initializationFailure) {
- m_initialized = initializeRuntime(this->framebufferObject());
- m_initializationFailure = !m_initialized;
- if (m_initializationFailure)
- m_commands.clear();
- }
-
- // Don't render if the plugin is hidden; however, if hidden, but sure
- // to process pending commands so we can be shown again.
- if (m_initialized) {
- if (m_visibleFlag)
- draw();
- else
- processCommands();
- update(); // mark as dirty to ensure update again
- }
-}
-
-/** Cause Qt3DS runtime to render content.
- * Initializes GL and the runtime when called the first time.
- */
-void Q3DSRenderer::draw()
-{
- if (m_runtime && m_runtime->IsInitialised() && m_window) {
- if (m_initialized)
- m_runtime->RestoreState();
- m_runtime->Render();
- m_runtime->SaveState();
-
- m_window->resetOpenGLState();
- }
-}
-
-bool Q3DSRenderer::initializeRuntime(QOpenGLFramebufferObject *inFbo)
-{
- m_runtime = &Q3DSViewerApp::Create(nullptr, new Qt3DSAudioPlayerImpl());
- Q_ASSERT(m_runtime);
-
- // Connect presentation ready signal before initializing the app
- connect(m_runtime, &Q3DSViewer::Q3DSViewerApp::SigPresentationReady,
- this, &Q3DSRenderer::presentationReady);
-
- int theWidth = inFbo->width();
- int theHeight = inFbo->height();
-
- const QString localSource = Q3DSUtils::urlToLocalFileOrQrc(m_presentation->source());
-
- if (!m_runtime->InitializeApp(theWidth, theHeight, QOpenGLContext::currentContext()->format(),
- inFbo->handle(), localSource, m_visitor)) {
- m_error = m_runtime->error();
- releaseRuntime();
- return false;
- }
-
- m_runtime->RegisterScriptCallback(Q3DSViewer::ViewerCallbackType::Enum::CALLBACK_ON_INIT,
- reinterpret_cast<qml_Function>(Q3DSRenderer::onInitHandler),
- this);
- m_runtime->RegisterScriptCallback(Q3DSViewer::ViewerCallbackType::Enum::CALLBACK_ON_UPDATE,
- reinterpret_cast<qml_Function>(Q3DSRenderer::onUpdateHandler),
- this);
-
- m_settings->d_ptr->setViewerApp(m_runtime);
- m_presentation->d_ptr->setViewerApp(m_runtime, false);
-
- // Connect signals
- connect(m_runtime, &Q3DSViewer::Q3DSViewerApp::SigSlideEntered,
- this, &Q3DSRenderer::enterSlide);
- connect(m_runtime, &Q3DSViewer::Q3DSViewerApp::SigSlideExited,
- this, &Q3DSRenderer::exitSlide);
-
- return true;
-}
-
-/** Accept user commands (e.g. setAttribute) needed to initialize the code.
- *
- * If we attempt to run Qt3DS methods like setAttribute() before the runtime
- * has been initialized, they will be lost. This method is the correct place
- * to accept user commands.
- *
- * Currently this method just sets a flag needed to pass a flag to the
- * plugin next time syncronize() is called, which eventually gets the plugin
- * to emit an `runningChanged` signal the next time `tick()` is called.
- * As a result, code specified in an `onRunningChanged` handler may be run
- * after one or more frames have already rendered.
- */
-void Q3DSRenderer::onInitHandler(void *userData)
-{
- Q3DSRenderer *theRenderer = static_cast<Q3DSRenderer *>(userData);
- theRenderer->setInitElements(true);
-}
-
-/** Accept the latest pending user commands (e.g. setAttribute).
- *
- * This method just calls `ProcessCommands` to avoid unnecessary
- * pointer dereferencing and accessor methods (or public member variables).
- */
-void Q3DSRenderer::onUpdateHandler(void *userData)
-{
- Q3DSRenderer *theRenderer = static_cast<Q3DSRenderer *>(userData);
- theRenderer->processCommands();
-}
-
-/** Apply commands queued up by the user (e.g. setAttribute).
- *
- * Note that these commands are executed even if the plugin is not visible,
- * in part to allow changes to the visible flag to be noticed, but also
- * to allow specialty code to continue to be queued up even when not rendering.
- */
-void Q3DSRenderer::processCommands()
-{
- if (!m_runtime) {
- m_commands.clear();
- return;
- }
-
- if (m_commands.m_visibleChanged)
- m_visibleFlag = m_commands.m_visible;
-
- if (QOpenGLFramebufferObject *inFbo = this->framebufferObject()) {
- if (inFbo->isValid() && (inFbo->width() != m_runtime->GetWindowWidth()
- || inFbo->height() != m_runtime->GetWindowHeight())) {
- m_runtime->Resize(inFbo->width(), inFbo->height());
- }
- }
-
- if (m_commands.m_scaleModeChanged)
- m_settings->setScaleMode(m_commands.m_scaleMode);
- if (m_commands.m_shadeModeChanged)
- m_settings->setShadeMode(m_commands.m_shadeMode);
- if (m_commands.m_matteColorChanged)
- m_settings->setMatteColor(m_commands.m_matteColor);
- if (m_commands.m_showRenderStatsChanged)
- m_settings->setShowRenderStats(m_commands.m_showRenderStats);
-
- if (m_commands.m_globalAnimationTimeChanged)
- m_presentation->setGlobalAnimationTime(m_commands.m_globalAnimationTime);
-
- // Send scene graph changes over to Q3DS
- for (int i = 0; i < m_commands.size(); i++) {
- const ElementCommand &cmd = m_commands.commandAt(i);
- switch (cmd.m_commandType) {
- case CommandType_SetAttribute:
- m_presentation->setAttribute(cmd.m_elementPath, cmd.m_stringValue, cmd.m_variantValue);
- break;
- case CommandType_SetPresentationActive:
- m_presentation->setPresentationActive(cmd.m_elementPath, cmd.m_boolValue);
- break;
- case CommandType_GoToTime:
- m_presentation->goToTime(cmd.m_elementPath, cmd.m_floatValue);
- break;
- case CommandType_GoToSlide:
- m_presentation->goToSlide(cmd.m_elementPath, cmd.m_intValues[0]);
- break;
- case CommandType_GoToSlideByName:
- m_presentation->goToSlide(cmd.m_elementPath, cmd.m_stringValue);
- break;
- case CommandType_GoToSlideRelative:
- m_presentation->goToSlide(cmd.m_elementPath, bool(cmd.m_intValues[0]),
- bool(cmd.m_intValues[1]));
- break;
- case CommandType_FireEvent:
- m_presentation->fireEvent(cmd.m_elementPath, cmd.m_stringValue);
- break;
- case CommandType_MousePress:
- m_runtime->HandleMousePress(cmd.m_intValues[0],
- cmd.m_intValues[1], cmd.m_intValues[2], true);
- break;
- case CommandType_MouseRelease:
- m_runtime->HandleMousePress(cmd.m_intValues[0],
- cmd.m_intValues[1], cmd.m_intValues[2], false);
- break;
- case CommandType_MouseMove:
- m_runtime->HandleMouseMove(cmd.m_intValues[0], cmd.m_intValues[1], true);
- break;
- case CommandType_MouseWheel:
- m_runtime->HandleMouseWheel(cmd.m_intValues[0], cmd.m_intValues[1],
- bool(cmd.m_intValues[2]), cmd.m_intValues[3]);
- break;
- case CommandType_KeyPress:
- m_runtime->HandleKeyInput(Q3DStudio::EKeyCode(cmd.m_intValues[0]), true);
- break;
- case CommandType_KeyRelease:
- m_runtime->HandleKeyInput(Q3DStudio::EKeyCode(cmd.m_intValues[0]), false);
- break;
- case CommandType_SetDataInputValue:
- m_runtime->SetDataInputValue(cmd.m_stringValue, cmd.m_variantValue);
- break;
- case CommandType_RequestSlideInfo: {
- int current = 0;
- int previous = 0;
- QString currentName;
- QString previousName;
- const QByteArray path(cmd.m_elementPath.toUtf8());
- m_runtime->GetSlideInfo(path, current, previous, currentName, previousName);
- QVariantList *requestData = new QVariantList();
- requestData->append(QVariant(current));
- requestData->append(QVariant(previous));
- requestData->append(QVariant(currentName));
- requestData->append(QVariant(previousName));
-
- Q_EMIT requestResponse(cmd.m_elementPath, cmd.m_commandType, requestData);
-
- break;
- }
- default:
- qWarning() << __FUNCTION__ << "Unrecognized CommandType in command list!";
- }
- }
-
- m_commands.clear();
-}
-
-QT_END_NAMESPACE
diff --git a/src/Viewer/qmlviewer/Qt3DSRenderer.h b/src/Viewer/qmlviewer/Qt3DSRenderer.h
deleted file mode 100644
index 0037d9a6..00000000
--- a/src/Viewer/qmlviewer/Qt3DSRenderer.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2016 NVIDIA CORPORATION.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef Q3DS_RENDERER_H
-#define Q3DS_RENDERER_H
-
-#include <QtGui/qopenglframebufferobject.h>
-#include <QtQuick/qquickframebufferobject.h>
-
-#include "Qt3DSViewerApp.h"
-#include "Qt3DSView.h"
-
-QT_BEGIN_NAMESPACE
-
-class Q3DSViewerSettings;
-class Q3DSPresentation;
-
-class Q3DSRenderer : public QObject,
- public QQuickFramebufferObject::Renderer
-{
- Q_OBJECT
-
-public:
- Q3DSRenderer(bool visibleFlag, qt3ds::Qt3DSAssetVisitor *assetVisitor);
- ~Q3DSRenderer();
-
- QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override;
-
- void setInitElements(bool inFlag) { m_initElements = inFlag; }
- void processCommands();
-
-Q_SIGNALS:
- void enterSlide(const QString &elementPath, unsigned int slide, const QString &slideName);
- void exitSlide(const QString &elementPath, unsigned int slide, const QString &slideName);
- void requestResponse(const QString &elementPath, CommandType commandType, void *requestData);
- void presentationReady();
-
-protected:
- static void onInitHandler(void *userData);
- static void onUpdateHandler(void *userData);
- bool initializeRuntime(QOpenGLFramebufferObject *inFbo);
- void draw();
- void render() override;
- void synchronize(QQuickFramebufferObject *inView) override;
- void releaseRuntime();
-
-protected:
- bool m_visibleFlag; // Is the plugin visible? Prevents rendering hidden content.
- CommandQueue m_commands; // A list of commands retrieved by the plugin to be applied.
- bool m_initElements; // Flag set when the runtime is first ready to render.
- Q3DSViewer::Q3DSViewerApp *m_runtime; // The Qt3DS viewer that renders all content.
- QQuickWindow *m_window; // Window associated with the plugin; needed to reset OpenGL state.
-
- bool m_initialized; // Has the runtime and OpenGL state been initialized?
- bool m_initializationFailure; // Initialization failed, no point in trying to init again
- qt3ds::Qt3DSAssetVisitor *m_visitor;
-
- Q3DSViewerSettings *m_settings;
- Q3DSPresentation *m_presentation;
- QString m_error;
-};
-
-QT_END_NAMESPACE
-
-#endif // Q3DS_RENDERER_H
diff --git a/src/Viewer/qmlviewer/Qt3DSView.cpp b/src/Viewer/qmlviewer/Qt3DSView.cpp
deleted file mode 100644
index 08103d5e..00000000
--- a/src/Viewer/qmlviewer/Qt3DSView.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2016 NVIDIA CORPORATION.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "Qt3DSView.h"
-#include "Qt3DSRenderer.h"
-#include "q3dspresentationitem.h"
-
-#include <QtStudio3D/private/q3dsviewersettings_p.h>
-#include <QtStudio3D/private/q3dspresentation_p.h>
-#include <QtStudio3D/private/q3dssceneelement_p.h>
-#include <QtStudio3D/private/viewerqmlstreamproxy_p.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfileinfo.h>
-#include <QtQuick/qquickwindow.h>
-
-QT_BEGIN_NAMESPACE
-
-Q3DSView::Q3DSView()
- : m_viewerSettings(nullptr)
- , m_presentation(nullptr)
- , m_emitRunningChange(false)
- , m_isRunning(false)
- , m_ignoreMouseEvents(false)
- , m_ignoreWheelEvents(false)
- , m_ignoreKeyboardEvents(false)
- , m_pixelRatio(1.0)
-{
- setMirrorVertically(true);
- connect(this, &Q3DSView::windowChanged, this, &Q3DSView::handleWindowChanged);
- connect(this, &Q3DSView::visibleChanged, this, &Q3DSView::handleVisibleChanged);
-
- setIgnoreEvents(false, false, false);
-}
-
-Q3DSView::~Q3DSView()
-{
-}
-
-Q3DSPresentationItem *Q3DSView::presentation() const
-{
- return m_presentation;
-}
-
-Q3DSViewerSettings *Q3DSView::viewerSettings() const
-{
- return m_viewerSettings;
-}
-
-QString Q3DSView::error() const
-{
- return m_error;
-}
-
-void Q3DSView::setError(const QString &error)
-{
- if (error != m_error) {
- m_error = error;
- Q_EMIT errorChanged(m_error);
- }
-}
-
-void Q3DSView::setIgnoreEvents(bool mouse, bool wheel, bool keyboard)
-{
- // TODO: It might be beneficial to have these as properties so they could be acceessed from QML
- m_ignoreMouseEvents = mouse;
- m_ignoreWheelEvents = wheel;
- m_ignoreKeyboardEvents = keyboard;
-
- if (mouse)
- setAcceptedMouseButtons(Qt::NoButton);
- else
- setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton);
- setAcceptHoverEvents(!mouse);
-}
-
-void Q3DSView::componentComplete()
-{
- const auto childObjs = children();
- for (QObject *child : childObjs) {
- auto settings = qobject_cast<Q3DSViewerSettings *>(child);
- if (settings) {
- if (m_viewerSettings)
- qWarning("Duplicate ViewerSettings defined for Studio3D.");
- else
- m_viewerSettings = settings;
- }
- auto presentation = qobject_cast<Q3DSPresentationItem *>(child);
- if (presentation) {
- if (m_presentation)
- qWarning("Duplicate Presentation defined for Studio3D.");
- else
- m_presentation = presentation;
- }
- }
-
- if (!m_viewerSettings)
- m_viewerSettings = new Q3DSViewerSettings(this);
- if (!m_presentation)
- m_presentation = new Q3DSPresentationItem(this);
-
- m_viewerSettings->d_ptr->setCommandQueue(&m_pendingCommands);
- m_presentation->d_ptr->setCommandQueue(&m_pendingCommands);
-
- // Ensure qml stream proxy gets created on main thread
- m_presentation->d_ptr->streamProxy();
-
- QQuickFramebufferObject::componentComplete();
-}
-
-void Q3DSView::handleWindowChanged(QQuickWindow *window)
-{
- if (!window)
- return;
-
- window->setClearBeforeRendering(false);
- m_pixelRatio = window->devicePixelRatio();
-
- // Call tick every frame of the GUI thread to notify QML about new frame via frameUpdate signal
- connect(window, &QQuickWindow::afterAnimating, this, &Q3DSView::tick);
- // Call update after the frame is handled to queue another frame
- connect(window, &QQuickWindow::afterSynchronizing, this, &Q3DSView::update);
-}
-
-// Queue up a command to inform the renderer of a newly-changed visible/hidden status.
-void Q3DSView::handleVisibleChanged()
-{
- m_pendingCommands.m_visibleChanged = true;
- m_pendingCommands.m_visible = isVisible();
-}
-
-void Q3DSView::reset()
-{
- // Fake a source change to trigger a reloading of the presentation
- m_pendingCommands.m_sourceChanged = true;
- m_pendingCommands.m_source = m_presentation->source();
-}
-
-void Q3DSView::requestResponseHandler(const QString &elementPath, CommandType commandType,
- void *requestData)
-{
- switch (commandType) {
- case CommandType_RequestSlideInfo: {
- Q3DSSceneElement *handler = qobject_cast<Q3DSSceneElement *>(
- m_presentation->registeredElement(elementPath));
- if (handler)
- handler->d_ptr->requestResponseHandler(commandType, requestData);
- else
- qWarning() << __FUNCTION__ << "RequestSlideInfo response got for unregistered scene.";
- break;
- }
- default:
- qWarning() << __FUNCTION__ << "Unknown command type.";
- break;
- }
-}
-
-// Create the Q3DSRenderer. Invoked automatically by the QML scene graph.
-QQuickFramebufferObject::Renderer *Q3DSView::createRenderer() const
-{
- // It is "illegal" to create a connection between the renderer
- // and the plugin, and vice-versa. The only valid time the two
- // may communicate is during Q3DSRenderer::synchronize().
- Q3DSRenderer *renderer = new Q3DSRenderer(isVisible(), m_presentation->d_ptr->streamProxy());
-
- connect(renderer, &Q3DSRenderer::enterSlide,
- m_presentation->d_ptr, &Q3DSPresentationPrivate::handleSlideEntered);
- connect(renderer, &Q3DSRenderer::exitSlide,
- m_presentation, &Q3DSPresentation::slideExited);
- connect(renderer, &Q3DSRenderer::requestResponse,
- this, &Q3DSView::requestResponseHandler);
- connect(renderer, &Q3DSRenderer::presentationReady,
- this, &Q3DSView::presentationReady);
- return renderer;
-}
-
-bool Q3DSView::isRunning() const
-{
- return m_isRunning;
-}
-
-/** Emit QML `runningChanged` and `frameUpdate` and signals.
- * This method is called every frame, and emits the `frameUpdate` signal every frame,
- * regardless of plugin visibility. This allows a hidden Qt3DSView to still process
- * information every frame, even though the Renderer is not rendering.
- *
- * To prevent expensive onFrameUpdate handlers from being processed when hidden,
- * add an early return to the top like:
- *
- * onFrameUpdate: {
- * if (!visible) return;
- * ...
- * }
- */
-void Q3DSView::tick()
-{
- if (m_emitRunningChange) {
- m_isRunning = true;
- Q_EMIT runningChanged(true);
- m_emitRunningChange = false;
- }
-
- // Don't call onFrameUpdate until after onInitialize has been called
- if (m_isRunning) {
- // Give QML an opportunity to change Qt3DS values every frame
- Q_EMIT frameUpdate();
- }
-}
-
-// Copies the list of commands previously queued up. Called by Q3DSRenderer::synchronize().
-void Q3DSView::getCommands(bool emitInitialize, CommandQueue &renderQueue)
-{
- if (emitInitialize)
- m_emitRunningChange = true;
-
- renderQueue.copyCommands(m_pendingCommands);
- m_pendingCommands.clear();
-}
-
-void Q3DSView::mousePressEvent(QMouseEvent *event)
-{
- if (!m_ignoreMouseEvents) {
- if (m_pixelRatio != 1.0) {
- QMouseEvent scaledEvent(event->type(), event->pos() * m_pixelRatio,
- event->button(), event->buttons(), event->modifiers());
- m_presentation->mousePressEvent(&scaledEvent);
- } else {
- m_presentation->mousePressEvent(event);
- }
- }
-}
-
-void Q3DSView::mouseReleaseEvent(QMouseEvent *event)
-{
- if (!m_ignoreMouseEvents) {
- if (m_pixelRatio != 1.0) {
- QMouseEvent scaledEvent(event->type(), event->pos() * m_pixelRatio,
- event->button(), event->buttons(), event->modifiers());
- m_presentation->mouseReleaseEvent(&scaledEvent);
- } else {
- m_presentation->mouseReleaseEvent(event);
- }
- }
-}
-
-void Q3DSView::mouseMoveEvent(QMouseEvent *event)
-{
- if (!m_ignoreMouseEvents) {
- if (m_pixelRatio != 1.0) {
- QMouseEvent scaledEvent(event->type(), event->pos() * m_pixelRatio,
- event->button(), event->buttons(), event->modifiers());
- m_presentation->mouseMoveEvent(&scaledEvent);
- } else {
- m_presentation->mouseMoveEvent(event);
- }
- }
-}
-
-void Q3DSView::wheelEvent(QWheelEvent *event)
-{
- if (!m_ignoreWheelEvents)
- m_presentation->wheelEvent(event);
-}
-
-void Q3DSView::keyPressEvent(QKeyEvent *event)
-{
- if (m_ignoreKeyboardEvents)
- return;
- m_presentation->keyPressEvent(event);
-}
-
-void Q3DSView::keyReleaseEvent(QKeyEvent *event)
-{
- if (m_ignoreKeyboardEvents)
- return;
- if (!event->isAutoRepeat())
- m_presentation->keyReleaseEvent(event);
-}
-
-QT_END_NAMESPACE
diff --git a/src/Viewer/qmlviewer/Qt3DSView.h b/src/Viewer/qmlviewer/Qt3DSView.h
deleted file mode 100644
index ab104d4c..00000000
--- a/src/Viewer/qmlviewer/Qt3DSView.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2016 NVIDIA CORPORATION.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef Q3DS_VIEW_H
-#define Q3DS_VIEW_H
-
-
-#include <QtStudio3D/private/q3dscommandqueue_p.h>
-#include <QtGui/qopenglframebufferobject.h>
-#include <QtQuick/qquickframebufferobject.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q3DSRenderer;
-class Q3DSViewerSettings;
-class Q3DSPresentationItem;
-
-class Q3DSView : public QQuickFramebufferObject
-{
- Q_OBJECT
- Q_PROPERTY(bool running READ isRunning NOTIFY runningChanged)
- Q_PROPERTY(Q3DSPresentationItem *presentation READ presentation CONSTANT)
- Q_PROPERTY(Q3DSViewerSettings *viewerSettings READ viewerSettings CONSTANT)
- Q_PROPERTY(QString error READ error NOTIFY errorChanged)
-
-public:
- Q3DSView();
- virtual ~Q3DSView();
-
- QQuickFramebufferObject::Renderer *createRenderer() const override;
-
- bool isRunning() const;
- Q3DSPresentationItem *presentation() const;
- Q3DSViewerSettings *viewerSettings() const;
- QString error() const;
- void setError(const QString &error);
-
- void getCommands(bool emitInitialize, CommandQueue &renderQueue);
-
- void mousePressEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void wheelEvent(QWheelEvent *event) override;
- void keyPressEvent(QKeyEvent *event) override;
- void keyReleaseEvent(QKeyEvent *event) override;
-
- void setIgnoreEvents(bool mouse, bool wheel, bool keyboard);
-
- void componentComplete() override;
-
-Q_SIGNALS:
- void frameUpdate();
- void runningChanged(bool initialized);
- void errorChanged(const QString &error);
- Q_REVISION(1) void presentationReady();
-
-public Q_SLOTS:
- void reset();
-
-protected Q_SLOTS:
- void handleWindowChanged(QQuickWindow *window);
- void handleVisibleChanged();
- void tick();
- void requestResponseHandler(const QString &elementPath, CommandType commandType,
- void *requestData);
-
-protected:
- Q3DSViewerSettings *m_viewerSettings;
- Q3DSPresentationItem *m_presentation;
-
- bool m_emitRunningChange;
- bool m_isRunning;
- bool m_ignoreMouseEvents;
- bool m_ignoreWheelEvents;
- bool m_ignoreKeyboardEvents;
-
- CommandQueue m_pendingCommands;
- qreal m_pixelRatio;
- QString m_error;
-};
-
-QT_END_NAMESPACE
-
-#endif // Q3DS_VIEW_H
diff --git a/src/Viewer/qmlviewer/Qt3DSViewPlugin.cpp b/src/Viewer/qmlviewer/Qt3DSViewPlugin.cpp
deleted file mode 100644
index 389e1cc4..00000000
--- a/src/Viewer/qmlviewer/Qt3DSViewPlugin.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2016 NVIDIA CORPORATION.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "Qt3DSViewPlugin.h"
-
-#include <QtQml/qqml.h>
-
-#include <QtStudio3D/private/q3dsviewersettings_p.h>
-
-#include "Qt3DSView.h"
-#include "q3dspresentationitem.h"
-#include "q3dsqmlstream.h"
-#include "q3dsqmlsubpresentationsettings.h"
-#include "q3dssceneelement.h"
-#include "q3dsdatainput.h"
-
-QT_BEGIN_NAMESPACE
-
-//TODO: remove if works with X
-/*
-#if defined _LINUX || defined linux
-extern "C" {
-bool InitializeGL();
-}
-#endif
-*/
-
-void Q3DSViewPlugin::registerTypes(const char *uri)
-{
- Q_ASSERT(uri == QLatin1String("QtStudio3D"));
-//TODO: remove if works with X
-/*
-#if defined _LINUX || defined linux
- // To initialize GL functions for Qt3DS GL bindings
- InitializeGL();
-#endif
-*/
- // @uri Studio3D
- // Version 1.0
- qmlRegisterType<Q3DSView>(uri, 1, 0, "Studio3D");
- qmlRegisterType<Q3DSViewerSettings>(uri, 1, 0, "ViewerSettings");
- qmlRegisterType<Q3DSPresentationItem>(uri, 1, 0, "Presentation");
- qmlRegisterType<Q3DSSceneElement>(uri, 1, 0, "SceneElement");
- qmlRegisterType<Q3DSElement>(uri, 1, 0, "Element");
- qmlRegisterType<Q3DSQmlStream>(uri, 1, 0, "QmlStream");
- qmlRegisterType<Q3DSSubPresentationSettings>(uri, 1, 0, "SubPresentationSettings");
-
- // Version 1.1
- qmlRegisterType<Q3DSView, 1>(uri, 1, 1, "Studio3D");
- qmlRegisterType<Q3DSDataInput>(uri, 1, 1, "DataInput");
- qmlRegisterType<Q3DSPresentationItem, 1>(uri, 1, 1, "Presentation");
-}
-
-QT_END_NAMESPACE
diff --git a/src/Viewer/qmlviewer/q3dspresentationitem.cpp b/src/Viewer/qmlviewer/q3dspresentationitem.cpp
deleted file mode 100644
index 6c4c8e36..00000000
--- a/src/Viewer/qmlviewer/q3dspresentationitem.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "q3dspresentationitem.h"
-
-#include <QtStudio3D/q3dssceneelement.h>
-#include <QtStudio3D/q3dsdatainput.h>
-#include <QtStudio3D/private/q3dspresentation_p.h>
-#include <QtStudio3D/private/viewerqmlstreamproxy_p.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-Q3DSPresentationItem::Q3DSPresentationItem(QObject *parent)
- : Q3DSPresentation(parent)
- , m_subPresentationSettings(nullptr)
-{
-}
-
-Q3DSPresentationItem::~Q3DSPresentationItem()
-{
-}
-
-Q3DSSubPresentationSettings *Q3DSPresentationItem::subPresentationSettings() const
-{
- return m_subPresentationSettings;
-}
-
-QQmlListProperty<QObject> Q3DSPresentationItem::qmlChildren()
-{
- return QQmlListProperty<QObject>(this, nullptr, &appendQmlChildren, nullptr, nullptr, nullptr);
-}
-
-void Q3DSPresentationItem::appendQmlChildren(QQmlListProperty<QObject> *list, QObject *obj)
-{
- auto item = qobject_cast<Q3DSPresentationItem *>(list->object);
- if (item) {
- auto scene = qobject_cast<Q3DSSceneElement *>(obj);
- if (scene) {
- if (item->registeredElement(scene->elementPath()))
- qWarning() << __FUNCTION__ << "A duplicate SceneElement defined for Presentation.";
- else
- item->registerElement(scene);
- } else {
- auto studioElement = qobject_cast<Q3DSElement *>(obj);
- if (studioElement) {
- if (item->registeredElement(studioElement->elementPath()))
- qWarning() << __FUNCTION__ << "A duplicate Element defined for Presentation.";
- else
- item->registerElement(studioElement);
- } else {
- auto subPresSettings = qobject_cast<Q3DSSubPresentationSettings *>(obj);
- if (subPresSettings) {
- if (item->m_subPresentationSettings) {
- qWarning() << __FUNCTION__
- << "Duplicate SubPresentationSettings defined for Presentation.";
- } else {
- item->m_subPresentationSettings = subPresSettings;
- item->d_ptr->streamProxy()->setSettings(subPresSettings);
- }
- } else {
- auto dataInput = qobject_cast<Q3DSDataInput *>(obj);
- if (item->registeredDataInput(dataInput->name())) {
- qWarning() << __FUNCTION__
- << "Duplicate DataInput defined for Presentation.";
- } else {
- item->registerDataInput(dataInput);
- }
- }
- }
- }
- }
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/Viewer/qmlviewer/q3dspresentationitem.h b/src/Viewer/qmlviewer/q3dspresentationitem.h
deleted file mode 100644
index 63270594..00000000
--- a/src/Viewer/qmlviewer/q3dspresentationitem.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef Q3DSPRESENTATIONITEM_H
-#define Q3DSPRESENTATIONITEM_H
-
-#include "q3dsqmlsubpresentationsettings.h"
-
-#include <QtStudio3D/q3dspresentation.h>
-#include <QtQml/qqmllist.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q3DSPresentationItem : public Q3DSPresentation
-{
- Q_OBJECT
- Q_PROPERTY(QQmlListProperty<QObject> qmlChildren READ qmlChildren DESIGNABLE false)
- Q_PROPERTY(Q3DSSubPresentationSettings *subPresentationSettings READ subPresentationSettings CONSTANT)
- Q_CLASSINFO("DefaultProperty", "qmlChildren")
-
-public:
- explicit Q3DSPresentationItem(QObject *parent = nullptr);
- ~Q3DSPresentationItem();
-
- Q3DSSubPresentationSettings *subPresentationSettings() const;
-
- QQmlListProperty<QObject> qmlChildren();
-
-public Q_SLOTS:
- static void appendQmlChildren(QQmlListProperty<QObject> *list, QObject *obj);
-
-private:
- Q3DSSubPresentationSettings *m_subPresentationSettings;
-};
-
-QT_END_NAMESPACE
-
-#endif // Q3DSPRESENTATIONITEM_H
diff --git a/src/Viewer/qmlviewer/qmldir b/src/Viewer/qmlviewer/qmldir
deleted file mode 100644
index 381f7e42..00000000
--- a/src/Viewer/qmlviewer/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module QtStudio3D
-plugin declarative_qtstudio3d
-classname Q3DSViewPlugin
diff --git a/src/Viewer/qmlviewer/qmlviewer.pro b/src/Viewer/qmlviewer/qmlviewer.pro
deleted file mode 100644
index dca7feab..00000000
--- a/src/Viewer/qmlviewer/qmlviewer.pro
+++ /dev/null
@@ -1,34 +0,0 @@
-include($$PWD/../../Runtime/commoninclude.pri)
-
-QT += qml quick opengl studio3d-private
-CONFIG += plugin
-
-qtHaveModule(multimedia) {
-DEFINES += PLATFORM_HAS_QT_MULTIMEDIA_LIB
-QT += multimedia
-}
-
-TARGET = qtstudio3d
-TARGETPATH = QtStudio3D
-IMPORT_VERSION = 1.0
-
-SOURCES += \
- Qt3DSViewPlugin.cpp \
- Qt3DSView.cpp \
- Qt3DSRenderer.cpp \
- q3dspresentationitem.cpp
-
-HEADERS += \
- Qt3DSViewPlugin.h \
- Qt3DSView.h \
- Qt3DSRenderer.h \
- q3dspresentationitem.h
-
-LIBS += \
- -lqt3dsruntime$$qtPlatformTargetSuffix() \
- -lqt3dsqmlstreamer$$qtPlatformTargetSuffix()
-
-OTHER_FILES += \
- qmldir
-
-load(qml_plugin)
diff --git a/src/Viewer/studio3d/q3dspresentation.cpp b/src/Viewer/studio3d/q3dspresentation.cpp
index e36a4d7c..27c050b1 100644
--- a/src/Viewer/studio3d/q3dspresentation.cpp
+++ b/src/Viewer/studio3d/q3dspresentation.cpp
@@ -148,15 +148,15 @@ void Q3DSPresentation::setAttribute(const QString &elementPath, const QString &a
float valueFloat;
const void *theValue = nullptr;
- switch (value.type()) {
- case QVariant::Bool:
- case QVariant::Int:
- case QVariant::Double:
+ switch (static_cast<QMetaType::Type>(value.type())) {
+ case QMetaType::Bool:
+ case QMetaType::Int:
+ case QMetaType::Double:
case QMetaType::Float:
valueFloat = value.toFloat();
theValue = &valueFloat;
break;
- case QVariant::String:
+ case QMetaType::QString:
default: // Try string for other types
valueStr = value.toString().toUtf8();
theValue = valueStr.constData();
diff --git a/src/shared/dummyqml/qml/dummyqml.qml b/src/shared/dummyqml/qml/dummyqml.qml
new file mode 100644
index 00000000..9f32ce3a
--- /dev/null
+++ b/src/shared/dummyqml/qml/dummyqml.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtWebSockets 1.1
+import QtQml 2.3
+import QtQml.Models 2.11
+import QtQml.StateMachine 1.11
+import QtQml.RemoteObjects 1.0
+import QtGamepad 1.0
+import QtBluetooth 5.11
+import QtPurchasing 1.0
+import QtSensors 5.11
+import Qt.labs.settings 1.0
+import Qt.labs.calendar 1.0
+import Qt.labs.location 5.11
+import Qt.labs.platform 1.0
+import Qt.labs.folderlistmodel 2.11
+import Qt.labs.handlers 1.0
+import Qt.labs.sharedimage 1.0
+import QtCanvas3D 1.1
+import QtQuick 2.11
+import QtCharts 2.0
+import QtGraphicalEffects 1.0
+import QtNfc 5.11
+import QtQuick.Scene2D 2.9
+import QtQuick.PrivateWidgets 1.1
+import QtQuick.Particles 2.0
+import QtQuick.Shapes 1.11
+import QtQuick.Templates 2.4
+import QtQuick.Controls 1.5
+import QtQuick.Controls.Fusion 2.3
+import QtQuick.Controls.Universal 2.3
+import QtQuick.Controls 2.4
+import QtQuick.Controls.Material 2.3
+import QtQuick.Controls.Imagine 2.3
+import QtQuick.Layouts 1.3
+import QtQuick.XmlListModel 2.0
+import QtQuick.LocalStorage 2.11
+import QtQuick.Dialogs 1.2
+import QtQuick.Dialogs.Private 1.1
+import QtQuick.Scene3D 2.0
+import QtQuick.Window 2.11
+import QtQuick.VirtualKeyboard.Settings 2.1
+import QtQuick.VirtualKeyboard 2.1
+import QtQuick.Extras 1.4
+import QtWebChannel 1.0
+import QtDataVisualization 1.3
+import QtMultimedia 5.9
+import QtLocation 5.11
+import Qt3D.Core 2.9
+import Qt3D.Input 2.1
+import Qt3D.Logic 2.0
+import Qt3D.Render 2.9
+import Qt3D.Animation 2.9
+import Qt3D.Extras 2.9
+import QtPositioning 5.11
+import QtAudioEngine 1.1
+import QtScxml 5.8
+
+Rectangle {
+}