panel similar to spreadSheet

168 views
Skip to first unread message

ogre

unread,
May 21, 2012, 6:47:42 PM5/21/12
to python_inside_maya
Hello
This question might be somewhat offtopic, but I couldn't get
information
elsewhere - perhaps someone can help.
So...
I need a sortof SpreadSheet control that is not connected to any
objects
and attributes.
Standard maya "spreadSheetEditor" lists nodes as rows and attributes
as
columns. How would I create a similar UI that is not dependand on any
nodes? I'd like to explicitly specify string arrays for rows and
colums,
and be able to read values from certain cells.
The bigger picture: I've got a list of lightGroups and list of
renderpasses/AOVs, and I'd like to set on/off relationship between
any
lightGrp/renderpass. Spreadsheets seems most convinient for this
purpose.
I found a devkit example "mathTableControl.py" using
MPxUITableControl,
but I couldn't get it to accept interactive input.
Maybe it's possible with some kind of PyQT control ? However I'd like
to
stay away from external dependecies if that's possible.

thanks for any tips
-michal

Justin Israel

unread,
May 21, 2012, 8:04:28 PM5/21/12
to python_in...@googlegroups.com
I don't see any straightforward way that they expect you to be able to receive the callbacks for the table if you create them with that plugin via the API. I could be missing something since I have never used that approach to make interfaces before. Your best bet, if you are trying to avoid the dependency of Qt/PyQt, is to just use a scriptTable:
That apparently wraps around the API-based table, but also gives you a cellChangedCmd callback so you can handle edits.



Ravi Jagannadhan

unread,
May 21, 2012, 8:06:27 PM5/21/12
to python_in...@googlegroups.com
You can use the API to make a custom spreadsheet. The
'MPxUITableControl' lets you do this.
--
Where we have strong emotions, we're liable to fool ourselves - Carl Sagan

Ravi Jagannadhan

unread,
May 21, 2012, 8:06:49 PM5/21/12
to python_in...@googlegroups.com
The 'MPxUITableControl' class in the API, rather :)

Justin Israel

unread,
May 21, 2012, 9:06:28 PM5/21/12
to python_in...@googlegroups.com
Hey Ravi,

I believe he already referenced this class via the plugin example, but was confused as to how to use it in an editable manner. I too, not having used this class directly, didn't see an obvious way to receive a callback of edits being made to the table. What would be the approach to receiving callbacks of updates, similar to how you would set a calback using maya.cmds.scriptTable?

Ravi Jagannadhan

unread,
May 21, 2012, 9:14:08 PM5/21/12
to python_in...@googlegroups.com
Ah, sorry, I didn't catch that. Looking at the docs, I don't see how
you can tie a callback to an edit event on the spreadsheet. My
mistake.

ogre

unread,
May 22, 2012, 6:19:59 AM5/22/12
to python_inside_maya


On 22 Maj, 02:04, Justin Israel <justinisr...@gmail.com> wrote:
> I don't see any straightforward way that they expect you to be able to
> receive the callbacks for the table if you create them with that plugin via
> the API. I could be missing something since I have never used that approach
> to make interfaces before. Your best bet, if you are trying to avoid the
> dependency of Qt/PyQt, is to just use a scriptTable:http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPytho...
> That apparently wraps around the API-based table, but also gives you a
> cellChangedCmd callback so you can handle edits.
>

Thanks Justin,
I did some testing with scriptTable, and it seems only last column is
editable, or am I doing smth. really wrong ?
Anyway, maya is highlighting entire row, and enters data only in last
cell :/

Judah Baron

unread,
May 22, 2012, 1:23:00 PM5/22/12
to python_in...@googlegroups.com
It's been a long time since I've worked with the scriptTable, but when I did I had no problems receiving callback for all cells. As I recall, a callback, specifiec by the cellChangedCmd argument, had to be assigned for each cell. Could it be that you have assigned to the last row and column due to a loop scoping issue?

At any rate, as I mentioned, I've not used this ui for years, and that's for good reason: it's awkward and limiting. If you can use an alternate I would highly recommend it. The Qt options are good, and nearly limitless in flexibility, though you will incur a more significant startup cost. If you don't need to edit multiple cells at once, you may consider using standard Maya ui elements and laying them out yourself procedurally, dependent upon selection, or whatever your input method is for determining what the ui should reflected.

-Judah


Justin Israel

unread,
May 22, 2012, 1:24:14 PM5/22/12
to python_in...@googlegroups.com
Ha. Seems you discovered a bug. Its working in both 2011 and 2013. Apparently its broken in 2012 and only makes the last column editable. I took the liberty of making a ticket on this: Case 07277716

Take Judah's advise and just use Qt. You can pretty easily set up a table widget.


On Tue, May 22, 2012 at 3:19 AM, ogre <f.mi...@gmail.com> wrote:

ogre

unread,
May 23, 2012, 9:55:20 AM5/23/12
to python_inside_maya
thanks everybody for help. I think I'll just save me some pain and go
with Qt.

cheers :)

Justin Israel

unread,
May 24, 2012, 3:17:15 PM5/24/12
to python_in...@googlegroups.com
Just as a follow up to this thread...
Autodesk acknowledged this as an already discovered bug with scriptTable. They have confirmed fixing it in 2013 and have no plans to address it in 2012 unless its a production halting situation for a subscription client, in which case they might do a hotfix.


ogre

unread,
Jun 13, 2012, 11:16:18 AM6/13/12
to python_inside_maya
Just to let know if someone is interested - in the end I did it in
maya2013, it worked ok.
Here's a screenshot

https://dl.dropbox.com/u/11300586/spreadSheet.jpg






On May 22, 12:47 am, ogre <f.mic...@gmail.com> wrote:
> Hello
> This question might be somewhat offtopic, but I couldn't get
> information
> elsewhere - perhaps someone can help.
> So...
> I need a sortofSpreadSheetcontrol that is not connected to any
Reply all
Reply to author
Forward
0 new messages