Skip to content

Instantly share code, notes, and snippets.

select `ls -typ "animCurveTL" -typ "animCurveTU" -typ "animCurveTA" -typ "animCurveTT"`; gets just the curves that are animated - i.e. parameters that change over time The 2 letters at the end specify imput and output units input is Time or Unitless output is Linear Unitless Angle or Time - gotta admit, i never knew about the ls -typ "animCurve" catchall - thanks
from pymel.core import *
for s in selected():
so = PyNode( 'tinker_director_anim:' + s )
connectAttr( so.t, s.t, f=1, l=0 )
connectAttr( so.r, s.r, f=1, l=0 )
connectAttr( so.s, s.s, f=1, l=0 )
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMaya as om
#Add Render Element Extra_Tex
mel.eval("vrayAddRenderElement ExtraTexElement")
#Rename Extra_Tex
cmds.rename("vrayRE_Extra_Tex", "vrayRE_Extra_Tex_UV")
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMaya as om
#Add Render Element Extra_Tex
mel.eval("vrayAddRenderElement ExtraTexElement")
#Rename Extra_Tex
cmds.rename("vrayRE_Extra_Tex", "vrayRE_Extra_Tex_PP")
@SEVEZ
SEVEZ / set_cam_clip_planes.py
Last active September 5, 2017 15:03
Set camera clipping planes for rendering z-depth #misc
from pymel.core import *
sel = selected()[0]
cam = PyNode( 'persp1' )
parent( sel, cam, a=1 )
bbcoord = xform( sel, q=1, os=1, bb=1 )
near = -bbcoord[5]
far = -bbcoord[2]
'''
mayaScene.uv
namespace for uv manipulation and queries
'''
import maya.cmds as cmds
def get_names(obj):
@SEVEZ
SEVEZ / gist:247beea1085931c4224d
Created August 29, 2015 11:29
check key modifiers
import maya.cmds as cmds
mods = cmds.getModifiers()
if (mods & 4) > 0:
print "Ctrl pressed"
else:
print "Ctrl not pressed"
@SEVEZ
SEVEZ / new_gist_file.mel
Created August 29, 2015 11:30
Bake wrap and ffd weights to skinCluster
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//This script was written by Ben Bathen.
//It was based on an idea presented By David Stripinis in his tutorial "Complex Character Setup In Maya For Games."
//It was completed April 5, 2003.
//This script bakes all the weights from wrap deformers and lattices into a skincluster on a mesh.
//This is helpful because a wrap deformer can have alot less vertices than a high Res mesh.
//Also you can edit the geomety on the high res mesh at any time without losing your weighting.
//select the root, then select the mesh, then execute the script. Works on only one mesh at a time.
import maya.OpenMaya as OpenMaya
import pymel.core as pm
import math
#Function to get the texture name.
def GetFileTextureName(plug):
connectedPlugs = OpenMaya.MPlugArray()
plug.connectedTo(connectedPlugs, True, False)
for k in range(connectedPlugs.length()):
if (connectedPlugs[k].node().apiType() == OpenMaya.MFn.kFileTexture):
@SEVEZ
SEVEZ / enum_shells.py
Created August 29, 2015 11:30
Iterate through all the shells of mesh
from pymel.all import *
def getShellFaces( poly, str = 0 ):
shells = set()
faces = set()
total = polyEvaluate( poly, s=1)
for f in xrange( polyEvaluate( poly, f=1 ) ):
if len( shells ) >= total: