C++ API Reference
|
Introduced in 2020.0 More...
#include <MPanelCanvas.h>
Public Types | |
enum | DrawLayer |
Principal layer values. | |
enum | GraphEditorReservedLayer |
Graph Editor reserved layers. | |
typedef void(* | MDrawUIFunction) (MHWRender::MUIDrawManager &drawMgr, void *userData) |
UI callback function definition. | |
Public Member Functions | |
MPanelCanvas (const MString &panelControlName, MStatus *stat=NULL) | |
Constructor. More... | |
~MPanelCanvas () | |
Destructor. | |
bool | supportsUIDrawing () |
Returns whether the attached panel control supports drawing primitives in screen space. More... | |
bool | isValid () |
Returns true if MPanelCanvas has a valid pointer to a Graph Editor object, false otherwise. More... | |
int | createVertexBuffer (const MTimeArray &xvals, const MFloatArray &yvals, const MColorArray *colors=NULL, MStatus *stat=NULL) |
Create a vertex buffer with time values as the x-coordinate. More... | |
int | createVertexBuffer (const MFloatArray &xvals, const MFloatArray &yvals, const MColorArray *colors=NULL, MStatus *stat=NULL) |
Create a vertex buffer with screen space values as the x and y coordinates. More... | |
int | createPrimitive (MHWRender::MGeometry::Primitive primType, int vertexBufferId, int startIndex, int numVertices, const MDrawProperties &props, MStatus *stat=NULL) |
Create a primitive of the given type using the vertex buffer specified by the given id, the range of vertices used from the buffer, and a drawing style. More... | |
MStatus | addPrimitive (int primId, int layer) |
Add the primitive referred to by the given id to the list of primitives to be drawn at the given layer. More... | |
MStatus | removePrimitive (int primId, int layer) |
Remove the primitive referred to by the given id from the list of primitives to be drawn at the given layer. More... | |
MStatus | destroyPrimitive (int primId) |
Destroy the primitive referred to by the given id. More... | |
MStatus | destroyVertexBuffer (int vertId) |
Destroy the vertex buffer referred to by the given id. More... | |
MStatus | refresh () |
Force the associated Graph Editor to refresh. More... | |
MStatus | setAutoRefresh (bool enable) |
Set whether the associated editor will be automatically refreshed. More... | |
bool | isAutoRefresh () |
Introduced in 2022.0 More... | |
MStatus | setLayerVisible (int layer, bool isVisible) |
Set whether the given layer will be drawn. More... | |
bool | isLayerVisible (int layer, MStatus *stat=NULL) |
Return whether the given layer is visible. More... | |
int | registerDrawUICallback (int layer, MDrawUIFunction func, void *clientData=NULL, MStatus *returnStatus=NULL) |
Register a callback to be called when the given panel is drawing the given layer. More... | |
void | unregisterDrawUICallback (int callbackId, MStatus *returnStatus=NULL) |
Unregister the callback specified by the given id. More... | |
Introduced in 2020.0
Custom Panel user drawing capabilities for supported panels
This class provides methods for a user to draw additional primitives to a supporting control. The user can construct this class from the name of a panel which supports such drawing.
MPanelCanvas | ( | const MString & | editorName, |
MStatus * | ReturnStatus = NULL |
||
) |
Constructor.
Attaches to the Graph Editor corresponding the supplied name.
[in] | editorName | the name of the Graph Editor (i.e. graphEditor1GraphEd) |
[out] | ReturnStatus | the return status |
bool supportsUIDrawing | ( | ) |
Returns whether the attached panel control supports drawing primitives in screen space.
If such drawing is not supported, the registerDrawUICallback () method will return MStatus::kNotImplemented.
Note that for the Graph Editor, if the panel for drawing has not yet been created (e.g., when the default Graph Editor has not yet been opened), this method will return false.
bool isValid | ( | ) |
Returns true if MPanelCanvas has a valid pointer to a Graph Editor object, false otherwise.
int createVertexBuffer | ( | const MTimeArray & | tVals, |
const MFloatArray & | yVals, | ||
const MColorArray * | cVals = NULL , |
||
MStatus * | stat = NULL |
||
) |
Create a vertex buffer with time values as the x-coordinate.
An id referring to the created buffer is returned.
[in] | tVals | Array of time values |
[in] | yVals | Array of y values |
[in] | cVals | Array of colors |
[out] | stat | Status code |
int createVertexBuffer | ( | const MFloatArray & | xVals, |
const MFloatArray & | yVals, | ||
const MColorArray * | cVals = NULL , |
||
MStatus * | stat = NULL |
||
) |
Create a vertex buffer with screen space values as the x and y coordinates.
An id referring to the created buffer is returned.
[in] | xVals | Array of screen space x values |
[in] | yVals | Array of screen space y values |
[in] | cVals | Array of colors |
[out] | stat | Status code |
int createPrimitive | ( | MHWRender::MGeometry::Primitive | primType, |
int | bufferId, | ||
int | startIndex, | ||
int | numVertices, | ||
const MDrawProperties & | props, | ||
MStatus * | stat = NULL |
||
) |
Create a primitive of the given type using the vertex buffer specified by the given id, the range of vertices used from the buffer, and a drawing style.
An id referring to the created primitive is returned.
[in] | primType | Primitive type |
[in] | bufferId | Id of vertex buffer to use |
[in] | startIndex | Index of first vertex in buffer |
[in] | numVertices | Number of vertices in the primitive, starting at startIndex |
[in] | props | Draw properties of the primitive, where applicable |
[out] | stat | Status code |
MStatus addPrimitive | ( | int | primitiveId, |
int | layerId | ||
) |
Add the primitive referred to by the given id to the list of primitives to be drawn at the given layer.
[in] | primitiveId | Id of the primitive being added |
[in] | layerId | Id of the layer to which the primitive is being added |
MStatus removePrimitive | ( | int | primitiveId, |
int | layerId | ||
) |
Remove the primitive referred to by the given id from the list of primitives to be drawn at the given layer.
The primitive will not be destroyed.
[in] | primitiveId | Id of the primitive being removed |
[in] | layerId | Id of the layer from which the primitive is being removed |
MStatus destroyPrimitive | ( | int | primitiveId | ) |
Destroy the primitive referred to by the given id.
A primitive can only be destroyed if it is not present in any of the layers.
[in] | primitiveId | Id of the primitive being removed |
MStatus destroyVertexBuffer | ( | int | bufferId | ) |
Destroy the vertex buffer referred to by the given id.
If the buffer is being used by a primitive, an error will be generated.
[in] | bufferId | Id of vertex buffer to destroy. |
MStatus refresh | ( | ) |
Force the associated Graph Editor to refresh.
MStatus setAutoRefresh | ( | bool | enable | ) |
Set whether the associated editor will be automatically refreshed.
Initially, automatic refresh is enabled.
[in] | enable | Enables auto refresh if True, disable otherwise |
bool isAutoRefresh | ( | ) |
Introduced in 2022.0
Returns whether the associated editor will automatically refresh.
MStatus setLayerVisible | ( | int | layerId, |
bool | isVisible | ||
) |
Set whether the given layer will be drawn.
All layers are initially set to be visible. Only user defined layers may have their visibility set.
[in] | layerId | Id of the layer to be made visible or invisible |
[in] | isVisible | If true, the layer is made visible, otherwise invisible |
bool isLayerVisible | ( | int | layerId, |
MStatus * | stat = NULL |
||
) |
Return whether the given layer is visible.
[in] | layerId | Id of the layer to be made visible or invisible |
[out] | stat | Status code |
int registerDrawUICallback | ( | int | layerId, |
MDrawUIFunction | cb, | ||
void * | clientData = NULL , |
||
MStatus * | stat = NULL |
||
) |
Register a callback to be called when the given panel is drawing the given layer.
An id to the callback is returned.
[in] | layerId | Id of the layer to be made visible or invisible |
[in] | cb | Callback function to be registerd |
[in] | cliendData | Data to be passed to callback when it is invoked |
[out] | stat | Status code |
void unregisterDrawUICallback | ( | int | callbackId, |
MStatus * | stat = NULL |
||
) |
Unregister the callback specified by the given id.
[in] | callbackId | Id of the callback being removed |
[out] | stat | Status code |