History

images auto-add to asset server, started asset browser add link

Elisa Lupin-Jimenez committed 8 years ago

Commit 2ff47fa1 parent bd7204e3 files · +38 −8Browse files

Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all

Unified · Split

interface/src/Application.cpp+35−7
@@ -335,15 +335,17 @@ static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; · 334 unmodified lines
335// we will never drop below the 'min' value335// we will never drop below the 'min' value
336static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;336static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
337 337
338static const QString SNAPSHOT_EXTENSION = ".jpg";338static const QString SNAPSHOT_EXTENSION = ".jpg";
339static const QString SVO_EXTENSION = ".svo";339static const QString JPG_EXTENSION = ".jpg";
340static const QString PNG_EXTENSION = ".png";
341static const QString SVO_EXTENSION = ".svo";
340static const QString SVO_JSON_EXTENSION = ".svo.json";342static const QString SVO_JSON_EXTENSION = ".svo.json";
341static const QString JSON_GZ_EXTENSION = ".json.gz";343static const QString JSON_GZ_EXTENSION = ".json.gz";
342static const QString JSON_EXTENSION = ".json";344static const QString JSON_EXTENSION = ".json";
343static const QString JS_EXTENSION = ".js";345static const QString JS_EXTENSION = ".js";
344static const QString FST_EXTENSION = ".fst";346static const QString FST_EXTENSION = ".fst";
345static const QString FBX_EXTENSION = ".fbx";347static const QString FBX_EXTENSION = ".fbx";
346static const QString OBJ_EXTENSION = ".obj";348static const QString OBJ_EXTENSION = ".obj";
347static const QString AVA_JSON_EXTENSION = ".ava.json";349static const QString AVA_JSON_EXTENSION = ".ava.json";
348static const QString WEB_VIEW_TAG = "noDownload=true";350static const QString WEB_VIEW_TAG = "noDownload=true";
349static const QString ZIP_EXTENSION = ".zip";351static const QString ZIP_EXTENSION = ".zip";
@@ -382,7 +384,9 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 32 unmodified lines
382 { JS_EXTENSION, &Application::askToLoadScript },384 { JS_EXTENSION, &Application::askToLoadScript },
383 { FST_EXTENSION, &Application::askToSetAvatarUrl },385 { FST_EXTENSION, &Application::askToSetAvatarUrl },
384 { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },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
388class DeadlockWatchdogThread : public QThread {392class DeadlockWatchdogThread : public QThread {
@@ -2899,6 +2903,27 @@ bool Application::importFromZIP(const QString& filePath) { · 2510 unmodified lines
2899 return true;2903 return true;
2900}2904}
2901 2905
2906bool 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// thread-safe2927// thread-safe
2903void Application::onPresent(quint32 frameCount) {2928void Application::onPresent(quint32 frameCount) {
2904 bool expected = false;2929 bool expected = false;
@@ -6403,6 +6428,7 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 3498 unmodified lines
6403 // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().6428 // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
6404 QString mapping;6429 QString mapping;
6405 QString filename = filenameFromPath(path);6430 QString filename = filenameFromPath(path);
6431 qCDebug(interfaceapp) << "Filename is: " << filename;
6406 if (isZip || isBlocks) {6432 if (isZip || isBlocks) {
6407 QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));6433 QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
6408 QString assetFolder = path.section("model_repo/", -1);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
6427void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {6453void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {
6454 qCDebug(interfaceapp) << "mapping request is: " << mapping;
6455 qCDebug(interfaceapp) << "file is located: " << filePath;
6428 auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);6456 auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);
6429 6457
6430 QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {6458 QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {