Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -6328,20 +6328,19 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) { · 6327 unmodified lines | |||
| 6328 | addAssetToWorldError(filename, "Couldn't unzip file " + filename + "."); | 6328 | addAssetToWorldError(filename, "Couldn't unzip file " + filename + "."); |
| 6329 | } | 6329 | } |
| 6330 | 6330 | ||
| 6331 | void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip, bool isBlocks) { | 6331 | void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, bool isBlocks) { |
| 6332 | // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget(). | 6332 | // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget(). |
| 6333 | QString mapping; | 6333 | QString mapping; |
| 6334 | QString path = filePath; | ||
| 6335 | QString filename = filenameFromPath(path); | 6334 | QString filename = filenameFromPath(path); |
| 6336 | if (isZip) { | 6335 | if (isZip || isBlocks) { |
| 6337 | QString assetFolder = zipFile.section("/", -1); | 6336 | QString assetName; |
| 6338 | assetFolder.remove(".zip"); | 6337 | if (isZip) { |
| 6339 | mapping = "/" + assetFolder + "/" + filename; | 6338 | assetName = zipFile.section("/", -1).remove(".zip"); |
| 6340 | } else if (isBlocks) { | 6339 | } else if (isBlocks) { |
| 6341 | qCDebug(interfaceapp) << "Path to asset folder: " << zipFile; | 6340 | assetName = zipFile.section("/", -1).remove(".zip?noDownload=false"); |
| 6342 | QString assetFolder = zipFile.section('/', -1); | 6341 | } |
| 6343 | assetFolder.remove(".zip?noDownload=false"); | 6342 | QString assetFolder = path.section("model_repo/", -1); |
| 6344 | mapping = "/" + assetFolder + "/" + filename; | 6343 | mapping = "/" + assetName + "/" + assetFolder; |
| 6345 | } else { | 6344 | } else { |
| 6346 | mapping = "/" + filename; | 6345 | mapping = "/" + filename; |
| 6347 | } | 6346 | } |
| @@ -6727,8 +6726,10 @@ void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoA · 379 unmodified lines | |||
| 6727 | if (autoAdd) { | 6726 | if (autoAdd) { |
| 6728 | if (!unzipFile.isEmpty()) { | 6727 | if (!unzipFile.isEmpty()) { |
| 6729 | for (int i = 0; i < unzipFile.length(); i++) { | 6728 | for (int i = 0; i < unzipFile.length(); i++) { |
| 6730 | qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i); | 6729 | if (QFileInfo(unzipFile.at(i)).isFile()) { |
| 6731 | addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks); | 6730 | qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i); |
| 6731 | addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks); | ||
| 6732 | } | ||
| 6732 | } | 6733 | } |
| 6733 | } else { | 6734 | } else { |
| 6734 | addAssetToWorldUnzipFailure(zipFile); | 6735 | addAssetToWorldUnzipFailure(zipFile); |