diff --git a/FileOFF.cc b/FileOFF.cc index 27e3b5cfe593f867f4ca943359ac25548b4f52ea..b0012d5d167811e2614e617f720a6e228367268b 100644 --- a/FileOFF.cc +++ b/FileOFF.cc @@ -1251,7 +1251,7 @@ bool FileOFFPlugin::saveObject(int _id, QString _filename) PolyMeshObject* polyObj = dynamic_cast( object ); - if (writeMesh(ofs, *polyObj->mesh())){ + if (writeMesh(ofs, *polyObj->mesh(), *polyObj)){ emit log(LOGINFO, tr("Saved object to ") + _filename ); ofs.close(); return true; @@ -1267,7 +1267,7 @@ bool FileOFFPlugin::saveObject(int _id, QString _filename) TriMeshObject* triObj = dynamic_cast( object ); - if (writeMesh(ofs, *triObj->mesh())) { + if (writeMesh(ofs, *triObj->mesh(), *triObj)) { emit log(LOGINFO, tr("Saved object to ") + _filename ); ofs.close(); return true; diff --git a/FileOFF.hh b/FileOFF.hh index 2dd2bab414b628916e80671252b5c0d494758013..3b3c38ac3502254a27d0ca10389428005b3143bb 100644 --- a/FileOFF.hh +++ b/FileOFF.hh @@ -213,7 +213,7 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte /// Writer function template< class MeshT > - bool writeMesh(std::ostream& _out, MeshT& _mesh ); + bool writeMesh(std::ostream& _out, MeshT& _mesh, BaseObject &_baseObj); /// Write binary mesh data to file template< class MeshT > diff --git a/FileOFFT.cc b/FileOFFT.cc index a5d0ac11824c7bdc56c1f1e88d087f7eb522d816..6d32145cbbd739a34fec6f2775c533f4a47ed5d2 100644 --- a/FileOFFT.cc +++ b/FileOFFT.cc @@ -50,7 +50,7 @@ template< class MeshT > -bool FileOFFPlugin::writeMesh(std::ostream& _out, MeshT& _mesh ){ +bool FileOFFPlugin::writeMesh(std::ostream& _out, MeshT& _mesh, BaseObject &_baseObj){ /***************** * HEADER @@ -86,9 +86,10 @@ bool FileOFFPlugin::writeMesh(std::ostream& _out, MeshT& _mesh ){ * Comment */ OpenMesh::MPropHandleT mp_comment; - if (_mesh.get_property_handle(mp_comment, "COMMENT")) { + + if (_baseObj.hasComments()) { _out << "# %% BEGIN OPENFLIPPER_COMMENT %%" << std::endl; - std::istringstream comment(_mesh.property(mp_comment)); + std::istringstream comment(_baseObj.getAllCommentsFlat().toStdString()); std::string commentLine; while (std::getline(comment, commentLine)) { _out << "# " << commentLine << std::endl;