class MPx3dModelView

Jump to documentation

3d Model View (OpenMayaUI) (OpenMayaMPx.py)

public members:

enum LightingMode
kLightAll
kLightSelected
kLightActive
kLightDefault
kLightNone
kLightQuality
enum FogSource
kFogFragment
fog is computed per pixel (default)
kFogCoordinate
fog is computed by specified vertex fog coordinates
enum FogMode
kFogLinear
linear drop off
kFogExponential
exponential drop-off
kFogExponentialSquared
squared exponential drop-off
MPx3dModelView ()
virtual ~MPx3dModelView ()
MString name ( MStatus *ReturnStatus = NULL) const
virtual MString viewType () const
virtual void preMultipleDraw ()
virtual void postMultipleDraw ()
virtual void preMultipleDrawPass (unsigned int index)
virtual void postMultipleDrawPass (unsigned int index)
virtual bool okForMultipleDraw (const MDagPath &)
virtual unsigned int multipleDrawPassCount ()
bool multipleDrawEnabled () const
void setMultipleDrawEnable (bool enable)
bool destroyOnPanelDestruction () const
void setDestroyOnPanelDestruction (bool how)
MStatus updateViewingParameters ()
virtual void removingCamera ( MDagPath &cameraPath)
MStatus refresh (bool all = false, bool force = false)
MStatus drawText (const MString &text, const MPoint position, M3dView::TextPosition textPosition = M3dView::kLeft )
MStatus beginGL ()
MStatus endGL ()
MStatus setCameraInDraw ( MDagPath & camera)
MStatus setCamera ( MDagPath & camera)
MStatus getCamera ( MDagPath & camera)
virtual MString getCameraHUDName ()
MStatus setDisplayHUD (bool display)
bool displayHUD ( MStatus *ReturnStatus = NULL) const
MStatus drawHUDNow ()
MStatus setDrawAdornments (bool display)
bool drawAdornments ( MStatus *ReturnStatus = NULL )
MStatus drawAdornmentsNow ()
MStatus setDisplayAxis (bool display)
bool displayAxisOn ( MStatus *ReturnStatus = NULL) const
MStatus setDisplayAxisAtOrigin (bool display)
bool displayAxisAtOriginOn ( MStatus *ReturnStatus = NULL) const
MStatus setDisplayCameraAnnotation (bool display)
bool displayCameraAnnotationOn ( MStatus *ReturnStatus = NULL) const
bool isVisible ( MStatus *ReturnStatus = NULL) const
M3dView::DisplayStyle displayStyle ( MStatus *ReturnStatus = NULL) const
bool isShadeActiveOnly ( MStatus *ReturnStatus = NULL) const
MStatus setDisplayStyle ( M3dView::DisplayStyle style, bool activeOnly = false)
int portWidth ( MStatus * ReturnStatus = NULL )
int portHeight ( MStatus * ReturnStatus = NULL )
MStatus beginOverlayDrawing ()
MStatus endOverlayDrawing ()
MStatus clearOverlayPlane ()
MStatus setDrawColor (unsigned int index, M3dView::ColorTable table = M3dView::kActiveColors )
MStatus setDrawColor (const MColor & color)
bool isColorIndexMode ( MStatus * ReturnStatus = NULL)
MStatus setColorIndexMode (bool state)
unsigned int numDormantColors ( MStatus * ReturnStatus = NULL )
unsigned int numActiveColors ( MStatus * ReturnStatus = NULL )
unsigned int numUserDefinedColors ( MStatus * ReturnStatus = NULL)
MStatus setUserDefinedColor (unsigned int index, const MColor & color)
unsigned int userDefinedColorIndex (unsigned int index, MStatus * ReturnStatus = NULL )
MColor templateColor ( MStatus * ReturnStatus = NULL)
MColor backgroundColor ( MStatus * ReturnStatus = NULL)
MColor colorAtIndex (unsigned int index, M3dView::ColorTable table = M3dView::kActiveColors , MStatus * ReturnStatus = NULL)
MStatus getColorIndexAndTable (unsigned int glindex, unsigned int &index, M3dView::ColorTable &table ) const
MStatus viewToWorld (short x_pos, short y_pos, MPoint & worldPt, MVector & worldVector ) const
MStatus viewToWorld (short x_pos, short y_pos, MPoint & nearClipPt, MPoint & farClipPt ) const
MStatus viewToObjectSpace (short x_pos, short y_pos, const MMatrix & localMatrixInverse, MPoint & oPt, MVector & oVector ) const
bool worldToView (const MPoint & worldPt, short& x_pos, short& y_pos, MStatus * ReturnStatus = NULL ) const
MStatus setObjectDisplay ( M3dView::DisplayObjects , bool)
bool objectDisplay ( M3dView::DisplayObjects , MStatus *ReturnStatus = NULL)
MStatus setBackfaceCulling (bool cull)
bool isBackfaceCulling ( MStatus *ReturnStatus = NULL) const
MStatus setWireframeOnShaded (bool on)
bool isWireframeOnShaded ( MStatus *ReturnStatus = NULL) const
MStatus setXrayEnabled (bool xray)
bool isXrayEnabled ( MStatus *ReturnStatus = NULL) const
MStatus setTextureDisplayEnabled (bool texture)
bool isTextureDisplayEnabled ( MStatus *ReturnStatus = NULL) const
MStatus setTwoSidedLighting (bool twoSided)
bool isTwoSidedLighting ( MStatus *ReturnStatus = NULL) const
MStatus setLightingMode ( MPx3dModelView::LightingMode )
MPx3dModelView::LightingMode lightingMode ( MStatus *ReturnStatus = NULL) const
MStatus setFogEnabled (bool state)
bool isFogEnabled ( MStatus *ReturnStatus = NULL) const
MPx3dModelView::FogSource fogSource ( MStatus *ReturnStatus = NULL) const
MStatus setFogSource ( MPx3dModelView::FogSource )
MPx3dModelView::FogMode fogMode ( MStatus *ReturnStatus = NULL) const
MStatus setFogMode ( MPx3dModelView::FogMode )
double fogDensity ( MStatus *ReturnStatus = NULL) const
MStatus setFogDensity (double)
double fogStart ( MStatus *ReturnStatus = NULL) const
MStatus setFogStart (double)
double fogEnd ( MStatus *ReturnStatus = NULL) const
MStatus setFogEnd (double)
MColor fogColor ( MStatus *ReturnStatus = NULL) const
MStatus setFogColor (const MColor &)
bool isBackgroundFogEnabled ( MStatus *ReturnStatus = NULL) const
MStatus setBackgroundFogEnabled (bool enable)
MString viewSelectedPrefix ( MStatus *ReturnStatus) const
MStatus setViewSelectedPrefix (const MString &prefix)
bool viewSelected ( MStatus *ReturnStatus = NULL) const
MStatus setViewSelected (bool viewSelected )
MObject viewSelectedSet ( MStatus *ReturnStatus = NULL) const
MStatus setViewSelectedSet ( MObject &set)
MStatus getObjectsToView ( MSelectionList &list) const
MStatus setObjectsToView (const MSelectionList &list)
bool hasStereoBufferSupport () const
MStatus getAsM3dView ( M3dView &view)
static MPx3dModelView * getModelView (const MString & name , MStatus *ReturnStatus = NULL)
virtual bool wantStereoGLBuffer () const

