void StandardNodeGadget::setEdgeGadget( Edge edge, GadgetPtr gadget ) { GadgetPtr previous = getEdgeGadget( edge ); if( previous == gadget ) { return; } if( IECore::runTimeCast<Nodule>( gadget ) ) { throw IECore::Exception( "End Gadget can not be a Nodule." ); } LinearContainer *c = noduleContainer( edge ); GadgetPtr spacer = boost::static_pointer_cast<Gadget>( c->children().back() ); c->removeChild( spacer ); if( previous ) { c->removeChild( previous ); } if( gadget ) { c->addChild( gadget ); } c->addChild( spacer ); }
void StandardNodeGadget::setEdgeGadget( Edge edge, GadgetPtr gadget ) { LinearContainer *c = noduleContainer( edge ); c->removeChild( c->getChild<Gadget>( c->children().size() - 1 ) ); c->addChild( gadget ); }