#include "osg/Node" #include "osgDB/Registry" #include "osgDB/Input" #include "osgDB/Output" using namespace osg; using namespace osgDB; // forward declare functions to use later. bool Node_readLocalData(Object& obj, Input& fr); bool Node_writeLocalData(const Object& obj, Output& fw); // register the read and write functions with the osgDB::Registry. RegisterDotOsgWrapperProxy g_NodeProxy ( new osg::Node, "Node", "Object Node", &Node_readLocalData, &Node_writeLocalData ); bool Node_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; Node& node = static_cast(obj); if (fr.matchSequence("name %s")) { node.setName(fr[1].getStr()); fr+=2; iteratorAdvanced = true; } if (fr[0].matchWord("cullingActive")) { if (fr[1].matchWord("FALSE")) { node.setCullingActive(false); iteratorAdvanced = true; fr+=2; } else if (fr[1].matchWord("TRUE")) { node.setCullingActive(true); iteratorAdvanced = true; fr+=2; } } // if (fr.matchSequence("user_data {")) // { // notify(DEBUG) << "Matched user_data {"<entry) // { // Object* object = fr.readObject(); // if (object) setUserData(object); // notify(DEBUG) << "read "<entry) { node.addDescription(fr[0].getStr()); ++fr; } iteratorAdvanced = true; } while (fr.matchSequence("description %s")) { node.addDescription(fr[1].getStr()); fr+=2; iteratorAdvanced = true; } static ref_ptr s_drawstate = new osg::StateSet; if (StateSet* readState = static_cast(fr.readObjectOfType(*s_drawstate))) { node.setStateSet(readState); iteratorAdvanced = true; } return iteratorAdvanced; } bool Node_writeLocalData(const Object& obj, Output& fw) { const Node& node = static_cast(obj); if (!node.getName().empty()) fw.indent() << "name "<<'"'<(_userData); // if (object) // { // fw.indent() << "user_data {"<write(fw); // fw.moveOut(); // fw.indent() << "}"<