Documentation

Class for creating custom model views
Description

MPx3dModelView is the class for user defined model views. The MPx3dModelView class works with the MPxModelEditorCommand class to create a user defined model editor that may be used in a window or in a scripted panel. When registering the model editor with the MFnPlugin::registerModelEditorCommand() method, an appropriate MPx3dModelView::creator() method is required. This class works for interactive Maya views and is not designed for rendering.

One of the interesting uses of a MPx3dModelView is that it allows multiple cameras to be drawn into the same window. Like a normal model view, this view has a main camera associated with it. This camera is obtained with the getCamera() method and is the camera used for manipulations and selection.

To setup a multiple camera draw, first the number of passes must be set by an overloaded multipleDrawPassCount() method. The preMultipleDraw() method allows any setup to be performed. The preMultipleDrawPass(unsigned int) is called for each pass, with the argument indicating which pass is currently being used. The camera for the specific pass may be set with the setCameraInDraw() method. The postMultipleDrawPass(unsigned int) method is called after the drawing for the indicated pass is complete. Finally any cleanup may be done with the postMultipleDraw() method.

During the drawing, a filter exists to determine which items should be drawn. The okForMultipleDraw(MdagPath &) allows filtering of what should be drawn. Another approach which is faster is to tuen on the view selected mode (setViewSelected()) and use the setObjectsToView() or viewSelectedSet() to specify which items should be drawn. These values may be set per pass so that each camera has control over what gets drawn.

Functions

MPx3dModelView:: MPx3dModelView ()

Description

class constructor

Arguments

Return Value

Status Codes

  • MS::kSuccess Method was successful

MPx3dModelView:: ~MPx3dModelView ()

Description

class destructor

Arguments

Return Value

Status Codes

  • MS::kSuccess Method was successful

MString MPx3dModelView:: viewType () const

Description

Returns a string specifying the view type. The view type should be a different string for every class derived from MPx3dModelView. The default type is "MPx3dModelView".

Return Value

  • the view type

MString MPx3dModelView:: name ( MStatus *ReturnStatus ) const

Description

Returns the name of the view.

Arguments

  • ReturnStatus status

