mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 12:21:06 +02:00
images auto-add to asset server, started asset browser add link
This commit is contained in:
parent
bd7204e6ef
commit
2ff47fa454
3 changed files with 38 additions and 8 deletions
|
@ -142,8 +142,9 @@ Windows.ScrollingWindow {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Elisa note - need to link this with specific add entity call
|
||||||
function canAddToWorld(path) {
|
function canAddToWorld(path) {
|
||||||
var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i];
|
var supportedExtensions = [/\.fbx\b/i, /\.obj\b/i, /\.jpg\b/i, /\.png\b/i];
|
||||||
|
|
||||||
if (selectedItems > 1) {
|
if (selectedItems > 1) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -335,15 +335,17 @@ static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
|
||||||
// we will never drop below the 'min' value
|
// we will never drop below the 'min' value
|
||||||
static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
|
static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
|
||||||
|
|
||||||
static const QString SNAPSHOT_EXTENSION = ".jpg";
|
static const QString SNAPSHOT_EXTENSION = ".jpg";
|
||||||
static const QString SVO_EXTENSION = ".svo";
|
static const QString JPG_EXTENSION = ".jpg";
|
||||||
|
static const QString PNG_EXTENSION = ".png";
|
||||||
|
static const QString SVO_EXTENSION = ".svo";
|
||||||
static const QString SVO_JSON_EXTENSION = ".svo.json";
|
static const QString SVO_JSON_EXTENSION = ".svo.json";
|
||||||
static const QString JSON_GZ_EXTENSION = ".json.gz";
|
static const QString JSON_GZ_EXTENSION = ".json.gz";
|
||||||
static const QString JSON_EXTENSION = ".json";
|
static const QString JSON_EXTENSION = ".json";
|
||||||
static const QString JS_EXTENSION = ".js";
|
static const QString JS_EXTENSION = ".js";
|
||||||
static const QString FST_EXTENSION = ".fst";
|
static const QString FST_EXTENSION = ".fst";
|
||||||
static const QString FBX_EXTENSION = ".fbx";
|
static const QString FBX_EXTENSION = ".fbx";
|
||||||
static const QString OBJ_EXTENSION = ".obj";
|
static const QString OBJ_EXTENSION = ".obj";
|
||||||
static const QString AVA_JSON_EXTENSION = ".ava.json";
|
static const QString AVA_JSON_EXTENSION = ".ava.json";
|
||||||
static const QString WEB_VIEW_TAG = "noDownload=true";
|
static const QString WEB_VIEW_TAG = "noDownload=true";
|
||||||
static const QString ZIP_EXTENSION = ".zip";
|
static const QString ZIP_EXTENSION = ".zip";
|
||||||
|
@ -382,7 +384,9 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi
|
||||||
{ JS_EXTENSION, &Application::askToLoadScript },
|
{ JS_EXTENSION, &Application::askToLoadScript },
|
||||||
{ FST_EXTENSION, &Application::askToSetAvatarUrl },
|
{ FST_EXTENSION, &Application::askToSetAvatarUrl },
|
||||||
{ JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },
|
{ JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },
|
||||||
{ ZIP_EXTENSION, &Application::importFromZIP }
|
{ ZIP_EXTENSION, &Application::importFromZIP },
|
||||||
|
{ JPG_EXTENSION, &Application::importImage },
|
||||||
|
{ PNG_EXTENSION, &Application::importImage }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeadlockWatchdogThread : public QThread {
|
class DeadlockWatchdogThread : public QThread {
|
||||||
|
@ -2899,6 +2903,27 @@ bool Application::importFromZIP(const QString& filePath) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::importImage(const QString& urlString) {
|
||||||
|
qCDebug(interfaceapp) << "dragged image";
|
||||||
|
QString filepath(urlString);
|
||||||
|
filepath.remove("file:///");
|
||||||
|
//<<gets stuck at addAssetToWorldUpload()>>
|
||||||
|
addAssetToWorld(filepath, "", false, false);
|
||||||
|
//emit uploadRequest(urlString);
|
||||||
|
/*auto upload = DependencyManager::get<AssetClient>()->createUpload(urlString);
|
||||||
|
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
|
||||||
|
if (upload->getError() != AssetUpload::NoError) {
|
||||||
|
QString errorInfo = "Could not upload model to the Asset Server.";
|
||||||
|
qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
|
||||||
|
//addAssetToWorldError(filenameFromPath(urlString), errorInfo);
|
||||||
|
} else {
|
||||||
|
//addAssetToWorldSetMapping(urlString, QString("/" + filenameFromPath(urlString)), hash);
|
||||||
|
}
|
||||||
|
upload->deleteLater();
|
||||||
|
});*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// thread-safe
|
// thread-safe
|
||||||
void Application::onPresent(quint32 frameCount) {
|
void Application::onPresent(quint32 frameCount) {
|
||||||
bool expected = false;
|
bool expected = false;
|
||||||
|
@ -6403,6 +6428,7 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo
|
||||||
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
|
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
|
||||||
QString mapping;
|
QString mapping;
|
||||||
QString filename = filenameFromPath(path);
|
QString filename = filenameFromPath(path);
|
||||||
|
qCDebug(interfaceapp) << "Filename is: " << filename;
|
||||||
if (isZip || isBlocks) {
|
if (isZip || isBlocks) {
|
||||||
QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
|
QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
|
||||||
QString assetFolder = path.section("model_repo/", -1);
|
QString assetFolder = path.section("model_repo/", -1);
|
||||||
|
@ -6425,6 +6451,8 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {
|
void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {
|
||||||
|
qCDebug(interfaceapp) << "mapping request is: " << mapping;
|
||||||
|
qCDebug(interfaceapp) << "file is located: " << filePath;
|
||||||
auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);
|
auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);
|
||||||
|
|
||||||
QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {
|
QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {
|
||||||
|
|
|
@ -469,6 +469,7 @@ private:
|
||||||
bool importJSONFromURL(const QString& urlString);
|
bool importJSONFromURL(const QString& urlString);
|
||||||
bool importSVOFromURL(const QString& urlString);
|
bool importSVOFromURL(const QString& urlString);
|
||||||
bool importFromZIP(const QString& filePath);
|
bool importFromZIP(const QString& filePath);
|
||||||
|
bool importImage(const QString& urlString);
|
||||||
|
|
||||||
bool nearbyEntitiesAreReadyForPhysics();
|
bool nearbyEntitiesAreReadyForPhysics();
|
||||||
int processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode);
|
int processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode);
|
||||||
|
|
Loading…
Reference in a new issue