Python pymel.core.listAttr() Examples

The following are 3 code examples of pymel.core.listAttr(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pymel.core , or try the search function .
Example #1
Source File: pluginMaya.py    From dpAutoRigSystem with GNU General Public License v2.0 6 votes vote down vote up
def import_network(_network):
    if not _network.hasAttr('_class'):
        log.error('[importFromNetwork] Network dont have mandatory attribute _class')
        raise AttributeError

    cls = _network.getAttr('_class').split('.')[-1]
    obj = core.create_class_instance(cls)
    if obj is None:
        return None
    obj._network = _network

    for key in pymel.listAttr(_network, userDefined=True):
        if '_' != key[0]: # Variables starting with '_' are private
            #logging.debug('Importing attribute {0} from {1}'.format(key, _network.name()))
            val = _getNetworkAttr(_network.attr(key))
            #if hasattr(obj, key):
            setattr(obj, key, val)
            #else:
            #    #logging.debug("Can't set attribute {0} to {1}, attribute does not exists".format(key, obj))

    # Update network _uid to the current python variable context
#    if _network.hasAttr('_uid'):
#        _network._uid.set(id(obj))

    return obj 
Example #2
Source File: anim_utils.py    From mgear_core with MIT License 6 votes vote down vote up
def reset_all_keyable_attributes(dagnodes, *args):  # @unusedVariable
    """Resets to default values all keyable attributes on the given node

    Args:
        dagnodes (list): Maya transform nodes to reset
        *args: State of the menu item (if existing) send by mgear's dagmenu
    """

    for node in dagnodes:
        keyable_attrs = cmds.listAttr(node, keyable=True)
        reset_selected_channels_value([node], keyable_attrs)


##################################################
# Transfer space
################################################## 
Example #3
Source File: anim_utils.py    From mgear_core with MIT License 5 votes vote down vote up
def listAttrForMirror(node):
    """List attributes to invert the value for mirror posing

    Args:
        node (PyNode): The Node with the attributes to invert

    Returns:
        list: Attributes to invert
    """
    # TODO: should "ro" be here?
    res = ["tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz"]
    res.extend(pm.listAttr(node, userDefined=True, shortNames=True))
    res = list(filter(lambda x: not x.startswith("inv"), res))

    return res