Return Value

  • The name of the view.

Status Codes

  • MS::kSuccess Operation successful

void MPx3dModelView:: preMultipleDraw ()

Description

This method is called before any drawing is performed in the model view. It should control any setting required for every pass that will be drawn.

void MPx3dModelView:: postMultipleDraw ()

Description

This method is called after the drawing is finished. Any cleanup should be done by this method.

void MPx3dModelView:: preMultipleDrawPass (unsigned int index)

Description

This method is called immediately before a specific pass is about to be drawn. The unsigned int argument indictates which pass is about to be drawn.

Typically the camera (set with the setCameraInDraw method) and any pass specific settings would be made here.

Arguments

  • index A number indicating which pass is about to be drawn.

void MPx3dModelView:: postMultipleDrawPass (unsigned int index)

Description

This method is called when a specified pass is finshed.

Arguments

  • index A number indicating which pass was just drawn.

bool MPx3dModelView:: okForMultipleDraw (const MDagPath &dp)

Description

This method provides some filter capabilities as to what is drawn. When ever a draw operation during the multiple camera drawing, this method will get called. If true is returned, then the object will be drawn.

This method is useful for filtering out multiple occurances of manipulators and ground planes.

To reduce the number of objects queried, look at the setViewSelected() method along with the setObjectsToView() method.

Arguments

  • dp A MDagPath of the object that may be drawn.

Return Value

  • true if it is OK to draw the passed object.

unsigned int MPx3dModelView:: multipleDrawPassCount ()

Description

This method returns the number of multiple draw passes that are going to be made. By default a 1 is returned.

Return Value

  • The number of multiple draw passes that will be made.

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: multipleDrawEnabled () const

Description

This method returns the multiple draw enable state for this view.

Return Value

  • true if multiple draw is enabled.

void MPx3dModelView:: setMultipleDrawEnable (bool enable)

Description

This method turns enables/disables multiple camera drawing for this view. If multiple draw is disabled, then this view will behave like a normal Maya view.

Arguments

  • enable If true, then multiple draw is enabled.

bool MPx3dModelView:: destroyOnPanelDestruction () const

Description

This method queries the destruction setting for this MPx3dModelView which is employed when the panel associated with this view is destroyed.

By choosing to have the MPx3dModelView destroyed along with the panel, you are guaranteed that a new MPx3dModelView will be created the next time the editor is displayed.

Return Value

  • Returns true if this MPx3dModelView gets destroyed when its panel is destroyed (such as closing a torn-off window), and false if it is not to be destroyed.

void MPx3dModelView:: setDestroyOnPanelDestruction (bool how)

Description

This method enables/disables destruction of the MPx3dModelView object when the panel is destroyed. By default, Maya does not destroy the MPx3dModelView when the panel is destroyed. Example cases of destroying a panel are when you tear off a panel, or close a torn-off panel.

By choosing to have the MPx3dModelView destroyed along with the panel, you are guaranteed that a new MPx3dModelView will be created the next time the editor is displayed.

Arguments

  • how If true, destroy the MPx3dModelView when the panel is destroyed. If false (the default behaviour), the editor is retained.

MStatus MPx3dModelView:: getAsM3dView ( M3dView &view)

Description

Get this MPx3dModelView as a M3dView.

Arguments

  • view The M3dView to set as this MPx3dModelView

Return Value

  • return status

Status Codes

  • MS::kSuccess Method was successful
  • MS::kSuccess Method failed

bool MPx3dModelView:: hasStereoBufferSupport () const
Description

Returns true if this 3dModelView is running in stereo buffer mode. This should be used in cases where the API developer has requested to create stereo buffer enabled view. See wantStereoGLBuffer()

MString MPx3dModelView:: getCameraHUDName ()

Description

Return the name to use for the camera in the heads up display.

Return Value

  • the name of the camera

MStatus MPx3dModelView:: setDisplayHUD (bool enable)

Description

Enables or disables the drawing the heads up display in this view. This method only affects this view and will stop all heads up display elements from being drawn in this view.

Arguments

  • enable The enable state of the heads up display in this view.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: drawHUDNow ()

Description

Forces the HUD viewport elements to be drawn immediately. This should only be called when setDrawAdornments has been set to false. And this method should only be called in the postMultiple* draw methods. This allows the drawing of display elements during a specific pass while attached to a specific camera.

Arguments

  • None.

Return Value

  • MS::kFailure - invalid editor.
  • MS::kSuccess - success.

MStatus MPx3dModelView:: setDrawAdornments (bool display)

Description

Toggles the control of how adornments are drawn in the view. Adornments are objects that are drawn in the viewport that are not scene entities. This includes the origin axis and the camera decorations like film gate and resolution gate. These items are usually drawn last and outside of the multiple refresh loop. You can choose to disable the drawing of the adornments by specifying false here, and you can control the drawing of the feature within their display loop calling displayAdornmentsNow() method on this class. By default this flag is true; so adornments are always drawn unless explicitly disabled by you.

