View Full Version : Creating a graph in Mel

07 July 2010, 04:00 AM
Howdy all.

A new artist in the office was showing off a tool that he had used at another company. It checked for missing, corrupted, and blank frames in a render sequence, then it graphed out the file sizes on a spiffy graph and displayed them. Not to be outdone, I decided to build a similar application in Mel. Does anyone know a way to display a graph in Mel without using the animation graph editor?

My other option is to make the program a stand alone program with Python, but I'm not fast enough in Python. Any ideas?

07 July 2010, 04:40 AM
I doubt I know anything you dont (being at DD), but where do you mean that you want the graph? written out on a bitmap and shown or drawn up in the viewport? or do you mean you want a custom graph editor-like window but non-editable, only for showing stuff a certain way?

07 July 2010, 05:25 PM
I suppose a bitmap graph would be fine, then I could display the bmp in my UI. Any idea how to have mel write out a bitmap? I suppose I could have it open photoshop and pass a javaScript command to write out the file. I would like to avoid this somehow. I am also thinking of having an orthographic window with a cv line drawn as my linear graph.

07 July 2010, 01:21 AM
what is it graphing the file size of? each frame?

the best way i can think of doing it solely through mel is something along these lines.

1. get your files with getFileList
2. use python os.path.getsize(filepath) to find the file size
3. find your min/max
4. use linstep to normalize the sizes
5. make a columnLayout with the number of columns = number of files
6. for each file make a symbolButton with height = normalize value * some value

i'm too lazy atm to code it up :p

then you got a sweet ass bar graph of file sizes... though i'm not quite sure that's what your looking for???? :shrug:

07 July 2010, 01:24 AM
hmm. well I seem to remember that there arent any good ways of writing out a bitmap in mel - only hardcoding a binary file write which would end up very slow anyways I guess? (and you didnt want to use Python, right? that should be fairly fast to write though using some image library like PIL or something? - mind you I havent tried it myself. but Ive read about people doing it on forums)
maybe automate a process to hide all objects, draw it in an orthographic window like you said and then capture that image with a playblast or something could work...?
sending to photoshop must take forever if the app has to be booted up?

Ive used a system to plot out object paths in screenspace by creating a plane parented and aligned to the camera FOV and very close to it (so as not to disrupt the scene too much and only show the info in that camera) using that as a "screen" I had curves drawn on it and a UI to handle all the objects and clean it up when done. worked well but might be a bit hacky and fake for you. but it could be extended with ticks for the timeline and functionality to zoom and pan even if theres a lot of detail. I wanted "HUD"-style feedback and not an image so it was good for me.

python seems most straightforward for getting a bitmap? but Im no expert.

07 July 2010, 10:22 AM
maybe gradientControlNoAttr (

CGTalk Moderation
07 July 2010, 10:22 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.