MeshLib Documentation
Loading...
Searching...
No Matches
Serializer

Functions

MRMESH_API Expected< Json::Value > MR::deserializeJsonValue (std::istream &in)
 
MRMESH_API Expected< Json::Value > MR::deserializeJsonValue (const std::string &str)
 
MRMESH_API Expected< Json::Value > MR::deserializeJsonValue (const std::filesystem::path &path)
 
MRMESH_API Expected< void > MR::serializeMesh (const Mesh &mesh, const std::filesystem::path &path, const FaceBitSet *selection=nullptr, const char *saveMeshFormat=".mrmesh")
 
MRMESH_API void MR::serializeToJson (const Vector2i &vec, Json::Value &root)
 saves an object into json value
 
MRMESH_API void MR::serializeToJson (const Vector2f &vec, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Vector3i &vec, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Vector3f &vec, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Vector4f &vec, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Box3i &box, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Box3f &box, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Color &col, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Matrix2f &matrix, Json::Value &root, bool skipIdentity=true)
 
MRMESH_API void MR::serializeToJson (const Matrix3f &matrix, Json::Value &root, bool skipIdentity=true)
 
MRMESH_API void MR::serializeToJson (const AffineXf2f &xf, Json::Value &root, bool skipIdentity=true)
 
MRMESH_API void MR::serializeToJson (const AffineXf3f &xf, Json::Value &root, bool skipIdentity=true)
 
MRMESH_API void MR::serializeToJson (const BitSet &bitset, Json::Value &root)
 
MRMESH_API Expected< void > MR::serializeToJson (const Mesh &mesh, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const Plane3f &plane, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const TriPointf &tp, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const MeshTexture &texture, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const std::vector< TextureId > &texturePerFace, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const std::vector< UVCoord > &uvCoords, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const std::vector< Color > &colors, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const MeshTriPoint &mtp, const MeshTopology &topology, Json::Value &root)
 
MRMESH_API void MR::serializeToJson (const PointOnFace &pf, Json::Value &root)
 
MRMESH_API void MR::serializeViaVerticesToJson (const UndirectedEdgeBitSet &edges, const MeshTopology &topology, Json::Value &root)
 
MRMESH_API void MR::deserializeViaVerticesFromJson (const Json::Value &root, UndirectedEdgeBitSet &edges, const MeshTopology &topology)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Vector2i &vec)
 loads an object from json value
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Vector2f &vec)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Vector3i &vec)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Vector3f &vec)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Vector4f &vec)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Color &col)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Matrix2f &matrix)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Matrix3f &matrix)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, AffineXf2f &xf)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, AffineXf3f &xf)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, BitSet &bitset)
 
MRMESH_API Expected< MeshMR::deserializeFromJson (const Json::Value &root, VertColors *colors=nullptr)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, Plane3f &plane)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, TriPointf &tp)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, MeshTexture &texture)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, std::vector< TextureId > &texturePerFace)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, std::vector< UVCoord > &uvCoords)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, std::vector< Color > &colors)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, MeshTriPoint &mtp, const MeshTopology &topology)
 
MRMESH_API void MR::deserializeFromJson (const Json::Value &root, PointOnFace &pf)
 
MRMESH_API Expected< void > MR::decompressZip (const std::filesystem::path &zipFile, const std::filesystem::path &targetFolder, const char *password=nullptr)
 decompresses given zip-file into given folder
 
MRMESH_API Expected< void > MR::decompressZip (std::istream &zipStream, const std::filesystem::path &targetFolder, const char *password=nullptr)
 decompresses given binary stream (containing the data of a zip file only) into given folder
 
MRMESH_API Expected< void > MR::compressZip (const std::filesystem::path &zipFile, const std::filesystem::path &sourceFolder, const std::vector< std::filesystem::path > &excludeFiles={}, const char *password=nullptr, ProgressCallback cb={})
 compresses given folder in given zip-file
 

Detailed Description

