Remove old model When init is called multiple times (i.e. reinit).
Also allow explicit removal of submodel (= init(0) ).
_selector(new osg::Switch),
_transform(new osg::PositionAttitudeTransform)
{
+ _selector->addChild(_transform.get());
}
SGModelPlacement::~SGModelPlacement ()
void
SGModelPlacement::init( osg::Node * model )
{
+ // remove previous model (in case of reinit)
+ _transform->removeChild(0,1);
if (model != 0) {
_transform->addChild(model);
}
- _selector->addChild(_transform.get());
_selector->setValue(0, 1);
}