Hello all,
I'd like to make Node::_sfVolume a non-internal field and modify the OSB
loader/writer to write it out in certain cases (see attached patch).
If a volume is marked as static or infinite, written to OSB and read
back in that information is lost. I see this when loading from OGRE
.mesh files (which can contain an explicit volume in case the mesh is
animated to contain all motions the mesh goes through) storing to OSB
and loading that back in.
Luckily the OSB format is robust enough that we don't have to bump the
version number - old versions of OpenSG load OSBs written by ones with
the patch applied and the other way around.
Any objections/comments?
Cheers,
Carsten
diff --git a/Source/Base/FieldContainer/Node/OSGNode.cpp
b/Source/Base/FieldContainer/Node/OSGNode.cpp
index f132e40..c505e50 100644
--- a/Source/Base/FieldContainer/Node/OSGNode.cpp
+++ b/Source/Base/FieldContainer/Node/OSGNode.cpp
@@ -106,7 +106,7 @@ void Node::classDescInserter(TypeObject &oType)
"volume",
"Bounding volume for the node.",
OSG_RC_FIELD_DESC(Node::Volume),
- true,
+ false,
Field::SFDefaultFlags,
static_cast<FieldEditMethodSig>(&Node::editHandleVolume),
static_cast<FieldGetMethodSig >(&Node::getHandleVolume ));
diff --git a/Source/System/FileIO/OSB/OSGOSBNodeElement.cpp
b/Source/System/FileIO/OSB/OSGOSBNodeElement.cpp
index 730c2f1..009cbcf 100644
--- a/Source/System/FileIO/OSB/OSGOSBNodeElement.cpp
+++ b/Source/System/FileIO/OSB/OSGOSBNodeElement.cpp
@@ -97,7 +97,7 @@ OSBNodeElement::read(const std::string &typeName)
NodeUnrecPtr node = Node::create();
setContainer(node);
- readFields("'volume'", "");
+ readFields("", "");
}
void
@@ -132,5 +132,14 @@ OSBNodeElement::write(void)
wh->putValue(OSBCommonElement::FCPtrNode);
wh->putValue(getVersion() );
- writeFields("'volume'", true);
+ Node* node = dynamic_cast<Node*>(getContainer());
+ std::string skipFields = "";
+
+ if(node->getVolume().isStatic () == false &&
+ node->getVolume().isInfinite() == false )
+ {
+ skipFields += "'volume'";
+ }
+
+ writeFields(skipFields, true);
}
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core