From c8eb9b2f554ad091088686cbba3c615aaf1cc0e0 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Sun, 3 Apr 2022 14:47:32 -0700 Subject: [PATCH 1/2] Fix geometric pivots. --- conanfile.py | 2 +- src/fbx/Fbx2Raw.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index cb623ec..3e94af3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ from conans import ConanFile, CMake class FBX2glTFConan(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = ( - ("boost/1.76.0"), + ("boost/1.78.0"), ("libiconv/1.15"), ("zlib/1.2.11"), ("libxml2/2.9.12"), diff --git a/src/fbx/Fbx2Raw.cpp b/src/fbx/Fbx2Raw.cpp index 03be3a0..c8acd66 100644 --- a/src/fbx/Fbx2Raw.cpp +++ b/src/fbx/Fbx2Raw.cpp @@ -733,8 +733,31 @@ static void ReadNodeHierarchy( node.rotation = toQuatf(localRotation); node.scale = toVec3f(localScaling); + const FbxVector4 nodeGeometricTranslationPivot = + pNode->GetGeometricTranslation(FbxNode::eSourcePivot); + const FbxVector4 nodeGeometricRotationPivot = pNode->GetGeometricRotation(FbxNode::eSourcePivot); + FbxVector4 nodeGeometricScalePivot = pNode->GetGeometricScaling(FbxNode::eSourcePivot); + if (abs(nodeGeometricScalePivot[0]) < FBXSDK_FLOAT_EPSILON) { + nodeGeometricScalePivot[0] = 1.0; + } + if (abs(nodeGeometricScalePivot[1]) < FBXSDK_FLOAT_EPSILON) { + nodeGeometricScalePivot[1] = 1.0; + } + if (abs(nodeGeometricScalePivot[2]) < FBXSDK_FLOAT_EPSILON) { + nodeGeometricScalePivot[2] = 1.0; + } + FbxAMatrix matrixGeo; + matrixGeo.SetIdentity(); + matrixGeo.SetT(nodeGeometricTranslationPivot); + matrixGeo.SetR(nodeGeometricRotationPivot); + matrixGeo.SetS(nodeGeometricScalePivot); + if (parentId) { RawNode& parentNode = raw.GetNode(raw.GetNodeById(parentId)); + parentNode.translation += toVec3f(matrixGeo.GetT()); + const FbxQuaternion nodeRotation = matrixGeo.GetQ(); + parentNode.rotation = parentNode.rotation * toQuatf(nodeRotation); + parentNode.scale *= toVec3f(matrixGeo.GetS()); // Add unique child name to the parent node. if (std::find(parentNode.childIds.begin(), parentNode.childIds.end(), nodeId) == parentNode.childIds.end()) { @@ -744,9 +767,14 @@ static void ReadNodeHierarchy( // If there is no parent then this is the root node. raw.SetRootNode(nodeId); } - + matrixGeo = matrixGeo.Inverse(); for (int child = 0; child < pNode->GetChildCount(); child++) { ReadNodeHierarchy(raw, pScene, pNode->GetChild(child), nodeId, newPath); + RawNode& childNode = raw.GetNode(child); + childNode.translation += toVec3f(matrixGeo.GetT()); + const FbxQuaternion nodeRotation = matrixGeo.GetQ(); + childNode.rotation = childNode.rotation * toQuatf(nodeRotation); + childNode.scale *= toVec3f(matrixGeo.GetS()); } } From 124d12cbde08f9a8b2aedad3b1ca39db42d20101 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Sun, 3 Apr 2022 16:10:30 -0700 Subject: [PATCH 2/2] Make release and latest branches. --- .github/workflows/build-release.yml | 305 ++++++++++++++++++ .../workflows/{build.yml => build-test.yml} | 1 - 2 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-release.yml rename .github/workflows/{build.yml => build-test.yml} (99%) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..aa0fb86 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,305 @@ +name: "Build FBX2GLTF" +on: + push: + branches: + - 'releases/**' + +concurrency: + group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-build + cancel-in-progress: true + +jobs: + build-win-10: + runs-on: windows-2019 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install conan + run: | + pip install --upgrade conan + shell: bash + + - name: Setup conan profile + run: | + conan profile new default --detect + conan profile show default + shell: bash + + - name: Setup filter.lfs.required + run: | + git config --global filter.lfs.required false + shell: bash + + - name: Setup filter.lfs.smudge + run: | + git config --global filter.lfs.smudge "git-lfs smudge --skip %f" + shell: bash + + - name: Setup filter.lfs.process + run: | + git config --global filter.lfs.process "git-lfs filter-process --skip" + shell: bash + + - name: Fetch sdk + run: | + curl -O -L "https://github.com/V-Sekai/FBXSDK-Windows/archive/refs/tags/2020.2.zip" + shell: cmd + + - name: install 7z extract + run: | + 7z x 2020.2.zip + shell: cmd + + - name: move + run: | + mkdir -p sdk + mv ./FBXSDK-Windows-2020.2/sdk . + shell: bash + + - name: Decompress sdk + run: | + zstd -d -r --rm ./sdk || true + shell: bash + + - name: Conan install + run: | + conan install . --build=missing -i build -s build_type=Release -s compiler="Visual Studio" + shell: cmd + + - name: Conan build + run: | + conan build -bf build . + shell: cmd + + - name: Run FBX2glTF help + run: | + ./build/Release/FBX2glTF.exe --help + shell: bash + + - uses: actions/upload-artifact@v2 + with: + name: FBX2glTF-windows.exe + path: build/Release/FBX2glTF.exe + + - name: Copy licenses + run: | + mkdir -p result + cp sdk/Windows/2020.2/License.rtf result/thirdparty-license.rtf + cp LICENSE result/LICENSE + cp build/Release/FBX2glTF.exe result/FBX2glTF.exe + shell: bash + + - uses: papeloto/action-zip@v1 + with: + files: result + recursive: false + dest: fbx2gltf-windows.zip + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: release-windows + prerelease: false + title: FBX2glTF Windows packages + files: | + fbx2gltf-windows.zip + build-ubuntu: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install conan + run: | + pip install --upgrade conan + shell: bash + + - name: Setup conan profile + run: | + conan profile new default --detect + conan profile show default + shell: bash + + - name: Setup filter.lfs.required + run: | + git config --global filter.lfs.required false + shell: bash + + - name: Setup filter.lfs.smudge + run: | + git config --global filter.lfs.smudge "git-lfs smudge --skip %f" + shell: bash + + - name: Setup filter.lfs.process + run: | + git config --global filter.lfs.process "git-lfs filter-process --skip" + shell: bash + + - name: Fetch sdk + run: | + curl -O -L "https://github.com/V-Sekai/FBXSDK-Linux/archive/refs/tags/2020.2.zip" + shell: bash + + - name: install 7z extract + run: | + 7z x 2020.2.zip + shell: bash + + - name: move + run: | + mkdir -p sdk + mv ./FBXSDK-Linux-2020.2/sdk . + shell: bash + + - name: Decompress sdk + run: | + zstd -d -r --rm ./sdk || true + shell: bash + + - name: Conan install + run: | + conan install . -i build -s build_type=Release --build fmt -s compiler.libcxx=libstdc++11 + shell: bash + + - name: Conan build + run: | + conan build -bf build . + shell: bash + + - name: Run FBX2glTF help + run: | + ./build/FBX2glTF --help + shell: bash + + - uses: actions/upload-artifact@v2 + with: + name: FBX2glTF-linux + path: build/FBX2glTF + + - name: Copy licenses + run: | + mkdir -p result + cp sdk/Linux/2020.2/License.txt result/thirdparty-license.txt + cp LICENSE result/LICENSE + cp build/FBX2glTF result/FBX2glTF + shell: bash + + - uses: papeloto/action-zip@v1 + with: + files: result + recursive: false + dest: fbx2gltf-linux.zip + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: release-linux + prerelease: false + title: FBX2glTF Linux packages + files: | + fbx2gltf-linux.zip + + build-macos-x86_64: + runs-on: macos-11 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Update python + uses: actions/setup-python@v1 + + - name: Install conan + run: | + pip install --upgrade conan + shell: bash + + - name: Setup conan profile + run: | + conan profile new default --detect + conan profile show default + shell: bash + + - name: Setup filter.lfs.required + run: | + git config --global filter.lfs.required false + shell: bash + + - name: Setup filter.lfs.smudge + run: | + git config --global filter.lfs.smudge "git-lfs smudge --skip %f" + shell: bash + + - name: Setup filter.lfs.process + run: | + git config --global filter.lfs.process "git-lfs filter-process --skip" + shell: bash + + - name: Fetch sdk + run: | + curl -O -L "https://github.com/V-Sekai/FBXSDK-Darwin/archive/refs/tags/2020.2.zip" + shell: bash + + - name: install 7z extract + run: | + 7z x 2020.2.zip + shell: bash + + - name: move + run: | + mkdir -p sdk + mv ./FBXSDK-Darwin-2020.2/sdk . + shell: bash + + - name: Decompress sdk + run: | + zstd -d -r --rm ./sdk || true + shell: bash + + - name: Conan install + run: | + env CMAKE_OSX_ARCHITECTURES=x86_64 conan install . -i build -s build_type=Release --build missing --settings arch=x86_64 + shell: bash + + - name: Conan build + run: | + env CMAKE_OSX_ARCHITECTURES=x86_64 conan build -bf build . + shell: bash + + - name: Run FBX2glTF help + run: | + ./build/FBX2glTF --help + shell: bash + + - name: Adhoc signature + run: | + codesign -s - --options=runtime build/FBX2glTF + shell: bash + + - uses: actions/upload-artifact@v2 + with: + name: FBX2glTF-macos + path: build/FBX2glTF + + - name: Copy licenses + run: | + mkdir -p result + cp sdk/Darwin/2020.2/License.rtf result/thirdparty-license.rtf + cp LICENSE result/LICENSE + cp build/FBX2glTF result/FBX2glTF + shell: bash + + - uses: papeloto/action-zip@v1 + with: + files: result + recursive: false + dest: fbx2gltf-macos.zip + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: release-macos + prerelease: false + title: FBX2glTF Macos x86_64 packages + files: | + fbx2gltf-macos.zip diff --git a/.github/workflows/build.yml b/.github/workflows/build-test.yml similarity index 99% rename from .github/workflows/build.yml rename to .github/workflows/build-test.yml index 81bc506..9fc1022 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-test.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - 'releases/**' concurrency: group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-build