-Willy
On 9/25/06, Radu Mihai
<[EMAIL PROTECTED]> wrote:
Might be because even SHALLOW_COPY will copy the ref_ptr that references redCube, or any other children. You don't get 2 copies of redCube, that would be what a DEEP_COPY would do in my understanding.You could remove all children pointers after the copy, but that's extra work :)Someone more knowledgeable with clone() could give you the 'normal' behavior.--------------------------Radu Mihai
On 24-Sep-06, at 11:08 PM, Willy P wrote:Hey all,
I'm trying to copy just the data from a node, not it's parents or children pointers. Ie: I want to copy the tranformations from an osg::PAT, not it's entire sub-tree. I'm using the clone function set on SHALLOW_COPY:
osg::ref_ptr< osg::PositionAttitudeTransform > littleSquareResize = new osg::PositionAttitudeTransform;
littleSquareResize.get()->setScale( osg::Vec3( 10.0, 10.0, 11.0 ) );
littleSquareResize.get()->addChild( redCube.get() ); //redCube is an osg::Geode
osg::ref_ptr< osg::PositionAttitudeTransform > anotherResize =
dynamic_cast< osg::PositionAttitudeTransform* >( littleSquareResize.get()->clone( osg::CopyOp::SHALLOW_COPY ) );
if( anotherResize.get()->getChild( 0 ) == littleSquareResize.get()->getChild( 0 ) )
{
std::cout << "they are the same" << std::endl;
return 0;
}
program output:
>they are the same
But what is happening is the child of littleSquareResize ( redCube ) is getting copied during the clone operation. I thought that that's what the DEEP_COPY options would have done but I'm clearly wrong. Can someone tell me where my concept of clone has gone wrong or point me to some docs / tutorials that explain it? Thanks a lot...
-Willy_______________________________________________osg-users mailing list
_______________________________________________
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/
