only write custom properties if the Custom option is set
This commit is contained in:
@@ -110,7 +110,7 @@ public:
|
|||||||
FaceTexCoord = 0x0400, ///< Has (r) / store (w) face texture coordinates
|
FaceTexCoord = 0x0400, ///< Has (r) / store (w) face texture coordinates
|
||||||
ColorAlpha = 0x0800, ///< Has (r) / store (w) alpha values for colors
|
ColorAlpha = 0x0800, ///< Has (r) / store (w) alpha values for colors
|
||||||
ColorFloat = 0x1000, ///< Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files)
|
ColorFloat = 0x1000, ///< Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files)
|
||||||
Custom = 0x2000, ///< Has (r) custom properties (currently only implemented in PLY Reader ASCII version)
|
Custom = 0x2000, ///< Has (r) / store (w) custom properties (currently PLY only supports reading and only ASCII version. OM supports reading and writing)
|
||||||
Status = 0x4000, ///< Has (r) / store (w) status properties
|
Status = 0x4000, ///< Has (r) / store (w) status properties
|
||||||
TexCoordST = 0x8000 ///< Write texture coordinates as ST instead of UV
|
TexCoordST = 0x8000 ///< Write texture coordinates as ST instead of UV
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -562,34 +562,35 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
|
|||||||
|
|
||||||
// -------------------- write custom properties
|
// -------------------- write custom properties
|
||||||
|
|
||||||
|
if (_opt.check(Options::Custom))
|
||||||
|
|
||||||
const auto store_property = [this, &_os, swap, &bytes](
|
|
||||||
const BaseKernel::const_prop_iterator _it_begin,
|
|
||||||
const BaseKernel::const_prop_iterator _it_end,
|
|
||||||
const OMFormat::Chunk::Entity _ent)
|
|
||||||
{
|
{
|
||||||
for (auto prop = _it_begin; prop != _it_end; ++prop)
|
const auto store_property = [this, &_os, swap, &bytes](
|
||||||
|
const BaseKernel::const_prop_iterator _it_begin,
|
||||||
|
const BaseKernel::const_prop_iterator _it_end,
|
||||||
|
const OMFormat::Chunk::Entity _ent)
|
||||||
{
|
{
|
||||||
if (!*prop || (*prop)->name().empty() ||
|
for (auto prop = _it_begin; prop != _it_end; ++prop)
|
||||||
((*prop)->name().size() > 1 && (*prop)->name()[1] == ':'))
|
{
|
||||||
{ // skip dead and "private" properties (no name or name matches "?:*")
|
if (!*prop || (*prop)->name().empty() ||
|
||||||
continue;
|
((*prop)->name().size() > 1 && (*prop)->name()[1] == ':'))
|
||||||
|
{ // skip dead and "private" properties (no name or name matches "?:*")
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bytes += store_binary_custom_chunk(_os, **prop, _ent, swap);
|
||||||
}
|
}
|
||||||
bytes += store_binary_custom_chunk(_os, **prop, _ent, swap);
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
store_property(_be.kernel()->vprops_begin(), _be.kernel()->vprops_end(),
|
store_property(_be.kernel()->vprops_begin(), _be.kernel()->vprops_end(),
|
||||||
OMFormat::Chunk::Entity_Vertex);
|
OMFormat::Chunk::Entity_Vertex);
|
||||||
store_property(_be.kernel()->fprops_begin(), _be.kernel()->fprops_end(),
|
store_property(_be.kernel()->fprops_begin(), _be.kernel()->fprops_end(),
|
||||||
OMFormat::Chunk::Entity_Face);
|
OMFormat::Chunk::Entity_Face);
|
||||||
store_property(_be.kernel()->eprops_begin(), _be.kernel()->eprops_end(),
|
store_property(_be.kernel()->eprops_begin(), _be.kernel()->eprops_end(),
|
||||||
OMFormat::Chunk::Entity_Edge);
|
OMFormat::Chunk::Entity_Edge);
|
||||||
store_property(_be.kernel()->hprops_begin(), _be.kernel()->hprops_end(),
|
store_property(_be.kernel()->hprops_begin(), _be.kernel()->hprops_end(),
|
||||||
OMFormat::Chunk::Entity_Halfedge);
|
OMFormat::Chunk::Entity_Halfedge);
|
||||||
store_property(_be.kernel()->mprops_begin(), _be.kernel()->mprops_end(),
|
store_property(_be.kernel()->mprops_begin(), _be.kernel()->mprops_end(),
|
||||||
OMFormat::Chunk::Entity_Mesh);
|
OMFormat::Chunk::Entity_Mesh);
|
||||||
|
}
|
||||||
|
|
||||||
memset(&chunk_header, 0, sizeof(chunk_header));
|
memset(&chunk_header, 0, sizeof(chunk_header));
|
||||||
chunk_header.name_ = false;
|
chunk_header.name_ = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user