diff options
Diffstat (limited to 'src/Authoring/Qt3DStudio/Application/ProjectFile.cpp')
-rw-r--r-- | src/Authoring/Qt3DStudio/Application/ProjectFile.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/Authoring/Qt3DStudio/Application/ProjectFile.cpp b/src/Authoring/Qt3DStudio/Application/ProjectFile.cpp index b4c18c50..1ad0b5c0 100644 --- a/src/Authoring/Qt3DStudio/Application/ProjectFile.cpp +++ b/src/Authoring/Qt3DStudio/Application/ProjectFile.cpp @@ -486,12 +486,6 @@ void ProjectFile::parseDataInputElem(const QDomElement &elem, } else if (type == QLatin1String("Variant")) { item->type = EDataType::DataTypeVariant; } -#ifdef DATAINPUT_EVALUATOR_ENABLED - else if (type == QLatin1String("Evaluator")) { - item->type = EDataType::DataTypeEvaluator; - item->valueString = elem.attribute(QStringLiteral("evaluator")); - } -#endif auto metadata = elem.attribute(QStringLiteral("metadata")); if (!metadata.isEmpty()) { @@ -546,9 +540,11 @@ void ProjectFile::loadSubpresentationsAndDatainputs( m_initialPresentation = g_StudioApp.GetCore()->GetDoc()->getPresentationId(); QDomDocument doc; - if (!StudioUtils::readFileToDomDocument(getProjectFilePath(), doc)) + QSaveFile projectFile(getProjectFilePath()); + if (!StudioUtils::openDomDocumentSave(projectFile, doc)) return; + QVector<QDomElement> removedElements; QDomElement assetsElem = doc.documentElement().firstChildElement(QStringLiteral("assets")); if (!assetsElem.isNull()) { QString initial = assetsElem.attribute(QStringLiteral("initial")); @@ -563,13 +559,24 @@ void ProjectFile::loadSubpresentationsAndDatainputs( QString argsOrSrc = p.attribute(QStringLiteral("src")); if (argsOrSrc.isNull()) argsOrSrc = p.attribute(QStringLiteral("args")); - subpresentations.push_back( - SubPresentationRecord(p.nodeName(), p.attribute("id"), argsOrSrc)); + // Skip non-existent presentations (they have been manually deleted) + if (QFileInfo().exists(getAbsoluteFilePathTo(argsOrSrc))) { + subpresentations.push_back( + SubPresentationRecord(p.nodeName(), p.attribute("id"), argsOrSrc)); + } else { + removedElements.append(p); + } } else { parseDataInputElem(p, datainputs); } } } + if (removedElements.size()) { + for (auto &elem : qAsConst(removedElements)) + assetsElem.removeChild(elem); + StudioUtils::commitDomDocumentSave(projectFile, doc); + } + g_StudioApp.GetCore()->GetDoc()->UpdateDatainputMap(); } @@ -934,11 +941,11 @@ QString ProjectFile::getRelativeFilePathTo(const QString &absFilePath) const return QDir(getProjectPath()).relativeFilePath(absFilePath); } -// Return multimap of type subpresentationid - QPair<datainput, propertyname> -QMultiMap<QString, QPair<QString, QString>> +// Return multimap of type subpresentationid - DataInputOutputBinding +QMultiHash<QString, ProjectFile::DataInputOutputBinding> ProjectFile::getDiBindingtypesFromSubpresentations() const { - QMultiMap<QString, QPair<QString, QString>> map; + QMultiHash<QString, DataInputOutputBinding> map; for (auto sp : qAsConst(g_StudioApp.m_subpresentations)) PresentationFile::getDataInputBindings(sp, map); |