Embed textures(Color/Normal) to FBX

master
Jeremy Hu 2018-11-28 00:14:56 +09:30
parent 1866e8fbda
commit b60b9d8691
3 changed files with 1285 additions and 4 deletions

View File

@ -1270,6 +1270,7 @@ void DocumentWindow::exportFbxResult()
exportMotions.push_back({motion->name, motion->jointNodeTrees}); exportMotions.push_back({motion->name, motion->jointNodeTrees});
} }
FbxFileWriter fbxFileWriter(skeletonResult, m_document->resultRigBones(), m_document->resultRigWeights(), filename, FbxFileWriter fbxFileWriter(skeletonResult, m_document->resultRigBones(), m_document->resultRigWeights(), filename,
m_document->textureImage, m_document->textureNormalImage, m_document->textureMetalnessRoughnessAmbientOcclusionImage,
exportMotions.empty() ? nullptr : &exportMotions); exportMotions.empty() ? nullptr : &exportMotions);
fbxFileWriter.save(); fbxFileWriter.save();
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
#include <QString> #include <QString>
#include <QMatrix4x4> #include <QMatrix4x4>
#include <QQuaternion> #include <QQuaternion>
#include <QImage>
#include "outcome.h" #include "outcome.h"
#include "document.h" #include "document.h"
@ -16,6 +17,9 @@ public:
const std::vector<RiggerBone> *resultRigBones, const std::vector<RiggerBone> *resultRigBones,
const std::map<int, RiggerVertexWeights> *resultRigWeights, const std::map<int, RiggerVertexWeights> *resultRigWeights,
const QString &filename, const QString &filename,
QImage *textureImage=nullptr,
QImage *normalImage=nullptr,
QImage *ormImage=nullptr,
const std::vector<std::pair<QString, std::vector<std::pair<float, JointNodeTree>>>> *motions=nullptr); const std::vector<std::pair<QString, std::vector<std::pair<float, JointNodeTree>>>> *motions=nullptr);
bool save(); bool save();
@ -28,6 +32,8 @@ private:
void createDocuments(); void createDocuments();
void createReferences(); void createReferences();
void createDefinitions(size_t deformerCount, void createDefinitions(size_t deformerCount,
size_t textureCount=0,
size_t videoCount=0,
bool hasAnimtion=false, bool hasAnimtion=false,
size_t animationStackCount=0, size_t animationStackCount=0,
size_t animationLayerCount=0, size_t animationLayerCount=0,