Пример #1
0
def addSuffixToSelection():
    """ Add suffix to selected objects."""
    sel = apiFn.getSelectionAsMObjs()
    for i, mObj in enumerate(sel, 1):
        lN, sN = apiFn.getPath(mObj, returnString=True)
        # suffix = getSuffixForObjType(lN)
        r = rename(mObj, sN, startNum=i, skipSuff=False)
Пример #2
0
def swapSideSelection(side='C'):
    """ Swap the side prefix of the selected objects.
        [Args]:
        side (string) - The side to swap to ('R', 'L' or 'C')
        [Returns]:
        True on success
    """
    sel = apiFn.getSelectionAsMObjs()
    for i, mObj in enumerate(sel, 1):
        swapSide(mObj, side, startNum=i)
    return True
Пример #3
0
def renameSelection(newName, side):
    """ Rename the selected objects.
        [Args]:
        newName (string) - The new name for the objects
        [Returns]:
        True on success
    """
    sel = apiFn.getSelectionAsMObjs()
    for i, mObj in enumerate(sel, 1):
        rename(mObj, newName, side, i)
    return True
Пример #4
0
def stripNameSelection(stripFromRight=False):
    """ Strip the name of the selected objects.
        [Args]:
        stripFromRight (bool) - Toggles stripping from the right
                                instead of the left
        [Returns]:
        True on success
    """
    sel = apiFn.getSelectionAsMObjs()
    for i, mObj in enumerate(sel, 1):
        stripName(mObj, stripFromRight=stripFromRight, startNum=i)
    return True
Пример #5
0
def findReplaceSelection(find, replace):
    """ Find and replace for the current selection.
        [Args]:
        find (string) - The string to find
        replace (string) - The string to replace with
        [Returns]:
        True on success
    """
    sel = apiFn.getSelectionAsMObjs()
    for i, mObj in enumerate(sel, 1):
        findReplace(mObj, find, replace, startNum=i)
    return True