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
335335 // we will never drop below the 'min' value
336336 static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
337337
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";
340342 static const QString SVO_JSON_EXTENSION = ".svo.json";
341343 static const QString JSON_GZ_EXTENSION = ".json.gz";
342344 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";
347349 static const QString AVA_JSON_EXTENSION = ".ava.json";
348350 static const QString WEB_VIEW_TAG = "noDownload=true";
349351 static const QString ZIP_EXTENSION = ".zip";
@@ -382,7 +384,9 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 32 unmodified lines
382384 { JS_EXTENSION, &Application::askToLoadScript },
383385 { FST_EXTENSION, &Application::askToSetAvatarUrl },
384386 { 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 }
386390 };
387391
388392 class DeadlockWatchdogThread : public QThread {
@@ -2899,6 +2903,27 @@ bool Application::importFromZIP(const QString& filePath) { · 2510 unmodified lines
28992903 return true;
29002904 }
29012905
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+
29022927 // thread-safe
29032928 void Application::onPresent(quint32 frameCount) {
29042929 bool expected = false;
@@ -6403,6 +6428,7 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 3498 unmodified lines
64036428 // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
64046429 QString mapping;
64056430 QString filename = filenameFromPath(path);
6431+ qCDebug(interfaceapp) << "Filename is: " << filename;
64066432 if (isZip || isBlocks) {
64076433 QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
64086434 QString assetFolder = path.section("model_repo/", -1);
@@ -6425,6 +6451,8 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 16 unmodified lines
64256451 }
64266452
64276453 void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {
6454+ qCDebug(interfaceapp) << "mapping request is: " << mapping;
6455+ qCDebug(interfaceapp) << "file is located: " << filePath;
64286456 auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);
64296457
64306458 QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {