void HoudiniScene::calculatePath( const Path &contentPath, const Path &rootPath ) { OP_Node *node = retrieveNode(); if ( node->isManager() ) { return; } UT_String tmp( m_nodePath ); UT_WorkArgs workArgs; tmp.tokenize( workArgs, "/" ); OP_Node *current = dynamic_cast<MOT_Director *>( OPgetDirector() )->getObjectManager(); // skipping the token for the OBJ manager for ( int i = 1; i < workArgs.getArgc(); ++i ) { current = current->getChild( workArgs[i] ); /// recursively collect all input connections OP_Node *parent = current->getInput( 0 ); UT_StringArray parentNames; while ( parent ) { parentNames.append( parent->getName() ); parent = parent->getInput( 0 ); } // add them in reverse order for ( int j = parentNames.entries() - 1; j >= 0; --j ) { m_path.push_back( Name( parentNames( j ) ) ); } if ( ( i < workArgs.getArgc() - 1 ) || Name( workArgs[i] ) != contentName ) { m_path.push_back( Name( workArgs[i] ) ); } } if ( !contentPath.empty() ) { m_contentIndex = m_path.size(); m_path.resize( m_path.size() + contentPath.size() ); std::copy( contentPath.begin(), contentPath.end(), m_path.begin() + m_contentIndex ); } if ( m_path.size() < rootPath.size() ) { std::string pStr, rStr; pathToString( m_path, pStr ); pathToString( rootPath, rStr ); throw Exception( "IECoreHoudini::HoudiniScene: Path \"" + pStr + "\" is not a valid child of root \"" + rStr + "\"." ); } for ( size_t i = 0; i < rootPath.size(); ++i ) { if ( rootPath[i] != m_path[i] ) { std::string pStr, rStr; pathToString( m_path, pStr ); pathToString( rootPath, rStr ); throw Exception( "IECoreHoudini::HoudiniScene: Path \"" + pStr + "\" is not a valid child of root \"" + rStr + "\"." ); } } m_rootIndex = rootPath.size(); }