Hi guys,
Just to let you know that the code supplied by Brede has done the trick. Thanks for all your help, Stu -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brede Johansen Sent: 29 November 2006 23:03 To: osg users Subject: Re: [osg-users] External Reference Problem *** WARNING *** This mail has originated outside your organization, either from an external partner or the Global Internet. Keep this in mind if you answer this message. Hi Stuart, Could you try to replace ReadExternalsVisitor in ReaderWriterFLT.cpp with the code below and give it a try. The magic word (reader option) is "cloneExternalReferences". class ReadExternalsVisitor : public osg::NodeVisitor { bool _cloneExternalReferences; osg::ref_ptr<ReaderWriter::Options> _options; public: ReadExternalsVisitor(ReaderWriter::Options* options) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _options(options), _cloneExternalReferences(false) { if (options) _cloneExternalReferences = (options->getOptionString().find("cloneExternalReferences")!=std::string ::npos); } virtual ~ReadExternalsVisitor() {} virtual void apply(ProxyNode& node) { // Transfer ownership of pools. _options->setUserData( node.getUserData() ); node.setUserData(NULL); for (unsigned int pos=0; pos<node.getNumFileNames(); pos++) { std::string filename = node.getFileName(pos); // read external osg::Node* external = osgDB::readNodeFile(filename,_options.get()); if (external) { if (_cloneExternalReferences) external = dynamic_cast<osg::Node*>(external->clone(osg::CopyOp(osg::CopyOp::DEEP_C OPY_NODES))); node.addChild(external); } } } }; Brede On 11/29/06, Paul Martz <[EMAIL PROTECTED]> wrote: > > > > Does OSG have a similar function? > > > > > > node->clone(osg::CopyOp(...)) > > > > Great! Then I suggest that that is how users will expect flt > > external references to be implemented. Shared instancing using > > multiple parents was used for internal instances and replications, > > but not external instances. > > If you implement this in the OpenFlight loader, could you do so as an > option? The current behavior of multiply parenting a single instance > would be preferable in situations where the ext ref is not to be > dynamically manipulated. > -Paul > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/ ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
