diff --git a/src/osgPlugins/osg/Node.cpp b/src/osgPlugins/osg/Node.cpp index 0ee128679..ef15f16a9 100644 --- a/src/osgPlugins/osg/Node.cpp +++ b/src/osgPlugins/osg/Node.cpp @@ -59,22 +59,6 @@ bool Node_readLocalData(Object& obj, Input& fr) } } - // if (fr.matchSequence("user_data {")) - // { - // notify(DEBUG) << "Matched user_data {"<< std::endl; - // int entry = fr[0].getNoNestedBrackets(); - // fr += 2; - // - // while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - // { - // Object* object = fr.readObject(); - // if (object) setUserData(object); - // notify(DEBUG) << "read "<(_userData); - // if (object) - // { - // fw.indent() << "user_data {"<< std::endl; - // fw.moveIn(); - // object->write(fw); - // fw.moveOut(); - // fw.indent() << "}"<< std::endl; - // } - // } if (!node.getDescriptions().empty()) { diff --git a/src/osgPlugins/osg/Object.cpp b/src/osgPlugins/osg/Object.cpp index f2c59117b..9eda41c99 100644 --- a/src/osgPlugins/osg/Object.cpp +++ b/src/osgPlugins/osg/Object.cpp @@ -1,4 +1,5 @@ #include "osg/Object" +#include "osg/Notify" #include "osgDB/Registry" #include "osgDB/Input" @@ -42,6 +43,22 @@ bool Object_readLocalData(Object& obj, Input& fr) } } + if (fr.matchSequence("UserData {")) + { + osg::notify(osg::DEBUG_INFO) << "Matched UserData {"<< std::endl; + int entry = fr[0].getNoNestedBrackets(); + fr += 2; + + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + Object* object = fr.readObject(); + if (object) obj.setUserData(object); + osg::notify(osg::DEBUG_INFO) << "read "<(obj.getUserData()); + if (object) + { + fw.indent() << "UserData {"<< std::endl; + fw.moveIn(); + fw.writeObject(*object); + fw.moveOut(); + fw.indent() << "}"<< std::endl; + } + } + return true; }