Support xml file as input document for command line

master
huxingyi 2020-10-16 19:36:04 +09:30
parent 3cff6ad52a
commit 9c8ea6bb83
4 changed files with 81 additions and 66 deletions

View File

@ -8,7 +8,6 @@ language: cpp
matrix:
include:
- if: tag IS present
- os: linux
dist: xenial
sudo: required

View File

@ -1,6 +1,6 @@
os: Visual Studio 2017
skip_non_tags: true
skip_non_tags: false
environment:
matrix:

View File

@ -1663,13 +1663,24 @@ void DocumentWindow::createPartSnapshotForFillMesh(const QUuid &fillMeshFileId,
void DocumentWindow::openPathAs(const QString &path, const QString &asName)
{
QApplication::setOverrideCursor(Qt::WaitCursor);
Ds3FileReader ds3Reader(path);
m_document->clearHistories();
m_document->resetScript();
m_document->reset();
m_document->saveSnapshot();
if (path.endsWith(".xml")) {
QFile file(path);
file.open(QIODevice::ReadOnly);
QXmlStreamReader stream(&file);
Snapshot snapshot;
loadSkeletonFromXmlStream(&snapshot, stream);
m_document->fromSnapshot(snapshot);
m_document->saveSnapshot();
} else {
Ds3FileReader ds3Reader(path);
for (int i = 0; i < ds3Reader.items().size(); ++i) {
Ds3ReaderItem item = ds3Reader.items().at(i);
if (item.type == "asset") {
@ -1731,6 +1742,8 @@ void DocumentWindow::openPathAs(const QString &path, const QString &asName)
}
}
}
}
QApplication::restoreOverrideCursor();
setCurrentFilename(asName);
@ -2122,6 +2135,9 @@ void DocumentWindow::checkExportWaitingList()
} else if (filename.endsWith(".glb")) {
exportGlbToFilename(filename);
emit waitingExportFinished(filename, isSuccessful);
} else if (filename.endsWith(".png")) {
exportImageToFilename(filename);
emit waitingExportFinished(filename, isSuccessful);
} else {
emit waitingExportFinished(filename, false);
}

View File

@ -79,7 +79,7 @@ int main(int argc, char ** argv)
continue;
}
QString arg = argv[i];
if (arg.endsWith(".ds3")) {
if (arg.endsWith(".ds3") || arg.endsWith(".xml")) {
openFileList.append(arg);
continue;
}