Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -335,15 +335,17 @@ static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; · 334 unmodified lines | ||
| 335 | 335 | // we will never drop below the 'min' value |
| 336 | 336 | static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1; |
| 337 | 337 | |
| 338 | −static const QString SNAPSHOT_EXTENSION = ".jpg"; | |
| 339 | −static const QString SVO_EXTENSION = ".svo"; | |
| 338 | +static const QString SNAPSHOT_EXTENSION = ".jpg"; | |
| 339 | +static const QString JPG_EXTENSION = ".jpg"; | |
| 340 | +static const QString PNG_EXTENSION = ".png"; | |
| 341 | +static const QString SVO_EXTENSION = ".svo"; | |
| 340 | 342 | static const QString SVO_JSON_EXTENSION = ".svo.json"; |
| 341 | 343 | static const QString JSON_GZ_EXTENSION = ".json.gz"; |
| 342 | 344 | static const QString JSON_EXTENSION = ".json"; |
| 343 | −static const QString JS_EXTENSION = ".js"; | |
| 344 | −static const QString FST_EXTENSION = ".fst"; | |
| 345 | −static const QString FBX_EXTENSION = ".fbx"; | |
| 346 | −static const QString OBJ_EXTENSION = ".obj"; | |
| 345 | +static const QString JS_EXTENSION = ".js"; | |
| 346 | +static const QString FST_EXTENSION = ".fst"; | |
| 347 | +static const QString FBX_EXTENSION = ".fbx"; | |
| 348 | +static const QString OBJ_EXTENSION = ".obj"; | |
| 347 | 349 | static const QString AVA_JSON_EXTENSION = ".ava.json"; |
| 348 | 350 | static const QString WEB_VIEW_TAG = "noDownload=true"; |
| 349 | 351 | static const QString ZIP_EXTENSION = ".zip"; |
| @@ -382,7 +384,9 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 32 unmodified lines | ||
| 382 | 384 | { JS_EXTENSION, &Application::askToLoadScript }, |
| 383 | 385 | { FST_EXTENSION, &Application::askToSetAvatarUrl }, |
| 384 | 386 | { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent }, |
| 385 | − { ZIP_EXTENSION, &Application::importFromZIP } | |
| 387 | + { ZIP_EXTENSION, &Application::importFromZIP }, | |
| 388 | + { JPG_EXTENSION, &Application::importImage }, | |
| 389 | + { PNG_EXTENSION, &Application::importImage } | |
| 386 | 390 | }; |
| 387 | 391 | |
| 388 | 392 | class DeadlockWatchdogThread : public QThread { |
| @@ -2899,6 +2903,27 @@ bool Application::importFromZIP(const QString& filePath) { · 2510 unmodified lines | ||
| 2899 | 2903 | return true; |
| 2900 | 2904 | } |
| 2901 | 2905 | |
| 2906 | +bool Application::importImage(const QString& urlString) { | |
| 2907 | + qCDebug(interfaceapp) << "dragged image"; | |
| 2908 | + QString filepath(urlString); | |
| 2909 | + filepath.remove("file:///"); | |
| 2910 | + //<<gets stuck at addAssetToWorldUpload()>> | |
| 2911 | + addAssetToWorld(filepath, "", false, false); | |
| 2912 | + //emit uploadRequest(urlString); | |
| 2913 | + /*auto upload = DependencyManager::get<AssetClient>()->createUpload(urlString); | |
| 2914 | + QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { | |
| 2915 | + if (upload->getError() != AssetUpload::NoError) { | |
| 2916 | + QString errorInfo = "Could not upload model to the Asset Server."; | |
| 2917 | + qWarning(interfaceapp) << "Error downloading model: " + errorInfo; | |
| 2918 | + //addAssetToWorldError(filenameFromPath(urlString), errorInfo); | |
| 2919 | + } else { | |
| 2920 | + //addAssetToWorldSetMapping(urlString, QString("/" + filenameFromPath(urlString)), hash); | |
| 2921 | + } | |
| 2922 | + upload->deleteLater(); | |
| 2923 | + });*/ | |
| 2924 | + return true; | |
| 2925 | +} | |
| 2926 | + | |
| 2902 | 2927 | // thread-safe |
| 2903 | 2928 | void Application::onPresent(quint32 frameCount) { |
| 2904 | 2929 | bool expected = false; |
| @@ -6403,6 +6428,7 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 3498 unmodified lines | ||
| 6403 | 6428 | // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget(). |
| 6404 | 6429 | QString mapping; |
| 6405 | 6430 | QString filename = filenameFromPath(path); |
| 6431 | + qCDebug(interfaceapp) << "Filename is: " << filename; | |
| 6406 | 6432 | if (isZip || isBlocks) { |
| 6407 | 6433 | QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$")); |
| 6408 | 6434 | QString assetFolder = path.section("model_repo/", -1); |
| @@ -6425,6 +6451,8 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 16 unmodified lines | ||
| 6425 | 6451 | } |
| 6426 | 6452 | |
| 6427 | 6453 | void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) { |
| 6454 | + qCDebug(interfaceapp) << "mapping request is: " << mapping; | |
| 6455 | + qCDebug(interfaceapp) << "file is located: " << filePath; | |
| 6428 | 6456 | auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping); |
| 6429 | 6457 | |
| 6430 | 6458 | QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable { |