Allows convenient access and handling of references in an object oriented manner
Returns: | True if other which may be a string, is rooted at ‘root |
---|---|
Parameters: |
|
Note: | the arguments are very specific, but this allows the method to be faster than usual |
Returns: | A path instance of the correct type |
---|---|
Note: | use this constructor if you use the Path.set_separator method at runtime to assure you will always create instances of the actual type, and not only of the type you imported last |
Returns: | list instead of None |
---|
Bases: object
For use with python’s filter method, simulates logical AND Usage: filter(And(f1,f2,fn), sequence)
Epydoc: mrv.maya.ref.FileReference
Bases: mrv.interface.iDagItem
Represents a Maya file reference
Note: | do not cache these instances but get a fresh one when you have to work with it |
---|---|
Note: | as FileReference is also a iDagItem, all the respective methods, especially for parent/child iteration and query can be used as well |
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
Returns: | all intermediate child references of this instance |
---|
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
remove unresolved edits or all edits on this reference
Parameters: |
|
---|---|
Returns: | self |
Returns: | the references copy number - starting at 0 for the first reference |
---|---|
Note: | we do not cache the copy number as mayas internal numbering can change on when references change - the only stable thing is the reference node name |
Create a reference with the given namespace
Parameters: |
|
---|---|
Raises ValueError: | |
if the namespace does already exist |
|
Raises RuntimeError: | |
if the reference could not be created |
Returns: | True if our file reference exists in maya |
---|
Find the reference for each path in paths. If you provide the path X 2 times, but you only have one reference to X, the return value will be [FileReference(X), None] as there are less references than provided paths.
Parameters: |
|
---|---|
Returns: | list(FileReference|None, ...) if a filereference was found for given occurrence of Path, it will be returned at index of the current path in the input paths, otherwise it is None. |
Note: | zip(paths, result) to get a corresponding tuple list associating each input path with the located reference |
Import the reference until the given depth is reached
Parameter: | depth –
|
---|---|
Returns: | list of FileReference objects that are now in the root namespace - this list could be empty if all subreferences are fully imported |
Returns: | True if the reference is loaded |
---|
Returns: | True if reference is locked |
---|
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Creates iterator over nodes in this reference
Parameters: |
|
---|---|
Raises ValueError: | |
if incompatible arguments have been given |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
list all references in the scene or under the given root
Parameters: |
|
---|---|
Returns: | list of FileReference s objects |
Return all references recursively
Parameter: | kwargs – support for arguments as in ls, hence you can use the rootReference flag to restrict the set of returned FileReferences. |
---|
Returns: | namespace object of the full namespace holding all objects in this reference |
---|
Returns: | the parent reference of this instance or None if we are root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | Path object with the path containing the reference’s data |
---|---|
Parameters: |
|
Note: | we always query it from maya as our numbers change if some other reference is being removed and cannot be trusted |
Returns: | wrapped reference node managing this reference |
---|
Remove the given reference from the scene
Note: | assures that no namespaces of that reference are left, remaining objects will be moved into the root namespace. This way the namespaces will not be left as waste. This fails if there are referenced objects in the subnamespace - we currently ignore that issue as the main reference removal worked at that point. |
---|---|
Note: | kwargs passed to namespace.delete |
Replace this reference with filepath
Parameter: | filepath – the path to the file to replace this reference with Reference instances will be handled as well. |
---|---|
Returns: | self |
Returns: | the root of the DAG - it has no further parents |
---|
set the reference loaded or unloaded
Parameter: | state – True = unload reference, True = load reference |
---|---|
Returns: | self |
Set the reference to be locked or unlocked
Parameter: | state – if True, the reference is locked , if False its unlocked and can be altered |
---|---|
Returns: | self |
set the reference to use the given namespace
Parameter: | namespace – Namespace instance or name of the short namespace |
---|---|
Raises RuntimeError: | |
if namespace already exists or if reference is not root | |
Returns: | self |
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
Bases: unicode, mrv.interface.iDagItem
Represents a Maya namespace Namespaces follow the given nameing conventions:
- Paths starting with a column are absolute
- :absolute:path
- Path separator is ‘:’
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
S.capitalize() -> unicode
Return a capitalized version of S, i.e. make the first character have upper case.
S.center(width[, fillchar]) -> unicode
Return S centered in a Unicode string of length width. Padding is done using the specified fill character (default is a space)
Returns: | list of child namespaces |
---|---|
Parameter: | predicate – return True to include x in result |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
S.count(sub[, start[, end]]) -> int
Return the number of non-overlapping occurrences of substring sub in Unicode string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Create a new namespace
Parameter: | namespaceName – the name of the namespace, absolute or relative - it may contain subspaces too, i.e. :foo:bar. fred:subfred is a relative namespace, created in the currently active namespace |
---|---|
Note: | if the target namespace already exists, it will be returned |
Returns: | the create Namespace object |
Returns: | the currently set absolute namespace |
---|
S.decode([encoding[,errors]]) -> string or unicode
Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeDecodeError. Other possible values are ‘ignore’ and ‘replace’ as well as any other name registerd with codecs.register_error that is able to handle UnicodeDecodeErrors.
Delete this namespace and move it’s obejcts to the given move_to_namespace
Parameters: |
|
---|---|
Note: | can handle sub-namespaces properly |
Raises RuntimeError: | |
Todo: | Implement undo ! |
S.encode([encoding[,errors]]) -> string or unicode
Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
S.endswith(suffix[, start[, end]]) -> bool
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
Returns: | True if this namespace exists |
---|
S.expandtabs([tabsize]) -> unicode
Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
S.find(sub [,start [,end]]) -> int
Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
Find a unique namespace based on basename which does not yet exist in the scene and can be created.
Parameters: |
|
---|---|
Returns: | unique namespace that is guaranteed not to exist below the current namespace |
S.index(sub [,start [,end]]) -> int
Like S.find() but raise ValueError when the substring is not found.
Returns: | True if this namespace is an absolut one, defining a namespace from the root namespace like “:foo:bar |
---|
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
S.isalnum() -> bool
Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
S.isalpha() -> bool
Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
S.isdecimal() -> bool
Return True if there are only decimal characters in S, False otherwise.
S.isdigit() -> bool
Return True if all characters in S are digits and there is at least one character in S, False otherwise.
S.islower() -> bool
Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
S.isnumeric() -> bool
Return True if there are only numeric characters in S, False otherwise.
S.isspace() -> bool
Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
S.istitle() -> bool
Return True if S is a titlecased string and there is at least one character in S, i.e. upper- and titlecase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
S.isupper() -> bool
Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
Return an iterator on all objects in the namespace
Parameters: |
|
---|---|
Note: | this method is quite similar to FileReference.iterNodes, but has a different feature set and needs this code here for maximum performance |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
S.join(iterable) -> unicode
Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.
S.ljust(width[, fillchar]) -> int
Return S left-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).
S.lower() -> unicode
Return a copy of the string S converted to lowercase.
S.lstrip([chars]) -> unicode
Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping
Move objects from this to the targetNamespace
Parameters: |
|
---|---|
Todo: | Implement undo ! |
Returns: | parent namespace of this instance |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
S.partition(sep) -> (head, sep, tail)
Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.
returns this namespace relative to the given basenamespace
Parameter: | basenamespace – the namespace to which the returned one should be relative too |
---|---|
Raises ValueError: | |
If this or basenamespace is not absolute or if no relative namespace exists | |
Returns: | relative namespace |
Rename this namespace to newName - the original namespace will cease to exist
Note: | if the namespace already exists, the existing one will be returned with all objects from this one added accordingly |
---|---|
Parameter: | newName – the absolute name of the new namespace |
Returns: | Namespace with the new name |
Todo: | Implement undo ! |
S.replace (old, new[, count]) -> unicode
Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
S.rfind(sub [,start [,end]]) -> int
Return the highest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
S.rindex(sub [,start [,end]]) -> int
Like S.rfind() but raise ValueError when the substring is not found.
S.rjust(width[, fillchar]) -> unicode
Return S right-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).
Returns: | the root of the DAG - it has no further parents |
---|
S.rpartition(sep) -> (head, sep, tail)
Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.
S.rsplit([sep [,maxsplit]]) -> list of strings
Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator.
S.rstrip([chars]) -> unicode
Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping
Set this namespace to be the current one - new objects will be put in it by default
Returns: | self |
---|
S.split([sep [,maxsplit]]) -> list of strings
Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.
Cut the namespace from the given name and return a tuple( namespacename, objectname )
Note: | method assumes that the namespace starts at the beginning of the object |
---|
S.splitlines([keepends]) -> list of strings
Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
S.startswith(prefix[, start[, end]]) -> bool
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
S.strip([chars]) -> unicode
Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping
Returns: | string with our namespace properly substituted with replacement such that the result is a properly formatted object name ( with or without namespace depending of the value of replacement ) As this method is based on string replacement, self might as well match sub-namespaces if it is relative |
---|---|
Note: | if replacement is an empty string, it will effectively cut the matched namespace off the object name |
Note: | handles replacement of subnamespaces correctly as well |
Note: | as it operates on strings, the actual namespaces do not need to exist |
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
S.swapcase() -> unicode
Return a copy of S with uppercase characters converted to lowercase and vice versa.
S.title() -> unicode
Return a titlecased version of S, i.e. words start with title case characters, all remaining cased characters have lower case.
Returns: | a relative version of self, thus it does not start with a colon |
---|---|
Note: | the root namespace cannot be relative - if this is of interest for you, you have to check for it. This method gracefully ignores that fact to make it more convenient to use as one does not have to be afraid of exceptions |
S.translate(table) -> unicode
Return a copy of the string S, where all characters have been mapped through the given translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, Unicode strings or None. Unmapped characters are left untouched. Characters mapped to None are deleted.
S.upper() -> unicode
Return a copy of S converted to uppercase.
S.zfill(width) -> unicode
Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.
Bases: mrv.interface.Interface
Describes interface for a DAG item. Its used to unify interfaces allowing to access objects in a dag like graph Of the underlying object has a string representation, the defatult implementation will work natively. Otherwise the getParent and getChildren methods should be overwritten
Note: | a few methods of this class are abstract and need to be overwritten |
---|---|
Note: | this class expects the attribute ‘_sep’ to exist containing the separator at which your object should be split ( for default implementations ). This works as the passed in pointer will belong to derived classes that can define that attribute on instance or on class level |
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
Returns: | list of intermediate children of path, [ child1 , child2 ] |
---|---|
Parameter: | predicate – return True to include x in result |
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | the root of the DAG - it has no further parents |
---|
Returns: | True if this instance supports the interface of the given type |
---|---|
Parameter: | interface_type – Type of the interface you require this instance to support |
Note: | Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work |
Epydoc: mrv.maya.ref.FileReferenceError
Bases: mrv.exc.MRVError