Arguments

  • display toggle to control the display of the adornments.

Return Value

  • status code

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: drawAdornments ( MStatus *ReturnStatus )

Description

Returns the state of the adornment drawing for this view. See setDrawAdornments for more information on adornment drawing.

Arguments

  • None.

Return Value

  • None.

MStatus MPx3dModelView:: drawAdornmentsNow ()

Description

Forces the adornment viewport elements to be drawn immediately. This should only be called when setDrawAdornments has been set to false. And this method should only be called in the postMultiple* draw methods. This allows you to draw camera adornments during a specific pass while attached to a specific camera.

Arguments

  • None.

Return Value

  • MS::kFailure - invalid editor.
  • MS::kSuccess - success.

bool MPx3dModelView:: displayHUD ( MStatus *ReturnStatus ) const

Description

Returns the heads up display state for this view.

Arguments

  • ReturnStatus the return status

Return Value

  • The enable state for the HUD

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setDisplayAxis (bool enable)

Description

Sets the axis display in the MPx3dModelView.

Arguments

  • enable If true, then the axis is displayed.

Return Value

  • return status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kSuccess Operation failed

bool MPx3dModelView:: displayAxisOn ( MStatus *ReturnStatus ) const

Description

Returns the axis display state for this MPx3dModelView.

Arguments

  • Return Status The return status.

Return Value

  • true if the axis is displayed.

Status Codes

  • MS::kSuccess Operation successful
  • MS::kSuccess Operation failed

MStatus MPx3dModelView:: setDisplayAxisAtOrigin (bool enable)

Description

Sets the origin axis display in the MPx3dModelView.

Arguments

  • enable If true, then the origin axis is displayed.

Return Value

  • return status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kSuccess Operation failed

bool MPx3dModelView:: displayAxisAtOriginOn ( MStatus *ReturnStatus ) const

Description

Returns the origin axis display state for this MPx3dModelView.

Arguments

  • Return Status The return status.

Return Value

  • true if the origin axis is displayed.

Status Codes

  • MS::kSuccess Operation successful
  • MS::kSuccess Operation failed

MStatus MPx3dModelView:: setDisplayCameraAnnotation (bool enable)

Description

Sets the camera annotation display in the MPx3dModelView.

Arguments

  • enable If true, then the camera annotation is displayed.

Return Value

  • return status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kSuccess Operation failed

bool MPx3dModelView:: displayCameraAnnotationOn ( MStatus *ReturnStatus ) const

Description

Returns the camera annotation display state for this MPx3dModelView.

Arguments

  • Return Status The return status.

Return Value

  • true if the camera annotation is displayed.

Status Codes

  • MS::kSuccess Operation successful
  • MS::kSuccess Operation failed

MStatus MPx3dModelView:: refresh ( bool all, bool force )

Description

Refresh the this view. If all is set to true then all of the 3d-view will be refreshed.

If force is set to true, then the views will be refreshed even if they do not require it. This option should be used with extreme care because extra refreshes will greatly degrade application performance. In almost all cases it is better to use the default behavior where the view is only refreshed if it is required.

Arguments

  • all If true then refresh all views, otherwise refresh this view.
  • force If true then force views to refresh even if they do not require it.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

bool MPx3dModelView:: isVisible ( MStatus *ReturnStatus ) const

Description

This method returns true if this view is visible, otherwise false is returned.

Arguments

  • ReturnStatus The return status.

Return Value

  • true if the view is visible, otherwise false is returned.

Status Codes

  • MS::kSuccess Method succeeded.
  • MS::kFailure Method failed.

MStatus MPx3dModelView:: beginGL ()

Description

Setup port for native OpenGL drawing calls. Only make openGL calls between the beginGL() and endGL() methods. M3dView and MPx3dModelView calls should not be made betwen beginGL() and endGL() calls.

This should only be used if there is not a M3dView or MPx3dModelView method that performs the required task.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Method failed

MStatus MPx3dModelView:: endGL ()

Description

End OpenGL drawing.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: drawText (const MString & text, const MPoint position, M3dView::TextPosition textPosition )

Description

Draws the given text at the given spot in the default font. This method is provided as a convienient way to draw OpenGL text.

Arguments

  • text Text to draw
  • position Position in space to draw at
  • textPosition Text position relative to the point

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: setCameraInDraw ( MDagPath &camera)

Description

Sets the camera during a draw. If the normal setCamera() method is used, then that camera will not get its parameters loaded during the draw.

Arguments

  • camera Dag path of the camera

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

void MPx3dModelView:: removingCamera ( MDagPath &cameraPath)

