summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp')
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp
index 8804e675..8b20b950 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/TextureChooserView.cpp
@@ -91,8 +91,20 @@ QString TextureChooserView::currentDataModelPath() const
qt3dsdm::SValue value;
propertySystem->GetInstancePropertyValue(m_instance, m_handle, value);
-
- const QString path = qt3dsdm::get<QString>(value);
+ QString path;
+ if (value.getType() == qt3dsdm::DataModelDataType::Long4) {
+ qt3dsdm::Option<qt3dsdm::SLong4> guid = qt3dsdm::get<qt3dsdm::SLong4>(value);
+ qt3dsdm::Qt3DSDMInstanceHandle imageInstance = doc->GetDocumentReader()
+ .GetInstanceForGuid(guid);
+ if (imageInstance.Valid()) {
+ Q3DStudio::CFilePath relPath(doc->GetDocumentReader().GetSourcePath(imageInstance));
+ path = relPath.GetFileName().toQString();
+ } else {
+ path = QString();
+ }
+ } else {
+ path = qt3dsdm::get<QString>(value);
+ }
// An empty value can sometimes be represented by a relative path either to project root or the
// presentation file, such as"./" or "../", so let's just consider all directory paths as empty