def getAddAttrCmd(sNodeAttr, longName=True):

    sNode, sAttr = sNodeAttr.split(".")

    node = api.getNode(sNode)
    fnNode = om.MFnDependencyNode(node)
    mAttr = om.MFnAttribute(fnNode.attribute(sAttr))
    return mAttr.getAddAttrCmd(longName)
def getAddAttrCmd(sNodeAttr, longName=True):

    sNode, sAttr = sNodeAttr.split(".")

    node = api.getNode(sNode)
    fnNode = om.MFnDependencyNode(node)
    mAttr = om.MFnAttribute(fnNode.attribute(sAttr))
    return mAttr.getAddAttrCmd(longName)
def copyAttrs(srcNode, destNode, *sAttrList, **kwargs):
    logMsg(log='all')

    if "values" not in kwargs:
        kwargs["values"] = True

    bDelete = kwargs.pop("delete", False)
    bCreate = kwargs.pop("create", False)

    sSrcNode = argToStr(srcNode)
    sDestNode = argToStr(destNode)

    mObj = api.getNode(sSrcNode)
    fnNode = om.MFnDependencyNode(mObj)

    sCopyAttrList = []
    for sAttr in sAttrList:
        if not getObject(sDestNode + "." + sAttr):
            if bCreate:
                mAttr = om.MFnAttribute(fnNode.attribute(sAttr))
                sAddAttrCmd = mAttr.getAddAttrCmd(False).replace(";", " {};".format(sDestNode))

                logMsg("Copy attr. '{}' from '{}' to '{}'."
                       .format(sAttr, sSrcNode, sDestNode), log="info")
                pm.mel.eval(sAddAttrCmd)
            else:
                sAttr = ""
        else:
            if bCreate:
                logMsg("Attr. '{}' already exists on '{}'.".format(sAttr, sDestNode), log="info")

        if sAttr:
            sCopyAttrList.append(sAttr)

    mc.copyAttr(sSrcNode, sDestNode, attribute=sCopyAttrList, **kwargs)
    #copyAttrState(sSrcNode, sDestNode , *sCopyAttrList)

    if bDelete:
        for sAttr in sCopyAttrList:
            mc.deleteAttr(sSrcNode + "." + sAttr)

    return sCopyAttrList
def copyAttrs(srcNode, destNode, *sAttrList, **kwargs):
    logMsg(log='all')

    if "values" not in kwargs:
        kwargs["values"] = True

    bDelete = kwargs.pop("delete", False)
    bCreate = kwargs.pop("create", False)

    sSrcNode = argToStr(srcNode)
    sDestNode = argToStr(destNode)

    mObj = api.getNode(sSrcNode)
    fnNode = om.MFnDependencyNode(mObj)

    sCopyAttrList = []
    for sAttr in sAttrList:
        if not getObject(sDestNode + "." + sAttr):
            if bCreate:
                mAttr = om.MFnAttribute(fnNode.attribute(sAttr))
                sAddAttrCmd = mAttr.getAddAttrCmd(False).replace(";", " {};".format(sDestNode))

                logMsg("Copy attr. '{}' from '{}' to '{}'."
                       .format(sAttr, sSrcNode, sDestNode), log="info")
                pm.mel.eval(sAddAttrCmd)
            else:
                sAttr = ""
        else:
            if bCreate:
                logMsg("Attr. '{}' already exists on '{}'.".format(sAttr, sDestNode), log="info")

        if sAttr:
            sCopyAttrList.append(sAttr)

    mc.copyAttr(sSrcNode, sDestNode, attribute=sCopyAttrList, **kwargs)
    #copyAttrState(sSrcNode, sDestNode , *sCopyAttrList)

    if bDelete:
        for sAttr in sCopyAttrList:
            mc.deleteAttr(sSrcNode + "." + sAttr)

    return sCopyAttrList