mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
Drag zip folder works
This commit is contained in:
parent
ed1ed4f3e0
commit
c3d943ff72
1 changed files with 34 additions and 2 deletions
|
@ -2788,7 +2788,7 @@ void Application::onPresent(quint32 frameCount) {
|
|||
bool Application::importFromZIP(const QString& filePath) {
|
||||
qDebug() << "A zip file has been dropped in: " << filePath;
|
||||
QUrl empty = "";
|
||||
qApp->getFileDownloadInterface()->runUnzip(filePath, empty, false, true);
|
||||
qApp->getFileDownloadInterface()->runUnzip(filePath, empty, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6266,6 +6266,38 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) {
|
|||
void Application::addAssetToWorld(QString filePath, QString zipFile, bool isBlocks) {
|
||||
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
|
||||
|
||||
qCDebug(interfaceapp) << "File about to be uploaded: " << filePath;
|
||||
qCDebug(interfaceapp) << "Original zip folder: " << zipFile;
|
||||
QString mapping;
|
||||
QString path = filePath;
|
||||
QString filename = filenameFromPath(filePath);
|
||||
if (isBlocks) {
|
||||
QString assetFolder = zipFile.section("/", -1);
|
||||
assetFolder.remove(".zip");
|
||||
mapping = "/" + assetFolder + "/" + filenameFromPath(filename);
|
||||
}
|
||||
else {
|
||||
path = QUrl(filePath).toLocalFile();
|
||||
filename = filenameFromPath(path);
|
||||
mapping = "/" + filename;
|
||||
}
|
||||
|
||||
// Test repeated because possibly different code paths.
|
||||
if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
|
||||
QString errorInfo = "You do not have permissions to write to the Asset Server.";
|
||||
qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
|
||||
addAssetToWorldError(filename, errorInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
addAssetToWorldInfo(filename, "Adding " + mapping.mid(1) + " to the Asset Server.");
|
||||
|
||||
addAssetToWorldWithNewMapping(path, mapping, 0);
|
||||
}
|
||||
|
||||
/**void Application::addAssetToWorld(QString filePath, QString zipFile, bool isBlocks) {
|
||||
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
|
||||
|
||||
qCDebug(interfaceapp) << "File about to be uploaded: " << filePath;
|
||||
qCDebug(interfaceapp) << "Original zip folder: " << zipFile;
|
||||
QString path = QUrl(filePath).toLocalFile();
|
||||
|
@ -6290,7 +6322,7 @@ void Application::addAssetToWorld(QString filePath, QString zipFile, bool isBloc
|
|||
addAssetToWorldInfo(filename, "Adding " + mapping.mid(1) + " to the Asset Server.");
|
||||
|
||||
addAssetToWorldWithNewMapping(path, mapping, 0);
|
||||
}
|
||||
}*/
|
||||
|
||||
void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {
|
||||
auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);
|
||||
|
|
Loading…
Reference in a new issue