mrv.maya.util

Epydoc: mrv.maya.util

All kinds of utility methods and classes that are used in more than one modules

Functions

mrv.maya.util._logException(func, reraise)
mrv.maya.util.capitalize(s)
Returns:s with first letter capitalized
mrv.maya.util.editMethod(inCmd, flag, methodName=None)
Shorthand edit version of makeEditOrQueryMethod
mrv.maya.util.isIterable(obj)
mrv.maya.util.logException(func)
Decorator which shows short exception information in a popup and a full stack trace to stdout. Finally the exception will be reraised
mrv.maya.util.makeEditOrQueryMethod(inCmd, flag, isEdit=False, methodName=None)

Create a function calling inFunc with an edit or query flag set.

Note:

THIS CODE HAS BEEN DUPLICATED TO mrv.maya.ui.util !

Parameters:
  • inCmd – maya command to call
  • flag – name of the query or edit flag
  • isEdit – If not False, the method returned will be an edit function
  • methodName – the name of the method returned, defaults to inCmd name
mrv.maya.util.noneToList(res)
Returns:list instead of None
mrv.maya.util.notifyException(func)
As logException, but does not reraise on error. This is useful if you just want to see a popup, but not cause maya to remove the possibly problematic UI callback. Additionally, no stacktrace will be shown
mrv.maya.util.propertyQE(inCmd, flag, methodName=None)
Shorthand for simple query and edit properties
mrv.maya.util.pythonToMel(arg)
mrv.maya.util.queryMethod(inCmd, flag, methodName=None)
Shorthand query version of makeEditOrQueryMethod
mrv.maya.util.uncapitalize(s, preserveAcronymns=False)
Returns:s with first letter lower case
Parameter:preserveAcronymns – enabled ensures that ‘NTSC’ does not become ‘nTSC’
Note:from pymel

Classes

Epydoc: mrv.maya.util.CallbackEventBase

class mrv.maya.util.CallbackEventBase(eventId, **kwargs)

Bases: mrv.util.Event

Allows the mapping of MMessage callbacks to mrv’s event sender system. This event will register a new message once the first event receiver registers itself. Once the last event receiver deregisters, the message will be deregistered in maya as well.

Derived types have to implement the _getRegisterFunction

Note:Its important that you care about deregistering your event to make sure the maya event can be deregistered. Its worth knowing that the eventSender in question is strongly bound to his callback event, so it cannot be deleted while the event is active.
class CBStorageFunction(callbackID=None)

Bases: object

callbackID()
removeCallback()
setCallbackID(callbackID)
CallbackEventBase.duplicate()
CallbackEventBase.remove(eventfunc)
Also removes our callback if the last receiver is gone
CallbackEventBase.send(inst, *args, **kwargs)

Sets our instance prior to calling the super class

Note:must not be called manually

Epydoc: mrv.maya.util.MEnumeration

class mrv.maya.util.MEnumeration

Bases: tuple

Simple enumeration class which allows access to its enumeration using getattr access. As it is a tuple as well, one can access the enumeration values in the right sequencial order

count
T.count(value) -> integer – return number of occurrences of value
classmethod create(ed, mfncls)
Returns:new instance of this type as initialized from the EnumDescriptor ed and the mfncls
index
T.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.
nameByValue(value)
Returns:name string with the given integer value
Parameter:value – integer value of this enumeration
Raises ValueError:
 if value is not in the enumeration

Epydoc: mrv.maya.util.Mel

class mrv.maya.util.Mel

Bases: mrv.util.Singleton

This class is a necessity for calling mel scripts from python. It allows scripts to be called in a cleaner fashion, by automatically formatting python arguments into a string which is executed via maya.mel.eval().

Note:originated from pymel, added customizations
static call(command, *args)

Call a mel script , very simpilar to Mel.myscript( args )

Todo:more docs
static error(*args)
error
static eval(command)
same as maya.mel eval
static info(*args)
print
static mprint(*args)
mel print command in case the python print command doesn’t cut it. i have noticed that python print does not appear in certain output, such as the rush render-queue manager.
static trace(*args)
trace

Epydoc: mrv.maya.util.MetaClassCreator

class mrv.maya.util.MetaClassCreator

Bases: type

Builds the base hierarchy for the given classname based on our typetree

mro
mro() -> list return a type’s method resolution order

Epydoc: mrv.maya.util.OptionVarDict

class mrv.maya.util.OptionVarDict

Bases: mrv.util.Singleton

A singleton dictionary-like class for accessing and modifying optionVars.

Note:Idea and base Implementation from PyMel, modified to adapt to mrv
class OptionVarList

Bases: tuple

appendVar(val)
values appended to the OptionVarList with this method will be added to the Maya optionVar at the key denoted by self.key.
count
T.count(value) -> integer – return number of occurrences of value
index
T.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.
OptionVarDict.get(key, default=None)
OptionVarDict.has_key(key)
OptionVarDict.iteritems()
Returns:iterators to tuple of key,value pairs
OptionVarDict.iterkeys()
Returns:iterator to option var names
OptionVarDict.itervalues()
Returns:iterator to optionvar values
OptionVarDict.keys()
OptionVarDict.pop(key)

Epydoc: mrv.maya.util.StandinClass

class mrv.maya.util.StandinClass(classname, classcreator=<type 'type'>)

Bases: object

Simple Function Object allowing to embed the name of the type as well as the metaclass object supposed to create the actual class. It mus be able to completely create the given class.

Note:Use it at placeholder for classes that are to be created on first call, without vasting large amounts of memory if one wants to precreate them.
classcreator
clsname
createCls()

Create the class of type self.clsname using our classcreator - can only be called once !

:return : the newly created class

Table Of Contents

Previous topic

mrv.maya.mdb

Next topic

mrv.maya.ref

This Page