
- MAYA PYTHON LS MOD
- MAYA PYTHON LS CODE
- MAYA PYTHON LS LICENSE
This means that the annoying inconsistencies of string comparisons are over: no more worrying about short names versus long names, DAG paths, unique paths, instance paths. PyMEL harnesses the API to create a name-independent representation of your object. Your studio can freely use, contribute to, and modify this module with no strings attached. PyMEL is released under the BSD license, which is as open as open source gets.
MAYA PYTHON LS LICENSE
Kudos to the PyMel team for such a well thought out project! BSD License It's also going to help our other Technical Artists with their Python learning curve, since PyMEL's syntax is consistent with most other python packages.
MAYA PYTHON LS CODE
With PyMel, I can think and write the python code and syntax I'm already used to, which speeds up my development time considerably. Having done production python code myself for many years, wrapping my head around Maya's native implementation took a little bit of time. Here's what Seth Gibson of Bungie Studios, makers of Halo, has to say: Since its release in 2008, PyMEL has accumulated an impressive resume in both feature films and games, and is now bundled with every release of Maya.
Provide documentation accessible via html and the builtin `help() function. Add organization through class hierarchy and sub-modules. Fix bugs and design limitations in Maya's python modues, maya.cmds and l. Create an open-source python module for Maya that is intuitive to MEL users and python users alike. PyMEL builds on the maya.cmds module by organizing its commands into a class hierarchy, and by customizing them to operate in a more succinct and intuitive way. The result is a very awkward and unpythonic syntax which does not take advantage of python's strengths - particulary, a flexible, object-oriented design. Maya's command module is a direct translation of mel commands into python commands. Note the forceElement, it will fail without if the object already is connected to a SG, which is almost always the case.PyMEL makes python scripting with Maya work the way it should. You'd see a lot of cmds.hyperShade(assign=mat) around the net, but beware: this does not work in batch mode and appears to be slower than just using set, as in ts(e=True,forceElement=shading_group). viewFit() is a great way, but you need to specify a camera. Sometimes, for example to render a preview, you need to ensure that everything is visible. There is not much documentation on running maya headlessly, which is sometimes all you need and all you are allowed to do when automating stuff, so here are some thoughts: cmds.workspace("/path/to/workspace",o=True) This assumes a valid project folder at the target location. The "open" flag actually tells maya to set the workspace root, called "Project" in the ui. Print cmds.file(query=True, sceneName=True) Set workspace Sometimes you need to retrieve the current workspace directory, a.k.a. If cmds.window(window_name, q = True, ex = True): Super(UiClass, self)._init_(parent=parent) Max_syllables = int(random.random() * 4)+1Ĭlass UiClass (MayaQWidgetDockableMixin,QWidget): Handling close events: class Ui (MayaQWidgetDockableMixin, QWidget):Ĭomplete example: import maya.cmds as cmdsįrom import MayaQWidgetDockableMixin Still, one had to use classes, but this is the bare stuff. Fortunately this is not so true: from PySide import QtGui Get Shading Group from material sg = cmds.listConnections('material_node', type='shadingEngine')Īre incredibly complicated, if you search around the webz. Mat = for se in node.getShape().outputs(type='shadingEngine')] Pymel oneliner for aquiring material import re as pm Shading_group=ts(renderable=True,noSurfaceShader=True,empty=True)Ĭmds.connectAttr('%s.outColor' %shader ,'%s.surfaceShader' %shading_group)Ĭmds.connectAttr('%s.outColor' %file_node, '%s.color' %shader)Ĭmds.setAttr(file_node+".fileTextureName", "texture.png",type="string")Ĭmds.sets("myobject",e=True,forceElement=shading_group)Īpply a sg to faces: ts(', 'new.f'], e = True, forceElement = 'sg') shader=cmds.shadingNode("phong",asShader=True)įile_node=cmds.shadingNode("file",asTexture=True) Probably not elegant, but this is the whole shebang of creating a shader, shading group and texture and assigning it to something. Maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM) MAYA PYTHON LS MOD
Message = 'import mymod as mod mod.run()' This is pretty straightforward, but there is one evil thing: when I talked from blender to Maya, blender's python version wanted to send encoded strings. The command port might be really useful for remote controlling maya from other apps. Get object of shape (actually, the parent - since the transform is the parent of the shape, this will return the transform):Ĭmds.listRelatives( "pCubeShape1", allParents=True ) Command port Print cmds.ls("yourpattern*",showType=True)