mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +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 + ".");
|
||||
}
|
||||
|
||||
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().
|
||||
QString mapping;
|
||||
QString path = filePath;
|
||||
QString filename = filenameFromPath(path);
|
||||
if (isBlocks) {
|
||||
if (isZip) {
|
||||
QString assetFolder = zipFile.section("/", -1);
|
||||
assetFolder.remove(".zip");
|
||||
mapping = "/" + assetFolder + "/" + filename;
|
||||
|
@ -6355,6 +6355,7 @@ void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, Q
|
|||
if (filePath.endsWith(".obj") || filePath.endsWith(".fbx")) {
|
||||
addAssetToWorldAddEntity(filePath, mapping);
|
||||
} else {
|
||||
qCDebug(interfaceapp) << "Zipped contents are not valid entity files";
|
||||
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 (!unzipFile.isEmpty()) {
|
||||
for (int i = 0; i < unzipFile.length(); i++) {
|
||||
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
|
||||
addAssetToWorld(unzipFile.at(i), zipFile, isBlocks);
|
||||
addAssetToWorld(unzipFile.at(i), zipFile, isZip);
|
||||
}
|
||||
} else {
|
||||
addAssetToWorldUnzipFailure(zipFile);
|
||||
|
|
|
@ -331,14 +331,14 @@ public slots:
|
|||
// FIXME: Move addAssetToWorld* methods to own class?
|
||||
void addAssetToWorldFromURL(QString url);
|
||||
void addAssetToWorldFromURLRequestFinished();
|
||||
void addAssetToWorld(QString filePath, QString zipFile, bool isBlocks);
|
||||
void addAssetToWorld(QString filePath, QString zipFile, bool isZip);
|
||||
void addAssetToWorldUnzipFailure(QString filePath);
|
||||
void addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy);
|
||||
void addAssetToWorldUpload(QString filePath, QString mapping);
|
||||
void addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash);
|
||||
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; }
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent
|
|||
// 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) << "Path where download is saved: " + path;
|
||||
QString fileName = "/" + path.section("/", -1);
|
||||
QString tempDir = path;
|
||||
if (!isBlocks) {
|
||||
if (!isZip) {
|
||||
tempDir.remove(fileName);
|
||||
} else {
|
||||
QTemporaryDir blocks;
|
||||
|
@ -60,7 +60,7 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
|
|||
else {
|
||||
qCDebug(scriptengine) << "Unzip failed";
|
||||
}
|
||||
emit unzipResult(path, fileList, autoAdd, isBlocks);
|
||||
emit unzipResult(path, fileList, autoAdd, isZip);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ public:
|
|||
|
||||
public slots:
|
||||
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();
|
||||
|
||||
signals:
|
||||
void unzipResult(QString zipFile, QStringList unzipFile, bool autoAdd, bool isBlocks);
|
||||
void unzipResult(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip);
|
||||
|
||||
private:
|
||||
bool isTempDir(QString tempDir);
|
||||
|
|
Loading…
Reference in a new issue