Browse Source

Merge pull request #1602 from Matter-and-Form/fix/multibody-binary-stls

Restore import of multi mesh binary STLs
Kim Kulling 7 years ago
parent
commit
77b0aa4f4b
1 changed files with 7 additions and 0 deletions
  1. 7 0
      code/STLLoader.cpp

+ 7 - 0
code/STLLoader.cpp

@@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 using namespace Assimp;
 using namespace Assimp;
 
 
 namespace {
 namespace {
+    
 static const aiImporterDesc desc = {
 static const aiImporterDesc desc = {
     "Stereolithography (STL) Importer",
     "Stereolithography (STL) Importer",
     "",
     "",
@@ -505,6 +506,12 @@ bool STLImporter::LoadBinaryFile()
     // now copy faces
     // now copy faces
     addFacesToMesh(pMesh);
     addFacesToMesh(pMesh);
 
 
+    // add all created meshes to the single node
+    pScene->mRootNode->mNumMeshes = pScene->mNumMeshes;
+    pScene->mRootNode->mMeshes = new unsigned int[pScene->mNumMeshes];
+    for (unsigned int i = 0; i < pScene->mNumMeshes; i++)
+        pScene->mRootNode->mMeshes[i] = i;
+
     if (bIsMaterialise && !pMesh->mColors[0])
     if (bIsMaterialise && !pMesh->mColors[0])
     {
     {
         // use the color as diffuse material color
         // use the color as diffuse material color