Re: [osg-users] Add ancillary data file to an archive
Eduardo Poyart wrote on 2011-03-28: But I can't add an osg::Object to an osg::Group... I want my data to be saved with the scene, so I made it derive from osg::Node and added it to my root group. Unless there is another way? You can add it as user data (see osg::Object::setUserData()) if it is an osg::Object. It looks like user data is serialized. On Mon, Mar 28, 2011 at 11:00 AM, Robert Osfield robert.osfi...@gmail.com wrote: On Mon, Mar 28, 2011 at 6:52 PM, Eduardo Poyart poy...@gmail.com wrote: I did it with the serializers. The document on the Wiki helped a lot. I would be lost without it. The only funny thing is that I had to make my class derive from Node and add it to the scene graph, even though it's not graphics related at all! I don't know the specifics of your case, but serializers work for any object subclassed from osg::Object so there isn't any need to subclass from osg::Node. So if you hadsome custom user data you could subclass from osg::Object and then provide the serializers for this subclass and in theory the serilizers should then output your object. -- Bryan Thrall FlightSafety International bryan.thr...@flightsafety.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add ancillary data file to an archive
I see. That's an alternative. The only thing is if I have more than one I have to serialize my collection class as well. The way I did it so far, by making my data items as osg::Nodes, I could add all of them to the root group and I didn't need to serialize the collection. But I'll think about the alternative. Thanks, much helpful! Eduardo On Tue, Mar 29, 2011 at 6:31 AM, Thrall, Bryan bryan.thr...@flightsafety.com wrote: Eduardo Poyart wrote on 2011-03-28: But I can't add an osg::Object to an osg::Group... I want my data to be saved with the scene, so I made it derive from osg::Node and added it to my root group. Unless there is another way? You can add it as user data (see osg::Object::setUserData()) if it is an osg::Object. It looks like user data is serialized. On Mon, Mar 28, 2011 at 11:00 AM, Robert Osfield robert.osfi...@gmail.com wrote: On Mon, Mar 28, 2011 at 6:52 PM, Eduardo Poyart poy...@gmail.com wrote: I did it with the serializers. The document on the Wiki helped a lot. I would be lost without it. The only funny thing is that I had to make my class derive from Node and add it to the scene graph, even though it's not graphics related at all! I don't know the specifics of your case, but serializers work for any object subclassed from osg::Object so there isn't any need to subclass from osg::Node. So if you hadsome custom user data you could subclass from osg::Object and then provide the serializers for this subclass and in theory the serilizers should then output your object. -- Bryan Thrall FlightSafety International bryan.thr...@flightsafety.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add ancillary data file to an archive
Hi Eduardo, On Sun, Mar 27, 2011 at 11:31 AM, Eduardo Poyart poy...@gmail.com wrote: There seems to be no easy way to do this. I read the Serialization page on the wiki. I decided to go ahead and make my data class derive from Node and write a wrapper for it. Actually the I'd say the serializers are the easy way to do what you want. There are plenty of macro's to help the writing of the wrappers, and all the examples of how to do in the directories in src/osgWrappers/serializers. I've found the wrappers very easy to write, it just take a small learning curve but once you've done one wrapper, it should be pretty straightfoward. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add ancillary data file to an archive
I did it with the serializers. The document on the Wiki helped a lot. I would be lost without it. The only funny thing is that I had to make my class derive from Node and add it to the scene graph, even though it's not graphics related at all! Thanks Eduardo On Mon, Mar 28, 2011 at 12:57 AM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Eduardo, On Sun, Mar 27, 2011 at 11:31 AM, Eduardo Poyart poy...@gmail.com wrote: There seems to be no easy way to do this. I read the Serialization page on the wiki. I decided to go ahead and make my data class derive from Node and write a wrapper for it. Actually the I'd say the serializers are the easy way to do what you want. There are plenty of macro's to help the writing of the wrappers, and all the examples of how to do in the directories in src/osgWrappers/serializers. I've found the wrappers very easy to write, it just take a small learning curve but once you've done one wrapper, it should be pretty straightfoward. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add ancillary data file to an archive
HI Eduardo, On Mon, Mar 28, 2011 at 6:52 PM, Eduardo Poyart poy...@gmail.com wrote: I did it with the serializers. The document on the Wiki helped a lot. I would be lost without it. The only funny thing is that I had to make my class derive from Node and add it to the scene graph, even though it's not graphics related at all! I don't know the specifics of your case, but serializers work for any object subclassed from osg::Object so there isn't any need to subclass from osg::Node. So if you had some custom user data you could subclass from osg::Object and then provide the serializers for this subclass and in theory the serilizers should then output your object. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add ancillary data file to an archive
But I can't add an osg::Object to an osg::Group... I want my data to be saved with the scene, so I made it derive from osg::Node and added it to my root group. Unless there is another way? Eduardo On Mon, Mar 28, 2011 at 11:00 AM, Robert Osfield robert.osfi...@gmail.comwrote: HI Eduardo, On Mon, Mar 28, 2011 at 6:52 PM, Eduardo Poyart poy...@gmail.com wrote: I did it with the serializers. The document on the Wiki helped a lot. I would be lost without it. The only funny thing is that I had to make my class derive from Node and add it to the scene graph, even though it's not graphics related at all! I don't know the specifics of your case, but serializers work for any object subclassed from osg::Object so there isn't any need to subclass from osg::Node. So if you had some custom user data you could subclass from osg::Object and then provide the serializers for this subclass and in theory the serilizers should then output your object. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add ancillary data file to an archive
There seems to be no easy way to do this. I read the Serialization page on the wiki. I decided to go ahead and make my data class derive from Node and write a wrapper for it. On Sat, Mar 26, 2011 at 4:08 PM, Eduardo Poyart poy...@gmail.com wrote: Hello, In my application I need to create a file that consists of essentially an OSGB file plus ancillary data. I have this ancillary data in either an external binary file or an in-memory buffer. I thought I could use osg::Archive to do the archiving and to handle the OSGB data. If I can write a class that derives from osg::Object (called something like AncillaryData) and that implements the interfaces to save/load a memory buffer to an archive, I thought it could fit nicely into the osg::Archive paradigm. AncillaryData would be able to save/load data that is opaque to all of OSG and that is handled only by my application. Would it be a good way to go? Is it better to do it differently? Any pointers? Thanks Eduardo ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Add ancillary data file to an archive
Hello, In my application I need to create a file that consists of essentially an OSGB file plus ancillary data. I have this ancillary data in either an external binary file or an in-memory buffer. I thought I could use osg::Archive to do the archiving and to handle the OSGB data. If I can write a class that derives from osg::Object (called something like AncillaryData) and that implements the interfaces to save/load a memory buffer to an archive, I thought it could fit nicely into the osg::Archive paradigm. AncillaryData would be able to save/load data that is opaque to all of OSG and that is handled only by my application. Would it be a good way to go? Is it better to do it differently? Any pointers? Thanks Eduardo ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org