I would like one of my Maya MEL procedures to be executed every x seconds. Is there any way to do that ?
相关问题
- Timer vs. repetitive background worker
- How to manipulate (aggregate) the data in R?
- Create class intervals in r and sum values
- setInterval doesn't slow down on inactive tab
- Timers not running when screen is turned off / dev
相关文章
- Is the HPET directly accessible in Windows?
- Blinking Button for Simon Says
- Timer Label not updated after switching views (swi
- Indy TIdTCPClient receive text
- A HR timers precision study case
- Chrono Timer Not Converting Seconds Properly
- How to change one texture image of a 3d model(maya
- How to move several buttons throughout the screen
In general, no. However in Python I was able to create something that works pretty well:
I don't know what the overhead is, but it only runs on idle anyway, so it's probably not a big deal.
Most of this can be done in Mel (but as usual not as elegantly...). The biggest roadblock is getting the time. In Mel you'd have to parse a
system time
call.Edit: Keeping this Python, you can then call your Mel code from within the python
timed_function()
The mel setup would be
However it's hard to get the time in seconds from Mel - system("time /t") will get you time to the minute but not to the second on windows. In Unix system("date +\"%H:%M:%S\"") would get you hours, minutes and seconds.
The main drawback to scriptJob here is that idle events won't be processed when the user or a script is operating - if either the GUI or a script does something long you won't get any events fired during that period.
You can do this in Python with threads as well:
Threads are much more powerful and flexible - and a big pain the the butt. They also suffer from the same limitation of as the scriptJob idle event; if Maya's busy they won't fire.