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.api.OpenMaya as om2 | |
import maya.cmds as mc | |
import contextlib | |
from colorbleed.maya.lib import iter_parents | |
@contextlib.contextmanager | |
def maintained_time(): | |
ct = cmds.currentTime(query=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
""" | |
A simple utility module for moving skinned joints. | |
""" | |
import math | |
import pymel.core as pmc | |
def reset_bind_matrix(joint): | |
""" |
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 FbxCommon | |
def fbx_trim_keys(scene, start, end, take_buffer=10): | |
""" | |
Uses the FBX SDK to remove unnecessary keys. | |
:param scene: FBX SDK scene class that hold data to edit | |
:param int start: start frame of animation keys to keep | |
:param int end: end frame of animation keys to keep |
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
// Randall Hess randall.hess@gmail.com | |
// Instructions: Copy this file over your local maya version to override the default behavior | |
// Maya 2022 and Higher | |
// Additional: You can also build and load this as a module and not overwrite the local maya file. | |
// Location: C:\Program Files\Autodesk\MayaXX\scripts\others\performFileDropAction.mel | |
global proc int | |
performFileDropAction (string $theFile) |
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
from maya import cmds, OpenMaya | |
from pprint import pprint | |
import os | |
def _getProxyAttributeCommands(cmdsnode): | |
#Takes a string of a maya object, like 'pshere1' | |
#checks for proxy attributes | |
#returns mel command to make that proxy attribute | |
proxyAttrCmds = [] | |
selectionList = OpenMaya.MSelectionList() |
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 | |
def xformMirror(transforms=[], across='YZ', behaviour=True): | |
""" Mirrors transform across hyperplane. | |
transforms -- list of Transform or string. | |
across -- plane which to mirror across. | |
behaviour -- bool | |
""" |
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.api.OpenMaya as om | |
import maya.cmds as cmds | |
#returns the closest vertex given a mesh and a position [x,y,z] in world space. | |
#Uses om.MfnMesh.getClosestPoint() returned face ID and iterates through face's vertices. | |
def getClosestVertex(mayaMesh,pos=[0,0,0]): | |
mVector = om.MVector(pos)#using MVector type to represent position | |
selectionList = om.MSelectionList() | |
selectionList.add(mayaMesh) | |
dPath= selectionList.getDagPath(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 maya.cmds as cmds | |
import pymel.core as pymel | |
def create_pivot_bone(): | |
""" | |
Create a bone from the customPivot context | |
In component mode of a mesh: | |
Press "D" or "Insert" to go into custom pivot context | |
If you click on edges verts or faces the pivot will auto align |
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
''' | |
FBXWrapper | |
This module provides a python wrapper for every method exposed in the FBX plugin. | |
The arguments for the calls are the same as for the equivalent mel calls, however they can be passed with typical | |
python syntax, which is translated to mel-style flags and arguments under the hood. The actual flags and arguments | |
are documented here: | |
usage: |
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
'''A simple example of a control shape manager in Maya contained in one file for easier access. It can be used for loading, saving, copying, etc. control shapes. | |
This file is used for demonstration purposes, to be followed along with in this blog post | |
http://bindpose.com/creating-maya-control-shape-manager | |
''' | |
import os | |
import json | |
import re |