This file contains hidden or 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 PySide2 import QtWidgets | |
QtWidgets.qApp.setStyleSheet(""" | |
QWidget { | |
background: #2a2a2a; | |
color: #999; | |
} | |
""") |
This file contains hidden or 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 os | |
# os.environ is a dict. Key is variable name and value is value. | |
print os.environ['MAYA_PLUG_IN_PATH'] |
This file contains hidden or 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 os.path | |
import maya.cmds as cmds | |
import maya.mel as mel | |
import maya.OpenMaya as OpenMaya | |
mel.eval('string $MyScenes; \ | |
putenv $MyScenes "C:/Users/Admin/Desktop/fairy/"') | |
def foo(retCode, fileObject, clientData): | |
print "Callback was given %s" % fileObject.rawFullName() | |
rel = "$MyScenes/" | |
rel = rel + (os.path.basename(fileObject.rawFullName())) |
This file contains hidden or 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 selectedAttributes | |
sel = cmds.ls(selection=True) | |
if cmds.scaleKey(attribute=True): # Is a key/curve selected? | |
keys = cmds.keyframe(sel, query=True, selected=True) or [] | |
attributes = cmds.keyframe(sel, query=True, selected=True, name=True) or [] | |
first_key = min(keys) | |
last_key = max(keys) |
This file contains hidden or 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 _null(*args): | |
pass | |
class _shelf(): | |
'''A simple class to build shelves in maya. Since the build method is empty, | |
it should be extended by the derived class to build the necessary shelf elements. |
This file contains hidden or 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 maya.api.OpenMaya as api | |
def bestFitPlane(points, plane=False): | |
""" | |
Takes an array of points (transforms) | |
Returns a plane located at the centroid of the points | |
It is oriented as a best fit plane using this method: | |
http://www.ilikebigbits.com/blog/2017/9/24/fitting-a-plane-to-noisy-points-in-3d |
This file contains hidden or 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 selectedAttributes | |
sel = cmds.ls(selection=True) | |
if cmds.scaleKey(attribute=True): # Is a key/curve selected? | |
keys = cmds.keyframe(sel, query=True, selected=True) or [] | |
attributes = cmds.keyframe(sel, query=True, selected=True, name=True) or [] | |
first_key = min(keys) | |
last_key = max(keys) |
This file contains hidden or 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 | |
from maya import mel | |
# If you want to mess with the Char_Anim globals, here you go. Not necessary, though. | |
# namespace, char = mel.eval('$tempVar = $char').split(':') | |
# namespace = mel.eval('$tempVar = stringArrayToString($namespc, " ")').split(" ")[0] | |
sel = cmds.ls(sl=True) | |
toon = sel[0].rpartition(':')[0] | |
chest_control = cmds.ls(toon + ':*_ac_cn_chest')[0] |
This file contains hidden or 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
# ---------------------------------------------------------------------------- # | |
# Custom Icon Paths | |
import os | |
icon_paths = [ # Mind the lack of comma after the last item in the list! | |
'F:/Dropbox/Code/Maya/KlugTools/Icons', | |
'F:/Dropbox/Code/Maya/ForeignTools/Icons' # No comma! | |
] | |
os.environ['XBMLANGPATH'] += os.pathsep + (os.pathsep).join(icon_paths) |
This file contains hidden or 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 better parent constraint | |
sel = cmds.ls(sl=1) | |
source = sel[0] | |
target = sel[-1] | |
constraint = cmds.parentConstraint(source, target, maintainOffset=True)[0] | |
cmds.addAttr(source, longName='blendParent', attributeType='float3', hidden=0, keyable=1, proxy=target + '.blendParent1') | |
cmds.addAttr(source, longName='constraint', attributeType='float3', hidden=0, keyable=1, proxy=constraint + '.w0') | |
cmds.addAttr(target, longName='constraint', attributeType='float3', hidden=0, keyable=1, proxy=constraint + '.w0') |
OlderNewer