Function Documentation

◆ compressZip()

MRMESH_API Expected< void > MR::compressZip ( const std::filesystem::path & zipFile,
const std::filesystem::path & sourceFolder,
const std::vector< std::filesystem::path > & excludeFiles = {},
const char * password = nullptr,
ProgressCallback cb = {} )

compresses given folder in given zip-file

Parameters
excludeFilesfiles that should not be included to result zip
passwordif password is given then the archive will be encrypted
cban option to get progress notifications and cancel the operation

◆ decompressZip() [1/2]

MRMESH_API Expected< void > MR::decompressZip ( const std::filesystem::path & zipFile,
const std::filesystem::path & targetFolder,
const char * password = nullptr )

decompresses given zip-file into given folder

Parameters
passwordif password is given then it will be used to decipher encrypted archive

◆ decompressZip() [2/2]

MRMESH_API Expected< void > MR::decompressZip ( std::istream & zipStream,
const std::filesystem::path & targetFolder,
const char * password = nullptr )

decompresses given binary stream (containing the data of a zip file only) into given folder

Parameters
passwordif password is given then it will be used to decipher encrypted archive

◆ deserializeFromJson() [1/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
AffineXf2f & xf )

◆ deserializeFromJson() [2/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
AffineXf3f & xf )

◆ deserializeFromJson() [3/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
BitSet & bitset )

◆ deserializeFromJson() [4/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Color & col )

◆ deserializeFromJson() [5/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Matrix2f & matrix )

◆ deserializeFromJson() [6/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Matrix3f & matrix )

◆ deserializeFromJson() [7/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
MeshTexture & texture )

◆ deserializeFromJson() [8/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
MeshTriPoint & mtp,
const MeshTopology & topology )

this version takes topology to construct MeshTriPoint from its representation relative a face; also beware that de-serialization will work only if faces are not renumbered (so please pack mesh before saving)

◆ deserializeFromJson() [9/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Plane3f & plane )

◆ deserializeFromJson() [10/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
PointOnFace & pf )

◆ deserializeFromJson() [11/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
std::vector< Color > & colors )

◆ deserializeFromJson() [12/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
std::vector< TextureId > & texturePerFace )

◆ deserializeFromJson() [13/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
std::vector< UVCoord > & uvCoords )

◆ deserializeFromJson() [14/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
TriPointf & tp )

◆ deserializeFromJson() [15/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Vector2f & vec )

◆ deserializeFromJson() [16/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Vector2i & vec )

loads an object from json value

◆ deserializeFromJson() [17/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Vector3f & vec )

◆ deserializeFromJson() [18/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Vector3i & vec )

◆ deserializeFromJson() [19/20]

MRMESH_API void MR::deserializeFromJson ( const Json::Value & root,
Vector4f & vec )

◆ deserializeFromJson() [20/20]

MRMESH_API Expected< Mesh > MR::deserializeFromJson ( const Json::Value & root,
VertColors * colors = nullptr )

◆ deserializeJsonValue() [1/3]

MRMESH_API Expected< Json::Value > MR::deserializeJsonValue ( const std::filesystem::path & path)

◆ deserializeJsonValue() [2/3]

MRMESH_API Expected< Json::Value > MR::deserializeJsonValue ( const std::string & str)

◆ deserializeJsonValue() [3/3]

MRMESH_API Expected< Json::Value > MR::deserializeJsonValue ( std::istream & in)

◆ deserializeViaVerticesFromJson()

MRMESH_API void MR::deserializeViaVerticesFromJson ( const Json::Value & root,
UndirectedEdgeBitSet & edges,
const MeshTopology & topology )

◆ serializeMesh()

MRMESH_API Expected< void > MR::serializeMesh ( const Mesh & mesh,
const std::filesystem::path & path,
const FaceBitSet * selection = nullptr,
const char * saveMeshFormat = ".mrmesh" )

