Python API 2.0 Reference
|
Static Public Attributes | |
List Adjustment Modes | |
int | kAddToHeadOfList = 4 |
int | kAddToList = 2 |
int | kRemoveFromList = 3 |
int | kReplaceList = 0 |
int | kXORWithList = 1 |
Maya States | |
int | kBaseUIMode = 3 |
int | kBatch = 1 |
int | kInteractive = 0 |
int | kLibraryApp = 2 |
Selection Modes | |
int | kSelectComponentMode = 1 |
int | kSelectLeafMode = 3 |
int | kSelectObjectMode = 0 |
int | kSelectRootMode = 2 |
int | kSelectTemplateMode = 4 |
Selection Methods | |
int | kSurfaceSelectMethod = 0 |
int | kWireframeSelectMethod = 1 |
Static class providing common API global functions.
MGlobal is currently a stub which only implements a small portion of the class's total functionality.
MGlobal is a pure static class. It cannot be instantiated and therefore has no constructors.
Not applicable as the class cannot be instantiated.
Not applicable as the class cannot be instantiated.
|
static |
addToModel(MObject, MObject) -> None This method is used to add new dag objects to the model. If no parent node is specified, then the node is added under the world. When a node is added under the world, then a transform node is automatically created as a parent. This assumes that the node being added is not already a transform node. This method is only valid for dag nodes. If the specified object is not of type MFn::kDagNode then MS::kInvalidParameter will be returned.
|
static |
addToModelAt(MObject, MVector, double[3], double[3], rotateOrder=MTransformationMatrix.kXYZ) -> None Adds the specified dag object to the DAG and transform the object by the specified arguments. This method is only valid for dag nodes. If the specified object is not of type MFn::kDagNode then MS::kInvalidParameter will be returned.
|
static |
animSelectionMask() -> MSelectionMask Returns the animation selection mask.
|
static |
apiVersion() -> int Returns a number describing the version of the Maya API at runtime.
|
static |
className() -> string Returns the name of this class.
|
static |
clearSelectionList() -> None Removes all items from the active selection list.
|
static |
closeErrorLog() -> None This method closes the API error log file. If error logging is currently enabled this method disables it. The error log is time and date stamped before it is closed. After the log is closed the error log path name is reset to the default path name. If the error log file is already closed, then no action is taken. Note that if a log is reopened after it is closed, all information previously logged to it is lost.
|
static |
componentSelectionMask() -> MSelectionMask Returns the component selection mask.
|
static |
currentToolContext() -> MObject Returns the current tool context as an MObject.
|
static |
defaultErrorLogPathName() -> string Determines the default path name of the error log file. Returns an empty string on failure.
|
static |
deleteNode(MObject) -> None Delete the given dag node or dependency graph node.
|
static |
disableStow() -> bool This method is used to query if the disabling of Stowing (hiding) and Unstowing (showing) windows is active.
|
static |
displayError(msg) -> None Display an error in the script editor.
Name: | displayError(msg) |
Parameters: | msg - string |
Returns: | |
Description: | Display an error in the script editor. |
|
static |
displayInfo(msg) -> None Display an informational message in the script editor.
Name: | displayInfo(msg) |
Parameters: | msg - string |
Returns: | |
Description: | Display an informational message in the script editor. |
|
static |
displayWarning(msg) -> None Display a warning in the script editor.
Name: | displayWarning(msg) |
Parameters: | msg - string |
Returns: | |
Description: | Display a warning in the script editor. |
|
static |
doErrorLogEntry(string) -> bool Logs an entry in the currently open log file. It is not necessary for error logging to be enabled, but a log file must be open. A newline is appended to each log entry.
|
static |
errorLoggingIsOn() -> bool This method determines whether or not API errors are being logged.
|
static |
errorLogPathName() -> string Determines the path name of the current error log file. Returns the null stringon failure.
|
static |
executeCommandOnIdle(string, bool displayEnabled=False) -> None Sets a MEL command to execute on the next idle event. Since the command will likely not be executed until some time after control is returned to caller, there is no access to the command results. This method is thread safe and can be called from a thread other than Maya's main thread. However, that thread must still be part of the Maya process. Calling this method from a completely separate process will not work and may lead to unpredictable behaviour.
|
static |
executeCommandStringResult(string, bool displayEnabled=False, bool undoEnabled=False) -> string or [string, string, ...] Executes a MEL command that returns a string or an array of strings result from the command engine depending on the number of return values. Optionally allows display of the command in the Command Window to be enabled or disabled. Defaults to disabled. Optionally allows undo for the command to be enabled or disabled. Defaults to disabled. Note: This is not thread safe; you may use executeCommandOnIdle instead
|
static |
getAbsolutePathToResources() -> string Return the absolute path of Maya's "Resources" fold on the system, including the "Resources" folder itself.
|
static |
getActiveSelectionList(orderedSelectionIfAvailable=False) -> MSelectionList Return an MSelectionList containing the nodes, components and plugs currently selected in Maya. If orderedSelectionIfAvailable is True, and tracking is enabled, will return the selected items in the order that they were selected.
Name: | getActiveSelectionList() |
Parameters: | |
Returns: | MSelectionList |
Description: | Returns a copy of the active selection list. |
|
static |
getAssociatedSets(MSelectionList) -> list This utility method finds all the sets that the items in the given selection list are members of.
|
static |
getFunctionSetList(MObject) -> (string, string, ...) Returns a tuple of strings that represent the type of each function set that will accept this object.
Name: | getFunctionSetList(object) |
Parameters: | object - MObject |
Returns: | tuple of strings |
Description: | Returns a tuple of strings that represent the type of each function set that will accept this object. |
|
static |
getHiliteList() -> MSelectionList Returns a copy of the hilite list. The hilite list contains all DAG objects that are hilited for component selection mode. (e.g. when the user right clicks over a Mesh object and chooses the "vertex" option the Mesh line drawing changes color and the mesh is added to the hiliteList.)
|
static |
getLiveList() -> MSelectionList Returns a copy of the live list. When a user performs a "Modify->Make Live" in the user interface the currently selected objects are added to the live list.
|
static |
getPreselectionHiliteList() -> MSelectionList Gets the objects for which Maya is displaying a preselection highlight in the viewports.
|
static |
getRichSelection(defaultToActiveSelection=True) -> MRichSelection Returns the current rich selection (usually the active selection with any soft selection and symmetry applied). If no rich selection exists and 'defaultToActiveSelection' is True, the current active selection will be returned instead.
|
static |
getSelectionListByName(name) -> MSelectionList Returns an MSelectionList with all of the objects that match the specified name. The name may use the same type of regular expressions as can be used in MEL commands. For example, the pattern 'pCube*' will match all occurrences of objects whose names begin with 'pCube'.
Name: | getSelectionListByName(name) |
Parameters: | name - string |
Returns: | MSelectionList |
Description: | Returns a selection list with all of the objects that match the specified name. The name may use the same type of regular expressions as can be used in MEL commands. For example, the pattern "pCube*" will match all occurrences of objects whose names begin with "pCube". |
|
static |
isRedoing() -> bool true if Maya is currently in the middle of a redo.
|
static |
isSelected(MObject) -> bool Determines whether the given object is on the active selection list.
|
static |
isUndoing() -> bool true if Maya is currently in the middle of an undo.
|
static |
isYAxisUp() -> bool This method returns true if, currently, the Y-axis is UP.
|
static |
isZAxisUp() -> bool This method returns true if, currently, the Z-axis is UP.
|
static |
mayaState() -> int Returns an enumerated type specifying the way in which Maya was invoked. kInteractive Running with a UI kBatch Running without a UI kLibraryApp Running as a standalone (MLibrary) application. kBaseUIMode Running with UI enabled but Maya's std UI scripts not run.
|
static |
mayaVersion() -> string Returns a string describing this version of Maya.
|
static |
miscSelectionMask() -> MSelectionMask Returns the miscellaneous selection mask.
|
static |
objectSelectionMask() -> MSelectionMask Returns the object selection mask.
|
static |
optionVarDoubleValue(string) -> double This method is used to get the option variable value of type double
|
static |
optionVarExists(string) -> bool This method is used to check if the option variable exists
|
static |
optionVarIntValue(string) -> int This method is used to get the option variable value of int type
|
static |
optionVarStringValue(string) -> MString This method is used to get the option variable value of type string
|
static |
removeFromModel(MObject) -> None Removes the specified dag node from the scene. This method is only valid for dag nodes. If the specified object is not of type MFn::kDagNode then MS::kInvalidParameter will be returned. Note that this method doesn't delete the dag node which means the node must be added back to scene by calling either MGlobal::addToModel() or MGlobal::addToModelAt() in later calls, otherwise the dag node is leaked. To delete the dag node, call MGlobal::deleteNode() instead.
|
static |
removeOptionVar(string) -> None This method is used to remove the option variable
|
static |
resetToDefaultErrorLogPathName() -> None Closes the current log file if it is open, and then resets the log path to the default path. Logging is disabled and the log file speicified by the default path is not opened. If logging is disabled, it remains disabled. Use startErrorLogging() to enable logging to the default log file. If the current path is the default path, no action is taken, but an invalid parameter error is returned. Note that if the default log is reopened after it is closed, all information previously logged to it is lost.
|
static |
selectByName(string, listAdjustment=kReplaceList) -> None Puts objects that match the give name on the active selection list.
|
static |
selectCommand(MSelectionList, listAdjustment=kReplaceList) -> None Set the active selection list, by calling the built in Maya select command. This differs from setActiveSelectionList in that in this version Maya takes over the selection list you give it and will be responsible for maintaing the necessary information required for undo, redo, and journaling.
|
static |
selectFromScreen(short, short, listAdjustment=kAddToList, selectMethod=kWireframeSelectMethod) -> None selectFromScreen(short, short, short, short, listAdjustment=kAddToList, selectMethod=kWireframeSelectMethod) -> None Perform click-pick type selection on the dag. If an object intersects the click point then it is selected according to listAdjustment.
|
static |
selectionMethod() -> int Determines the selection method that should be used in the currently active viewport. This is useful as input to the "selectFromScreen" functions.
|
static |
selectionMode() -> int Get current selection mode: kSelectObjectMode Objects are selected as a whole. Components are not directly accessible. kSelectComponentMode Components such as vertices are selectable in this mode. kSelectRootMode Selecting the child in a hierarchy will also select its root DAG node. kSelectLeafMode Selecting the child in a hierarchy will result only in that child being selected. kSelectTemplateMode Templated objects are selectable in this mode.
|
static |
setActiveSelectionList(MSelectionList, listAdjustment=kReplaceList) -> None Set the active selection list. The selection items on the given list will update the contents of the active selection list as indicated by the listAdjustment parameter. Valid listAdjustment values are: kReplaceList #Totally replace the list with the given items. kXORWithList #Items already in the list will be removed. New items will be appended to the end of the list. kAddToList #Add the items to the end of the list. kRemoveFromList #Remove the items from the list. kAddToHeadOfList #Add the items to the beginning of the list.
|
static |
setAnimSelectionMask(mask) -> selfsetAnimSelectionMask(type) -> self Set the animation selection mask to the supplied value. * mask (MSelectionMask) - The selection mask. * type (int) - The selection type (see MSelectionMask.addMask() for a list of values).
|
static |
setComponentSelectionMask(mask) -> selfsetComponentSelectionMask(type) -> self Set the component selection mask to the supplied value. * mask (MSelectionMask) - The selection mask. * type (int) - The selection type (see MSelectionMask.addMask() for a list of values).
|
static |
setDisableStow(bool) -> None This method is used to make the visiblity of all Maya windows unchangable. If set to true, it disables any attempts to change the visiblity of any window. In addition, all popup windows will be supressed.
|
static |
setDisplayCVs(MSelectionList, bool) -> None Controls drawing of control points in the specified selection list. The selection items on the given list will be marked for drawing. This overrides Maya's current draw list and allow, for example, the drawing of control points without being in vertex selection mode.
|
static |
setErrorLogPathName(string) -> None Determines the default path name of the error log file. Returns an empty string on failure.
|
static |
setHiliteList(MSelectionList) -> None Sets the current hilite list. The current selection list is unchanged.
|
static |
setMiscSelectionMask(mask) -> selfsetMiscSelectionMask(type) -> self Set the miscellaneous selection mask to the supplied value. * mask (MSelectionMask) - The selection mask. * type (int) - The selection type (see MSelectionMask.addMask() for a list of values).
|
static |
setObjectSelectionMask(mask) -> selfsetObjectSelectionMask(type) -> self Set the object selection mask to the supplied value. * mask (MSelectionMask) - The selection mask. * type (int) - The selection type (see MSelectionMask.addMask() for a list of values).
|
static |
setOptionVarValue(string, int) -> bool setOptionVarValue(string name, double) -> bool setOptionVarValue(string name, string) -> bool This method is used to set the option variable value of int, bool, string type
|
static |
setPreselectionHiliteList(MSelectionList) -> None Sets the objects for which Maya will display a preselection highlight in the viewports. The objects/components in the list will be drawn in Maya's preselection highlight style on the next viewport refresh (if preselection highlighting is enabled in the preferences). If preselection highlighting is not enabled, Maya will still store the list.
|
static |
setRichSelection(MRichSelection) -> None Set the current rich selection.
|
static |
setSelectionMode(int) -> None Set the current selection mode. See selectionMode() for a list of valid modes.
|
static |
setTrackSelectionOrderEnabled() -> None Set whether Maya should maintain an active selection list which maintains object and component selection order.
|
static |
setYAxisUp() -> None This method sets the flag to identify which axis is Up, and rotates the ground plane around around the X-axis 90 degrees to get the Y-Up from Z-Up.
|
static |
setZAxisUp() -> None This method sets the flag to identify which axis is Up, and rotates the ground plane around around the X-axis 90 degrees to get the Y-Up from Y-Up.
|
static |
sourceFile(string) -> None Causes the MEL command engine to open the named file and execute the contents of the file as a MEL script. If the provided fileName is a Unix absolute pathname, then that file is opened. If a relative pathname is provided, the directories indicated by the environment variable, MAYA_SCRIPT_PATH, will be searched for a matching filename.
|
static |
startErrorLogging() -> None startErrorLogging(string) This method enables output to the API error log file specified by the path. If another error log file is already open this method time and date stamps the log, and closes it. The new error log is time and date stamped when it is opened. If the new path name is the same as the current path name, this method ensures that logging is enabled, but no other action is taken.
|
static |
stopErrorLogging() -> None This method disables output to the API error log but does not close the log file.
|
static |
trackSelectionOrderEnabled() -> bool Returns whether the selection order is currerntly being tracked.
|
static |
unselect(MObject) -> None unselect(MDagPath, MObject) -> None Remove the given object/components from the active selection list. If components is null then the object will be unselected, otherwise the components will be unselected. Perform marquee type selection on the dag. If an object intersects the selection rectangle, it is selected according to listAdjustment.
|
static |
unselectByName(string) -> None Removes objects matching the pattern from the active selection list.
|
static |
upAxis() -> MVector This method returns the model's current up axis.
|
static |
viewFrame(double) -> None viewFrame(MTime) -> None Sets the global time to the specified time. This function is optimized for sequential time values that are monotonically increasing. While one can set the time randomly with this function, a significant performance hit will be incurred.
|
static |
Name: | kAddToHeadOfList |
Type: | int |
Description: | Add the items to the beginning of the list. |
|
static |
Name: | kAddToList |
Type: | int |
Description: | Add the items to the end of the list. |
|
static |
Name: | kBaseUIMode |
Type: | int |
Description: | Running with UI functionality enabled but Maya's standard UI startup scripts are not run. Allows users to provide their own UI. |
|
static |
Name: | kBatch |
Type: | int |
Description: | Running without a UI. |
|
static |
Name: | kInteractive |
Type: | int |
Description: | Running with a UI. |
|
static |
Name: | kLibraryApp |
Type: | int |
Description: | Running as standalone (MLibrary) application. |
|
static |
Name: | kRemoveFromList |
Type: | int |
Description: | Remove the items from the list. |
|
static |
Name: | kReplaceList |
Type: | int |
Description: | Totally replace the list with the given items. |
|
static |
Name: | kSelectComponentMode |
Type: | int |
Description: | Select components. |
|
static |
Name: | kSelectLeafMode |
Type: | int |
Description: | Select DAG leaves. |
|
static |
Name: | kSelectObjectMode |
Type: | int |
Description: | Select objects. |
|
static |
Name: | kSelectRootMode |
Type: | int |
Description: | Select DAG roots. |
|
static |
Name: | kSelectTemplateMode |
Type: | int |
Description: | Select templated objects. |
|
static |
Name: | kSurfaceSelectMethod |
Type: | int |
Description: | Select based on the surface of the objects. |
|
static |
Name: | kWireframeSelectMethod |
Type: | int |
Description: | Select based on the wireframe of the objects. |
|
static |
Name: | kXORWithList |
Type: | int |
Description: | Any of the items which are already on the list will be removed. Any which are not already on the list will be added to the end of the list. |