예제 #1
0
def isCustomMirrorNode(node):
    """Check if input node has custom mirror data.

    Args:
        node (pm.PyNode): Node to check.

    Returns:
        bool
    """
    return mirrorData.hasMirrorData(node) and 'customMirror' in mirrorData.getMirrorData(node)
예제 #2
0
def clearMirrorNode(node):
    """Remove mirror node meta data from the given node.

    Args:
        node (pm.PyNode): Name of node to remove data from.

    Returns:
        None
    """
    if mirrorData.hasMirrorData(node):
        pm.deleteAttr(node.attr(mirrorData.MIRROR_DATA_ATTR_NAME))
예제 #3
0
def isMirrorNode(node, validate=True):
    """Check if node is a mirror node already.

    Args:
        node (pm.PyNode): Name of a node.
        validate (bool): Run a validate function, to see if a node has a mirror.

    Returns:
        bool: True if it is a mirror, False if not.
    """
    if not mirrorData.hasMirrorData(node):
        return False
    if validate:
        return validateMirrorNode(node)
    return True
예제 #4
0
def validateMirrorNode(node):
    """Check if the given mirror node still has a mirror object.
    Otherwise remove the mirror meta data from the node.

    Args:
        node (pm.PyNode): Name of a node.

    Returns:
        bool: True if the node is a valid mirror node.
    """
    if not mirrorData.hasMirrorData(node):
        return False

    mirrorNode = mirrorData.getMirrorData(node, 'mirrorNode')
    if mirrorNode is None:
        LOG.debug('{0} mirror node was None, clearing mirror node'.format(node))
        clearMirrorNode(node)
        return False

    return True
예제 #5
0
def setMirrorNode(node, mirrorNode, force=False):
    """Set a given node's mirror node.

    Args:
        node (pm.PyNode): Name of the source node.
        mirrorNode (pm.PyNode): Name of the destination node.
        force (bool): Override any mirroring that exists.

    Returns:
        None
    """
    data = mirrorData.getMirrorData(node, 'mirrorNode')

    if mirrorData.hasMirrorData(node):
        if not force and data != mirrorNode and data is not None:
            LOG.warning('{0} is already associated with another node {1}, use force=True to replace with {2}'.format(node, data, mirrorNode))
            return

    mirrorData.setMirrorData(node, key='mirrorNode', value=mirrorNode)
    mirrorData.setMirrorData(node, key='mirrorMode', value='Auto')