mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 17:55:36 +02:00
client side fixes for upload with no extension
This commit is contained in:
parent
1ece9aac26
commit
8fa32e75b2
4 changed files with 17 additions and 11 deletions
|
@ -421,14 +421,20 @@ void AssetServer::loadMappingsFromFile() {
|
|||
QFile mapFile { mapFilePath };
|
||||
if (mapFile.exists()) {
|
||||
if (mapFile.open(QIODevice::ReadOnly)) {
|
||||
auto jsonDocument = QJsonDocument::fromJson(mapFile.readAll());
|
||||
_fileMappings = jsonDocument.object().toVariantHash();
|
||||
QJsonParseError error;
|
||||
|
||||
qInfo() << "Loaded" << _fileMappings.count() << "mappings from map file at" << mapFilePath;
|
||||
} else {
|
||||
qCritical() << "Failed to read mapping file at" << mapFilePath << "- assignment with not continue.";
|
||||
setFinished(true);
|
||||
auto jsonDocument = QJsonDocument::fromJson(mapFile.readAll(), &error);
|
||||
|
||||
if (error.error == QJsonParseError::NoError) {
|
||||
_fileMappings = jsonDocument.object().toVariantHash();
|
||||
|
||||
qInfo() << "Loaded" << _fileMappings.count() << "mappings from map file at" << mapFilePath;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
qCritical() << "Failed to read mapping file at" << mapFilePath << "- assignment with not continue.";
|
||||
setFinished(true);
|
||||
} else {
|
||||
qInfo() << "No existing mappings loaded from file since no file was found at" << mapFilePath;
|
||||
}
|
||||
|
|
|
@ -4334,14 +4334,14 @@ void Application::modelUploadFinished(AssetUpload* upload, const QString& hash)
|
|||
auto filename = QFileInfo(upload->getFilename()).fileName();
|
||||
|
||||
if ((upload->getError() == AssetUpload::NoError) &&
|
||||
(FBX_EXTENSION.endsWith(upload->getExtension(), Qt::CaseInsensitive) ||
|
||||
OBJ_EXTENSION.endsWith(upload->getExtension(), Qt::CaseInsensitive))) {
|
||||
(filename.endsWith(FBX_EXTENSION, Qt::CaseInsensitive) ||
|
||||
filename.endsWith(OBJ_EXTENSION, Qt::CaseInsensitive))) {
|
||||
|
||||
auto entities = DependencyManager::get<EntityScriptingInterface>();
|
||||
|
||||
EntityItemProperties properties;
|
||||
properties.setType(EntityTypes::Model);
|
||||
properties.setModelURL(QString("%1:%2.%3").arg(URL_SCHEME_ATP).arg(hash).arg(upload->getExtension()));
|
||||
properties.setModelURL(QString("%1:%2").arg(URL_SCHEME_ATP).arg(hash);
|
||||
properties.setPosition(_myCamera.getPosition() + _myCamera.getOrientation() * Vectors::FRONT * 2.0f);
|
||||
properties.setName(QUrl(upload->getFilename()).fileName());
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void ATPAssetMigrator::migrateResource(ResourceRequest* request) {
|
|||
|
||||
QFileInfo assetInfo { request->getUrl().fileName() };
|
||||
|
||||
auto upload = assetClient->createUpload(request->getData(), assetInfo.completeSuffix());
|
||||
auto upload = assetClient->createUpload(request->getData());
|
||||
|
||||
if (upload) {
|
||||
// add this URL to our hash of AssetUpload to original URL
|
||||
|
|
|
@ -87,7 +87,7 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
|
|||
// setup the line edit to hold the copiable text
|
||||
QLineEdit* lineEdit = new QLineEdit;
|
||||
|
||||
QString atpURL = QString("%1:%2.%3").arg(URL_SCHEME_ATP).arg(hash).arg(upload->getExtension());
|
||||
QString atpURL = QString("%1:%2").arg(URL_SCHEME_ATP).arg(hash);
|
||||
|
||||
// set the ATP URL as the text value so it's copiable
|
||||
lineEdit->insert(atpURL);
|
||||
|
|
Loading…
Reference in a new issue