MEL - Function Dependency Tracking

I have a very large MEL script that has several functions calls inside. I’m certain there are several dependencies. Is there any built in way through Maya or a module or software that will allow me to track/see all the dependencies of all the functions?

The script is ridiculous, something like 30k lines of code (*I didn’t write it btw :slight_smile: ) but need to be able to figure out how it’s working and find areas for optimization if there are multiple calls to the same chunks of code.

Thanks all-

I’m not aware of one. I started writing one in C#, but then gave up when I realized that there’s no practical way to track functions called through concatenated eval statements ($cmd = $cmd + “blah”) and UI callback strings.
If you happen across one, I’m sure others will be interested.

If you ever happen to port this suite to Python, there are tools to track dependencies, unless of course you are using self generated code (ala eval), etc.

Yeah, you’re probably going to have to some horrible ascii searching for function calls.

You could try something like using python to open the mel file, search for procedure defintions, drop in a whole bunch of global variables at the start of each procedure that increment a counter for each proc, then print out results after running the script. That could narrow the bottleneck search down somewhat(?)

We did lots of external dependency searching between mel files, but since it was all for externals, we could search for “source” lines and the like. Used xdot.py and depgraph2dot.py to visualize, which worked quite nicely.