mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 23:53:48 +02:00
Merge pull request #11849 from elisa-lj11/blocks
Zip file structures replicated in asset server
This commit is contained in:
commit
3211aa7d13
3 changed files with 11 additions and 15 deletions
interface/src
libraries/script-engine/src
unpublishedScripts/marketplace/blocks
|
@ -6333,20 +6333,14 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) {
|
|||
addAssetToWorldError(filename, "Couldn't unzip file " + filename + ".");
|
||||
}
|
||||
|
||||
void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip, bool isBlocks) {
|
||||
void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, bool isBlocks) {
|
||||
// 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 (isZip) {
|
||||
QString assetFolder = zipFile.section("/", -1);
|
||||
assetFolder.remove(".zip");
|
||||
mapping = "/" + assetFolder + "/" + filename;
|
||||
} else if (isBlocks) {
|
||||
qCDebug(interfaceapp) << "Path to asset folder: " << zipFile;
|
||||
QString assetFolder = zipFile.section('/', -1);
|
||||
assetFolder.remove(".zip?noDownload=false");
|
||||
mapping = "/" + assetFolder + "/" + filename;
|
||||
if (isZip || isBlocks) {
|
||||
QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
|
||||
QString assetFolder = path.section("model_repo/", -1);
|
||||
mapping = "/" + assetName + "/" + assetFolder;
|
||||
} else {
|
||||
mapping = "/" + filename;
|
||||
}
|
||||
|
@ -6732,8 +6726,10 @@ void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoA
|
|||
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, isZip, isBlocks);
|
||||
if (QFileInfo(unzipFile.at(i)).isFile()) {
|
||||
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
|
||||
addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addAssetToWorldUnzipFailure(zipFile);
|
||||
|
|
|
@ -55,7 +55,7 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
|
|||
QStringList fileList = unzipFile(path, tempDir);
|
||||
|
||||
if (!fileList.isEmpty()) {
|
||||
qCDebug(scriptengine) << "File to upload: " + fileList.first();
|
||||
qCDebug(scriptengine) << "First file to upload: " + fileList.first();
|
||||
} else {
|
||||
qCDebug(scriptengine) << "Unzip failed";
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
(function () {
|
||||
var APP_NAME = "BLOCKS";
|
||||
var APP_URL = "https://vr.google.com/objects/";
|
||||
var APP_URL = "https://poly.google.com/";
|
||||
var APP_OUTDATED_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html";
|
||||
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg";
|
||||
var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg";
|
||||
|
|
Loading…
Reference in a new issue