Description

This method should be overloaded in MPx3dModelView derived classes. It will get called whenever a camera that was used with this MPx3dModelView is deleted. The MPx3dModelView should then remove any reference to the deleted camera.

Arguments

  • cameraPath The MDagPath for the camera that is about to be deleted.

MStatus MPx3dModelView:: updateViewingParameters ()

Description

This method tells the camera to set the view's transformation matrix.

Return Value

  • Status code

MStatus MPx3dModelView:: setCamera ( MDagPath &camera)

Description

Set the camera for this view.

Arguments

  • camera Dag path of the camera for this view

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Method failed

MStatus MPx3dModelView:: getCamera ( MDagPath &camera)

Description

Get the camera for this view.

Arguments

  • camera Dag path for the camera (allocated by caller)

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Method failed

M3dView::DisplayStyle MPx3dModelView:: displayStyle ( MStatus *ReturnStatus ) const

Description

Return the display style for this 3d view. The display style can be wireframe, flat-shaded, or smooth-shaded.

Arguments

  • ReturnStatus Status code

Return Value

  • The display style for this view

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

bool MPx3dModelView:: isShadeActiveOnly ( MStatus *ReturnStatus ) const

Description

Returns true if this view's display style is shaded for objects that are active and wireframe otherwise.

Arguments

  • ReturnStatus Status code

Return Value

  • true Only active objects are shaded if this view is in shaded mode
  • false All objects are shaded if this view is in shaded mode

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: setDisplayStyle ( M3dView::DisplayStyle style, bool activeOnly )

Description

Sets the display style for this view. The display style can be wireframe, flat-shaded, or smooth-shaded.

Arguments

  • style The display style to be set for this view
  • activeOnly Specifies whether only active objects are to be shaded in shaded mode.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

int MPx3dModelView:: portWidth ( MStatus * ReturnStatus )

Description

Returns the width of the current viewport.

Arguments

  • ReturnStatus Status Code

Return Value

  • The width of this viewport

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

int MPx3dModelView:: portHeight ( MStatus * ReturnStatus )

Description

Returns the height of the current viewport.

Arguments

  • ReturnStatus Status Code

Return Value

  • The height of this viewport

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: beginOverlayDrawing ()

Description

Setup the OpenGL context for drawing on the overlay plane.

The overlay plane is commonly used for drawing guidelines for tools.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: endOverlayDrawing ()

Description

Set the OpenGL context to for normal screen drawing.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: clearOverlayPlane ()

Description

Clear the overlay plane.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: setDrawColor ( unsigned int index, M3dView::ColorTable table )

Description

Set the color to draw in. The index argument is an index into the application's color tables. Valid values range between zero and the size of the table minus one. The size of the active and dormant color tables can be found using methods of this class. The background and template color tables are both of size one.

These indices do not directly correspond to those of the underlying OpenGL color index mode. Using the glIndex call directly is not recommended and may cause unpredictable results. This method should be used instead.

Note that this method will work in either RGBA mode or color index mode.

Arguments

  • index index of the color to draw in
  • table color table to index into

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kInvalidParameter Index is out of range
  • MS::kFailure Object error

MStatus MPx3dModelView:: setDrawColor ( const MColor & color )

Description

Set the color to draw in. This method should only be used in RGBA mode. It is a convenient replacement for glColor.

Arguments

  • color color to draw in

Return Value

  • Status code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kInvalidParameter Index is out of range
  • MS::kFailure Object error

bool MPx3dModelView:: isColorIndexMode ( MStatus * ReturnStatus )

Description

Returns true if this view is currently in the OpenGL color index mode. A false return means that it is in RGBA mode.

Arguments

  • ReturnStatus Status code

Return Value

  • boolean indicating if color index mode is in use

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: setColorIndexMode (bool colorIndexOn)

Description

sets color index mode - swaps buffers!

Arguments

Return Value

Status Codes

  • MS::kSuccess Method was successful

unsigned int MPx3dModelView:: numDormantColors ( MStatus * ReturnStatus )

Description

Returns the number of dormant object colors in the internal application color table.

Arguments

  • ReturnStatus Status code

Return Value

  • the number of dormant colors

Status Codes

  • MS::kSuccess Method was successful

unsigned int MPx3dModelView:: numActiveColors ( MStatus * ReturnStatus )

Description

Returns the number of active object colors in the internal application color table.

Arguments

  • ReturnStatus Status code

Return Value

  • the number of active colors

Status Codes

  • MS::kSuccess Method was successful

unsigned int MPx3dModelView:: numUserDefinedColors ( MStatus * ReturnStatus )

Description

Returns the number of user defined colors in the internal application color table. These colors may be changed by the user and assigned to specific objects. See the methods of MFnDagNode for information on assigning user defined colors to individual objects.

