From b37d6b19211d22bb449179f40d64b5bc0bedb68c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Nov 2014 17:17:11 +0000 Subject: [PATCH] Added testing for Drawables in the CopyOp::operator(Node*) to replicate the old functionality. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14518 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/CopyOp.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/osg/CopyOp.cpp b/src/osg/CopyOp.cpp index 50e801d57..9c28c0f29 100644 --- a/src/osg/CopyOp.cpp +++ b/src/osg/CopyOp.cpp @@ -33,7 +33,6 @@ TYPE* CopyOp::operator() (const TYPE* obj) const \ } COPY_OP( Object, DEEP_COPY_OBJECTS ) -COPY_OP( Node, DEEP_COPY_NODES ) COPY_OP( StateSet, DEEP_COPY_STATESETS ) COPY_OP( Image, DEEP_COPY_IMAGES ) COPY_OP( Uniform, DEEP_COPY_UNIFORMS ) @@ -49,6 +48,16 @@ Referenced* CopyOp::operator() (const Referenced* ref) const return const_cast(ref); } +Node* CopyOp::operator() (const Node* node) const +{ + if (!node) return 0; + + const Drawable* drawable = node->asDrawable(); + if (drawable) return operator()(drawable); + else if (_flags&DEEP_COPY_NODES) return osg::clone(node, *this); + else return const_cast(node); +} + StateAttribute* CopyOp::operator() (const StateAttribute* attr) const { if (attr && _flags&DEEP_COPY_STATEATTRIBUTES)