diff --git a/src/external/nexus b/src/external/nexus index c27d9bce0..61536927f 160000 --- a/src/external/nexus +++ b/src/external/nexus @@ -1 +1 @@ -Subproject commit c27d9bce0a8dc933ba7513da9ff95a73a76c5309 +Subproject commit 61536927f71dcab499d1db26c8913ed932dd4afa diff --git a/src/meshlabplugins/io_nxs/io_nxs.cpp b/src/meshlabplugins/io_nxs/io_nxs.cpp index 7b8e2ce38..9637ab43b 100644 --- a/src/meshlabplugins/io_nxs/io_nxs.cpp +++ b/src/meshlabplugins/io_nxs/io_nxs.cpp @@ -203,12 +203,15 @@ void IONXSPlugin::saveNxs( loader = new VcgLoader; + std::vector textures; + loader->load(&m.cm, has_colors, has_normals, has_textures); stream->load(loader); - //WORKAROUND to save loading textures not needed - if(!(components & NexusBuilder::TEXTURES)) { - stream->textures.clear(); + if((components & NexusBuilder::TEXTURES)) { + for (const std::string& tn : m.cm.textures){ + textures.push_back(m.getTexture(tn)); + } } NexusBuilder builder(components); @@ -221,10 +224,7 @@ void IONXSPlugin::saveNxs( if(deepzoom) builder.header.signature.flags |= nx::Signature::Flags::DEEPZOOM; builder.tex_quality = tex_quality; - bool success = builder.initAtlas(stream->textures); - if(!success) { - throw MLException("Fail"); - } + builder.initAtlas(textures); if(point_cloud) tree = new KDTreeCloud("cache_tree", adaptive.toFloat()); else