splinecraft
1/2/2017 - 1:27 AM

Get selected attributes in channel box

Get selected attributes in channel box

import maya.mel as mel

def get_selected_channels():
    #fetch maya's main channelbox
    channelBox = mel.eval('global string $gChannelBoxName; $temp=$gChannelBoxName;')	
    
    attrs = cmds.channelBox(channelBox, q=True, sma=True)
    if not attrs:
        return []
    return attrs
    
##### simpler
import pymel.core as pm

return pm.channelBox('mainChannelBox', q=True, selectedMainAttributes=True)