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
pm.system.openFile('/Users/johan/Documents/Projects/python_dev/scenes/spring_jnts.mb', f=True) | |
ik_jnt_list = [pm.PyNode('joint{0}'.format(j+1)) for j in range(5)] | |
pos_list = [j.getTranslation(ws=True) for j in ik_jnt_list] | |
crv = pm.curve(d=1, p=pos_list) | |
crv_shape = crv.getShape() | |
crv_shape.overrideEnabled.set(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
from PySide import QtCore, QtGui, QtWebKit | |
class MyWidget(QtGui.QDialog): | |
def __init__(self, parent, url): | |
super(MyWidget, self).__init__(parent) | |
# set window stuff | |
self.setWindowTitle('Hello Tree Widget') |
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 datetime | |
import os | |
time_string = datetime.datetime.now().strftime("%Y-%m-%d %H.%M.%S") | |
#print(time_string) | |
dir_name = 'playblasts {0}'.format(time_string) | |
root_path = r'/Users/johan/Desktop/test' | |
dir_path = os.path.join(root_path, dir_name) |
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 PySide import QtCore, QtGui | |
from shiboken import wrapInstance | |
import maya.OpenMayaUI as omui | |
from functools import partial | |
import pymel.core as pm | |
def maya_main_window(): | |
main_window_ptr = omui.MQtUtil.mainWindow() | |
return wrapInstance(long(main_window_ptr), QtGui.QWidget) |
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
#lattice = pm.lattice( dv=(2, 2, 2), oc=True) | |
#pm.select('{0}.pt[4:7]'.format(lattice[1]),r=True) | |
def move_lattice(lattice, pos_id_dict): | |
for id, pos in pos_id_dict.iteritems(): | |
x, y, z = id | |
pm.select('{0}.pt[{1}][{2}][{3}]'.format(lattice, x, y, z),r=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.api.OpenMaya as om | |
import pymel.core as pm | |
def intersect_mesh(pos, vec, mesh_name): | |
selectionList = om.MSelectionList() | |
selectionList.add(mesh_name) | |
dagPath = selectionList.getDagPath(0) | |
fnMesh = om.MFnMesh(dagPath) |
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 | |
pm.newFile(f=True) | |
# create the ctrl, add attr and set som keys | |
ctrl, _ = pm.circle(n='ctrl') | |
ctrl.addAttr('anim', k=True) | |
pm.setKeyframe(ctrl, v=0, attribute='anim', t=1) | |
pm.setKeyframe(ctrl, v=10, attribute='anim', t=25) | |
pm.setKeyframe(ctrl, v=0, attribute='anim', t=50) |
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 pymel.core as pm | |
rot_order = 5 | |
kRotateOrders = [om.MEulerRotation.kXYZ, | |
om.MEulerRotation.kYZX, | |
om.MEulerRotation.kZXY, | |
om.MEulerRotation.kXZY, | |
om.MEulerRotation.kYXZ, |
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 | |
import math | |
w = 200 | |
h = 200 | |
rw = 50 | |
rh = 50 | |
num_rect_width = float(w)/rw |
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 math | |
def fit_center_rect(total_length, item_length): | |
ret_list = [] | |
float_fit = float(total_length)/item_length | |
int_fit = int(math.ceil(float_fit)) | |
# add one to the count if we have an even number |