![]() ![]() Plug = OpenMaya.MPlug( nodeObject, attrObject ) # function that finds a plug given a node object and plug nameĭef nameToNodePlug( attrName, nodeObject ):ĭepNodeFn = OpenMaya.MFnDependencyNode( nodeObject )ĪttrObject = depNodeFn.attribute( attrName ) SelectionList = OpenMaya.MSelectionList() # function that returns a node object given a name The following is a script that finds the persp node and prints out its translateX attribute value: # import the OpenMaya module ![]() Scripts can access dependency graph information using the Maya Python API classes. It is possible to shorten the symbol names used by modifying the import command: import maya.OpenMaya as OpenMaya Print "newVector %f, %f, %f " % (newVector.x, newVector.y, newVector.z) We can use wrapper and function set classes to write scripts such as the following: import maya.OpenMaya Examples of this class are: MVector, MIntArray, and so forth. Most, although not all, of these classes are "Wrappers". MPxĬlasses with this prefix are all "Proxies", that is, API classes designed for you to derive from and create your own object types. For example, MItCurveCV is used to operate on an individual NURBS curve CV (there is no MFnNurbsCurveCV), or, iteratively, on all the CVs of a curve. These classes are iterators and work on MObjects similar to the way a function set does. Classes include: MFnĪny class with this prefix is a function set used to operate on MObjects of a particular type. These classes are separated into different categories and have appropriate naming conventions to signify their association. The Maya Python API modules contain the classes that are available for Python programming. This operation will take a while to return since the OpenMaya module is very large. It is also possible to display the information of an entire module: For example, if you wish to display the class information for MVector, use: Information can be displayed about any of the modules or classes using the help command. To import the OpenMaya module, run the following: import maya.OpenMaya Additionally, the Maya Python API lives in the Maya namespace therefore, an extra prefix is required. You must import the functionality that you wish to use in your script. The Maya Python API is contained in a number of Python modules. In this section, we discuss how to write both basic and scripted plug-in scripts along with standalone scripts.Īs this is a Python based API, knowledge of Python is required. A scripted plug-in provides a more complex solution that is tightly integrated into Maya. These scripts can query and manipulate the Maya model but are not fully integrated into Maya. Houdini imports works in houdini interpreter but maya imports does not.It is possible to write basic scripts that use the wrapper, iterator and function set classes of the Maya API. I'm (unfortunately) on Win10 and need this to work on Win10 since that is what we use at company. Maya imports works in maya python, but import hou does not. I have merged Maya devkit paths and houdini paths in P圜harm for both maya python and houdini python. …" I don't get how it can find “first” instance (OpenMaya.py) but then it can't find “maya.api._OpenMaya_py2”. closest I to solution is to set P圜harm to search for modules inside maya devkit (while in Houdini python interpreter and completition works) but I'm getting folowing results: " … Traceback (most recent call last): File “U posterToolsBase/mayaScripts/removeNamespace.py”, line 1, in import as om File “C:\Program Files\Autodesk\Maya2018\Python\Lib\site-packages\maya\api\OpenMaya.py”, line 25, in import maya.api._OpenMaya_py2 ImportError: DLL load failed: The specified module could not be found. ![]() I've tried this (and many other ideas) but without success Is anybody succeed running importing hou in Maya python (or PyMel, maya.cmds or in Houdini python)? I can't find any solution on net.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |