예제 #1
0
def paste(shader, uv, color):
    # try because of error when selection is empty. mel command handles it without error.
    # noinspection PyBroadException
    try:
        m.polyClipboard(paste=True, shader=shader, uv=uv, color=color)
    except:
        pass
예제 #2
0
def gtu_paste_material():
    ''' Copies selected material to clipboard '''
    try:
        cmds.polyClipboard(paste=True, shader=True)
    except:
        cmds.warning(
            'Couldn\'t paste material. Make sure you copied a material first, then selected the target objects or components.'
        )
예제 #3
0
def gtu_copy_material():
    ''' Copies selected material to clipboard '''
    selection = cmds.ls(selection=True)
    try:
        mel.eval('ConvertSelectionToFaces;')
        cmds.polyClipboard(copy=True, shader=True)
        cmds.inViewMessage(amg='Material <hl>copied</hl> to the clipboard.',
                           pos='midCenterTop',
                           fade=True)
    except:
        cmds.warning(
            'Couldn\'t copy material. Make sure you selected an object or component before copying.'
        )
    cmds.select(selection)
예제 #4
0
def copy():
    polygons = m.ls(m.polyListComponentConversion(tf=True), fl=True, l=True)
    if polygons:
        m.polyClipboard(polygons[0], copy=True, shader=True, uv=True, color=True)