This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
curves = pm.keyframe(q=True, sl=True, name=True) | |
for curve in curves: | |
key_vals = pm.keyframe(curve, q=True, vc=True) | |
start_val = key_vals[0] | |
pm.keyframe(curve, e=True, vc=start_val*-1, relative=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
import collections | |
def getAllLayers(): | |
rootLayer = cmds.animLayer(q=True, r=True) | |
if rootLayer: | |
def search(layer, depth=0): | |
children = cmds.animLayer(layer, q=True, c=True) | |
if children: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
from anim_utilities import anim_util | |
selection = pm.selected() | |
pm.refresh(suspend=True) | |
pm.bakeResults(selection, time=anim_util.get_playback_range()) | |
pm.delete(staticChannels=True) | |
pm.filterCurve(selection) | |
pm.refresh(suspend=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
import maya.mel as mm | |
def toggleMayaWindows(key): | |
# use toggleMayaWindows("GraphEditor"), toggleMayaWindows("DopeSheet"), etc | |
windDict = {"DopeSheet": ["dopeSheetPanel1Window", "DopeSheetEditor"], | |
"GraphEditor": ["graphEditor1Window", "GraphEditor"], | |
"TraxEditor": ["clipEditorPanel1Window", "CharacterAnimationEditor"], | |
"HyperShade": ["hyperShadePanel1Window", "HypershadeWindow"], | |
"Outliner": ["outlinerPanel1Window", "OutlinerWindow"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
cursel = cmds.ls( sl=True ) | |
for obj in cursel: | |
newname = obj.lower() | |
cmds.rename( obj, newname ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
curves = cmds.keyframe(q=True, sl=True, n=True) | |
if curves: | |
for curve in curves: | |
key_times = cmds.keyframe(curve, q=True, sl=True, tc=True) | |
key_vals = cmds.keyframe(curve, q=True, sl=True, vc=True) | |
for i, frame in enumerate(key_times): | |
cmds.keyframe(curve, e=True, time=(frame,frame), absolute=True, vc=(key_vals[i]*-1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
def createMirrorCam(currentCam): | |
mirrorCam_grp = mc.group(empty=True,n="mirrorCam_grp") | |
mc.addAttr(mirrorCam_grp, ln="notes", dt="string", sn="nts") | |
mc.setAttr("%s.notes"%mirrorCam_grp, currentCam,type="string") | |
mirrorCam = mc.duplicate (currentCam,n="mirrorCam") | |
camPos = mc.xform(mirrorCam[0], ws=1, t=1, q=1) | |
camRot = mc.xform(mirrorCam[0], ws=1, ro=1, q=1) | |
mc.xform(mirrorCam_grp, ws=1, t=(camPos[0], camPos[1], camPos[2]),ro=(camRot[0], camRot[1], camRot[2])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
pb_speed = cmds.playbackOptions(q=True, playbackSpeed=True) | |
if pb_speed == 1: | |
cmds.playbackOptions(e=True, playbackSpeed=0.5) | |
print('Playback Speed: 0.5' + '\n') | |
elif pb_speed == 0.5: | |
cmds.playbackOptions(e=True, playbackSpeed=1) | |
print('Playback Speed: 1.0' + '\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
string $selected[] = `ls -type joint`; | |
select -r $selected; | |
} | |
string $sel[] = `ls -sl`; | |
string $singleJnt; | |
for ($singleJnt in $sel) | |
{ | |
setAttr ($singleJnt + ".segmentScaleCompensate") 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymxs | |
rt = pymxs.runtime | |
def delete_similar_named_objs(in_name): | |
rt.select(rt.objects) | |
to_delete = [] | |
for s in rt.selection: | |
if in_name in s.name: | |
to_delete.append(s) # using rt.delete(s) doesn't get all the objects for some reason |
NewerOlder