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
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
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, 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
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
import nuke | |
import os.path | |
sel_nodes = nuke.selectedNodes() | |
frame = nuke.frame() | |
node = sel_nodes[0] | |
file_path = nukescripts.replaceHashes( node['file'].value() ) % frame |
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 | |
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
def set_bool_knob(name, all=True, value=None): | |
if all: | |
node_list = nuke.allNodes() | |
else: | |
node_list = nuke.selectedNodes() | |
for node in node_list: | |
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
// linear interpolation between position 100,100 to 500,500 | |
// from 0 to 3 seconds | |
linear(time,0,3,[100,100],[500,500]) | |
// drop the frame rate to 1fps on existing keyframes, | |
posterizeTime(1); | |
value; | |
// could use with the linear function (no keyframes needed) | |
posterizeTime(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
import maya.cmds as cmds | |
import random | |
import math | |
def build_tiled_mesh_uv(mesh, num, t_offset, rot_scale, item_per_row_uv, item_per_row_xform): | |
#get the x and z spacing [ xmin ymin zmin xmax ymax zmax ] | |
bb = cmds.xform(mesh, q=True, bb=True) | |
x_dist = bb[3] - bb[0] | |
z_dist = bb[5] - bb[2] |