mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 18:30:42 +02:00
Replace FBX SDK loading of file in FBXBaker with FBXReader
This commit is contained in:
parent
49e09f4838
commit
b60d68c714
7 changed files with 19 additions and 25 deletions
|
@ -15,5 +15,5 @@ if (FBX_FOUND)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
link_hifi_libraries(shared model networking ktx image)
|
link_hifi_libraries(shared model networking ktx image fbx)
|
||||||
include_hifi_library_headers(gpu)
|
include_hifi_library_headers(gpu)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// FBXBaker.cpp
|
// FBXBaker.cpp
|
||||||
// tools/oven/src
|
// tools/baking/src
|
||||||
//
|
//
|
||||||
// Created by Stephen Birarda on 3/30/17.
|
// Created by Stephen Birarda on 3/30/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
|
|
||||||
|
#include <FBXReader.h>
|
||||||
|
#include <FBXWriter.h>
|
||||||
|
|
||||||
#include "ModelBakingLoggingCategory.h"
|
#include "ModelBakingLoggingCategory.h"
|
||||||
#include "TextureBaker.h"
|
#include "TextureBaker.h"
|
||||||
|
|
||||||
|
@ -205,29 +208,16 @@ void FBXBaker::handleFBXNetworkReply() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FBXBaker::importScene() {
|
void FBXBaker::importScene() {
|
||||||
// create an FBX SDK importer
|
|
||||||
FbxImporter* importer = FbxImporter::Create(_sdkManager.get(), "");
|
|
||||||
|
|
||||||
qDebug() << "file path: " << _originalFBXFilePath.toLocal8Bit().data() << QDir(_originalFBXFilePath).exists();
|
qDebug() << "file path: " << _originalFBXFilePath.toLocal8Bit().data() << QDir(_originalFBXFilePath).exists();
|
||||||
// import the copy of the original FBX file
|
|
||||||
bool importStatus = importer->Initialize(_originalFBXFilePath.toLocal8Bit().data());
|
|
||||||
|
|
||||||
if (!importStatus) {
|
QFile fbxFile(_originalFBXFilePath);
|
||||||
// failed to initialize importer, print an error and return
|
if (!fbxFile.open(QIODevice::ReadOnly)) {
|
||||||
handleError("Failed to import " + _fbxURL.toString() + " - " + importer->GetStatus().GetErrorString());
|
handleError("Error opening " + _originalFBXFilePath);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
qCDebug(model_baking) << "Imported" << _fbxURL << "to FbxScene";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup a new scene to hold the imported file
|
qCDebug(model_baking) << "Imported" << _fbxURL << "to FbxScene";
|
||||||
_scene = FbxScene::Create(_sdkManager.get(), "bakeScene");
|
_rootNode = FBXReader::parseFBX(&fbxFile);
|
||||||
|
|
||||||
// import the file to the created scene
|
|
||||||
importer->Import(_scene);
|
|
||||||
|
|
||||||
// destroy the importer that is no longer needed
|
|
||||||
importer->Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString texturePathRelativeToFBX(QUrl fbxURL, QUrl textureURL) {
|
QString texturePathRelativeToFBX(QUrl fbxURL, QUrl textureURL) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// FBXBaker.h
|
// FBXBaker.h
|
||||||
// tools/oven/src
|
// tools/baking/src
|
||||||
//
|
//
|
||||||
// Created by Stephen Birarda on 3/30/17.
|
// Created by Stephen Birarda on 3/30/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include <gpu/Texture.h>
|
#include <gpu/Texture.h>
|
||||||
|
|
||||||
|
#include <FBX.h>
|
||||||
|
|
||||||
namespace fbxsdk {
|
namespace fbxsdk {
|
||||||
class FbxManager;
|
class FbxManager;
|
||||||
class FbxProperty;
|
class FbxProperty;
|
||||||
|
@ -76,6 +78,8 @@ private:
|
||||||
void bakeTexture(const QUrl& textureURL, image::TextureUsage::Type textureType, const QDir& outputDir);
|
void bakeTexture(const QUrl& textureURL, image::TextureUsage::Type textureType, const QDir& outputDir);
|
||||||
|
|
||||||
QUrl _fbxURL;
|
QUrl _fbxURL;
|
||||||
|
|
||||||
|
FBXNode _rootNode;
|
||||||
|
|
||||||
QString _bakedFBXFilePath;
|
QString _bakedFBXFilePath;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ set(TARGET_NAME oven)
|
||||||
|
|
||||||
setup_hifi_project(Widgets Gui Concurrent)
|
setup_hifi_project(Widgets Gui Concurrent)
|
||||||
|
|
||||||
link_hifi_libraries(networking shared image gpu ktx fbx baking)
|
link_hifi_libraries(networking shared image gpu ktx fbx baking model)
|
||||||
|
|
||||||
setup_memory_debugger()
|
setup_memory_debugger()
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
#include "../Baker.h"
|
#include <Baker.h>
|
||||||
|
|
||||||
class BakeWidget : public QWidget {
|
class BakeWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "../FBXBaker.h"
|
#include <FBXBaker.h>
|
||||||
|
|
||||||
#include "BakeWidget.h"
|
#include "BakeWidget.h"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "../TextureBaker.h"
|
#include <TextureBaker.h>
|
||||||
|
|
||||||
#include "BakeWidget.h"
|
#include "BakeWidget.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue