Show
Ignore:
Timestamp:
06/18/09 12:01:39 (4 years ago)
Author:
robert
Message:

From Cedric Pinson and Robert Osfield, addition of NodeCallbacks? to osg::CopyOp? and osg::Node copy constructor.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/CopyOp.cpp

    r6459 r10362  
    6666 
    6767 
     68NodeCallback* CopyOp::operator() (const NodeCallback* nc) const 
     69{ 
     70    if (nc && _flags&DEEP_COPY_NODECALLBACKS) 
     71    { 
     72        // deep copy the full chain of callback 
     73        osg::NodeCallback* first = dynamic_cast<osg::NodeCallback*>(nc->clone(*this)); 
     74        first->setNestedCallback(0); 
     75        nc = nc->getNestedCallback(); 
     76        while (nc)  
     77        { 
     78            osg::NodeCallback* ucb = dynamic_cast<osg::NodeCallback*>(nc->clone(*this)); 
     79            ucb->setNestedCallback(0); 
     80            first->addNestedCallback(ucb); 
     81            nc = nc->getNestedCallback(); 
     82        } 
     83        return first; 
     84    } 
     85    else 
     86        return const_cast<NodeCallback*>(nc); 
     87}