diff options
author | Määttä Antti <antti.maatta@qt.io> | 2018-06-07 15:45:01 +0300 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2018-06-08 06:35:18 +0000 |
commit | 8e861d768dfd594ef58e33cf9542763a43ad5340 (patch) | |
tree | bc92a01220edf68abb8e1e17c6ba0df1df2d8fcd | |
parent | cadaa3d52dee3765f47a237a35c2d01139a033cb (diff) |
Use the existing list of subpresentations to create renderable items
Task-number: QT3DS-1901
Change-Id: I3c48b9dfbfefdb8f46636e7d3f38d3585241fe55
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp index b4c24b22..81ac431a 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp @@ -67,56 +67,10 @@ static QStringList renderableItems() renderables.push_back(QObject::tr("No renderable item")); const CDoc *doc = g_StudioApp.GetCore()->GetDoc(); Q3DStudio::CString docDir = doc->GetDocumentDirectory(); - Q3DStudio::CFilePath fullDocPath = doc->GetDocumentPath().GetAbsolutePath(); - Q3DStudio::CString docFilename = fullDocPath.GetFileName(); - // First step, find uia file, parse and pull out renderable asset id's but ignoring the - // current presentation. - std::vector<Q3DStudio::CFilePath> dirFiles; - Q3DStudio::CFilePath thePath(docDir); - thePath.ListFilesAndDirectories(dirFiles); - for (size_t idx = 0, end = dirFiles.size(); idx < end; ++idx) { - if (!dirFiles[idx].IsFile()) - continue; - - Q3DStudio::CString ext = dirFiles[idx].GetExtension(); - if (!ext.CompareNoCase("uia")) - continue; - - qt3dsdm::TStringTablePtr theStringTable - = qt3dsdm::IStringTable::CreateStringTable(); - std::shared_ptr<qt3dsdm::IDOMFactory> theDomFact = - qt3dsdm::IDOMFactory::CreateDOMFactory(theStringTable); - Q3DStudio::CString fullFile = dirFiles[idx]; - qt3ds::foundation::CFileSeekableIOStream theStream( - fullFile, qt3ds::foundation::FileReadFlags()); - - qt3dsdm::SDOMElement *theElem - = qt3dsdm::CDOMSerializer::Read(*theDomFact, theStream); - if (theElem) { - std::shared_ptr<qt3dsdm::IDOMReader> theReader = - qt3dsdm::IDOMReader::CreateDOMReader(*theElem, theStringTable, - theDomFact); - if (theReader->MoveToFirstChild("assets")) { - for (bool success = theReader->MoveToFirstChild(); success; - success = theReader->MoveToNextSibling()) { - if (qt3dsdm::AreEqual(theReader->GetElementName(), L"presentation") || - qt3dsdm::AreEqual(theReader->GetElementName(), L"presentation-qml")) { - qt3dsdm::TXMLStr src = nullptr; - qt3dsdm::TXMLStr id = nullptr; - theReader->Att("src", src); - theReader->Att("id", id); - if (docFilename != src.c_str()) - renderables.push_back(QString::fromLatin1(id.c_str())); - } else if (qt3dsdm::AreEqual(theReader->GetElementName(), - L"renderplugin")) { - const wchar_t *id = nullptr; - theReader->UnregisteredAtt(L"id", id); - renderables.push_back(QString::fromWCharArray(id)); - } - } - } - } - } + + for (SubPresentationRecord r : qAsConst(g_StudioApp.m_subpresentations)) + renderables.push_back(r.m_id); + // second step, find the renderable plugins. { Q3DStudio::CFilePath pluginDir |