HI Michael, On Fri, Sep 25, 2009 at 4:02 PM, Michael Platings <[email protected]> wrote: > While working on osgAnimation I've encountered the following problem: if an > object is referenced multiple times in a scene graph, and the scene graph is > deep cloned, the scene graph clone will contain a different copy of that > object for each reference. I think so far this hasn't been a problem because > having multiple copies of most objects doesn't matter other than taking up > extra memory, but in osgAnimation meshes won't animate correctly if they're > not linked to the right bones so this has become an issue. > > A solution to this could be to add a map of old objects to new objects into > CopyOp, and in operator() only call clone() on an object if it hasn't > already been cloned. I've implemented this and it works fine, but before I > start to rely on this, would such a change be acceptable to you?
This change wouldn't be a clone() method, it'd be a shareASingleClone() method which is a totally different thing and in the general case would not be safe or appropriate a replacement for clone(). It sounds to me like osgAnimation's support for cloning is suspect, as one should be able to deep copy a subgraph with an animation and have it still work. If it's not possible then a shallow copy should be enforced. I'm not familiar with the internals of osgAnimation so l'll have to leave this to Cedric to consider. Cheers, Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

