I was actually talking to one of my buddies about this a couple days ago. There really is no good way to do it within mel.
I wrote a quick and sloppy hack though. The problem with this method is that it does not take into account switching files, crashing, or the idle times (and the easy fix for that can often eat up all of your CPU )
All it does is log how long Maya is open into a file in the same folder as your scene file, appending it if you're working on the same scene file for more than 1 sitting.
Anyway, here's how installation works.
Open up Maya, open the script editor (the double-rectangle looking icon at the bottom right), enter this code, and press ctrl+enter.
PHP Code:
{
/*This simply edits your usersetup.mel file to enable this script to run when you close Maya
if you want to disable it put two slashes "//" infront of the line.*/
string $fileName = (`internalVar -userScriptDir` + "usersetup.mel");
int $fileId = `fopen $fileName "a"`;
fprint $fileId ("\n scriptJob -pro -e \"quitApplication\" \"TIMERJUNK\"; \n");
fclose $fileId;
}
now put this TIMERJUNK.mel file into the my documents/maya/x.x/scripts/
close Maya and open it up again and it will write the .time file which you can open with notepad or wordpad.
I dunno how useful it will actually be .
There's not much more I can think to do in mel though... a more robust FUNCTIONAL timer would probably have to be done in the maya API.
Last edited by Funky Bunnies; 19-05-2007 at 11:38 AM.