mirror of
https://github.com/overte-org/overte.git
synced 2025-04-10 08:56:57 +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 ()
|
||||
|
||||
link_hifi_libraries(shared model networking ktx image)
|
||||
link_hifi_libraries(shared model networking ktx image fbx)
|
||||
include_hifi_library_headers(gpu)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// FBXBaker.cpp
|
||||
// tools/oven/src
|
||||
// tools/baking/src
|
||||
//
|
||||
// Created by Stephen Birarda on 3/30/17.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
|
@ -27,6 +27,9 @@
|
|||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include <FBXReader.h>
|
||||
#include <FBXWriter.h>
|
||||
|
||||
#include "ModelBakingLoggingCategory.h"
|
||||
#include "TextureBaker.h"
|
||||
|
||||
|
@ -205,29 +208,16 @@ void FBXBaker::handleFBXNetworkReply() {
|
|||
}
|
||||
|
||||
void FBXBaker::importScene() {
|
||||
// create an FBX SDK importer
|
||||
FbxImporter* importer = FbxImporter::Create(_sdkManager.get(), "");
|
||||
|
||||
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) {
|
||||
// failed to initialize importer, print an error and return
|
||||
handleError("Failed to import " + _fbxURL.toString() + " - " + importer->GetStatus().GetErrorString());
|
||||
QFile fbxFile(_originalFBXFilePath);
|
||||
if (!fbxFile.open(QIODevice::ReadOnly)) {
|
||||
handleError("Error opening " + _originalFBXFilePath);
|
||||
return;
|
||||
} else {
|
||||
qCDebug(model_baking) << "Imported" << _fbxURL << "to FbxScene";
|
||||
}
|
||||
|
||||
// setup a new scene to hold the imported file
|
||||
_scene = FbxScene::Create(_sdkManager.get(), "bakeScene");
|
||||
|
||||
// import the file to the created scene
|
||||
importer->Import(_scene);
|
||||
|
||||
// destroy the importer that is no longer needed
|
||||
importer->Destroy();
|
||||
qCDebug(model_baking) << "Imported" << _fbxURL << "to FbxScene";
|
||||
_rootNode = FBXReader::parseFBX(&fbxFile);
|
||||
}
|
||||
|
||||
QString texturePathRelativeToFBX(QUrl fbxURL, QUrl textureURL) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// FBXBaker.h
|
||||
// tools/oven/src
|
||||
// tools/baking/src
|
||||
//
|
||||
// Created by Stephen Birarda on 3/30/17.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <gpu/Texture.h>
|
||||
|
||||
#include <FBX.h>
|
||||
|
||||
namespace fbxsdk {
|
||||
class FbxManager;
|
||||
class FbxProperty;
|
||||
|
@ -76,6 +78,8 @@ private:
|
|||
void bakeTexture(const QUrl& textureURL, image::TextureUsage::Type textureType, const QDir& outputDir);
|
||||
|
||||
QUrl _fbxURL;
|
||||
|
||||
FBXNode _rootNode;
|
||||
|
||||
QString _bakedFBXFilePath;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ set(TARGET_NAME oven)
|
|||
|
||||
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()
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
#include "../Baker.h"
|
||||
#include <Baker.h>
|
||||
|
||||
class BakeWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <SettingHandle.h>
|
||||
|
||||
#include "../FBXBaker.h"
|
||||
#include <FBXBaker.h>
|
||||
|
||||
#include "BakeWidget.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <SettingHandle.h>
|
||||
|
||||
#include "../TextureBaker.h"
|
||||
#include <TextureBaker.h>
|
||||
|
||||
#include "BakeWidget.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue