Created
August 29, 2015 11:20
-
-
Save SEVEZ/7b75093ec0d5ecc8d95e to your computer and use it in GitHub Desktop.
Select channels in channel box for some operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.mel as mel | |
import maya.OpenMayaUI as omui | |
from PySide.QtGui import * | |
from PySide.QtCore import * | |
from shiboken import wrapInstance as wrap | |
qMaya = wrap(long(omui.MQtUtil.mainWindow()), QMainWindow) | |
# find chennelbox | |
gChannelBoxName = mel.eval('$temp=$gChannelBoxName') | |
table = qMaya.findChild(QTableView, gChannelBoxName) | |
if table: | |
model = table.model() | |
else: | |
model = None | |
# main function | |
def selectChannelBoxAttr(attrArray): | |
if model: | |
table.setSelectionMode( QAbstractItemView.MultiSelection ); | |
table.clearSelection() | |
for atr in attrArray: | |
for i in range(model.rowCount()): | |
if atr == model.data(model.index(i,0)): | |
table.selectRow(i) | |
# ############################ test | |
attrs = ['Scale Y', 'Translate X'] | |
selectChannelBoxAttr(attrs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment