diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index 8a69c3371a..a1be08e45e 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -1772,6 +1772,7 @@ std::vector MeshOutput::supportedMeshFormats() fmt.emplace_back("off"); fmt.emplace_back("smf"); fmt.emplace_back("x3d"); + fmt.emplace_back("x3dz"); fmt.emplace_back("xhtml"); fmt.emplace_back("wrl"); fmt.emplace_back("wrz"); @@ -1813,6 +1814,9 @@ MeshIO::Format MeshOutput::GetFormat(const char* FileName) else if (file.hasExtension("x3d")) { return MeshIO::X3D; } + else if (file.hasExtension("x3dz")) { + return MeshIO::X3DZ; + } else if (file.hasExtension("xhtml")) { return MeshIO::X3DOM; } @@ -1928,6 +1932,13 @@ bool MeshOutput::SaveAny(const char* FileName, MeshIO::Format format) const if (!SaveX3D(str)) throw Base::FileException("Export of X3D failed",FileName); } + else if (fileformat == MeshIO::X3DZ) { + // Compressed X3D is nothing else than a GZIP'ped X3D ascii file + zipios::GZIPOutputStream gzip(str); + // write file + if (!SaveX3D(gzip)) + throw Base::FileException("Export of compressed X3D mesh failed",FileName); + } else if (fileformat == MeshIO::X3DOM) { // write file if (!SaveX3DOM(str)) diff --git a/src/Mod/Mesh/App/Core/MeshIO.h b/src/Mod/Mesh/App/Core/MeshIO.h index e52b28fd03..8e222fc048 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.h +++ b/src/Mod/Mesh/App/Core/MeshIO.h @@ -50,6 +50,7 @@ namespace MeshIO { MGL, IV, X3D, + X3DZ, X3DOM, VRML, WRZ, diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index 541c94efc6..326f6cfe39 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -169,6 +169,7 @@ PyObject* MeshPy::read(PyObject *args, PyObject *kwds) ext["OFF" ] = MeshCore::MeshIO::OFF; ext["IV" ] = MeshCore::MeshIO::IV; ext["X3D" ] = MeshCore::MeshIO::X3D; + ext["X3DZ"] = MeshCore::MeshIO::X3DZ; ext["VRML"] = MeshCore::MeshIO::VRML; ext["WRL" ] = MeshCore::MeshIO::VRML; ext["WRZ" ] = MeshCore::MeshIO::WRZ; @@ -220,6 +221,7 @@ PyObject* MeshPy::write(PyObject *args, PyObject *kwds) ext["MGL" ] = MeshCore::MeshIO::MGL; ext["IV" ] = MeshCore::MeshIO::IV; ext["X3D" ] = MeshCore::MeshIO::X3D; + ext["X3DZ" ] = MeshCore::MeshIO::X3DZ; ext["X3DOM"] = MeshCore::MeshIO::X3DOM; ext["VRML" ] = MeshCore::MeshIO::VRML; ext["WRL" ] = MeshCore::MeshIO::VRML; diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index 1e57b26b40..648b22513d 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -516,6 +516,7 @@ void CmdMeshExport::activated(int) ext << qMakePair(QString::fromLatin1("%1 (*.off)").arg(QObject::tr("Object File Format")), "OFF"); ext << qMakePair(QString::fromLatin1("%1 (*.iv)").arg(QObject::tr("Inventor V2.1 ascii")), "IV"); ext << qMakePair(QString::fromLatin1("%1 (*.x3d)").arg(QObject::tr("X3D Extensible 3D")), "X3D"); + ext << qMakePair(QString::fromLatin1("%1 (*.x3dz)").arg(QObject::tr("Compressed X3D")), "X3DZ"); ext << qMakePair(QString::fromLatin1("%1 (*.xhtml)").arg(QObject::tr("WebGL/X3D")), "X3DOM"); ext << qMakePair(QString::fromLatin1("%1 (*.ply)").arg(QObject::tr("Stanford Polygon")), "PLY"); ext << qMakePair(QString::fromLatin1("%1 (*.wrl *.vrml)").arg(QObject::tr("VRML V2.0")), "VRML");