Example #1
0
void Skeleton::traverseNodes( const NodeRef& node, std::function<void(NodeRef)> visit ) const
{
	visit( node );
	for( NodeRef child : node->getChildren() ) {
		traverseNodes(child, visit);
	}
}
Example #2
0
void cloneTraversal( const NodeRef& origin, NodeRef& copy )
{
	for( const auto& originChild : origin->getChildren() ) {
		NodeRef copyChild = originChild->clone();
		copyChild->setParent( copy );
		copy->addChild( copyChild );
		cloneTraversal( originChild, copyChild );
	}
}
Example #3
0
NodeRef Skeleton::findNode( const std::string& name, const NodeRef& node ) const
{
	if( node->getName() == name ) {
		return node;
	}
	for( const NodeRef& child : node->getChildren() ) {
		NodeRef foundNode = findNode( name, child );
		if (foundNode != nullptr) {
			return foundNode;
		}
	}
	return nullptr;
}