Home Technical Talk

Maya Python scripting Issue

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

  • monster
    Options
    Offline / Send Message
    monster polycounter
    Do you already know another scripting language? This seems like a huge project right off the bat.

    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.
  • Regretful123
    Options
    Offline / Send Message
    monster wrote: »
    Do you already know another scripting language? This seems like a huge project right off the bat.

    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.
    Yeah I learned a few C# and Javascript, from Unity. I did have some experience mainly with C# language over the time, but knowing that learning another program or language would be a huge task.

    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.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Are you talking about dockControl when you mean adding it to attribute editor? Dont understand this :

    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.
  • Regretful123
    Options
    Offline / Send Message
    Are you talking about dockControl when you mean adding it to attribute editor? Dont understand this :

    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!
  • ProperSquid
    Options
    Offline / Send Message
    ProperSquid polycounter lvl 12
    You should be able to grab the mouse click events from Qt. I'm not 100% sure what you're trying to do, but look up some resources on Maya and PySide/ Qt.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    @ ProperSquid pyside is likly a little beyond what he wants to do, its a lot of trouble to setup for all maya versions byt 2015 and 2014
  • Regretful123
    Options
    Offline / Send Message
    I'm currently using 2012 version, and yeah I don't want to install custom plugins just for one thing.

    I still have yet found a decent tutorial on how to read and listen the mouse input. Gotta dig deeper then.
Sign In or Register to comment.