These utilities are grouped into related files, for simpler copy & paste to your scripts.
A couple of helper functions to convert to & from A1 notation.
| import maya.cmds as cmds | |
| import maya.OpenMaya as OpenMaya | |
| import math | |
| # Find if object located within camera frustum | |
| # Usage: | |
| # from obj_in_frust import in_frustum | |
| # in_frustum('camera1', 'pCube1') | |
| class Plane(object): |
| import os | |
| import base64 | |
| headerImg = b''' | |
| iVBORw0KGgoAAAANSUhEUgAAAfQAAAB/CAYAAAAZ1jAlAAAACXBIWXMAAAsTAAALEwEAmpwYAAAK | |
| T2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AU | |
| kSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXX | |
| Pues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgAB | |
| eNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAt | |
| AGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3 |
| from PyQt4 import QtCore, QtGui | |
| import sys, time | |
| class mythread(QtCore.QThread): | |
| total = QtCore.pyqtSignal(object) | |
| update = QtCore.pyqtSignal() | |
| def __init__(self, parent, n): | |
| super(mythread, self).__init__(parent) |
| f@angle = chf("angle") * 2 * $PI; // angle is a float slider with range from 0 - 1 | |
| v@axis = chv("axis") + point(1, "N", 0); // axis is a 3 float vector {0.0, 0.0, 0.0} | |
| 3@imatrix = ident(); | |
| rotate(@imatrix, @angle, @axis); | |
| @P = (@P - point(1, "P", 0)) * @imatrix + point(1, "P", 0); |