Skip to content

Instantly share code, notes, and snippets.

@SlyCodePanda
Last active June 24, 2019 07:54
Show Gist options
  • Save SlyCodePanda/60b7761ad1d43ba4b588b3a0904fa511 to your computer and use it in GitHub Desktop.
Save SlyCodePanda/60b7761ad1d43ba4b588b3a0904fa511 to your computer and use it in GitHub Desktop.
Handy snippets for quick maya python scripts.
# Get the shape node that is hidden in the transform.
selected_items = cmds.ls(selection=True)
if selected_items:
shapes = cmds.listRelatives(selected_items[0], shapes=True)
if shapes:
print shapes[0]
# Put this in a maya script editor python tab to load external scripts.
import sys
import maya.cmds as cmds
sys.path.append('<path>')
import <python file name> as <shorter name version>
reload(<shorter name version>)
<shorter name version>.run() # <- Not necessary if you don't have a 'run' function in your script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment