Merge branch 'master' into fix-5689

pull/5693/head
Kim Kulling 2024-08-13 09:24:27 +02:00 committed by GitHub
commit 2d81a1e8c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 12 deletions

View File

@ -1217,10 +1217,8 @@ void FBXExporter::WriteObjects ()
} }
// colors, if any // colors, if any
// TODO only one color channel currently for (size_t ci = 0; ci < m->GetNumColorChannels(); ++ci) {
const int32_t colorChannelIndex = 0; FBX::Node vertexcolors("LayerElementColor", int32_t(ci));
if (m->HasVertexColors(colorChannelIndex)) {
FBX::Node vertexcolors("LayerElementColor", int32_t(colorChannelIndex));
vertexcolors.Begin(outstream, binary, indent); vertexcolors.Begin(outstream, binary, indent);
vertexcolors.DumpProperties(outstream, binary, indent); vertexcolors.DumpProperties(outstream, binary, indent);
vertexcolors.EndProperties(outstream, binary, indent); vertexcolors.EndProperties(outstream, binary, indent);
@ -1230,7 +1228,7 @@ void FBXExporter::WriteObjects ()
"Version", int32_t(101), outstream, binary, indent "Version", int32_t(101), outstream, binary, indent
); );
char layerName[8]; char layerName[8];
snprintf(layerName, sizeof(layerName), "COLOR_%d", colorChannelIndex); snprintf(layerName, sizeof(layerName), "COLOR_%d", int32_t(ci));
FBX::Node::WritePropertyNode( FBX::Node::WritePropertyNode(
"Name", (const char*)layerName, outstream, binary, indent "Name", (const char*)layerName, outstream, binary, indent
); );
@ -1247,7 +1245,7 @@ void FBXExporter::WriteObjects ()
for (size_t fi = 0; fi < m->mNumFaces; ++fi) { for (size_t fi = 0; fi < m->mNumFaces; ++fi) {
const aiFace &f = m->mFaces[fi]; const aiFace &f = m->mFaces[fi];
for (size_t pvi = 0; pvi < f.mNumIndices; ++pvi) { 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.r);
color_data.push_back(c.g); color_data.push_back(c.g);
color_data.push_back(c.b); color_data.push_back(c.b);
@ -1354,11 +1352,14 @@ void FBXExporter::WriteObjects ()
le.AddChild("Type", "LayerElementNormal"); le.AddChild("Type", "LayerElementNormal");
le.AddChild("TypedIndex", int32_t(0)); le.AddChild("TypedIndex", int32_t(0));
layer.AddChild(le); layer.AddChild(le);
// TODO only 1 color channel currently
le = FBX::Node("LayerElement"); for (size_t ci = 0; ci < m->GetNumColorChannels(); ++ci) {
le.AddChild("Type", "LayerElementColor"); le = FBX::Node("LayerElement");
le.AddChild("TypedIndex", int32_t(0)); le.AddChild("Type", "LayerElementColor");
layer.AddChild(le); le.AddChild("TypedIndex", int32_t(ci));
layer.AddChild(le);
}
le = FBX::Node("LayerElement"); le = FBX::Node("LayerElement");
le.AddChild("Type", "LayerElementMaterial"); le.AddChild("Type", "LayerElementMaterial");
le.AddChild("TypedIndex", int32_t(0)); le.AddChild("TypedIndex", int32_t(0));

View File

@ -93,6 +93,10 @@ static std::string WideToUtf8(const wchar_t *in) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Tests for the existence of a file at the given path. // Tests for the existence of a file at the given path.
bool DefaultIOSystem::Exists(const char *pFile) const { bool DefaultIOSystem::Exists(const char *pFile) const {
if (pFile == nullptr) {
return false;
}
#ifdef _WIN32 #ifdef _WIN32
struct __stat64 filestat; struct __stat64 filestat;
if (_wstat64(Utf8ToWide(pFile).c_str(), &filestat) != 0) { if (_wstat64(Utf8ToWide(pFile).c_str(), &filestat) != 0) {

View File

@ -53,7 +53,9 @@
# define P2T_DLL_SYMBOL # define P2T_DLL_SYMBOL
# elif defined(P2T_SHARED_EXPORTS) # elif defined(P2T_SHARED_EXPORTS)
# define P2T_DLL_SYMBOL P2T_COMPILER_DLLEXPORT # define P2T_DLL_SYMBOL P2T_COMPILER_DLLEXPORT
# else # elif defined(BUILD_SHARED_LIBS)
# define P2T_DLL_SYMBOL P2T_COMPILER_DLLIMPORT # define P2T_DLL_SYMBOL P2T_COMPILER_DLLIMPORT
# else
# define P2T_DLL_SYMBOL
# endif # endif
#endif #endif