The user defined colors are not a color table of their own. They exist in the active and dormant color tables.

Arguments

  • ReturnStatus Status code

Return Value

  • the number of user defined colors

Status Codes

  • MS::kSuccess Method was successful

MStatus MPx3dModelView:: setUserDefinedColor ( unsigned int index, const MColor & color )

Description

Sets the user defined color at the given index. Valid indices range between zero and the number of user defined colors.

Arguments

  • index index into the user defined color
  • color color to set to

Return Value

  • an index into the application's color table

Status Codes

  • MS::kSuccess Method was successful
  • MS::kInvalidParameter Index is out of range

unsigned int MPx3dModelView:: userDefinedColorIndex ( unsigned int index, MStatus * ReturnStatus )

Description

Returns the index for the given user-defined color. Valid values for the index argument range between zero and the number of user-defined colors minus one.

The index returned gives the location of the specified color inside the active and dormant color tables (the index is the same in both tables).

Arguments

  • index Index into user-defined colors
  • ReturnStatus Status code

Return Value

  • index of user-defined color into the active and dormant tables

Status Codes

  • MS::kSuccess Method was successful

MColor MPx3dModelView:: templateColor ( MStatus * ReturnStatus )

Description

Returns the RGB values of the template color.

Arguments

  • ReturnStatus Status code

Return Value

  • the template color

Status Codes

  • MS::kSuccess Method was successful

MColor MPx3dModelView:: backgroundColor ( MStatus * ReturnStatus )

Description

Returns the RGB values of the active template color.

Arguments

  • ReturnStatus Status code

Return Value

  • the template color

Status Codes

  • MS::kSuccess Method was successful

MColor MPx3dModelView:: colorAtIndex ( unsigned int index, M3dView::ColorTable table, MStatus * ReturnStatus )

Description

Returns the RGB values of the color at the given index in the application's color table.

Arguments

  • index Index of the color to retrieve
  • table Table to index into
  • ReturnStatus Status code

Return Value

  • the color

Status Codes

  • MS::kSuccess Method was successful
  • MS::kInvalidParameter Index is out of range

MStatus MPx3dModelView:: getColorIndexAndTable ( unsigned int glindex, unsigned int &index, M3dView::ColorTable &table ) const

Description

Returns the color table and index representing the given OpenGL color-index value. This method is useful when converting color indices obtained from glReadPixels(GL_COLOR_INDEX) to Maya color-index values suitable for use with the colorAtIndex and setDrawColor methods.

Arguments

  • glindex Value of the OpenGL color-index to retrieve
  • index Returned ColorTable index
  • table Returned ColorTable

Return Value

  • StatusCode

Status Codes

  • MS::kSuccess Method was successful
  • MS::kInvalidParameter Index is out of range

MStatus MPx3dModelView:: viewToWorld ( short x_pos, short y_pos, MPoint & worldPt, MVector & worldVector ) const

Description

Takes a point in port coordinates and returns a corresponding ray in world coordinates.

Arguments

  • x_pos the x position of the point in port coordinates
  • y_pos the y position of the point in port coordinates
  • worldPt (returned) the source of the ray
  • worldVector (returned) the direction of the ray

Return Value

  • Status Code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: viewToWorld ( short x_pos, short y_pos, MPoint & nearClipPt, MPoint & farClipPt ) const

Description

Takes a point in port coordinates and returns a point on the near and far clipping planes.

Arguments

  • x_pos the x position of the point in port coordinates
  • y_pos the y position of the point in port coordinates
  • nearClipPt (returned) point on near clipping plane
  • farClipPt (returned) point on far clipping plane

Return Value

  • Status Code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: viewToObjectSpace ( short x_pos, short y_pos, const MMatrix & localMatrixInverse, MPoint & oPt, MVector & oVector ) const

Description

Takes a point in port coordinates and returns a corresponding ray in object coordinates.

Arguments

  • x_pos the x position of the point in port coordinates
  • y_pos the y position of the point in port coordinates
  • localMatrixInverse the inclusive matrix inverse of the object in question
  • oPt (returned) the source of the ray in object space
  • oVector (returned) the direction of the ray in object space

Return Value

  • Status Code

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

bool MPx3dModelView:: worldToView (const MPoint & worldPt, short& x_pos, short& y_pos, MStatus * ReturnStatus ) const

Description

converts a point in world space to port space. The return value indicates if the point is not clipped.

Arguments

  • worldPt the point to world space
  • portPt (returned) the point in port coordinates
  • ReturnStatus Status code

Return Value

  • true point is not clipped
  • false point is undefined or outside frustum

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Object error

MStatus MPx3dModelView:: setObjectDisplay ( M3dView::DisplayObjects displayType, bool display)

Description

Sets the display option for various types of objects. By default everything is displayed.

