Skip to content

Instantly share code, notes, and snippets.

@tokejepsen
tokejepsen / .py
Created July 30, 2015 18:11
multi fbx export
import os
import maya.cmds as cmds
path = cmds.fileDialog2(dialogStyle=1, fileMode=3)
if path:
path = path[0]
sel = cmds.ls(selection=True)
for node in sel:
@tokejepsen
tokejepsen / .py
Created July 30, 2015 18:01
multi obj export
import os
import maya.cmds as cmds
path = cmds.fileDialog2(dialogStyle=1, fileMode=3)
if path:
path = path[0]
sel = cmds.ls(selection=True)
for node in sel:
@tokejepsen
tokejepsen / gist:c54dabe11d64ee5d54bd
Last active August 29, 2015 14:25
Bake Shape to Blendshape
import maya.cmds as cmds
def bakeShapeToBlendShape(node, start, end):
step = 1.0 / end
bs_node = cmds.duplicate(node, n=node + '_blendshape')[0]
cmds.currentTime(end)
copy = cmds.duplicate(node)[0]
bs = cmds.blendShape(bs_node)[0]
@tokejepsen
tokejepsen / gist:77d02d8f2f09e27de08b
Last active March 15, 2020 22:38
DJV Viewer action
import sys
import argparse
import logging
import os
import getpass
import pprint
import subprocess
import ftrack
@tokejepsen
tokejepsen / mnh.py
Last active August 2, 2016 15:51
Maya: Nondestructive holds
import pymel.core as pc
import pymel.core.animation as pca
import pymel.core.nodetypes as pcn
import maya.mel
# create animation layer
if pc.ls(selection=True):
anim_layer = pca.animLayer(addSelectedObjects=True)
pc.rename(anim_layer, 'baked_secondary_keys')
anim_layer.override.set(True)
@tokejepsen
tokejepsen / gist:e7107f4c610e91214cfd
Created January 23, 2015 12:29
Maya: Paint Effects
import pymel.core as pm
import maya.mel as mel
for node in pm.ls(type='stroke'):
cmd = 'applyPresetToNode "%s" "" "" "ghost" 1;' % node
mel.eval(cmd)
for node in pm.ls(type='brush'):
cmd = 'applyPresetToNode "%s" "" "" "ghost" 1;' % node
mel.eval(cmd)
@tokejepsen
tokejepsen / gist:c79d54cb142103d16ea7
Last active August 29, 2015 14:02
Companies Contact
import re
import gspread
gc = gspread.login('LOGIN', 'PASSWORD')
wks = gc.open('Companies Contact')
worksheet = wks.worksheet('Input')
import maya.cmds as cmds
import Tapp.Maya.Red9.core.Red9_AnimationUtils as r9Anim
import Tapp.Maya.Red9.core.Red9_CoreUtils as r9Core
def switchRotationAxis(node, axis1, axis2, axis1Inverse, axis2Inverse):
#variables
temp = cmds.spaceLocator()
@tokejepsen
tokejepsen / gist:db33342ee451cf6aaa07
Created May 17, 2014 11:43
Maya Scene: parent inverse
//Maya ASCII 2014 scene
//Name: parentInverseOffset.ma
//Last modified: Tue, Apr 22, 2014 05:27:56 PM
//Codeset: 1252
requires maya "2014";
requires -nodeType "decomposeMatrix" -nodeType "composeMatrix" -nodeType "inverseMatrix"
-nodeType "transposeMatrix" "matrixNodes" "1.0";
currentUnit -l centimeter -a degree -t pal;
fileInfo "application" "maya";
fileInfo "product" "Maya 2014";
@tokejepsen
tokejepsen / gist:9387545
Created March 6, 2014 11:15
symmetry, preserving uvs
def symmetry(edit, original):
mirror = mirrorBlendshape([edit],original)[0]
copy = cmds.duplicate(original)[0]
bldShp = cmds.blendShape(edit, mirror,copy)[0]
cmds.setAttr('%s.%s' % (bldShp, edit), 1)
cmds.setAttr('%s.%s' % (bldShp, mirror), 1)
symmetry = cmds.duplicate(copy)[0]
symmetry = cmds.rename(symmetry, original + '_symmetry')
cmds.delete(copy, mirror)