Python API 2.0 Reference
OpenMayaRender.MVertexBuffer Class Reference
+ Inheritance diagram for OpenMayaRender.MVertexBuffer:

Public Member Functions

def __init__ ()
 
def acquire ()
 
def commit ()
 
def descriptor ()
 
def hasCustomResourceHandle ()
 
def lockResourceHandle ()
 
def map ()
 
def resourceHandle ()
 
def setResourceHandle ()
 
def unload ()
 
def unlockResourceHandle ()
 
def unmap ()
 
def update ()
 
def vertexCount ()
 

Static Public Member Functions

def __new__ ()
 

Detailed Description

Vertex buffer for use with MGeometry.

Constructor & Destructor Documentation

def OpenMayaRender.MVertexBuffer.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMayaRender.MVertexBuffer.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMayaRender.MVertexBuffer.acquire ( )
acquire(size, writeOnly) -> long

Get a pointer to memory for the buffer.

* size (int) - The size of the buffer to acquire.
* writeOnly (bool) - Specified if the returned memory should be uninitialized or filled with actual buffer content.
         When the current buffer content is not needed, it is preferable to set the writeOnly flag to true for better performance.
def OpenMayaRender.MVertexBuffer.commit ( )
commit(long) -> self

Commit the data stored in the memory given by acquire() to the buffer.
If this method is not called, the acquired buffer will not be used in drawing.
The pointer must be the same pointer returned from acquire().
def OpenMayaRender.MVertexBuffer.descriptor ( )
descriptor() -> MVertexBufferDescriptor

Get the the buffer descriptor.
def OpenMayaRender.MVertexBuffer.hasCustomResourceHandle ( )
hasCustomResourceHandle() -> bool

Returns true if this vertex buffer is using a custom resource handle set
by the plugin using MVertexBuffer.setResourceHandle(long, int).
def OpenMayaRender.MVertexBuffer.lockResourceHandle ( )
lockResourceHandle() -> self

Lock the resource handle. The pointer returned from resourceHandle() is
guaranteed to exist between lockResourceHandle() and unlockResourceHandle().

MVertexBuffer may store data in system memory, GPU memory or both. Direct
access to the GPU representation of the data is possible through the
buffer's resourceHandle(). If the GPU representation of the data is to be
directly modified using an external graphics or compute API, then
lockResourceHandle() must be called on the MVertexBuffer once, before any
modifications to the buffer are made.

While a resource handle is locked, any external modifications to the GPU
buffer will be recognized by Maya.

While a resource handle is locked, consolidated world will take longer to
consolidate the corresponding object. After unlocking a resource handle,
consolidated world will take longer to consolidate the corresponding object
one more time, the first time the unlocked resource handle is consolidated.

Calling lockResourceHandle() and unlockResourceHandle() on a custom resource
handle has no effect.

Reallocating or deleting the GPU representation of the data between
lockResourceHandle() and unlockResourceHandle() will result in undefined
behavior. acquire(), commit() and update() may reallocate the GPU representation.
unload() may delete the GPU representation.

map() and unmap() will work if they are called between lockResourceHandle()
and unlockResourceHandle(). They operate on the GPU representation.
def OpenMayaRender.MVertexBuffer.map ( )
map() -> long

Get a read-only pointer to the existing content of the buffer.
Writing new content in this memory block is not supported and can lead to unexpected behavior.
def OpenMayaRender.MVertexBuffer.resourceHandle ( )
resourceHandle() -> long

Returns a long containing a C++ 'float' pointer which points to the graphics device dependent handle to the vertex buffer.
def OpenMayaRender.MVertexBuffer.setResourceHandle ( )
setResourceHandle(long, int) -> self

Set the graphics-device-dependent hardware buffer resource handle.
def OpenMayaRender.MVertexBuffer.unload ( )
unload() -> self

If the buffer is resident in GPU memory, calling this method will move it to system memory and free the GPU memory.
def OpenMayaRender.MVertexBuffer.unlockResourceHandle ( )
unlockResourceHandle() -> self

Unlock the resource handle. The pointer returned from resourceHandle is not
guaranteed to exist any more.
See lockResourceHandle() for more details.
def OpenMayaRender.MVertexBuffer.unmap ( )
unmap() -> self

Release the data exposed by map(). If this method is not called, the buffer will not be recycled.
def OpenMayaRender.MVertexBuffer.update ( )
update(buffer, destOffset, numVerts, truncateIfSmaller) -> self

Set a portion (or all) of the contents of the MVertexBuffer using the data in the provided software buffer.
The internal hardware buffer will be allocated or reallocated to fit if required, according to the vertex size from the descriptor.

* buffer (long) - The input data buffer, starting with the first vertex to copy.
* destOffset (int) - The offset (in vertices) from the beginning of the buffer to start writing to.
* numVerts (int) - The number of vertices to copy.
* truncateIfSmaller (bool) - If true and offset+numVerts is less than the pre-existing size of the buffer,
                 then the buffer contents will be truncated to the new size. Truncating the buffer size
                 will not cause a reallocation and will not lose data before the destOffset.
def OpenMayaRender.MVertexBuffer.vertexCount ( )
vertexCount() -> int

Get the size of the vertex buffer.