removed old fbx code

This commit is contained in:
Elisa Lupin-Jimenez 2017-11-07 17:10:57 -08:00
parent e37010565f
commit 9a09ffe12f
2 changed files with 11 additions and 35 deletions

View file

@ -355,8 +355,7 @@ 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 }
{ FBX_EXTENSION, &Application::importFromFBX }
}; };
class DeadlockWatchdogThread : public QThread { class DeadlockWatchdogThread : public QThread {
@ -2702,17 +2701,7 @@ bool Application::importFromZIP(const QString& filePath) {
return true; return true;
} }
bool Application::importFromFBX(const QString& filePath) { // thread-safe
qDebug() << "An fbx file has been dropped in: " << filePath;
QUrl empty;
// handle Blocks download from Marketplace
if (filePath.contains("vr.google.com/downloads")) {
addAssetToWorldFromURL(filePath);
} else {
addAssetToWorld(filePath, "", false, false);
}
return true;
}
void Application::onPresent(quint32 frameCount) { void Application::onPresent(quint32 frameCount) {
bool expected = false; bool expected = false;
@ -6250,11 +6239,7 @@ void Application::addAssetToWorldFromURL(QString url) {
if (url.contains("vr.google.com/downloads")) { if (url.contains("vr.google.com/downloads")) {
filename = url.section('/', -1); filename = url.section('/', -1);
if (url.contains("noDownload")) { if (url.contains("noDownload")) {
if (url.contains(".fbx")) { filename.remove(".zip?noDownload=false");
filename.remove("?noDownload=false");
} else {
filename.remove(".zip?noDownload=false");
}
} else { } else {
filename.remove(".zip"); filename.remove(".zip");
} }
@ -6281,7 +6266,7 @@ void Application::addAssetToWorldFromURLRequestFinished() {
auto result = request->getResult(); auto result = request->getResult();
QString filename; QString filename;
bool isBlocksOBJ = false; bool isBlocks = false;
if (url.contains("filename")) { if (url.contains("filename")) {
filename = url.section("filename=", 1, 1); // Filename is in "?filename=" parameter at end of URL. filename = url.section("filename=", 1, 1); // Filename is in "?filename=" parameter at end of URL.
@ -6289,15 +6274,11 @@ void Application::addAssetToWorldFromURLRequestFinished() {
if (url.contains("vr.google.com/downloads")) { if (url.contains("vr.google.com/downloads")) {
filename = url.section('/', -1); filename = url.section('/', -1);
if (url.contains("noDownload")) { if (url.contains("noDownload")) {
if (url.contains(".fbx")) { filename.remove(".zip?noDownload=false");
filename.remove("?noDownload=false");
} else {
filename.remove(".zip?noDownload=false");
}
} else { } else {
filename.remove(".zip"); filename.remove(".zip");
} }
isBlocksOBJ = true; isBlocks = true;
} }
if (result == ResourceRequest::Success) { if (result == ResourceRequest::Success) {
@ -6314,11 +6295,7 @@ void Application::addAssetToWorldFromURLRequestFinished() {
tempFile.write(request->getData()); tempFile.write(request->getData());
addAssetToWorldInfoClear(filename); // Remove message from list; next one added will have a different key. addAssetToWorldInfoClear(filename); // Remove message from list; next one added will have a different key.
tempFile.close(); tempFile.close();
if (url.contains(".fbx")) { qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true, false, isBlocks);
addAssetToWorld(downloadPath, "", false, false);
} else {
qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true, false, isBlocksOBJ);
}
} else { } else {
QString errorInfo = "Couldn't open temporary file for download"; QString errorInfo = "Couldn't open temporary file for download";
qWarning(interfaceapp) << errorInfo; qWarning(interfaceapp) << errorInfo;
@ -6348,7 +6325,7 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) {
addAssetToWorldError(filename, "Couldn't unzip file " + filename + "."); addAssetToWorldError(filename, "Couldn't unzip file " + filename + ".");
} }
void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip, bool isBlocksOBJ) { void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip, bool isBlocks) {
// 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 path = filePath; QString path = filePath;
@ -6357,7 +6334,7 @@ void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip,
QString assetFolder = zipFile.section("/", -1); QString assetFolder = zipFile.section("/", -1);
assetFolder.remove(".zip"); assetFolder.remove(".zip");
mapping = "/" + assetFolder + "/" + filename; mapping = "/" + assetFolder + "/" + filename;
} else if (isBlocksOBJ) { } else if (isBlocks) {
qCDebug(interfaceapp) << "Path to asset folder: " << zipFile; qCDebug(interfaceapp) << "Path to asset folder: " << zipFile;
QString assetFolder = zipFile.section('/', -1); QString assetFolder = zipFile.section('/', -1);
assetFolder.remove(".zip?noDownload=false"); assetFolder.remove(".zip?noDownload=false");
@ -6750,12 +6727,12 @@ void Application::onAssetToWorldMessageBoxClosed() {
} }
void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip, bool isBlocksOBJ) { void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip, bool isBlocks) {
if (autoAdd) { if (autoAdd) {
if (!unzipFile.isEmpty()) { if (!unzipFile.isEmpty()) {
for (int i = 0; i < unzipFile.length(); i++) { for (int i = 0; i < unzipFile.length(); i++) {
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i); qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocksOBJ); addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks);
} }
} else { } else {
addAssetToWorldUnzipFailure(zipFile); addAssetToWorldUnzipFailure(zipFile);

View file

@ -472,7 +472,6 @@ 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 importFromFBX(const QString& filePath);
bool nearbyEntitiesAreReadyForPhysics(); bool nearbyEntitiesAreReadyForPhysics();
int processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode); int processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode);