pymel.util

General utilities which are pymel-independent.”

Functions

abs abs(number) -> number
acos acos(x)
all all(a, [,axis=(axis0, axis1, ...)]) –> bool or Array of booleans
angle angle(u, v) –> float
any any(a [,axis=(axis0, axis1, ...)]) –> bool or Array of booleans
appendEnv append the value to the environment variable list ( separated by ‘:’ on osx and linux and ‘;’ on windows).
asin asin(x)
atan atan(x)
atan2 atan2(y, x)
axis axis(u, v[, normalize=False]) –> VectorN
blend blend(a, b[, weight=0.5]) :
breadthArgs returns a list of a breadth first expansion of args
breadthIterArgs iterator doing a breadth first expansion of args
cacheProperty a property type for getattr functions that only need to be called once per instance.
capitalize Python’s string ‘capitalize’ method is NOT equiv. to mel’s capitalize, which preserves
ceil ceil(x)
clamp Clamps the value x between min and max
conjugate the conjugate part of x
convertListArgs
cos cos(x)
cosh cosh(x)
cotan cotan(u, v) –> float :
cross cross(u, v) –> VectorN
decorated Copies the original function’s name/docs/signature to the new function, so that the docstrings contain relevant information again.
decorator Decorator for decorators.
deepcopy Deep copy operation on arbitrary Python objects.
degrees degrees(x) -> converts angle x from radians to degrees
det det(m) –> float
dist dist(a, b[, axis=(axis0, axis1, ...)]) –> float or Array
dot dot(u, v) –> float
escape Escape all non-alphanumeric characters in pattern.
exp exp(x)
expandArgs ‘Flattens’ the arguments list: recursively replaces any iterable argument in *args by a tuple of its
fabs fabs(x)
filterwarnings Insert an entry into the list of warnings filters (at the front).
floor floor(x)
fmod fmod(x,y)
formatwarning Function to format a warning the standard way.
frexp frexp(x)
gamma Gamma color correction of c with a single scalar gamma value g
getCascadingDictItem
getEnv get the value of an environment variable. returns default (None) if the variable has not been previously set.
getEnvs get the value of an environment variable split into a list. returns default ([]) if the variable has not been previously set.
hermite As the MEL command : This command returns x point along on x hermite curve from the five given control arguments.
hermiteInterp Hermite interpolation of x between points y0 and y1 of tangent slope s0 and s1
hypot hypot(x,y)
imag the imaginary part of x
interface_wrapper A wrapper which allows factories to programatically create functions with
inv inv(m) –> MatrixN
isImmutableTree
isIterable Returns True if an object is iterable and not a string or ProxyUnicode type, otherwise returns False.
isMapping Returns True if an object is a mapping (dictionary) type, otherwise returns False.
isMutableTree
isNumeric Returns True if an object is a number type, otherwise returns False.
isScalar Returns True if an object is a number or complex type, otherwise returns False.
isSequence
isTree
iterateArgs Iterates through all arguments list: recursively replaces any iterable argument in *args by a tuple of its elements that will be inserted at its place in the returned arguments.
izip_longest
ldexp ldexp(x, i) -> x * (2**i)
length length(a[, axis=(axis0, axis1, ...)]) –> numeric or Array
linmap Returns the value of a linear remapping function.
linstep Returns the value of a linear step function.
listForNone
log log(x[, base]) -> the logarithm of x to the given base.
log10 log10(x) -> the base 10 logarithm of x.
max max(iterable[, key=func[, axis=(axis0, axis1, ...)]]) –> value
mergeCascadingDicts recursively update to_dict with values from from_dict. if allowDictToListMerging is
min min(iterable[, key=func[, axis=(axis0, axis1, ...)]]) –> value
modf modf(x)
mutabletree
namedtuple Returns a new subclass of tuple with named fields.
normal normal(a[, axis=(axis0, axis1, ...)]) –> Array
outer outer(u, v) –> MatrixN
pairIter Returns an iterator over every 2 items of sequence.
patchMath Overload various math functions to work element-wise on iterables
postorderArgs returns a list of a postorder expansion of args
postorderIterArgs iterator doing a postorder expansion of args
pow pow(x,y)
preorderArgs returns a list of a preorder expansion of args
preorderIterArgs iterator doing a preorder expansion of args
prependEnv prepend the value to the environment variable list (separated by ‘:’ on osx and linux and ‘;’ on windows).
prod prod(a[, start=1[, axis=(axis0, axis1, ...)]]) –> numeric or Array
proxyClass this function will generate a proxy class which keeps the internal data separate from the wrapped class. This
putEnv set the value of an environment variable. overwrites any pre-existing value for this variable. If value is a non-string
radians radians(x) -> converts angle x from degrees to radians
readonly Marks a class member as protected, allowing metaProtected to prevent re-assignation on the classes it generates
real the real part of x
reorder Reorder a list based upon a list of positional indices and/or a dictionary of fromIndex:toIndex.
resetwarnings Clear the list of warning filters, so that no filters are active.
round round(number[, ndigits]) -> float
sequenceToSlices convert a sequence of integers into a tuple of slice objects
setCascadingDictItem
setRange Resets x range from x linear interpolation of oldmin to oldmax to x linear interpolation from newmin to newmax
showwarning Hook to write a warning to a file; replace if you like.
sin sin(x)
sinh sinh(x)
smoothmap Returns the value of a smooth remapping function.
smoothstep Returns the value of a smooth step function.
sqlength sqlength(a[, axis=(axis0, axis1, ...)]) –> numeric or Array
sqrt sqrt(x)
sum sum(a[, start=0[, axis=(axis0, axis1, ...)]]) –> numeric or Array
tan tan(x)
tanh tanh(x)
timer
toZip Sample for storing directory to a ZipFile
treeFromChildLink This function will build a tree from the provided sequence and a comparison function in the form:
treeFromDict This function will build a tree from the provided dictionnary of child:parent relations :
treeFromIsChild This function will build a tree from the provided sequence and a comparison function in the form:
uncapitalize preserveAcronymns enabled ensures that ‘NTSC’ does not become ‘nTSC’
unescape
rtype:string
warn Issue a warning, or maybe ignore it or raise an exception.

