diff --git a/hecl/blender/BlenderConnection.cpp b/hecl/blender/BlenderConnection.cpp index eca86aa3a..8d3a9ed16 100644 --- a/hecl/blender/BlenderConnection.cpp +++ b/hecl/blender/BlenderConnection.cpp @@ -587,6 +587,21 @@ void BlenderConnection::PyOutStream::linkBackground(const char* target, sceneName, sceneName, target, sceneName); } +void BlenderConnection::DataStream::Mesh::normalizeSkinBinds() +{ + for (std::vector& skin : skins) + { + float accum = 0.f; + for (const SkinBind& bind : skin) + accum += bind.weight; + if (accum > FLT_EPSILON) + { + for (SkinBind& bind : skin) + bind.weight /= accum; + } + } +} + BlenderConnection::DataStream::Mesh::Mesh (BlenderConnection& conn, HMDLTopology topologyIn, int skinSlotCount, SurfProgFunc& surfProg) : topology(topologyIn), sceneXf(conn), aabbMin(conn), aabbMax(conn) diff --git a/hecl/blender/BlenderConnection.hpp b/hecl/blender/BlenderConnection.hpp index faa711be5..5d62790f3 100644 --- a/hecl/blender/BlenderConnection.hpp +++ b/hecl/blender/BlenderConnection.hpp @@ -431,18 +431,7 @@ public: std::vector> skins; std::vector contiguousSkinVertCounts; - void normalizeSkinBinds() - { - for (std::vector& skin : skins) - { - float accum = 0.f; - for (const SkinBind& bind : skin) - accum += bind.weight; - if (accum > FLT_EPSILON) - for (SkinBind& bind : skin) - bind.weight /= accum; - } - } + void normalizeSkinBinds(); /** Islands of the same material/skinBank are represented here */ struct Surface diff --git a/hecl/blender/HMDL.cpp b/hecl/blender/HMDL.cpp index 3d2576341..a19ecf50b 100644 --- a/hecl/blender/HMDL.cpp +++ b/hecl/blender/HMDL.cpp @@ -68,7 +68,7 @@ HMDLBuffers BlenderConnection::DataStream::Mesh::getHMDLBuffers(bool absoluteCoo bool found = false; for (const std::pair& tv : vertPool) { - if (v == *tv.second) + if (v == *tv.second && surf.skinBankIdx == tv.first->skinBankIdx) { iboData.push_back(ti); found = true;