Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 129
ExamplesMayaVertCache
Ben Toogood edited this page Jun 13, 2013
·
3 revisions
This simple example demonstrates the export of animation to a vertex cache using cortex. It can be used to generate vertex caches which can be used with the ExamplesProceduralsAnimatedMesh. It shows how to use the FileSequence and AttributeCache classes as well as how to convert maya objects to cortex objects.
importosimportmaya.cmdsimportIECoreimportIECoreMayadefwriteVertexCaches( meshes, destinationFileSequence ) :
destinationDirectory=os.path.dirname( str( destinationFileSequence ) )
ifnotos.path.exists( destinationDirectory ) :
os.makedirs( destinationDirectory )
forframeNumberindestinationFileSequence.frameList.asList() :
maya.cmds.currentTime( frameNumber )
attributeCache=IECore.AttributeCache( destinationFileSequence.fileNameForFrame( frameNumber*250 ), IECore.IndexedIOOpenMode.Write )
formeshinmeshes :
converter=IECoreMaya.FromMayaShapeConverter.create( mesh )
converter["space"].setValue( "World" )
points=converter.points()
bound=IECore.PointBoundsOp()( points=points )
attributeCache.write( mesh, "vertCache.P", points )
attributeCache.write( mesh, "vertCache.boundingBox", bound )
allMeshes=maya.cmds.ls( selection=True, noIntermediate=True, dag=True, type="mesh" )
writeVertexCaches( allMeshes, IECore.FileSequence( "/tmp/myCaches/cache.######.fio", IECore.FrameRange( 1, 50 ) ) )
- Introduction
- General Functionality
- Data Handling
- Parameters and Ops
- Point Primitives
- Mesh Primitives
- Image Primitives
- Procedurals
- Cortex & Python
- Cortex & Maya
- Cortex & Houdini