Classes

Array A generic n-dimensional array class using nested lists for storage.
ArrayIter A general purpose iterator on Arrays.
Enum Enumerated type
EnumValue A specific value of an enumerated type
FrozenTree Core methods for pure python trees implementation
IndexedFrozenTree Additionnal methods for pure python indexed trees implementation, elements must have unique values
IndexedTree Additionnal methods for pure python indexed trees implementation, elements must have unique values
MatrixN A generic size MatrixN class, basically a 2 dimensional Array.
MetaTree This metaclass defines the type of all ‘tree’ classes
ModuleInterceptor This class is used to intercept an unset attribute of a module to perfrom a callback.
ProxyUnicode
Singleton Metaclass for Singleton classes.
Tree Core methods for pure python trees implementation
VectorN A generic size VectorN class derived from Array, basically a 1 dimensional Array.
defaultdict defaultdict(default_factory) –> dict with default factory
defaultlist
deque deque(iterable) –> deque object
metaReadOnlyAttr A metaclass to allow to define read-only class attributes, accessible either on the class or it’s instances and protected against re-write or re-definition.
metaStatic A static (immutable) Singleton metaclass to quickly build classes
path Represents a filesystem path.
universalmethod

Exceptions

class EnumBadKeyError(key)

Bases: exceptions.TypeError, pymel.util.enum.EnumException

Raised when creating an Enum with non-string keys

args
message
exception message
class EnumEmptyError

Bases: exceptions.AssertionError, pymel.util.enum.EnumException

Raised when attempting to create an empty enumeration

args
message
exception message
class EnumException

Bases: exceptions.Exception

Base class for all exceptions in this module

args
message
exception message
class EnumImmutableError(*args)

Bases: exceptions.TypeError, pymel.util.enum.EnumException

Raised when attempting to modify an Enum

args
message
exception message
class Error

Bases: exceptions.Exception

args
message
exception message

Table Of Contents

Previous topic

pymel.mayahook.version.Version

Next topic

pymel.util.abs()

Commands

Modules

This Page