Пример #1
0
bool SceneCacheNode<BaseType>::tagged( const IECore::SceneInterface *scene, const UT_StringMMPattern &filter )
{
	SceneInterface::NameList tags;
	scene->readTags( tags );
	for ( SceneInterface::NameList::const_iterator it=tags.begin(); it != tags.end(); ++it )
	{
		if ( UT_String( *it ).multiMatch( filter ) )
		{
			return true;
		}
	}
	
	// an empty list should be equivalent to matching an empty string
	if ( tags.empty() && UT_String( "" ).multiMatch( filter ) )
	{
		return true;
	}
	
	return false;
}
OBJ_Node *OBJ_SceneCacheTransform::doExpandChild( const SceneInterface *scene, OP_Network *parent, const Parameters &params )
{
	OP_Node *opNode = parent->createNode( OBJ_SceneCacheTransform::typeName, scene->name().c_str() );
	OBJ_SceneCacheTransform *xform = reinterpret_cast<OBJ_SceneCacheTransform*>( opNode );

	xform->referenceParent( pFile.getToken() );
	xform->setPath( scene );
	xform->setSpace( Local );
	xform->setGeometryType( (OBJ_SceneCacheTransform::GeometryType)params.geometryType );
	xform->setAttributeFilter( params.attributeFilter );
	xform->setAttributeCopy( params.attributeCopy );
	xform->setShapeFilter( params.shapeFilter );
	xform->setFullPathName( params.fullPathName );
	xform->setInt( pHierarchy.getToken(), 0, 0, params.hierarchy );
	xform->setInt( pDepth.getToken(), 0, 0, params.depth );

	SceneInterface::NameList children;
	scene->childNames( children );
	if ( children.empty() && !scene->hasObject() )
	{
		xform->setInt( pExpanded.getToken(), 0, 0, 1 );
	}

	if ( tagged( scene, params.tagFilter ) )
	{
		xform->setTagFilter( params.tagFilterStr );
	}
	else
	{
		xform->setDisplay( false );
	}

	if ( params.hierarchy == SubNetworks )
	{
		xform->setIndirectInput( 0, parent->getParentInput( 0 ) );
	}

	return xform;
}