Pffffttt just use this!
import pymel.tools.mel2py as mel2py
print mel2py.mel2pyStr("""spaceLocator -p 0 0 0;""")
Output:
spaceLocator(p=(0, 0, 0))
Remember to add a cmds. to the start, because for some reason it doesn't add it on for you!
Now you can just replace 'spaceLocator -p 0 0 0;' with any other MEL code that the script editor may spit out whilst you're Maya'ing and BAM insta-python!
Sure, it doesn't work for all cases but for other cases where you just want to copy & paste a handy addAttr line and can't be bothered to google it, it can come in handy and help speed things along.
import pymel.core as pm
ReplyDeleteshrinkWrapNode = pm.deformer('pSphere1', type='shrinkWrap')[0]
pm.PyNode('pTorus1').worldMesh[0] >> shrinkWrapNode.targetGeom
shrinkWrapNode.closestIfNoIntersection.set(True)
Delete -r R_B_controlArm_transform_grp_parentConstraint1 ;
ReplyDeleteDelete -r L_B_controlArm_transform_grp_parentConstraint1 ;