scriptTable questions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm having some problems using the cmds.scriptTable library, and the rest of the internet has not been helpful so far. What I'm trying to do is add and remove single rows from a cmds.scriptTable. There are built in functions to do this but they do not seem to behave in a consistent manor. When I add two rows, and delete one of them, all of the rows seem to go blank. This symptom goes away when I add an extra blank row at the end, but that doesn't seem like a very good solution.
// -- code sample that has blank last line
// -- Code sample that behaves correctly
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, insertRow=3)
cmds.scriptTable(table, edit=True, deleteRow=1)
cmds.scriptTable(table, edit=True, deleteRow=2)
cmds.showWindow( window )
thanks in advance,
James