From 64e6b79340e254bb3b463b54c5610681a0fe1175 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Feb 2005 10:08:01 +0000 Subject: [PATCH] Changed the Switch::addChild(Node*) behavior so it doesn't override the any pre-exisitng _values value. --- src/osg/Switch.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/osg/Switch.cpp b/src/osg/Switch.cpp index 4ea48b7ec..6db7df0a7 100644 --- a/src/osg/Switch.cpp +++ b/src/osg/Switch.cpp @@ -47,7 +47,17 @@ void Switch::traverse(NodeVisitor& nv) bool Switch::addChild( Node *child ) { - return addChild(child,_newChildDefaultValue); + if (Group::addChild(child)) + { + if (_children.size()>_values.size()) + { + _values.resize(_children.size(),_newChildDefaultValue); + } + // note, we don't override any pre-existing _values[childPosition] setting + // like in addChild(child,value) below. + return true; + } + return false; } bool Switch::addChild( Node *child, bool value )