Maya2013 - scriptTable

55 views
Skip to first unread message

James Sathre

unread,
Jun 23, 2014, 7:30:58 PM6/23/14
to python_in...@googlegroups.com
Hello,

I'm trying to figure out how the scriptTable works, and I'm a little confused with the output.  Why is it that when you delete the first row, the table no longer has the correct items in it?  The last row seems to disappear?  Is there a good resource online that describes the proper function calls?


import maya.cmds as cmds

def edit_cell(row, column, value):
    return 1

window = cmds.window(widthHeight=(400, 300))
form = cmds.formLayout()
table = cmds.scriptTable(rows=2, columns=3, label=[(1,"Column 1")], width=420, height=400, cellChangedCmd=edit_cell, excludingHeaders=True)
cmds.scriptTable(table, cellIndex=(1,1), edit=True, cellValue="1")
cmds.scriptTable(table, cellIndex=(2,1), edit=True, cellValue="2")
cmds.scriptTable(table, edit=True, deleteRow=1)
cmds.showWindow( window )



This code should show a line with '2' in it, but the table is blank in all columns?

thanks,

James
Message has been deleted

James Sathre

unread,
Sep 4, 2014, 2:29:40 PM9/4/14
to python_in...@googlegroups.com
Just in case anybody else runs into this problem, here is my solution.  Since the native remove and add flags do not work, you need to write your own functions for them.  Each function should save the state of the table in your own data structure, perform the action on that data structure, and then clear the table and repopulate it with your data structure.

thanks,

James
Reply all
Reply to author
Forward
0 new messages