View Full Version : Zounds! A custom menu for sounds

07-05-2005, 05:33 AM
I have a custom timescrubber that I would like all the current sounds to be displayed for the user's selection. Problem is, once the menu is placed in the UI, any future additions/deletions aren't reflected in the choices!

1) How do I keep the drop-down list reflecting current sound(s)?

2) How would the drop-down menu include the 'options' square so that users can evoke the Attribute Editor and offset that particular sound?


paneLayout -configuration "horizontal2" -ps 1 100 50 -ps 2 100 50;
soundControl soundScrubber;
popupMenu -button 3 -ia;
menuItem -label "Import New" -command "ImportSoundFile";
menuItem -label "Delete" -command "delete `soundControl -q -s soundScrubber`";
menuItem -divider true;
menuItem -label "None" -command "soundControl -e -displaySound false -waveform both soundScrubber";
string $Sounds[] = `ls -type "audio"`;

for ($each in $Sounds)
menuItem -label $each -command "soundControl -e -sound $each -displaySound true -waveform both soundScrubber";
clear $Sounds;

timePort -gt true -enable true -isObscured -visible true timeScrubber;

07-05-2005, 06:19 AM
BTW, I always wanted to know how to query the current sound in the timeslider -- or if one were there at all.

I know I can do this with

if (`soundControl -q -s soundScrubber` == "")

with a soundControl bar, but how do you get it from the default Maya timeline?

07-05-2005, 09:46 AM
For a marking menu the option box is made in this way:

-label "Something"
-command "doSomething;"

-label "ELFdefaultMenuItem"
-command "doSomethingOption;"
-optionBox 1

The second menu item makes the optionbox, I think you can do it the same way for your menu.

As for the update problem, you might be able to use the 'scriptJob' command. With this you can execute a script when something in the scene changes (like the selection for example). don't have a lot of experience with this command, so you have to seach for yourself :)

CGTalk Moderation
07-05-2005, 09:46 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.