diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2018-11-15 13:37:01 +0200 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2018-11-15 14:23:19 +0000 |
commit | b59ae703d64744cb8c8957e8037bd1d7955ca3e3 (patch) | |
tree | 29e2b89683e459c450a7d641bb9573bb4dce7a44 | |
parent | 71a9b8410966c324258bacebce42a3385f2c22b1 (diff) |
Fix saving qml streams and subpres to matdefs
Task-number: QT3DS-2640
Change-Id: Iab9c2019cfd38f5cd34c0d4f7fb05f7c2b51ee69
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
3 files changed, 11 insertions, 1 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index 56fb7a88..c4d49ade 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -1839,6 +1839,14 @@ public: if (!img) img = CreateImageInstanceForMaterialOrLayer(instance, prop); + // When a matdef is first created the source path is not set properly + // when setting a subpresentation so we set it here manually + // TODO: Replace this with an actual fix + if (m_Bridge.isInsideMaterialContainer(instance)) { + SetInstancePropertyValue(img, m_Bridge.GetSourcePathProperty(), + std::make_shared<qt3dsdm::CDataStr>(src.c_str())); + } + SetInstancePropertyValueAsRenderable(img, isSubp ? m_Bridge.getSubpresentationProperty() : m_Bridge.GetSourcePathProperty(), src); } diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h index a284bcce..1045b329 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h @@ -128,6 +128,7 @@ public: void updateFontValues(InspectorControlBase *element) const; void refreshRenderables(); void refresh(); + void saveIfMaterial(qt3dsdm::Qt3DSDMInstanceHandle instance); QVariant getPropertyValue(long instance, int handle); @@ -211,7 +212,6 @@ private: void notifyInstancePropertyValue(qt3dsdm::Qt3DSDMInstanceHandle, qt3dsdm::Qt3DSDMPropertyHandle inProperty); void updateAnimateToggleState(InspectorControlBase *inItem); void updateControlledToggleState(InspectorControlBase *inItem) const; - void saveIfMaterial(qt3dsdm::Qt3DSDMInstanceHandle instance); std::shared_ptr<qt3dsdm::ISignalConnection> m_notifier; std::shared_ptr<qt3dsdm::ISignalConnection> m_slideNotifier; diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp index 070c8b3b..06d3d1e7 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp @@ -435,6 +435,8 @@ QObject *InspectorControlView::showImageChooser(int handle, int instance, const QObject::tr("Set Property")) ->setInstanceImagePropertyValue( instance, handle, Q3DStudio::CString::fromQString(renderableId)); + if (m_inspectorControlModel) + m_inspectorControlModel->saveIfMaterial(instance); } } }); |