fix:auto add rootnode and cut animation curve promblem

This commit is contained in:
luzhuang 2023-06-02 09:01:37 +00:00
parent 0a6ec8297e
commit 9cfd44bec9
4 changed files with 16 additions and 20 deletions

View File

@ -49,7 +49,7 @@ find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(LibXml2 MODULE REQUIRED) find_package(LibXml2 MODULE REQUIRED)
find_package(ZLIB MODULE REQUIRED) find_package(ZLIB MODULE REQUIRED)
find_package(fmt MODULE REQUIRED) find_package(fmt MODULE REQUIRED)
find_package(libiconv MODULE REQUIRED) find_package(Iconv MODULE REQUIRED)
# create a compilation database for e.g. clang-tidy # create a compilation database for e.g. clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Binary file not shown.

View File

@ -9,7 +9,7 @@ from conans import ConanFile, CMake
class FBX2glTFConan(ConanFile): class FBX2glTFConan(ConanFile):
settings = "os", "compiler", "build_type", "arch" settings = "os", "compiler", "build_type", "arch"
requires = ( requires = (
("boost/1.81.0"), ("boost/1.69.0"),
("libiconv/1.15"), ("libiconv/1.15"),
("zlib/1.2.13"), ("zlib/1.2.13"),
("libxml2/2.9.9"), ("libxml2/2.9.9"),

View File

@ -848,11 +848,6 @@ static void ReadAnimations(RawModel& raw, FbxScene* pScene, const GltfOptions& o
const FbxVector4 localScale = computeLocalScale(pNode, pTime); const FbxVector4 localScale = computeLocalScale(pNode, pTime);
if (!optAnimation) {
hasTranslation = true;
hasRotation = true;
hasScale = true;
} else {
hasTranslation |= hasTranslation |=
(fabs(localTranslation[0] - baseTranslation[0]) > epsilon || (fabs(localTranslation[0] - baseTranslation[0]) > epsilon ||
fabs(localTranslation[1] - baseTranslation[1]) > epsilon || fabs(localTranslation[1] - baseTranslation[1]) > epsilon ||
@ -866,7 +861,7 @@ static void ReadAnimations(RawModel& raw, FbxScene* pScene, const GltfOptions& o
(fabs(localScale[0] - baseScaling[0]) > epsilon || (fabs(localScale[0] - baseScaling[0]) > epsilon ||
fabs(localScale[1] - baseScaling[1]) > epsilon || fabs(localScale[1] - baseScaling[1]) > epsilon ||
fabs(localScale[2] - baseScaling[2]) > epsilon); fabs(localScale[2] - baseScaling[2]) > epsilon);
}
channel.translations.push_back(toVec3f(localTranslation) * scaleFactor); channel.translations.push_back(toVec3f(localTranslation) * scaleFactor);
channel.rotations.push_back(toQuatf(localRotation)); channel.rotations.push_back(toQuatf(localRotation));
channel.scales.push_back(toVec3f(localScale)); channel.scales.push_back(toVec3f(localScale));
@ -943,19 +938,20 @@ static void ReadAnimations(RawModel& raw, FbxScene* pScene, const GltfOptions& o
} }
if (hasTranslation || hasRotation || hasScale || hasMorphs) { if (hasTranslation || hasRotation || hasScale || hasMorphs) {
if (!hasTranslation) { if (optAnimation) {
channel.translations.clear(); if (!hasTranslation) {
channel.translations.clear();
}
if (!hasRotation) {
channel.rotations.clear();
}
if (!hasScale) {
channel.scales.clear();
}
if (!hasMorphs) {
channel.weights.clear();
}
} }
if (!hasRotation) {
channel.rotations.clear();
}
if (!hasScale) {
channel.scales.clear();
}
if (!hasMorphs) {
channel.weights.clear();
}
animation.channels.emplace_back(channel); animation.channels.emplace_back(channel);
totalSizeInBytes += channel.translations.size() * sizeof(channel.translations[0]) + totalSizeInBytes += channel.translations.size() * sizeof(channel.translations[0]) +