Python API 2.0 Reference
|
Public Member Functions | |
def | __init__ () |
def | arc () |
def | arc2d () |
def | beginDrawInXray () |
def | beginDrawable () |
def | box () |
def | capsule () |
def | circle () |
def | circle2d () |
def | cone () |
def | cylinder () |
def | depthPriority () |
def | endDrawInXray () |
def | endDrawable () |
def | icon () |
def | line () |
def | line2d () |
def | lineList () |
def | lineStrip () |
def | mesh () |
def | mesh2d () |
def | point () |
def | point2d () |
def | points () |
def | rect () |
def | rect2d () |
def | setColor () |
def | setColorIndex () |
def | setDepthPriority () |
def | setFontIncline () |
def | setFontLine () |
def | setFontName () |
def | setFontSize () |
def | setFontStretch () |
def | setFontWeight () |
def | setLineStyle () |
def | setLineWidth () |
def | setPaintStyle () |
def | setPointSize () |
def | setTexture () |
def | setTextureMask () |
def | setTextureSampler () |
def | sphere () |
def | text () |
def | text2d () |
Static Public Member Functions | |
def | __new__ () |
def | getFontList () |
def | getIconNames () |
Main interface for drawing basic UI drawables in Viewport 2.0 and Hardware Renderer 2.0.
def OpenMayaRender.MUIDrawManager.__init__ | ( | ) |
Initialize self. See help(type(self)) for accurate signature.
|
static |
Create and return a new object. See help(type) for accurate signature.
def OpenMayaRender.MUIDrawManager.arc | ( | ) |
arc(center, start, end, normal, radius, numSubdivisions, filled) -> selfarc(center, start, end, normal, radius, filled=False) -> self Draw an arc. The arc is within the plane determined by a normal vector. The arc sweeps in CCW from the vector that is the projection of the given start vector onto the arc plane, and ends at the vector that is the projection of the given end vector onto the arc plane. * center (MPoint) - Center of the arc. * start (MVector) - Start vector, its projection onto the arc plane is the start of the arc. * end (MVector) - End vector, its projection onto the arc plane is the end of the arc. * normal (MVector) - Normal vector of the arc plane. * radius (float) - Radius of the arc. * subdivisions (int) - Number of subdivisions of the arc. * filled (bool) - If true the arc will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.arc2d | ( | ) |
arc2d(center, start, end, radius, numSubdivisions, filled) -> selfarc2d(center, start, end, radius, filled=False) -> self Draw a 2D arc on the screen. The arc is always facing the camera. The arc sweeps in CCW from the start vector and ends at the end vector. * center (MPoint) - Center of the arc, only x-y components(in pixels) are used. * start (MVector) - Start vector, only x-y components are used. * end (MVector) - End vector, only x-y components are used. * radius (float) - Radius(in pixels) of the arc. * subdivisions (int) - Number of subdivisions of the arc. * filled (bool) - If true the arc will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.beginDrawable | ( | ) |
beginDrawable(selectability = kAutomatic, selectionName = 0) -> self Resets all draw state, such as color and line style, to defaults and indicates the start of a sequence of drawing operations. All drawing operations must take place between calls to beginDrawable() and endDrawable(). The behavior when calling with no (default) parameters depends on the context: - In MPxManipulatorNode.drawUI() context, the geometries will be marked as unselectable. - In any other context, like MPxDrawOverride.addUIDrawables(), the geometries will be marked as selectable and can be used for shape selection.Provide parameters (kSelectable, selectionName) with manipulators to specify they are selectable and their selection handle names. Provide kNonSelectable as selectability to specify locators are not selectable. * selectability (int) - Selectability of the handle to be drawn. kNonSelectable Geometries cannot be used for selection kSelectable Use geometries for selection kAutomatic Use geometries for selection when not in manipulator context * selectionName (int) - Selection name for manipulators, usually derived from MPxManipulatorNode.glFirstHandle().
def OpenMayaRender.MUIDrawManager.beginDrawInXray | ( | ) |
beginDrawInXray() -> self The drawables to be drawn between calls to beginDrawInXray() and endDrawInXray() will display on the top of other geometries in the scene, as the depth test is disabled for these drawables. These methods can be used to drawing objects such as locators. Note only the drawables meet following conditions would be affected by these two APIs. 1. Created by method MUIDrawManager::mesh(); 2. The first input parameter in MUIDrawManager::mesh() must be one of kTriangles, kLines and kPoints. Any other drawables to be drawn between calls to beginDrawInXray() and endDrawInXray() would display as normal. If several meshes are drawn between these two APIs, occlusion order is decided by their specification order.
def OpenMayaRender.MUIDrawManager.box | ( | ) |
box(center, up, right, scaleX=1.0, scaleY=1.0, scaleZ=1.0, filled=False) -> self Draw a box. * center (MPoint) - Center position for the box. * up (MVector) - The top of the box will be facing this direction. * right (MVector) - The side of the box will be facing this direction. * scaleX (float) - X size of the box. * scaleY (float) - Y size of the box. * scaleZ (float) - Z size of the box. * filled (bool) - If true the box will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.capsule | ( | ) |
capsule(center, up,radius, height, subdivisionsAxis, subdivisionsHeight, filled=False) -> self Draw a capsule. * center (MPoint) - Center position for the capsule. * up (MVector) - Direction of the Up vector. * radius (float) - Radius of the capsule. * height (float) - Height of the capsule. * subdivisionsAxis (int) - Subdivisions along the main axis. * subdivisionsHeight (int) - Subdivisions along height. * filled (bool) - If true the capsule will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.circle | ( | ) |
circle(center, normal, radius, numSubdivision, filled) -> selfcircle(center, normal, radius, filled=False) -> self Draw a circle. The circle is drawn within the plane determined by a normal vector. * center (MPoint) - Center of the circle. * normal (MVector) - Normal vector of the circle plane. * radius (float) - Radius of the circle. * numSubdivision (int) - Number of Subdivisions for the circle. * filled (bool) - If true the circle will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.circle2d | ( | ) |
circle2d(center, radius, numSubdivision, filled) -> selfcircle2d(center, radius, filled=False) -> self Draw a 2D circle on the screen. The circle is always facing the camera. * center (MPoint) - Center of the circle, only x-y components(in pixels) are used. * radius (float) - Radius(in pixels) of the circle. * numSubdivision (int) - Number of Subdivisions for the circle. * filled (bool) - If true the circle will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.cone | ( | ) |
cone(base, direction, radius, height, subdivisionsCap, filled) -> selfcone(base, direction, radius, height, filled=False) -> self Draw a cone. * base (MPoint) - Base position for the cone. * direction (MVector) - The cone's tip will point in this direction. * radius (float) - Radius of the cone. * height (float) - Height of the cone. * subdivisionsCap (int) - Number of subdivisions of the cap. * filled (bool) - If true the cone will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.cylinder | ( | ) |
cylinder(center, up, radius, height, subdivisionsAxis, filled=False) -> self Draw a cylinder. * center (MPoint) - Center position for the cylinder. * up (MVector) - Direction of the Up vector. * radius (float) - Radius of the cylinder. * height (float) - Height of the cylinder. * subdivisionsAxis (int) - Number of subdivisions along the main axis. * filled (bool) - If true the cylinder will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.depthPriority | ( | ) |
depthPriority() -> int Get the current depth priority value for primitive drawing. If the method failed to execute a value of 0 will be returned.
def OpenMayaRender.MUIDrawManager.endDrawable | ( | ) |
endDrawable() -> self Indicates the end of a sequence of drawing operations. All internal drawing state, such as color and line style, are reset to defaults.
def OpenMayaRender.MUIDrawManager.endDrawInXray | ( | ) |
endDrawInXray() -> self Pair with beginDrawInXray().
|
static |
getFontList() -> list of strings Get the names of all font faces that are available on current system. The names can then be used for MUIDrawManager::setFontName().
|
static |
getIconNames() -> list of strings Get list of icon names. The names can be used for drawing icons using the MUIDrawManager::icon() method.
def OpenMayaRender.MUIDrawManager.icon | ( | ) |
icon(position, name, scale)) -> self Draw an icon at a given 3d position. * position (MPoint) - 3d location of the icon.. * name (MString) - The name of an icon. The list of available icon names can be found using the MUIDrawManager::getIconNames() method. * scale (float) - Uniform scaling factor for the icon.
def OpenMayaRender.MUIDrawManager.line | ( | ) |
line(startPoint, endPoint) -> self Draw a straight line between two points. * startPoint (MPoint) - The start point of the line. * endPoint (MPoint) - The end point of the line.
def OpenMayaRender.MUIDrawManager.line2d | ( | ) |
line2d(startPoint, endPoint) -> self Draw a straight line between two points. * startPoint (MPoint) - The start point of the line, only x-y components(in pixels) are used. * endPoint (MPoint) - The end point of the line, only x-y components(in pixels) are used.
def OpenMayaRender.MUIDrawManager.lineList | ( | ) |
lineList(points, draw2D) -> self Draw a series of line segments in 3D or 2D. * points (MPointArray) - Array of point positions. Pairs of points are interpreted as line segments. If an odd number of points is specified then the last point will not be drawn, as it does not form a line segment. * draw2D (bool) Draw in 2D or 3D.
def OpenMayaRender.MUIDrawManager.lineStrip | ( | ) |
lineStrip(points, draw2D) -> self Draw a series of connected line segments in 3D or 2D * points (MPointArray) - Array of point positions. Each point in the array is connected to form a line strip. * draw2D (bool) Draw in 2D or 3D.
def OpenMayaRender.MUIDrawManager.mesh | ( | ) |
mesh(mode, position, normal=None, color=None, index=None, texcoord=None) -> self Draw custom geometric shapes from an array of vertices. If the optional normal or color arrays are provided they must contain a single value per element of the positions array (i.e. all three arrays must be the same length). The optional index array specifies the order in which the vertex positions (and their corresponding normals and colors) should be drawn. Vertices can be reused by having their indices appear multiple times, so the index array may be longer (or shorter) than the other three arrays. If the index array is not provided then the vertices will be drawn in the order in which they appear in the positions array. * mode (int) - Primitive mode kPoints Point list kLines Line list kLineStrip Line strip kClosedLine Closed line kTriangles Triangle list kTriStrip Triangle strip * position (MPointArray) - List of the vertex positions. * normal (MVectorArray) - List of the vertex normals. * color (MColorArray) - List of the vertex colors. * index (MUintArray) - List of the vertex indices. * texcoord (MPointArray) - List of the vertex texture coordinates.
def OpenMayaRender.MUIDrawManager.mesh2d | ( | ) |
mesh2d(mode, position, color=None, index=None, texcoord=None) -> self Draw custom 2d geometric shapes from an array of vertices. If the optional color arrays are provided they must contain a single value per element of the positions array (i.e. both arrays must be the same length). The optional index array specifies the order in which the vertex positions (and their corresponding colors) should be drawn. Vertices can be reused by having their indices appear multiple times, so the index array may be longer (or shorter) than the other two arrays. If the index array is not provided then the vertices will be drawn in the order in which they appear in the positions array. * mode (int) - Primitive mode kPoints Point list kLines Line list kLineStrip Line strip kClosedLine Closed line kTriangles Triangle list kTriStrip Triangle strip * position (MPointArray) - List of the vertex positions, only x-y components of the point are used. * color (MColorArray) - List of the vertex colors. * index (MUintArray) - List of the vertex indices. * texcoord (MPointArray) - List of the vertex texture coordinates.
def OpenMayaRender.MUIDrawManager.point | ( | ) |
point(point) -> self Draw a point. * point (MPoint) - Position of the point.
def OpenMayaRender.MUIDrawManager.point2d | ( | ) |
point2d(point) -> self Draw a point. * point (MPoint) - Position of the point, only x-y components(in pixels) are used.
def OpenMayaRender.MUIDrawManager.points | ( | ) |
points(points, draw2D) -> self Draw a series of points in 3D or 2D. * points (MPointArray) - Array of point positions. * draw2D (bool) Draw in 2D or 3D.
def OpenMayaRender.MUIDrawManager.rect | ( | ) |
rect(center, up, normal, scaleX, scaleY, filled=False) -> self Draw a rectangle. The rectangle is within the plane determined by a normal vector, and a up vector is given to determine the X-Y direction. * center (MPoint) - Center of the rectangle. * up (MVector) - Up vector of the rectangle. * normal (MVector) - Normal vector of the rectangle plane. * scaleX (float) - Scale factor in X-direction. * scaleY (float) - Scale factor in Y-direction. * filled (bool) - If true the rectangle will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.rect2d | ( | ) |
rect2d(center, up, scaleX, scaleY, filled=False) -> self Draw a 2D rectangle on the screen. The rectangle is always facing the camera, and a up vector is given to determine the X-Y direction * center (MPoint) - Center of the rectangle, only x-y components(in pixels) are used. * up (MVector) - Up vector of the rectangle, only x-y components are used. * scaleX (float) - Scale factor in X-direction. * scaleY (float) - Scale factor in Y-direction. * filled (bool) - If true the rectangle will be filled otherwise it will just be drawn as an outline.
def OpenMayaRender.MUIDrawManager.setColor | ( | ) |
setColor(color) -> self Set the draw color. This will remain in effect until the next call to setColor(), setColorIndex() or endDrawable(). For text this color will be used as the foreground color. Background color can be specified directly in the call to text(). Default: (0.7, 0.7, 0.7, 1)
def OpenMayaRender.MUIDrawManager.setColorIndex | ( | ) |
setColorIndex(index) -> self Set the color index for the later primitive and text drawing. For default, it will use (0.7, 0.7, 0.7, 1) as default color. * index (int) - Color index
def OpenMayaRender.MUIDrawManager.setDepthPriority | ( | ) |
setDepthPriority(priority) -> self Set the depth priority for primitive drawing. The MRenderItem class lists some sample internal priorities which may be used. * priority (int) - Depth priority.
def OpenMayaRender.MUIDrawManager.setFontIncline | ( | ) |
setFontIncline(fontIncline) -> self Set the incline of font to be used when drawing text. * fontIncline (int) - The font incline to use.
def OpenMayaRender.MUIDrawManager.setFontLine | ( | ) |
setFontLine(fontLine) -> self Set the line of font to be used when drawing text. * fontLine (int) - The font line to use.
def OpenMayaRender.MUIDrawManager.setFontName | ( | ) |
setFontName(faceName) -> self Set the face name of font to be used when drawing text. * faceName (string) - The font face name(case-insensitive) to use, All system font faces are supported. "helvetica" is the default for invalid input.
def OpenMayaRender.MUIDrawManager.setFontSize | ( | ) |
setFontSize(fontSize) -> self Set the size of font to be used when drawing text. * fontSize (int) - The font height(in pixel) to use.
def OpenMayaRender.MUIDrawManager.setFontStretch | ( | ) |
setFontStretch(fontStretch) -> self Set the stretch of font to be used when drawing text. * fontStretch (int) - The font stretch to use.
def OpenMayaRender.MUIDrawManager.setFontWeight | ( | ) |
setFontWeight(fontWeight) -> self Set the weight of font to be used when drawing text. * weight (int) - The font weight to use.
def OpenMayaRender.MUIDrawManager.setLineStyle | ( | ) |
setLineStyle(style) -> self setLineStyle(factor, pattern) -> self Set the line style for the primitive drawing (line, rect, box...) * style (int) - Line style type. kSolid Solid line kShortDotted Short Dotted line kShortDashed Short dashed line kDashed Dashed line kDashed Dotted line Or set the dashed line pattern for the primitive drawing (line, rect, box...) * factor (int) - a multiplier for each bit in the line stipple pattern. * pattern (int) - a bit pattern indicating which fragments of a line will be drawn
def OpenMayaRender.MUIDrawManager.setLineWidth | ( | ) |
setLineWidth(value) -> self Set the line width for the primitive drawing (line, rect, box...) * value (float) - Line width in pixels.
def OpenMayaRender.MUIDrawManager.setPaintStyle | ( | ) |
setPaintStyle(style) -> self Set the paint style for filled primitive drawing. * style (int) - Paint style type. kFlat Solid kStippled Stippled kShaded Shaded with lighting
def OpenMayaRender.MUIDrawManager.setPointSize | ( | ) |
setPointSize(value) -> self Set the point size for the point drawing. * value (float) - Point size in pixels.
def OpenMayaRender.MUIDrawManager.setTexture | ( | ) |
setTexture(texture) -> self Set the active texture to apply when drawing a mesh. This will remain in effect until the next call to setTexture(). * texture (MTexture) - The texture which will affect the later drawing.
def OpenMayaRender.MUIDrawManager.setTextureMask | ( | ) |
setTextureMask(mask) -> self Set the channel mask to used when applying a texture to a mesh. This will remain in effect until the next call to setTextureMask(). Fails when mask is not supported. * mask (int) - The channel mask which will affect the later drawing. Currently, only MBlendState.kRGBAChannels, MBlendState.kRGBChannels and MBlendState.kAlphaChannel are supported.
def OpenMayaRender.MUIDrawManager.setTextureSampler | ( | ) |
setTextureSampler(filter, address) -> self Set the filter and address mode used when applying a texture to a mesh. This will remain in effect until the next call to setTextureSampler(). Fails when filter and address combination is not supported. * filter (int) - The filter which will affect the later drawing. Currently, only MSamplerState.kMinMagMipPoint and MSamplerState.kMinMagMipLinear are supported. * address (int) - The canonical range which will affect the later drawing. Currently, only MSamplerState.kTexWrap and MSamplerState.kTexClamp are supported.
def OpenMayaRender.MUIDrawManager.sphere | ( | ) |
sphere(center, radius, subdivisionsAxis, subdivisionsHeight, filled=False) -> selfsphere(center, radius, filled=False) -> self Draw a sphere. * center (MPoint) - Center of the sphere. * radius (float) - Radius of the sphere. * subdivisionsAxis (int) - Number of subdivisions along main axis. * subdivisionsHeight (int) - Number of subdivisions along height. * filled (bool) - If true the sphere will be filled otherwise it will just be drawn as a wireframe.
def OpenMayaRender.MUIDrawManager.text | ( | ) |
text(position, text, alignment=kLeft, backgroundSize=None, backgroundColor=None, dynamic=False) -> self Draw a screen facing and horizontal aligned text in viewport 2.0. It has a fixed size in screen space. * position (MPoint) - Position of the text to be drawn, it is 3d object space. * text (string) - Content of the text string. * alignment (TextAlignment) - Alignment of the text. - "kLeft", background box's left bottom will be located at "position". In width direction, text area will be aligned to the left side of background. In height direction, text are will be aligned in the middle of background. - "kCenter", background box' center bottom will be located at "position". Text area's center and background box's center will be the same point. - "kRight", background box's right bottom will be located at "position". In width direction, text area will be aligned to the right side of background. In height direction, text are will be aligned in the middle of background. * backgroundSize ([int, int]) - The background box size of the text. Default is None, in this case there will be no background, just shows the text. If it is specified with smaller size than text, the text will be clipped. It is a int array with size 2, like "backgroundSize = [ width, height ]" Size unit is the screen pixel. * backgroundColor (MColor) - The color of the background, it can be transparent. If None is passed, background will be fully transparent. * dynamic (bool) - This is mostly used for performance. If the text draw is not changed frequently, we can leave it as default value false. If the text draw is changing very often like it is showing some dynamic numbers, in this case making dynamic true will give better performance.
def OpenMayaRender.MUIDrawManager.text2d | ( | ) |
text2d(position, text, alignment=kLeft, backgroundSize=None, backgroundColor=None, dynamic=False) -> self Draw a text on the screen. * position (MPoint) - Position of the text to be drawn, it is in screen space, only x-y components are used. * text Content of the text string. * alignment (TextAlignment) - Alignment of the text. - "kLeft", background box's left bottom will be located at "position". In width direction, text area will be aligned to the left side of background. In height direction, text are will be aligned in the middle of background. - "kCenter", background box' center bottom will be located at "position". Text area's center and background box's center will be the same point. - "kRight", background box's right bottom will be located at "position". In width direction, text area will be aligned to the right side of background. In height direction, text are will be aligned in the middle of background. * backgroundSize ([int, int]) - The background box size of the text. Default is None, in this case there will be no background, just shows the text. If it is specified with smaller size than text, the text will be clipped. It is a int array with size 2, like "backgroundSize = [ width, height ]" Size unit is the screen pixel. * backgroundColor (MColor) - The color of the background, it can be transparent. If None is passed, background will be fully transparent. * dynamic (bool) - This is mostly used for performance. If the text draw is not changed frequently, we can leave it as default value false. If the text draw is changing very often like it is showing some dynamic numbers, in this case making dynamic true will give better performance.