Home Technical Talk

Mel UI script keeps adding a shelf button instead of updating it.

HomeGrownHeroz
polycounter lvl 6
Offline / Send Message
HomeGrownHeroz polycounter lvl 6
Hi, I've made a script for work to help speed up the process for baking shadows ground plane. It works how I like apart from all of sudden, it keeps adding duplicates of the button to the shelf rather than just updating it.

Would anyone mind looking at the script and telling me what is causing this?

Feel free to provide any feedback on whether or not its tidy as well :)

Thanks a lot,

Replies

  • throttlekitty
    Options
    Offline / Send Message
    What's causing this is that your proc for creating the button doesn't check to see if it already exists. :) Wrap it inside of an if like this. Also you're labeling it with an empty string in your script, so I just made one up here that we can query.

    edit: crap, this doesn't actually work, and according to this thread, using a docTag on the button should work, but i can't get that to go either.

    <div>if ((`shelfButton -q -l "AOBakeButton"`) == 0)</div><div>    {<br>    shelfButton
        -label "AOBakeButton"
        ...rest of the button stuff<br>    }<br>}</div>
Sign In or Register to comment.