saves mesh with optional selection to mru format; this is very convenient for saving intermediate states during algorithm debugging; ".mrmesh" save mesh format is not space efficient, but guaranties no changes in the topology after loading

◆ serializeToJson() [1/22]

MRMESH_API void MR::serializeToJson ( const AffineXf2f & xf,
Json::Value & root,
bool skipIdentity = true )

◆ serializeToJson() [2/22]

MRMESH_API void MR::serializeToJson ( const AffineXf3f & xf,
Json::Value & root,
bool skipIdentity = true )

◆ serializeToJson() [3/22]

MRMESH_API void MR::serializeToJson ( const BitSet & bitset,
Json::Value & root )

◆ serializeToJson() [4/22]

MRMESH_API void MR::serializeToJson ( const Box3f & box,
Json::Value & root )

◆ serializeToJson() [5/22]

MRMESH_API void MR::serializeToJson ( const Box3i & box,
Json::Value & root )

◆ serializeToJson() [6/22]

MRMESH_API void MR::serializeToJson ( const Color & col,
Json::Value & root )

◆ serializeToJson() [7/22]

MRMESH_API void MR::serializeToJson ( const Matrix2f & matrix,
Json::Value & root,
bool skipIdentity = true )

◆ serializeToJson() [8/22]

MRMESH_API void MR::serializeToJson ( const Matrix3f & matrix,
Json::Value & root,
bool skipIdentity = true )

◆ serializeToJson() [9/22]

MRMESH_API Expected< void > MR::serializeToJson ( const Mesh & mesh,
Json::Value & root )

◆ serializeToJson() [10/22]

MRMESH_API void MR::serializeToJson ( const MeshTexture & texture,
Json::Value & root )

◆ serializeToJson() [11/22]

MRMESH_API void MR::serializeToJson ( const MeshTriPoint & mtp,
const MeshTopology & topology,
Json::Value & root )

this version takes topology to convert MeshTriPoint in its representation relative a face; also beware that de-serialization will work only if faces are not renumbered (so please pack mesh before saving)

◆ serializeToJson() [12/22]

MRMESH_API void MR::serializeToJson ( const Plane3f & plane,
Json::Value & root )

◆ serializeToJson() [13/22]

MRMESH_API void MR::serializeToJson ( const PointOnFace & pf,
Json::Value & root )

◆ serializeToJson() [14/22]

MRMESH_API void MR::serializeToJson ( const std::vector< Color > & colors,
Json::Value & root )

◆ serializeToJson() [15/22]

MRMESH_API void MR::serializeToJson ( const std::vector< TextureId > & texturePerFace,
Json::Value & root )

◆ serializeToJson() [16/22]

MRMESH_API void MR::serializeToJson ( const std::vector< UVCoord > & uvCoords,
Json::Value & root )

◆ serializeToJson() [17/22]

MRMESH_API void MR::serializeToJson ( const TriPointf & tp,
Json::Value & root )

◆ serializeToJson() [18/22]

MRMESH_API void MR::serializeToJson ( const Vector2f & vec,
Json::Value & root )

◆ serializeToJson() [19/22]

MRMESH_API void MR::serializeToJson ( const Vector2i & vec,
Json::Value & root )

saves an object into json value

◆ serializeToJson() [20/22]

MRMESH_API void MR::serializeToJson ( const Vector3f & vec,
Json::Value & root )

◆ serializeToJson() [21/22]

MRMESH_API void MR::serializeToJson ( const Vector3i & vec,
Json::Value & root )

◆ serializeToJson() [22/22]

MRMESH_API void MR::serializeToJson ( const Vector4f & vec,
Json::Value & root )

◆ serializeViaVerticesToJson()

MRMESH_API void MR::serializeViaVerticesToJson ( const UndirectedEdgeBitSet & edges,
const MeshTopology & topology,
Json::Value & root )

serialize given edges into json first converting them into pairs of vertices, which is safer when edge ids change after saving/loading, but vertex ids are not