Beispiel #1
0
 def bnn_get(cls, pattern, types=None):
     """Retrieve a node.
     
     Parameters
     ----------
     pattern : str
         Name or path pattern of the node to match. Wildcards are allowed.
     types : list of maya.OpenMaya.MFn.Type, optional
         Node types to match.
     
     Returns
     -------
     maya.OpenMaya.MObject
         The object of the node matched. If no or multiple
         nodes were found, None is returned.
     """
     iterator = OpenMaya.bnn_MItDependencyNode(pattern=pattern, types=types)
     object = None
     for item in iterator:
         if object:
             return None
         
         object = item
     
     return object
 def bnn_find(cls, pattern=''):
     """Find nodes.
     
     Parameters
     ----------
     pattern : str, optional
         Name or path pattern of the nodes to match. Wildcards are allowed.
     
     Returns
     -------
     list of calling class
         The nodes found. If no nodes were found, an empty
         list is returned.
     """
     return [cls(node) for node
             in OpenMaya.bnn_MItDependencyNode(pattern=pattern,
                                               types=cls().type())]
Beispiel #3
0
 def bnn_find(cls, pattern='', types=None):
     """Find DAG nodes.
     
     Parameters
     ----------
     pattern : str, optional
         Name or path pattern of the nodes to match. Wildcards are allowed.
     types : list of maya.OpenMaya.MFn.Type, optional
         Node types to match.
     
     Returns
     -------
     list of maya.OpenMaya.MObject
         The objects of the nodes found. If no nodes were
         found, an empty list is returned.
     """
     return list(OpenMaya.bnn_MItDependencyNode(pattern=pattern,
                                                types=types))
 def bnn_get(cls, pattern):
     """Retrieve a node.
     
     Parameters
     ----------
     pattern : str
         Name or path pattern of the node to match. Wildcards are allowed.
     
     Returns
     -------
     calling class
         The node found. If no or multiple nodes were found,
         None is returned.
     """
     iterator = OpenMaya.bnn_MItDependencyNode(pattern=pattern,
                                               types=cls().type())
     node = None
     for item in iterator:
         if node:
             return None
         
         node = item
     
     return cls(node) if node else None