Maya Environment

Cam
    opt + LMB - rotate
    opt + RMB - scale
    opt + MMB - move
    
Viewport
    frame geometry - H
    frame selected object - o
    Show Attribute Editor - Ctrl + A
Settings
    preferences - 
    Project - 
    Render -
    
Essential 
    Commander - 

Setting up Visual Studio Code for Maya

  1. Install Python, Visual Studio Code

  2. In VSC, install MEL - Maya Embedded Language, Maya-code, Maya-Py, Maya Code

  3. Download latest devkit > copy devkit into dev kit folder in your Maya application folder

  4. Modify your JSON

  5. In Maya > Script Editor > Open ports by entering these code

import maya.cmds as cmds
# Open new ports
cmds.commandPort(name=":7001", sourceType="mel", echoOutput=True)
cmds.commandPort(name=":7002", sourceType="python", echoOutput=True)

To enable ports at startup create a file named userSetup.mel in the following folder:

Windows: <drive>:\Documents and Settings\<username>\My Documents\maya\<Version>\scripts
Mac OS X: ~/Library/Preferences/Autodesk/maya/<version>/scripts.
Linux: ~/maya/<version>/scripts.
(where ~ is your home folder)

In the userSetup.mel file add the following

commandPort -name "localhost:7001" -sourceType "mel" -echoOutput; 
commandPort -name "localhost:7002" -sourceType "python" -echoOutput;
{
    "python.pythonPath": "python",
    "python.autoComplete.extraPaths": [  "C:/Program Files/Autodesk/Maya2019/devkit/other/pymel/extras/completion/py" ],

}

/Applications/Autodesk/maya2020/devkit

Part 1: Creating and Manipulating Objects

  • open Script Editor to see echo MEL command

  • go to Help > Python reference

  • flags: ch,o,w,g,d,name

  • DAG - direct acyclic graphic: transform node>shape node > data structures

  • Window > Setting / Preferences > Preferences > Selection > Track Selection Order

Hotkeys

  • Cmd T - new python

import maya.cmds as cmds

def keyFullRotation(pObjectName,pStartTime, pEndTime, pTargetAttribute):

    #print '%s type: %s' % (objectname, objectTypeResult)
    cmds.cutKey(pObjectName, time=(pStartTime,pEndTime), attribute=pTargetAttribute)
    cmds.setKeyframe(pObjectName, time= pStartTime, attribute = pTargetAttribute, value=0)
    cmds.setKeyframe(pObjectName, time= pEndTime, attribute = pTargetAttribute, value=360)
    
    #linear tangent
    cmds.selectKey(pObjectName, time-(pStartTime,pEndTime), attribute = pTargetAttribute
    cmds.keyTangent(inTangentType = 'linear', outTangetType='linear')
    
    
selectionList = cmds.ls(selection=True, type = 'transform))

if len(selectionList)>=1:
    #print 'Selected items: %s' % (selectionList)
    
    for objectName in selectionList:
    
    startTime = cmds.playBackOptions(query=True,minTime=True)
    endTime = cmds.playBackOptions(query=True,maxTime=True)

    #objectTypeResult = cmds.objectType(objectName)
    
    keyFullRotation(objectName, startTime,endTime,'rotateY')
else: 
    print ' Please select at least one object'

Why

  • widespread

  • cross platform

  • cross-software

Troubleshooting

Modifying userSetup.mel

Mac: ~/Library/Preferences/Autodesk/maya/2020/scripts

Last updated