Hi guys,
I'm starting to learn about Python and coding in Maya, and immediately, I have a first project to work along with this lesson.
I am trying to replicate the same user interface as Modifier Panel in 3ds studio max.
I got most of the stuff to work right, but the issue comes in where the Layout doesn't change accordingly to the right mode selection. I.e. The Edit Vertices shows when you have vertex mode selected, but if I check Polygon mode, it changes from Edit Vertices to Edit Poly, as well as having the whole layout change.
I tried doing something like cmds.deleteUI(Editvert, lay=True) but nothing.
Is there a way to work around this?
P.s. Another weird issue is that whenever I call in another Layout, it doesn't show in a different window, instead it shows up in the Attributed Editor instead? Is that normal?
Thanks in advance!
Replies
Seeing the script would help us help you better. The best I can say is to try hiding / disabling instead of deleting and rebuilding UI elements. For the second problem make sure you are setting the parent of the layout to the tool window. I think it defaults to the Attribute Editor.
I already reviewed tons of tutorials in the past two days about how python operation works. It seems like the function or method are being initiated after it's being declared.
The script is too long to paste it in here, I'll use the pastebin instead - here
I got the problem resolved by having the specific UI cleared out before calling in another UI. The problem still exist about having those options shows up in the Attribute editor. I still need to set those parents in.
How would I go in and hide variables? I can do it when the script is being called out, but not when there's already a variable existed
I also need to find some other ways to call in a listener for mouse clicks, or update object's selections.
The problem still exist about having those options shows up in the Attribute editor. I still need to set those parents in.
You can monitor object selections either through script jobs or current selected modes etc.
I meant to say that the frameLayout was appearing in the attribute editor. Turns out that I didn't have the "m=True" set in the setParent of each frameLayout chain.
Now I need to figure it out what other functions python has to read mouse input or update based on mouse. Need to find more tutorials/reference!
I still have yet found a decent tutorial on how to read and listen the mouse input. Gotta dig deeper then.