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 | |
objs = mc.ls(sl=1) | |
keyframes = mc.keyframe(objs,q=1) | |
fs = int( mc.playbackOptions(q=1, ast=1 ) ) | |
fe = int( mc.playbackOptions(q=1, aet=1 ) ) | |
keyframes = sorted( [k for k in set(keyframes) if k>=fs and k<=fe] ) | |
for k in keyframes: | |
mc.setKeyframe(objs,t=[k],i=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
masterObject = "controllerName" | |
import maya.cmds as mc | |
objs = mc.ls(sl=1) | |
keyframes = mc.keyframe(masterObject,q=1) | |
fs = int( mc.playbackOptions(q=1, ast=1 ) ) | |
fe = int( mc.playbackOptions(q=1, aet=1 ) ) | |
keyframes = sorted( [k for k in set(keyframes) if k>=fs and k<=fe] ) |
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 | |
objList = mc.ls(sl=1) | |
objList = mc.listRelatives(objList,ad=1,typ="mesh") | |
objList = mc.listRelatives(objList,type='transform',p=True) | |
for obj in objList: | |
mc.setAttr(obj+".sz",mc.getAttr(obj+".sx")) |
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 | |
gshelf = mm.eval("$temp = $gShelfTopLevel") | |
shelves = mc.tabLayout(gshelf,q=1,childArray=1) | |
sTotal = len(shelves) | |
pref = 'xxx' | |
sShelf = sorted([s for s in shelves if s.startswith(pref)]) + sorted([s for s in shelves if not s.startswith(pref)]) |
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 | |
panels = mc.getPanel(typ='modelPanel') | |
for pan in panels: | |
cam = mc.modelPanel(pan, q=1, camera=1) | |
startup = mc.camera(cam, q=1, sc=1) | |
mc.modelEditor(pan, e=1, joints=0, nurbsCurves=startup, ikHandles=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
from PyQt4 import QtGui, QtCore | |
import maya.cmds as cmds | |
import maya.OpenMayaUI as mui | |
import sip | |
def convertToQT(controlName): | |
controlPoniter = mui.MQtUtil.findControl(controlName) | |
if controlPoniter is not None: | |
return sip.wrapinstance(long(controlPoniter), QtCore.QObject) |
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
# You can ignore this. It's just so I can use print like it is in Python 3 | |
from __future__ import print_function | |
# This is an object. This is one of Python's most basic types and what all classes should inherit from eventually. | |
# So even if your class inherits from another class which in turn inherits from another class, eventually if you follow it all the way back it should inherit from object | |
myObject = object() | |
# Object has a method called __init__ | |
print(myObject.__init__) # <method-wrapper '__init__' of object object at 0x000001F746C1F0A0> |
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
# First lets import the two modules we'll need from Qt | |
from Qt import QtWidgets, QtCore | |
# Then we create our Window class, in this case from a QDialog | |
class MyWindow(QtWidgets.QDialog): | |
def __init__(self): | |
# We use the __init__ method to initialize it | |
# The super function gets the class we are inheriting from (in this case QDialog) and calls its' __init__ as well |
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
# First lets import our Maya command library | |
from maya import cmds | |
# Then we import our file. In this case I'm using a hardcoded value | |
# But notice the returnNewNodes parameter that tells it to give us back any imported nodes | |
# This may contain nodes we don't want | |
# So we'll need to shorten it down | |
nodes = cmds.file('C:/Users/dhruv/Documents/maya/controllerLibrary/bigdonut.ma', | |
i=True, returnNewNodes=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
#!/usr/bin/python2 | |
# -*- coding: utf-8 -*- | |
# Copyright (c) 2011 Sebastian Wiesner <[email protected]> | |
# Modifications by Charl Botha <[email protected]> | |
# * customWidgets support (registerCustomWidget() causes segfault in | |
# pyside 1.1.2 on Ubuntu 12.04 x86_64) | |
# * workingDirectory support in loadUi | |
# found this here: | |
# https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py |
OlderNewer