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 | |
sel = cmds.ls(sl=True) | |
conn = iter(cmds.listConnections(sel, c=True)) | |
conn = dict(zip(conn, conn)) | |
print conn |
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
# IK Orientation Control | |
import pymel.core as pmc | |
import maya.api.OpenMaya as om | |
def message(text): | |
pmc.confirmDialog(t="Uh oh...", m=text) | |
class Orient(object): | |
""" Orient setup using IK-like system """ |
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 timeit | |
import random | |
import sys | |
def build(): | |
for i in range(1000): | |
yield (i, random.random()) | |
d = dict(build()) # numerical index | |
l = list(a[1] for a in build()) # Regular index |
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
# Simple Error report mechanism squeezing into mailto: character limit | |
# Created By Jason Dixon. http://internetimagery.com | |
# | |
# Wrap the outermost function calls in the Report class | |
# As a decorator or as a context manager on the outermost function calls | |
# For instance, decorate your Main() function, | |
# or any function that is called directly by a GUI | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
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
# Contexturally make a selection. | |
# Created By Jason Dixon. http://internetimagery.com | |
# | |
# Wrap the outermost function calls in the Report class | |
# As a decorator or as a context manager on the outermost function calls | |
# For instance, decorate your Main() function, | |
# or any function that is called directly by a GUI | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
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
# Offset constraint for Maya | |
# Created By Jason Dixon. http://internetimagery.com | |
# | |
# Wrap the outermost function calls in the Report class | |
# As a decorator or as a context manager on the outermost function calls | |
# For instance, decorate your Main() function, | |
# or any function that is called directly by a GUI | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
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 collections | |
class Pascals_Triangle(collections.Sequence): | |
""" Build a triangle as indexes are requested """ | |
tri = [(1,)] | |
def __len__(s): return len(s.tri) | |
def __repr__(s): | |
rows = [repr(a) for a in s.tri] | |
size = max(len(a) for a in rows) | |
return "\n".join(a.center(size) for a in rows) |
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
# http://stackoverflow.com/questions/2587751/an-algorithm-to-find-bounding-box-of-closed-bezier-curves | |
from __future__ import division | |
import math | |
def getBoundsOfCurve(x0, y0, x1, y1, x2, y2, x3, y3): | |
tvalues = [] | |
bounds = [[], []] | |
points = [] |
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
# Testing gathering keyframe speeds | |
import timeit | |
import itertools | |
import collections | |
import maya.cmds as cmds | |
sel = cmds.ls(sl=True, type="transform") | |
if not sel: raise RuntimeError("Select something") |
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
# put in shebang here | |
from __future__ import print_function, division | |
""" | |
Take all duplicate files from decending directories and move | |
them into a new folder "Duplicates" in the working directory. | |
""" | |
import os | |
import sys |