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 | |
def get_mat_assigned_for_obj(mat, obj): | |
if issubclass(type(mat), (str, unicode)): | |
mat = pm.PyNode(mat) | |
if issubclass(type(obj), (str, unicode)): | |
obj = pm.PyNode(obj) | |
members = mat.connections(type=pm.nt.ShadingEngine)[0].members() | |
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 random as r | |
from argparse import ArgumentParser | |
import sys | |
def main(args): | |
switch = not args.no_switch | |
successful_hits = 0 | |
for i in range(args.tries): | |
correct_door = r.randint(0, 2) | |
doors = [True if x == correct_door else False for x in xrange(3)] |
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
# bash/zsh git prompt support | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# This script allows you to see repository status in your prompt. | |
# | |
# To enable: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). |
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
# -*- coding: utf-8 -*- | |
"""Hello World ToolBar UI for use in Maya Plugins | |
This module demonstrates a method of tracking instances used in Maya Plugins. | |
This method stores all instances that the plugin creates in the base class and | |
uses static methods to delete all of those instances. | |
Example: | |
If you wish to test this code without using the plugin simple execute the | |
same code shown below: |
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 <lunaryorn@gmail.com> | |
# Modifications by Charl Botha <cpbotha@vxlabs.com> | |
# * 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 |
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 maya.cmds as cmds | |
import os.path | |
import svgwrite | |
STROKE_LINECAP = ("butt", "round", "square") | |
def check_reverse_line_drawn(newLineCoords, drawnLines): |
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 resetMcRestPosition(joints, ctrl, ikHand): | |
'''Reset Multi chain rest position''' | |
ikHand.ikBlend.set(0) | |
for j in joints: | |
j.rotate.set((0,0,0)) | |
ctrl.translate.set((0,0,0)) | |
ikHand.ikBlend.set(1) | |
def resetMcRotX(joints, ikHand): |
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
MERGE_FACE_DIRECTION = {"+x":0, "-x":1, "+y":2, "-y":3, "+z":4, "-z":5} | |
def getBoundaryEdges(obj=None): | |
if obj == None: | |
obj = pm.selected()[0] | |
objType = type(obj) | |
if objType == pm.nt.Mesh: | |
edges = obj.edges | |
elif objType == pm.nt.Transform: |
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
for /f "delims== tokens=2" %a in ('assoc .pdf') do @ftype %a |
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
allDagNodes = cmds.ls(dag=True, sn=True) | |
allDagNodesLong = cmds.ls(dag=True, sn=False) | |
nonUnique = [ node for node in allDagNodes if '|' in node ] | |
values=[] | |
for n in nonUnique: | |
for ln in allDagNodesLong: |
NewerOlder