Arguments

  • displayType The type of object to display
  • display Should the object type be displayed?

Return Value

  • the return status

Status Codes

  • MS::kSuccess Method was successful
  • MS::kFailure Operation failed

bool MPx3dModelView:: objectDisplay ( M3dView::DisplayObjects dispObjs, MStatus *ReturnStatus )

Description

Returns true is the passed flag is set.

Arguments

  • ReturnStatus the return status

Return Value

  • returns true is the flag is set.

Status Codes

  • MS::kSuccess Method was successful

MStatus MPx3dModelView:: setBackfaceCulling (bool culling)

Description

Sets backface culling.

Arguments

  • culling sets the backface culling state

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isBackfaceCulling ( MStatus *ReturnStatus ) const

Description

Returns the state of backface culling.

Arguments

  • ReturnStatus return status

Return Value

  • true if backface culling is enabled.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setXrayEnabled (bool xray)

Description

Sets xray display state.

Arguments

  • xray sets the xray display state

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isXrayEnabled ( MStatus *ReturnStatus ) const

Description

Returns the state of xray display.

Arguments

  • ReturnStatus return status

Return Value

  • true if xray is enabled.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setWireframeOnShaded (bool onShaded)

Description

Displays as wireframe on shaded.

Arguments

  • onShaded sets the wireframe on shaded state

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isWireframeOnShaded ( MStatus *ReturnStatus ) const

Description

Returns the state of wireframe on shaded.

Arguments

  • ReturnStatus return status

Return Value

  • true if backface onShaded is enabled.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setTextureDisplayEnabled (bool textureDisplay)

Description

Enables texture display

Arguments

  • textureDisplay sets the texture display state

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isTextureDisplayEnabled ( MStatus *ReturnStatus ) const

Description

Returns the enable state of texture display.

Arguments

  • ReturnStatus return status

Return Value

  • true if texture display is enabled.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setTwoSidedLighting (bool twoSided)

Description

Enables two sided lighting.

Arguments

  • twoSided sets the two sided lighting state

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isTwoSidedLighting ( MStatus *ReturnStatus ) const

Description

Returns the state of two sided lighting.

Arguments

  • ReturnStatus return status

Return Value

  • true if two sided lighting is enabled.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setLightingMode ( MPx3dModelView::LightingMode lightingMode )

Description

Sets the lighting mode.

Arguments

  • lightingMode sets the lighting mode

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

MPx3dModelView::LightingMode MPx3dModelView:: lightingMode ( MStatus *ReturnStatus ) const

Description

Returns the lighting mode.

Arguments

  • ReturnStatus return status

Return Value

  • the lighting mode.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setFogEnabled (bool state)

Description

Enables and disables fog. If fog is enabled for one pass and disabled for another, the background fog will not be drawn. To display background fog in that configuration, use the MPx3dModelView::setBackgroundFogEnabled() call.

Arguments

  • state true is fog should be on.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isFogEnabled ( MStatus *ReturnStatus ) const

Description

Returns true if fog is enabled.

Arguments

  • ReturnStatus status

Return Value

  • true is fog is enabled.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setFogSource ( MPx3dModelView::FogSource source)

Description

Sets the type of fog algorithm to use. If the source argument is kFogFragment (default) then fog is computed per pixel. If the argument is kFogCoordinate then if the geometry has specified vertex fog coordinates, and the OpenGL extension for vertex fog is supported by the graphics system, then fog is computed per vertex.

Arguments

  • source The type of algorithm to use.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kInvalidParameter Unknown fog source
  • MS::kFailure Operation failed

MPx3dModelView::FogSource MPx3dModelView:: fogSource ( MStatus *ReturnStatus ) const

Description

Returns the algorithm used to compute fog. See MPx3dModelView::setFogSource for a description.

Arguments

  • ReturnStatus status

Return Value

  • The algorithm used to compute fog.

Status Codes

  • MS::kSuccess Operation successful
  • MS::kFailure Operation failed

MStatus MPx3dModelView:: setFogMode ( MPx3dModelView::FogMode mode)

Description

Sets the drop-off mode for fog. The possibilities are:

  • kFogLinear linear drop-off
  • kFogExponential exponential drop-off
  • kFogExponentialSquared squared exponential drop-off

Arguments

  • mode The type of drop off to use with fog.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kInvalidParameter Unknown fog mode
  • MS::kFailure Operation failed

MPx3dModelView::FogMode MPx3dModelView:: fogMode ( MStatus *ReturnStatus ) const

Description

Return the type of drop off used with fog. See MPx3dModelView::setFogMode for description of the drop off types.

Arguments

  • ReturnStatus status

Return Value

  • The type of drop off used with fog.

Status Codes

  • MS::kSuccess Operation successful
  • MS::kFailure Operation failed

