From d83904e3ee8595231a23a3e8bd244621266ca7eb Mon Sep 17 00:00:00 2001 From: sacereda <27723692+sacereda@users.noreply.github.com> Date: Wed, 21 Aug 2024 21:15:57 +0200 Subject: [PATCH 1/8] Expose aiGetEmbeddedTexture to C-API (#5382) Co-authored-by: Kim Kulling --- code/Common/Assimp.cpp | 32 ++++++++++++++++++-------------- include/assimp/cimport.h | 8 ++++++++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/code/Common/Assimp.cpp b/code/Common/Assimp.cpp index 9abac7ee2..ef3ee7b5d 100644 --- a/code/Common/Assimp.cpp +++ b/code/Common/Assimp.cpp @@ -512,6 +512,11 @@ void aiGetMemoryRequirements(const C_STRUCT aiScene *pIn, ASSIMP_END_EXCEPTION_REGION(void); } +// ------------------------------------------------------------------------------------------------ +ASSIMP_API const C_STRUCT aiTexture *aiGetEmbeddedTexture(const C_STRUCT aiScene *pIn, const char *filename) { + return pIn->GetEmbeddedTexture(filename); +} + // ------------------------------------------------------------------------------------------------ ASSIMP_API aiPropertyStore *aiCreatePropertyStore(void) { return reinterpret_cast(new PropertyMap()); @@ -1268,7 +1273,6 @@ ASSIMP_API void aiQuaternionInterpolate( aiQuaternion::Interpolate(*dst, *start, *end, factor); } - // stb_image is a lightweight image loader. It is shared by: // - M3D import // - PBRT export @@ -1279,21 +1283,21 @@ ASSIMP_API void aiQuaternionInterpolate( #define ASSIMP_HAS_M3D ((!ASSIMP_BUILD_NO_EXPORT && !ASSIMP_BUILD_NO_M3D_EXPORTER) || !ASSIMP_BUILD_NO_M3D_IMPORTER) #ifndef STB_USE_HUNTER -# if ASSIMP_HAS_PBRT_EXPORT -# define ASSIMP_NEEDS_STB_IMAGE 1 -# elif ASSIMP_HAS_M3D -# define ASSIMP_NEEDS_STB_IMAGE 1 -# define STBI_ONLY_PNG -# endif +#if ASSIMP_HAS_PBRT_EXPORT +#define ASSIMP_NEEDS_STB_IMAGE 1 +#elif ASSIMP_HAS_M3D +#define ASSIMP_NEEDS_STB_IMAGE 1 +#define STBI_ONLY_PNG +#endif #endif // Ensure all symbols are linked correctly #if ASSIMP_NEEDS_STB_IMAGE - // Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy. -# define STBI_ONLY_PNG -# ifdef ASSIMP_USE_STB_IMAGE_STATIC -# define STB_IMAGE_STATIC -# endif -# define STB_IMAGE_IMPLEMENTATION -# include "Common/StbCommon.h" +// Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy. +#define STBI_ONLY_PNG +#ifdef ASSIMP_USE_STB_IMAGE_STATIC +#define STB_IMAGE_STATIC +#endif +#define STB_IMAGE_IMPLEMENTATION +#include "Common/StbCommon.h" #endif diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index 80edfe221..b793eca44 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -58,6 +58,7 @@ extern "C" { #endif struct aiScene; +struct aiTexture; struct aiFileIO; typedef void (*aiLogStreamCallback)(const char * /* message */, char * /* user */); @@ -373,6 +374,13 @@ ASSIMP_API void aiGetMemoryRequirements( const C_STRUCT aiScene *pIn, C_STRUCT aiMemoryInfo *in); +// -------------------------------------------------------------------------------- +/** Returns an embedded texture, or nullptr. + * @param pIn Input asset. + * @param filename Texture path extracted from aiGetMaterialString. + */ +ASSIMP_API const C_STRUCT aiTexture *aiGetEmbeddedTexture(const C_STRUCT aiScene *pIn, const char *filename); + // -------------------------------------------------------------------------------- /** Create an empty property store. Property stores are used to collect import * settings. From bb9db8409f6ebbfe4500fbcc5cccb9586be597de Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 22 Aug 2024 11:09:14 +0200 Subject: [PATCH 2/8] Sparky kitty studios master (#5727) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * upload contains "windows" in GH Actions * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * buildする方についてwindows-msvcのついている方にした この二つ、何の違いがあるかいまいち理解してない… clでビルドするかhunterでビルドするかの違い? * upload/release対象のartifactを修正 追加当時のIssueを参考に修正(当時はHunterなかったっぽい) https://github.com/assimp/assimp/commit/a9a0c3093226a23eb7558539bc6ebe5bcb98442b * fix ccpp.yml -- fix matrix.name check for artifact * fix ccpp.yml - build both hunter or not * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Update ccpp.yml * Fix verbose string + refactorings * Revert "Fix verbose string + refactorings" This reverts commit 824db16a689d191bf20cafb94e29d9e8feeee66b. * Fix verbose string + refactorings --------- Co-authored-by: Kazuki Y <6259214+kazu0617@users.noreply.github.com> Co-authored-by: kazu0617 Co-authored-by: Kim Kulling --- .github/workflows/ccpp.yml | 98 ++++++++++++++++++-- code/PostProcessing/ImproveCacheLocality.cpp | 1 + 2 files changed, 92 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index db152b813..fcd6ece87 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -7,10 +7,10 @@ on: branches: [ master ] permissions: - contents: read # to fetch code (actions/checkout) + contents: write # to fetch code (actions/checkout),and release jobs: - job: + build: name: ${{ matrix.name }}-build-and-test runs-on: ${{ matrix.os }} strategy: @@ -70,12 +70,12 @@ jobs: - name: Set Windows specific CMake arguments if: contains(matrix.name, 'windows') id: windows_extra_cmake_args - run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1 -DASSIMP_BUILD_ZLIB=1" + run: echo ":set-output name=args::=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT - name: Set Hunter specific CMake arguments if: contains(matrix.name, 'hunter') id: hunter_extra_cmake_args - run: echo "::set-output name=args::-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake" + run: echo "args=-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake" >> $GITHUB_OUTPUT - name: configure and build uses: lukka/run-cmake@v3 @@ -92,7 +92,7 @@ jobs: - name: Exclude certain tests in Hunter specific builds if: contains(matrix.name, 'hunter') id: hunter_extra_test_args - run: echo "::set-output name=args::--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest" + run: echo "args=--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest" >> $GITHUB_OUTPUT - name: test run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }} @@ -101,5 +101,89 @@ jobs: - uses: actions/upload-artifact@v4 if: matrix.name == 'windows-msvc' with: - name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' - path: build/bin + name: 'assimp-bins-${{ matrix.name }}' + path: build/bin/assimp*.exe + + - uses: marvinpinto/action-automatic-releases@latest + if: contains(matrix.name, 'windows-msvc-hunter') + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "master" + prerelease: true + title: "AutoRelease" + files: | + build/bin/assimp*.exe + + create-release: + needs: [build] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - id: create-release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}' + with: + tag_name: '${{github.ref}}' + release_name: 'Release ${{github.ref}}' + draft: false + prerelease: true + - run: | + echo '${{steps.create-release.outputs.upload_url}}' > release_upload_url.txt + - uses: actions/upload-artifact@v1 + with: + name: create-release + path: release_upload_url.txt + + upload-release: + strategy: + matrix: + name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter] + # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. + include: + - name: windows-latest-cl.exe + os: windows-latest + cxx: cl.exe + cc: cl.exe + - name: ubuntu-latest-clang++ + os: ubuntu-latest + cxx: clang++ + cc: clang + - name: macos-latest-clang++ + os: macos-latest + cxx: clang++ + cc: clang + - name: ubuntu-latest-g++ + os: ubuntu-latest + cxx: g++ + cc: gcc + - name: ubuntu-gcc-hunter + os: ubuntu-latest + toolchain: ninja-gcc-cxx17-fpic + - name: macos-clang-hunter + os: macos-latest + toolchain: ninja-clang-cxx17-fpic + - name: windows-msvc-hunter + os: windows-latest + toolchain: ninja-vs-win64-cxx17 + + needs: [create-release] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: softprops/action-gh-release@v1 + with: + name: create-release + - id: upload-url + run: | + echo "url=$(cat create-release/release_upload_url.txt)" >> $GITHUB_OUTPUT + - uses: actions/download-artifact@v1 + with: + name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' + - uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}' + with: + files: | + *.zip + diff --git a/code/PostProcessing/ImproveCacheLocality.cpp b/code/PostProcessing/ImproveCacheLocality.cpp index c165b0114..e108354b1 100644 --- a/code/PostProcessing/ImproveCacheLocality.cpp +++ b/code/PostProcessing/ImproveCacheLocality.cpp @@ -380,3 +380,4 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes } } // namespace Assimp + From 12ed0286e4c212a81e57022c088526d0c72ba71d Mon Sep 17 00:00:00 2001 From: Sanchikuuus <35233247+Sanchikuuus@users.noreply.github.com> Date: Sat, 24 Aug 2024 12:29:47 +0300 Subject: [PATCH 3/8] Added more Maya materials (#5101) * Added more Maya materials Added Maya materials to list and add setting texture properties for getting lost textures to mesh * Update utMaterialSystem.cpp Now new enumerators are handled by a case label in utMaterialSystem.cpp * Update material.h - Fix tests: use the correct max material parameter --------- Co-authored-by: Kim Kulling --- code/AssetLib/FBX/FBXConverter.cpp | 4 ++++ include/assimp/material.h | 24 ++++++++++++++++-------- test/unit/utMaterialSystem.cpp | 4 ++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index 234931cbe..fd54c63f4 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -2128,6 +2128,10 @@ void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const TextureMap &_ TrySetTextureProperties(out_mat, _textures, "Maya|emissionColor", aiTextureType_EMISSION_COLOR, mesh); TrySetTextureProperties(out_mat, _textures, "Maya|metalness", aiTextureType_METALNESS, mesh); TrySetTextureProperties(out_mat, _textures, "Maya|diffuseRoughness", aiTextureType_DIFFUSE_ROUGHNESS, mesh); + TrySetTextureProperties(out_mat, _textures, "Maya|base", aiTextureType_MAYA_BASE, mesh); + TrySetTextureProperties(out_mat, _textures, "Maya|specular", aiTextureType_MAYA_SPECULAR, mesh); + TrySetTextureProperties(out_mat, _textures, "Maya|specularColor", aiTextureType_MAYA_SPECULAR_COLOR, mesh); + TrySetTextureProperties(out_mat, _textures, "Maya|specularRoughness", aiTextureType_MAYA_SPECULAR_ROUGHNESS, mesh); // Maya stingray TrySetTextureProperties(out_mat, _textures, "Maya|TEX_color_map", aiTextureType_BASE_COLOR, mesh); diff --git a/include/assimp/material.h b/include/assimp/material.h index a8c6282c4..244c6607e 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -292,6 +292,14 @@ enum aiTextureType { aiTextureType_DIFFUSE_ROUGHNESS = 16, aiTextureType_AMBIENT_OCCLUSION = 17, + /** Unknown texture + * + * A texture reference that does not match any of the definitions + * above is considered to be 'unknown'. It is still imported, + * but is excluded from any further post-processing. + */ + aiTextureType_UNKNOWN = 18, + /** PBR Material Modifiers * Some modern renderers have further PBR modifiers that may be overlaid * on top of the 'base' PBR materials for additional realism. @@ -318,20 +326,20 @@ enum aiTextureType { */ aiTextureType_TRANSMISSION = 21, - /** Unknown texture - * - * A texture reference that does not match any of the definitions - * above is considered to be 'unknown'. It is still imported, - * but is excluded from any further post-processing. - */ - aiTextureType_UNKNOWN = 18, + /** + * Maya material declarations + */ + aiTextureType_MAYA_BASE = 22, + aiTextureType_MAYA_SPECULAR = 23, + aiTextureType_MAYA_SPECULAR_COLOR = 24, + aiTextureType_MAYA_SPECULAR_ROUGHNESS = 25, #ifndef SWIG _aiTextureType_Force32Bit = INT_MAX #endif }; -#define AI_TEXTURE_TYPE_MAX aiTextureType_TRANSMISSION +#define AI_TEXTURE_TYPE_MAX aiTextureType_MAYA_SPECULAR_ROUGHNESS // ------------------------------------------------------------------------------- /** diff --git a/test/unit/utMaterialSystem.cpp b/test/unit/utMaterialSystem.cpp index 8b1691b3f..4d335a979 100644 --- a/test/unit/utMaterialSystem.cpp +++ b/test/unit/utMaterialSystem.cpp @@ -260,6 +260,10 @@ TEST_F(MaterialSystemTest, testMaterialTextureTypeEnum) { case aiTextureType_METALNESS: case aiTextureType_DIFFUSE_ROUGHNESS: case aiTextureType_AMBIENT_OCCLUSION: + case aiTextureType_MAYA_BASE: + case aiTextureType_MAYA_SPECULAR: + case aiTextureType_MAYA_SPECULAR_COLOR: + case aiTextureType_MAYA_SPECULAR_ROUGHNESS: case aiTextureType_SHEEN: case aiTextureType_CLEARCOAT: case aiTextureType_TRANSMISSION: From d32370ff12dae326d20d9789890b48395fea75cb Mon Sep 17 00:00:00 2001 From: imdongye Date: Mon, 26 Aug 2024 00:11:19 +0900 Subject: [PATCH 4/8] fix GetShortFilename function (#5728) when blender export fbx then embedded texture path have slash and back slash. so GetShortFilename have to check both types of slashes Co-authored-by: Kim Kulling --- include/assimp/scene.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 9137a856c..f3701d600 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -401,8 +401,9 @@ struct ASSIMP_API aiScene { //! Returns a short filename from a full path static const char* GetShortFilename(const char* filename) { const char* lastSlash = strrchr(filename, '/'); - if (lastSlash == nullptr) { - lastSlash = strrchr(filename, '\\'); + const char* lastBackSlash = strrchr(filename, '\\'); + if (lastSlash < lastBackSlash) { + lastSlash = lastBackSlash; } const char* shortFilename = lastSlash != nullptr ? lastSlash + 1 : filename; return shortFilename; From f0ca4df70466cf7b911a49c9ff5b36c5f050c6d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:36:13 +0200 Subject: [PATCH 5/8] Bump actions/download-artifact from 1 to 4 (#5732) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 1 to 4. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v1...v4) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index fcd6ece87..191715323 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -177,7 +177,7 @@ jobs: - id: upload-url run: | echo "url=$(cat create-release/release_upload_url.txt)" >> $GITHUB_OUTPUT - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v4 with: name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' - uses: actions/upload-release-asset@v1 From a7a424e0a73575850d9bf46a02cde4bbdf644ee2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:04:32 +0200 Subject: [PATCH 6/8] Bump actions/upload-artifact from 1 to 4 (#5731) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v1...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 191715323..e75575e27 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -130,7 +130,7 @@ jobs: prerelease: true - run: | echo '${{steps.create-release.outputs.upload_url}}' > release_upload_url.txt - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: create-release path: release_upload_url.txt From fd7ad4a9d81b6a7e9d4dda3f34ce227e2787c602 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:47:37 +0200 Subject: [PATCH 7/8] Bump softprops/action-gh-release from 1 to 2 (#5730) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kim Kulling --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index e75575e27..b6cfae367 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -171,7 +171,7 @@ jobs: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - - uses: softprops/action-gh-release@v1 + - uses: softprops/action-gh-release@v2 with: name: create-release - id: upload-url From 4338817ca2c83c2fec688fc746c913af1adf4600 Mon Sep 17 00:00:00 2001 From: Vincent Fazio Date: Thu, 29 Aug 2024 08:13:40 +1000 Subject: [PATCH 8/8] Fix copying private data when source pointer is NULL (#5733) --- code/Common/SceneCombiner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Common/SceneCombiner.cpp b/code/Common/SceneCombiner.cpp index 7954d4d01..09215d055 100644 --- a/code/Common/SceneCombiner.cpp +++ b/code/Common/SceneCombiner.cpp @@ -1057,7 +1057,7 @@ void SceneCombiner::CopyScene(aiScene **_dest, const aiScene *src, bool allocate dest->mFlags = src->mFlags; // source private data might be nullptr if the scene is user-allocated (i.e. for use with the export API) - if (dest->mPrivate != nullptr) { + if (src->mPrivate != nullptr) { ScenePriv(dest)->mPPStepsApplied = ScenePriv(src) ? ScenePriv(src)->mPPStepsApplied : 0; } }