From a37d748c172a294004b99461f8c3febff68b1426 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 2 Aug 2024 18:28:29 +0200 Subject: [PATCH 1/3] Update DefaultIOSystem.cpp (#5697) - closes https://github.com/assimp/assimp/issues/5678 --- code/Common/DefaultIOSystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/Common/DefaultIOSystem.cpp b/code/Common/DefaultIOSystem.cpp index e74add55f..ddb5b3b60 100644 --- a/code/Common/DefaultIOSystem.cpp +++ b/code/Common/DefaultIOSystem.cpp @@ -93,6 +93,10 @@ static std::string WideToUtf8(const wchar_t *in) { // ------------------------------------------------------------------------------------------------ // Tests for the existence of a file at the given path. bool DefaultIOSystem::Exists(const char *pFile) const { + if (pFile == nullptr) { + return false; + } + #ifdef _WIN32 struct __stat64 filestat; if (_wstat64(Utf8ToWide(pFile).c_str(), &filestat) != 0) { From 48c3a0ec46d2d67ad355b2ab727f503f67d9d7ce Mon Sep 17 00:00:00 2001 From: Kimbatt Date: Wed, 7 Aug 2024 22:43:02 +0200 Subject: [PATCH 2/3] FBX exporter - handle multiple vertex color channels (#5695) Co-authored-by: Kim Kulling --- code/AssetLib/FBX/FBXExporter.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp index 3b1dd335e..bfefc92c9 100644 --- a/code/AssetLib/FBX/FBXExporter.cpp +++ b/code/AssetLib/FBX/FBXExporter.cpp @@ -1217,10 +1217,8 @@ void FBXExporter::WriteObjects () } // colors, if any - // TODO only one color channel currently - const int32_t colorChannelIndex = 0; - if (m->HasVertexColors(colorChannelIndex)) { - FBX::Node vertexcolors("LayerElementColor", int32_t(colorChannelIndex)); + for (size_t ci = 0; ci < m->GetNumColorChannels(); ++ci) { + FBX::Node vertexcolors("LayerElementColor", int32_t(ci)); vertexcolors.Begin(outstream, binary, indent); vertexcolors.DumpProperties(outstream, binary, indent); vertexcolors.EndProperties(outstream, binary, indent); @@ -1230,7 +1228,7 @@ void FBXExporter::WriteObjects () "Version", int32_t(101), outstream, binary, indent ); char layerName[8]; - snprintf(layerName, sizeof(layerName), "COLOR_%d", colorChannelIndex); + snprintf(layerName, sizeof(layerName), "COLOR_%d", int32_t(ci)); FBX::Node::WritePropertyNode( "Name", (const char*)layerName, outstream, binary, indent ); @@ -1247,7 +1245,7 @@ void FBXExporter::WriteObjects () for (size_t fi = 0; fi < m->mNumFaces; ++fi) { const aiFace &f = m->mFaces[fi]; for (size_t pvi = 0; pvi < f.mNumIndices; ++pvi) { - const aiColor4D &c = m->mColors[colorChannelIndex][f.mIndices[pvi]]; + const aiColor4D &c = m->mColors[ci][f.mIndices[pvi]]; color_data.push_back(c.r); color_data.push_back(c.g); color_data.push_back(c.b); @@ -1354,11 +1352,14 @@ void FBXExporter::WriteObjects () le.AddChild("Type", "LayerElementNormal"); le.AddChild("TypedIndex", int32_t(0)); layer.AddChild(le); - // TODO only 1 color channel currently - le = FBX::Node("LayerElement"); - le.AddChild("Type", "LayerElementColor"); - le.AddChild("TypedIndex", int32_t(0)); - layer.AddChild(le); + + for (size_t ci = 0; ci < m->GetNumColorChannels(); ++ci) { + le = FBX::Node("LayerElement"); + le.AddChild("Type", "LayerElementColor"); + le.AddChild("TypedIndex", int32_t(ci)); + layer.AddChild(le); + } + le = FBX::Node("LayerElement"); le.AddChild("Type", "LayerElementMaterial"); le.AddChild("TypedIndex", int32_t(0)); From 09b981d943a4ca06865e11b68a0f1c892895edcb Mon Sep 17 00:00:00 2001 From: "Nathan V. Morrical" Date: Tue, 13 Aug 2024 01:23:14 -0600 Subject: [PATCH 3/3] fixing static build (#5713) --- contrib/poly2tri/poly2tri/common/dll_symbol.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/poly2tri/poly2tri/common/dll_symbol.h b/contrib/poly2tri/poly2tri/common/dll_symbol.h index 72ed5a75f..c18c2baec 100644 --- a/contrib/poly2tri/poly2tri/common/dll_symbol.h +++ b/contrib/poly2tri/poly2tri/common/dll_symbol.h @@ -53,7 +53,9 @@ # define P2T_DLL_SYMBOL # elif defined(P2T_SHARED_EXPORTS) # define P2T_DLL_SYMBOL P2T_COMPILER_DLLEXPORT -# else +# elif defined(BUILD_SHARED_LIBS) # define P2T_DLL_SYMBOL P2T_COMPILER_DLLIMPORT +# else +# define P2T_DLL_SYMBOL # endif #endif