mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:17:14 +02:00
Renamed isBlocks to isZip, added debug print for non-entity files
This commit is contained in:
parent
06ff766952
commit
ebc28a6557
4 changed files with 12 additions and 11 deletions
|
@ -6259,12 +6259,12 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) {
|
||||||
addAssetToWorldError(filename, "Couldn't unzip file " + filename + ".");
|
addAssetToWorldError(filename, "Couldn't unzip file " + filename + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::addAssetToWorld(QString filePath, QString zipFile, bool isBlocks) {
|
void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip) {
|
||||||
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
|
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
|
||||||
QString mapping;
|
QString mapping;
|
||||||
QString path = filePath;
|
QString path = filePath;
|
||||||
QString filename = filenameFromPath(path);
|
QString filename = filenameFromPath(path);
|
||||||
if (isBlocks) {
|
if (isZip) {
|
||||||
QString assetFolder = zipFile.section("/", -1);
|
QString assetFolder = zipFile.section("/", -1);
|
||||||
assetFolder.remove(".zip");
|
assetFolder.remove(".zip");
|
||||||
mapping = "/" + assetFolder + "/" + filename;
|
mapping = "/" + assetFolder + "/" + filename;
|
||||||
|
@ -6355,6 +6355,7 @@ void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, Q
|
||||||
if (filePath.endsWith(".obj") || filePath.endsWith(".fbx")) {
|
if (filePath.endsWith(".obj") || filePath.endsWith(".fbx")) {
|
||||||
addAssetToWorldAddEntity(filePath, mapping);
|
addAssetToWorldAddEntity(filePath, mapping);
|
||||||
} else {
|
} else {
|
||||||
|
qCDebug(interfaceapp) << "Zipped contents are not valid entity files";
|
||||||
addAssetToWorldInfoDone(filenameFromPath(filePath));
|
addAssetToWorldInfoDone(filenameFromPath(filePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6646,12 +6647,12 @@ void Application::onAssetToWorldMessageBoxClosed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoAdd, bool isBlocks) {
|
void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip) {
|
||||||
if (autoAdd) {
|
if (autoAdd) {
|
||||||
if (!unzipFile.isEmpty()) {
|
if (!unzipFile.isEmpty()) {
|
||||||
for (int i = 0; i < unzipFile.length(); i++) {
|
for (int i = 0; i < unzipFile.length(); i++) {
|
||||||
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
|
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
|
||||||
addAssetToWorld(unzipFile.at(i), zipFile, isBlocks);
|
addAssetToWorld(unzipFile.at(i), zipFile, isZip);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addAssetToWorldUnzipFailure(zipFile);
|
addAssetToWorldUnzipFailure(zipFile);
|
||||||
|
|
|
@ -331,14 +331,14 @@ public slots:
|
||||||
// FIXME: Move addAssetToWorld* methods to own class?
|
// FIXME: Move addAssetToWorld* methods to own class?
|
||||||
void addAssetToWorldFromURL(QString url);
|
void addAssetToWorldFromURL(QString url);
|
||||||
void addAssetToWorldFromURLRequestFinished();
|
void addAssetToWorldFromURLRequestFinished();
|
||||||
void addAssetToWorld(QString filePath, QString zipFile, bool isBlocks);
|
void addAssetToWorld(QString filePath, QString zipFile, bool isZip);
|
||||||
void addAssetToWorldUnzipFailure(QString filePath);
|
void addAssetToWorldUnzipFailure(QString filePath);
|
||||||
void addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy);
|
void addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy);
|
||||||
void addAssetToWorldUpload(QString filePath, QString mapping);
|
void addAssetToWorldUpload(QString filePath, QString mapping);
|
||||||
void addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash);
|
void addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash);
|
||||||
void addAssetToWorldAddEntity(QString filePath, QString mapping);
|
void addAssetToWorldAddEntity(QString filePath, QString mapping);
|
||||||
|
|
||||||
void handleUnzip(QString sourceFile, QStringList destinationFile, bool autoAdd, bool isBlocks);
|
void handleUnzip(QString sourceFile, QStringList destinationFile, bool autoAdd, bool isZip);
|
||||||
|
|
||||||
FileScriptingInterface* getFileDownloadInterface() { return _fileDownload; }
|
FileScriptingInterface* getFileDownloadInterface() { return _fileDownload; }
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent
|
||||||
// nothing for now
|
// nothing for now
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isBlocks) {
|
void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip) {
|
||||||
qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
|
qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
|
||||||
qCDebug(scriptengine) << "Path where download is saved: " + path;
|
qCDebug(scriptengine) << "Path where download is saved: " + path;
|
||||||
QString fileName = "/" + path.section("/", -1);
|
QString fileName = "/" + path.section("/", -1);
|
||||||
QString tempDir = path;
|
QString tempDir = path;
|
||||||
if (!isBlocks) {
|
if (!isZip) {
|
||||||
tempDir.remove(fileName);
|
tempDir.remove(fileName);
|
||||||
} else {
|
} else {
|
||||||
QTemporaryDir blocks;
|
QTemporaryDir blocks;
|
||||||
|
@ -60,7 +60,7 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
|
||||||
else {
|
else {
|
||||||
qCDebug(scriptengine) << "Unzip failed";
|
qCDebug(scriptengine) << "Unzip failed";
|
||||||
}
|
}
|
||||||
emit unzipResult(path, fileList, autoAdd, isBlocks);
|
emit unzipResult(path, fileList, autoAdd, isZip);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
QString convertUrlToPath(QUrl url);
|
QString convertUrlToPath(QUrl url);
|
||||||
void runUnzip(QString path, QUrl url, bool autoAdd, bool isBlocks);
|
void runUnzip(QString path, QUrl url, bool autoAdd, bool isZip);
|
||||||
QString getTempDir();
|
QString getTempDir();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void unzipResult(QString zipFile, QStringList unzipFile, bool autoAdd, bool isBlocks);
|
void unzipResult(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isTempDir(QString tempDir);
|
bool isTempDir(QString tempDir);
|
||||||
|
|
Loading…
Reference in a new issue