MStatus MPx3dModelView:: setFogDensity (double density)

Description

Determines the density of hardware fogging. This is meaniful for kFogExponential and kFogExponentialSquared drop off types (set by the MPx3dModelView::setFogMode() method).

Arguments

  • density

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

double MPx3dModelView:: fogDensity ( MStatus *ReturnStatus ) const

Description

Returns the fog density.

Arguments

  • ReturnStatus status

Return Value

  • The fog density.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setFogStart (double start)

Description

Determines the start location of hardware fogging. This is meaniful for kFogLinear drop off type (set by the MPx3dModelView::setFogMode() method).

Arguments

  • density

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

double MPx3dModelView:: fogStart ( MStatus *ReturnStatus ) const

Description

Returns the fog start postion.

Arguments

  • ReturnStatus status

Return Value

  • The fog start position.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setFogEnd (double end)

Description

Determines the end location of hardware fogging. This is meaniful for kFogLinear drop off type (set by the MPx3dModelView::setFogMode() method).

Arguments

  • density

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

double MPx3dModelView:: fogEnd ( MStatus *ReturnStatus ) const

Description

Returns the fog end position.

Arguments

  • ReturnStatus status

Return Value

  • The fog end location.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setFogColor (const MColor &color)

Description

Sets the color used for hardware fogging.

Arguments

  • color The color used by hardware fogging.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

MColor MPx3dModelView:: fogColor ( MStatus *ReturnStatus ) const

Description

Returns the fog color.

Arguments

  • ReturnStatus status

Return Value

  • The fog color.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setBackgroundFogEnabled (bool state)

Description

Enables and disables background fog.

Arguments

  • state treu if background fog should be enabled.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: isBackgroundFogEnabled ( MStatus *ReturnStatus ) const

Description

Returns true if the background fog is enabled.

Arguments

  • ReturnStatus status

Return Value

  • true, if the background fog is enabled, otherwise false.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setViewSelectedPrefix (const MString &prefix)

Description

Sets the prefix for the camera name as displayed in the heads up display when view selected is enabled. The prefix is concatenated with the camera name.

The default value is "isolate: "

Arguments

  • prefix The prefix to use.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

MString MPx3dModelView:: viewSelectedPrefix ( MStatus *ReturnStatus ) const

Description

Returns the prefix used when displaying the camera name in the heads up display when view selected in on.

Arguments

  • ReturnStatus the return status

Return Value

  • the prefix.

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setViewSelected (bool enable)

Description

Enables the view selected mode.

Arguments

  • enable enable or disable view selected mode.

Return Value

  • status

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: viewSelected ( MStatus *ReturnStatus ) const

Description

Returns the state of view selected for this view.

Arguments

  • ReturnStatus return status

Return Value

  • true if view selected is enabled.

Status Codes

  • MS::kSuccess Operation successful

MObject MPx3dModelView:: viewSelectedSet ( MStatus *ReturnStatus ) const

Description

Returns an MObject for the set used by view selected. If there is not a set associated with this view, then an invalid MObject will be returned. Check the isNull() method of the MObject to see if a valid set was found.

Arguments

Return Value

Status Codes

  • MS::kSuccess Operation successful

MStatus MPx3dModelView:: setViewSelectedSet ( MObject &set)

Description

Returns a set that contains the memebers used by view selected.

Arguments

  • set The set used by view selected.

Return Value

  • return status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kFailure Operation failed

MStatus MPx3dModelView:: getObjectsToView ( MSelectionList &list) const

Description

Returns a selection list containing all of the objects on the view selected list.

Arguments

  • list The list of objects used by view selected.

Return Value

  • return status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kFailure Operation failed

MStatus MPx3dModelView:: setObjectsToView (const MSelectionList &list)

Description

Sets the list of objects used by view selected as a selection list. View selected must be turned on for this to have an effect.

Arguments

  • list The objects to view with view selected.

Return Value

  • return status

Status Codes

  • MS::kSuccess Operation successful
  • MS::kFailure Operation failed

MPx3dModelView * MPx3dModelView:: getModelView (const MString & name , MStatus *ReturnStatus )

Description

Returns a pointer to a MPx3dModelView that has the passed name with the specified type (the same typed when registering the control). If one does not exist, then a NULL pointer is returned.

Arguments

  • name The name to find
  • ReturnStatus the return status

Return Value

  • A pointer to the MPx3dModelView.

Status Codes

  • MS::kSuccess Operation successful

bool MPx3dModelView:: wantStereoGLBuffer () const

Description

Users should override this method if they want a stereo buffer enabled MPx3dModelView. You must have a graphics card that can support stereo mode. If your graphics card does not support stereo mode, a non-stereo buffer is created.

Arguments

None

Return Value

  • true, if you want to create a stereo buffered view

Status Codes

None

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright