bool pathFromSelectionId( GLuint selectionId, ScenePlug::ScenePath &path ) const { path.clear(); const bool result = pathFromSelectionIdWalk( selectionId, path ); std::reverse( path.begin(), path.end() ); return result; }
void ScenePlug::pathToString( const ScenePlug::ScenePath &path, std::string &s ) { if( !path.size() ) { s = "/"; } else { s.clear(); for( ScenePlug::ScenePath::const_iterator it = path.begin(), eIt = path.end(); it != eIt; it++ ) { s += "/" + it->string(); } } }
bool GafferScene::SceneAlgo::exists( const ScenePlug *scene, const ScenePlug::ScenePath &path ) { ScenePlug::PathScope pathScope( Context::current() ); ScenePlug::ScenePath p; p.reserve( path.size() ); for( ScenePlug::ScenePath::const_iterator it = path.begin(), eIt = path.end(); it != eIt; ++it ) { pathScope.setPath( p ); ConstInternedStringVectorDataPtr childNamesData = scene->childNamesPlug()->getValue(); const vector<InternedString> &childNames = childNamesData->readable(); if( find( childNames.begin(), childNames.end(), *it ) == childNames.end() ) { return false; } p.push_back( *it ); } return true; }
bool GafferScene::exists( const ScenePlug *scene, const ScenePlug::ScenePath &path ) { ContextPtr context = new Context( *Context::current(), Context::Borrowed ); Context::Scope scopedContext( context.get() ); ScenePlug::ScenePath p; p.reserve( path.size() ); for( ScenePlug::ScenePath::const_iterator it = path.begin(), eIt = path.end(); it != eIt; ++it ) { context->set( ScenePlug::scenePathContextName, p ); ConstInternedStringVectorDataPtr childNamesData = scene->childNamesPlug()->getValue(); const vector<InternedString> &childNames = childNamesData->readable(); if( find( childNames.begin(), childNames.end(), *it ) == childNames.end() ) { return false; } p.push_back( *it ); } return true; }
bool GafferScene::SceneAlgo::visible( const ScenePlug *scene, const ScenePlug::ScenePath &path ) { ScenePlug::PathScope pathScope( Context::current() ); ScenePlug::ScenePath p; p.reserve( path.size() ); for( ScenePlug::ScenePath::const_iterator it = path.begin(), eIt = path.end(); it != eIt; ++it ) { p.push_back( *it ); pathScope.setPath( p ); ConstCompoundObjectPtr attributes = scene->attributesPlug()->getValue(); const BoolData *visibilityData = attributes->member<BoolData>( "scene:visible" ); if( visibilityData && !visibilityData->readable() ) { return false; } } return true; }
bool GafferScene::visible( const ScenePlug *scene, const ScenePlug::ScenePath &path ) { ContextPtr context = new Context( *Context::current(), Context::Borrowed ); Context::Scope scopedContext( context.get() ); ScenePlug::ScenePath p; p.reserve( path.size() ); for( ScenePlug::ScenePath::const_iterator it = path.begin(), eIt = path.end(); it != eIt; ++it ) { p.push_back( *it ); context->set( ScenePlug::scenePathContextName, p ); ConstCompoundObjectPtr attributes = scene->attributesPlug()->getValue(); const BoolData *visibilityData = attributes->member<BoolData>( "scene:visible" ); if( visibilityData && !visibilityData->readable() ) { return false; } } return true; }