GA_Detail::IOStatus GEO_CobIOTranslator::fileLoad( GEO_Detail *geo, UT_IStream &is, int ate_magic )
{
	((UT_IFStream&)is).close();
	
	ConstVisibleRenderablePtr renderable = 0;
	try
	{
		ReaderPtr reader = Reader::create( is.getLabel() );
		if ( reader->isInstanceOf( ParticleReaderTypeId ) )
		{
			reader->parameters()->parameter<IntParameter>( "realType" )->setNumericValue( ParticleReader::Float );
		}
		
		renderable = runTimeCast<VisibleRenderable>( reader->read() );
	}
	catch ( IECore::Exception e )
	{
		return false;
	}
	
	if ( !renderable )
	{
		return false;
	}
	
	ToHoudiniGeometryConverterPtr converter = ToHoudiniGeometryConverter::create( renderable );
	if ( !converter )
	{
		return false;
	}
	
	GU_DetailHandle handle;
	handle.allocateAndSet( (GU_Detail*)geo, false );
	
	return converter->convert( handle );
}
Exemplo n.º 2
0
GA_Detail::IOStatus GEO_CobIOTranslator::fileLoad( GEO_Detail *geo, UT_IStream &is, int ate_magic )
{
	((UT_IFStream&)is).close();
	
	ConstObjectPtr object = 0;
	try
	{
		ReaderPtr reader = Reader::create( is.getLabel() );
		if ( !reader )
		{
			return false;
		}
		
		object = reader->read();
	}
	catch ( IECore::Exception e )
	{
		return false;
	}
	
	if ( !object )
	{
		return false;
	}
	
	ToHoudiniGeometryConverterPtr converter = ToHoudiniGeometryConverter::create( object.get() );
	if ( !converter )
	{
		return false;
	}
	
	GU_DetailHandle handle;
	handle.allocateAndSet( (GU_Detail*)geo, false );
	
	return converter->convert( handle );
}